summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Perkin <jonathan.perkin@oracle.com>2010-12-16 11:13:58 +0100
committerJonathan Perkin <jonathan.perkin@oracle.com>2010-12-16 11:13:58 +0100
commit33827e7dbfc177ef52718f63eaf87e005ab3e8b5 (patch)
tree83c2beab0fb52424ab77dcb1449a3f394f0d0fe1
parentdec388d5beac2e9d0d32ce1610b871c3d1042544 (diff)
parentcf175bf4b8fef9c054fa4779fbea011ad43432a0 (diff)
downloadmariadb-git-33827e7dbfc177ef52718f63eaf87e005ab3e8b5.tar.gz
Merge from mysql-5.5.8-release
-rw-r--r--.bzrignore10
-rw-r--r--BUILD/FINISH.sh3
-rw-r--r--BUILD/Makefile.am77
-rwxr-xr-xBUILD/SETUP.sh2
-rwxr-xr-xBUILD/autorun.sh39
-rw-r--r--BUILD/cmake_configure.sh11
-rwxr-xr-xBUILD/compile-amd64-valgrind-max15
-rwxr-xr-xBUILD/compile-pentium-valgrind-max15
-rwxr-xr-xBUILD/compile-pentium-valgrind-max-no-ndb15
-rwxr-xr-xBUILD/compile-pentium64-valgrind-max15
-rw-r--r--CMakeLists.txt46
-rw-r--r--Docs/Makefile.am39
-rw-r--r--EXCEPTIONS-CLIENT119
-rw-r--r--Makefile.am335
-rw-r--r--README4464
-rw-r--r--VERSION4
-rw-r--r--client/Makefile.am125
-rw-r--r--client/mysql.cc15
-rw-r--r--client/mysqlbinlog.cc16
-rw-r--r--client/mysqltest.cc191
-rw-r--r--client/sql_string.h10
-rw-r--r--cmake/Makefile.am40
-rw-r--r--cmake/abi_check.cmake6
-rw-r--r--cmake/build_configurations/mysql_release.cmake32
-rw-r--r--cmake/configure.pl5
-rw-r--r--cmake/install_layout.cmake4
-rw-r--r--cmake/install_macros.cmake13
-rw-r--r--cmake/libutils.cmake3
-rw-r--r--cmake/make_dist.cmake.in32
-rw-r--r--cmake/mysql_add_executable.cmake2
-rw-r--r--cmake/mysql_version.cmake105
-rw-r--r--cmake/os/Linux.cmake2
-rw-r--r--cmake/os/Windows.cmake10
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--cmake/plugin.cmake1
-rw-r--r--cmake/versioninfo.rc.in8
-rw-r--r--cmd-line-utils/Makefile.am21
-rw-r--r--cmd-line-utils/libedit/Makefile.am92
-rw-r--r--cmd-line-utils/libedit/common.c5
-rw-r--r--cmd-line-utils/libedit/readline.c23
-rw-r--r--cmd-line-utils/libedit/vi.c29
-rw-r--r--cmd-line-utils/readline/Makefile.am34
-rw-r--r--cmd-line-utils/readline/bind.c2
-rw-r--r--cmd-line-utils/readline/complete.c7
-rw-r--r--cmd-line-utils/readline/histexpand.c3
-rw-r--r--cmd-line-utils/readline/histfile.c1
-rw-r--r--cmd-line-utils/readline/isearch.c8
-rw-r--r--cmd-line-utils/readline/parens.c4
-rw-r--r--cmd-line-utils/readline/readline.c3
-rw-r--r--cmd-line-utils/readline/terminal.c8
-rw-r--r--cmd-line-utils/readline/text.c3
-rw-r--r--config/ac-macros/alloca.m468
-rw-r--r--config/ac-macros/character_sets.m4501
-rw-r--r--config/ac-macros/check_cpu.m447
-rw-r--r--config/ac-macros/compiler_flag.m462
-rw-r--r--config/ac-macros/dtrace.m438
-rw-r--r--config/ac-macros/large_file.m4142
-rw-r--r--config/ac-macros/maintainer.m464
-rw-r--r--config/ac-macros/misc.m4688
-rw-r--r--config/ac-macros/plugins.m4862
-rw-r--r--config/ac-macros/readline.m4143
-rw-r--r--config/ac-macros/ssl.m4219
-rw-r--r--config/ac-macros/zlib.m4132
-rw-r--r--configure.cmake3
-rw-r--r--configure.in3003
-rw-r--r--dbug/Makefile.am68
-rw-r--r--dbug/dbug.c3
-rw-r--r--extra/Makefile.am57
-rw-r--r--extra/yassl/Makefile.am2
-rw-r--r--extra/yassl/src/Makefile.am8
-rw-r--r--extra/yassl/taocrypt/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/benchmark/Makefile.am6
-rw-r--r--extra/yassl/taocrypt/src/Makefile.am14
-rw-r--r--extra/yassl/taocrypt/test/Makefile.am6
-rw-r--r--extra/yassl/testsuite/Makefile.am10
-rw-r--r--include/Makefile.am107
-rw-r--r--include/m_string.h19
-rw-r--r--include/my_compiler.h18
-rw-r--r--include/my_dbug.h36
-rw-r--r--include/my_getopt.h7
-rw-r--r--include/my_pthread.h3
-rw-r--r--include/my_sys.h2
-rw-r--r--include/mysql.h7
-rw-r--r--include/mysql/client_plugin.h11
-rw-r--r--include/mysql/client_plugin.h.pp2
-rw-r--r--include/mysql/plugin_auth.h6
-rw-r--r--include/mysql_com.h6
-rw-r--r--libmysql/CMakeLists.txt6
-rw-r--r--libmysql/Makefile.am115
-rw-r--r--libmysql/Makefile.shared119
-rw-r--r--libmysql/acinclude.m491
-rw-r--r--libmysql/conf_to_src.c3
-rw-r--r--libmysql/errmsg.c3
-rw-r--r--libmysql/get_password.c3
-rw-r--r--libmysql/libmysql.c3
-rw-r--r--libmysql_r/Makefile.am45
-rw-r--r--libmysqld/Makefile.am229
-rw-r--r--libmysqld/examples/Makefile.am53
-rw-r--r--libmysqld/lib_sql.cc3
-rw-r--r--libservices/CMakeLists.txt2
-rw-r--r--libservices/Makefile.am21
-rw-r--r--man/CMakeLists.txt6
-rw-r--r--man/Makefile.am26
-rw-r--r--mysql-test/CMakeLists.txt3
-rw-r--r--mysql-test/Makefile.am150
-rw-r--r--mysql-test/collections/default.experimental5
-rw-r--r--mysql-test/collections/default.weekly2
-rw-r--r--mysql-test/collections/mysql-5.5-bugteam.daily5
-rw-r--r--mysql-test/collections/mysql-5.5-bugteam.push4
-rw-r--r--mysql-test/extra/binlog_tests/binlog_truncate.test6
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test2
-rw-r--r--mysql-test/extra/binlog_tests/implicit.test4
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test2
-rw-r--r--mysql-test/extra/rpl_tests/create_recursive_construct.inc39
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc24
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test114
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id_pk.test1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_not_null.test14
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp003.test18
-rw-r--r--mysql-test/extra/rpl_tests/rpl_start_stop_slave.test56
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stop_slave.test61
-rw-r--r--mysql-test/include/check_concurrent_insert.inc4
-rw-r--r--mysql-test/include/check_ftwrl_compatible.inc158
-rw-r--r--mysql-test/include/check_ftwrl_incompatible.inc155
-rw-r--r--mysql-test/include/check_no_concurrent_insert.inc4
-rw-r--r--mysql-test/include/check_slave_is_running.inc10
-rw-r--r--mysql-test/include/check_slave_param.inc2
-rw-r--r--mysql-test/include/ctype_numconv.inc15
-rw-r--r--mysql-test/include/diff_tables.inc2
-rw-r--r--mysql-test/include/get_relay_log_pos.inc4
-rw-r--r--mysql-test/include/handler.inc2
-rw-r--r--mysql-test/include/have_example_plugin.inc2
-rw-r--r--mysql-test/include/have_plugin_interface.inc5
-rw-r--r--mysql-test/include/have_plugin_server.inc5
-rw-r--r--mysql-test/include/have_semisync_plugin.inc2
-rw-r--r--mysql-test/include/have_simple_parser.inc2
-rw-r--r--mysql-test/include/have_udf.inc2
-rw-r--r--mysql-test/include/kill_query.inc4
-rw-r--r--mysql-test/include/kill_query_and_diff_master_slave.inc8
-rw-r--r--mysql-test/include/mtr_warnings.sql18
-rw-r--r--mysql-test/include/mysql_upgrade_preparation.inc2
-rw-r--r--mysql-test/include/no_valgrind_without_big.inc9
-rw-r--r--mysql-test/include/not_parallel.inc2
-rw-r--r--mysql-test/include/rpl_diff_tables.inc6
-rw-r--r--mysql-test/include/setup_fake_relay_log.inc11
-rw-r--r--mysql-test/include/show_events.inc4
-rw-r--r--mysql-test/include/show_rpl_debug_info.inc10
-rw-r--r--mysql-test/include/truncate_file.inc2
-rw-r--r--mysql-test/include/wait_for_slave_io_error.inc2
-rw-r--r--mysql-test/include/wait_for_slave_io_to_stop.inc2
-rw-r--r--mysql-test/include/wait_for_slave_param.inc4
-rw-r--r--mysql-test/include/wait_for_slave_sql_error.inc4
-rw-r--r--mysql-test/include/wait_for_slave_sql_to_stop.inc2
-rw-r--r--mysql-test/include/wait_for_slave_to_stop.inc2
-rw-r--r--mysql-test/include/wait_for_status_var.inc2
-rw-r--r--mysql-test/include/wait_show_condition.inc20
-rw-r--r--mysql-test/lib/My/SafeProcess/Makefile.am25
-rw-r--r--mysql-test/lib/mtr_cases.pm21
-rw-r--r--mysql-test/lib/mtr_misc.pl84
-rw-r--r--mysql-test/lib/mtr_process.pl10
-rwxr-xr-xmysql-test/mysql-test-run.pl175
-rw-r--r--mysql-test/r/1st.result2
-rw-r--r--mysql-test/r/bug58669.result17
-rw-r--r--mysql-test/r/connect.result6
-rw-r--r--mysql-test/r/ctype_binary.result21
-rw-r--r--mysql-test/r/ctype_cp1251.result21
-rw-r--r--mysql-test/r/ctype_latin1.result30
-rw-r--r--mysql-test/r/ctype_ucs.result21
-rw-r--r--mysql-test/r/ctype_ujis.result10
-rw-r--r--mysql-test/r/ctype_utf16.result4
-rw-r--r--mysql-test/r/ctype_utf8.result77
-rw-r--r--mysql-test/r/date_formats.result14
-rw-r--r--mysql-test/r/delayed.result12
-rw-r--r--mysql-test/r/errors.result12
-rw-r--r--mysql-test/r/events_2.result46
-rw-r--r--mysql-test/r/explain.result46
-rw-r--r--mysql-test/r/flush.result28
-rw-r--r--mysql-test/r/flush_read_lock.result1683
-rw-r--r--mysql-test/r/flush_read_lock_kill.result36
-rw-r--r--mysql-test/r/fulltext.result36
-rw-r--r--mysql-test/r/func_gconcat.result8
-rw-r--r--mysql-test/r/func_math.result21
-rw-r--r--mysql-test/r/func_misc.result23
-rw-r--r--mysql-test/r/func_time.result23
-rw-r--r--mysql-test/r/grant.result13
-rw-r--r--mysql-test/r/grant3.result25
-rw-r--r--mysql-test/r/group_by.result10
-rw-r--r--mysql-test/r/handler_innodb.result4
-rw-r--r--mysql-test/r/handler_myisam.result4
-rw-r--r--mysql-test/r/information_schema-big.result4
-rw-r--r--mysql-test/r/information_schema.result46
-rw-r--r--mysql-test/r/ipv4_as_ipv6.result30
-rw-r--r--mysql-test/r/join_outer.result30
-rw-r--r--mysql-test/r/keywords.result224
-rw-r--r--mysql-test/r/kill.result274
-rw-r--r--mysql-test/r/lock_sync.result69
-rw-r--r--mysql-test/r/log_tables.result10
-rw-r--r--mysql-test/r/log_tables_upgrade.result2
-rwxr-xr-xmysql-test/r/lowercase_table4.result7
-rw-r--r--mysql-test/r/mdl_sync.result11
-rw-r--r--mysql-test/r/mysql_upgrade.result12
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result2
-rw-r--r--mysql-test/r/mysqlbinlog.result4
-rw-r--r--mysql-test/r/mysqlcheck.result8
-rw-r--r--mysql-test/r/mysqld--help-notwin.result1
-rw-r--r--mysql-test/r/mysqld--help-win.result1
-rw-r--r--mysql-test/r/mysqltest.result40
-rw-r--r--mysql-test/r/not_embedded_server.result29
-rw-r--r--mysql-test/r/partition.result33
-rw-r--r--mysql-test/r/partition_debug_sync.result10
-rw-r--r--mysql-test/r/partition_innodb.result54
-rw-r--r--mysql-test/r/partition_innodb_plugin.result73
-rw-r--r--mysql-test/r/plugin_auth.result88
-rw-r--r--mysql-test/r/plugin_auth_qa.result327
-rw-r--r--mysql-test/r/plugin_auth_qa_1.result335
-rw-r--r--mysql-test/r/plugin_auth_qa_2.result150
-rw-r--r--mysql-test/r/plugin_auth_qa_3.result11
-rw-r--r--mysql-test/r/ps.result504
-rw-r--r--mysql-test/r/select.result19
-rw-r--r--mysql-test/r/show_check.result24
-rw-r--r--mysql-test/r/signal.result7
-rw-r--r--mysql-test/r/sp-bugs.result36
-rw-r--r--mysql-test/r/sp-destruct.result18
-rw-r--r--mysql-test/r/sp-error.result91
-rw-r--r--mysql-test/r/sp-lock.result91
-rw-r--r--mysql-test/r/sp-security.result29
-rw-r--r--mysql-test/r/subselect.result12
-rw-r--r--mysql-test/r/system_mysql_db.result2
-rw-r--r--mysql-test/r/trigger.result23
-rw-r--r--mysql-test/r/truncate_coverage.result27
-rw-r--r--mysql-test/r/type_blob.result10
-rw-r--r--mysql-test/r/type_date.result8
-rw-r--r--mysql-test/r/user_var.result3
-rw-r--r--mysql-test/r/variables-big.result10
-rw-r--r--mysql-test/r/xml.result33
-rw-r--r--mysql-test/std_data/bug57108.cnf95
-rw-r--r--mysql-test/suite/binlog/t/binlog_index-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test6
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_unsafe.test32
-rw-r--r--mysql-test/suite/binlog/t/disabled.def4
-rw-r--r--mysql-test/suite/bugs/r/bug57108.result5
-rw-r--r--mysql-test/suite/bugs/t/bug57108-master.opt2
-rw-r--r--mysql-test/suite/bugs/t/bug57108.test12
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.test2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_06.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result24
-rw-r--r--mysql-test/suite/funcs_1/r/is_key_column_usage.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics.result9
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_mysql.result9
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_mysql.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_06.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_06.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result4
-rw-r--r--mysql-test/suite/funcs_1/storedproc/storedproc_06.inc10
-rw-r--r--mysql-test/suite/ibmdb2i/include/have_i54.inc20
-rw-r--r--mysql-test/suite/ibmdb2i/include/have_i61.inc20
-rw-r--r--mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc6
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result11
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result4
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result4
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result18
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result33
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result7
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result20
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result9
-rw-r--r--mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result1204
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test9
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test9
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test8
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test28
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test26
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test11
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test47
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test10
-rw-r--r--mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test44
-rw-r--r--mysql-test/suite/innodb/r/innodb-create-options.result854
-rw-r--r--mysql-test/suite/innodb/r/innodb-zip.result20
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53046.result27
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug54679.result88
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug56143.result556
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug56680.result109
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug56947.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug57252.result6
-rwxr-xr-xmysql-test/suite/innodb/r/innodb_bug57904.result41
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result41
-rw-r--r--mysql-test/suite/innodb/t/innodb-create-options.test575
-rw-r--r--mysql-test/suite/innodb/t/innodb-zip.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53046.test48
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug54679.test101
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug56143.test581
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug56680.test142
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug56947.test16
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug57252.test46
-rwxr-xr-xmysql-test/suite/innodb/t/innodb_bug57904.test27
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test43
-rw-r--r--mysql-test/suite/parts/inc/partition_auto_increment.inc49
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_blackhole.result32
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_innodb.result72
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_memory.result72
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_myisam.result72
-rw-r--r--mysql-test/suite/perfschema/include/binlog_common.inc12
-rw-r--r--mysql-test/suite/perfschema/include/cleanup_helper.inc2
-rw-r--r--mysql-test/suite/perfschema/include/privilege.inc97
-rw-r--r--mysql-test/suite/perfschema/include/setup_helper.inc26
-rw-r--r--mysql-test/suite/perfschema/include/start_server_common.inc42
-rw-r--r--mysql-test/suite/perfschema/r/aggregate.result66
-rw-r--r--mysql-test/suite/perfschema/r/binlog_mix.result16
-rw-r--r--mysql-test/suite/perfschema/r/binlog_row.result16
-rw-r--r--mysql-test/suite/perfschema/r/binlog_stmt.result20
-rw-r--r--mysql-test/suite/perfschema/r/checksum.result68
-rw-r--r--mysql-test/suite/perfschema/r/column_privilege.result32
-rw-r--r--mysql-test/suite/perfschema/r/ddl_cond_instances.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_events_waits_current.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_events_waits_history.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_ews_by_instance.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_file_instances.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_fs_by_instance.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_mutex_instances.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_performance_timers.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_rwlock_instances.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_setup_consumers.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_setup_instruments.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_setup_timers.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_threads.result8
-rw-r--r--mysql-test/suite/perfschema/r/dml_cond_instances.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_events_waits_current.result32
-rw-r--r--mysql-test/suite/perfschema/r/dml_events_waits_history.result36
-rw-r--r--mysql-test/suite/perfschema/r/dml_events_waits_history_long.result36
-rw-r--r--mysql-test/suite/perfschema/r/dml_ews_by_instance.result40
-rw-r--r--mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result32
-rw-r--r--mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result32
-rw-r--r--mysql-test/suite/perfschema/r/dml_file_instances.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result32
-rw-r--r--mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result32
-rw-r--r--mysql-test/suite/perfschema/r/dml_mutex_instances.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_performance_timers.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_rwlock_instances.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_consumers.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result40
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_timers.result30
-rw-r--r--mysql-test/suite/perfschema/r/dml_threads.result38
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result64
-rw-r--r--mysql-test/suite/perfschema/r/func_mutex.result49
-rw-r--r--mysql-test/suite/perfschema/r/global_read_lock.result27
-rw-r--r--mysql-test/suite/perfschema/r/information_schema.result342
-rw-r--r--mysql-test/suite/perfschema/r/misc.result10
-rw-r--r--mysql-test/suite/perfschema/r/myisam_file_io.result12
-rw-r--r--mysql-test/suite/perfschema/r/no_threads.result22
-rw-r--r--mysql-test/suite/perfschema/r/one_thread_per_con.result6
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade.result170
-rw-r--r--mysql-test/suite/perfschema/r/privilege.result546
-rw-r--r--mysql-test/suite/perfschema/r/query_cache.result8
-rw-r--r--mysql-test/suite/perfschema/r/read_only.result18
-rw-r--r--mysql-test/suite/perfschema/r/schema.result108
-rw-r--r--mysql-test/suite/perfschema/r/selects.result56
-rw-r--r--mysql-test/suite/perfschema/r/server_init.result110
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result46
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result44
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result42
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result42
-rw-r--r--mysql-test/suite/perfschema/r/tampered_perfschema_table1.result8
-rw-r--r--mysql-test/suite/perfschema/t/aggregate.test96
-rw-r--r--mysql-test/suite/perfschema/t/checksum.test68
-rw-r--r--mysql-test/suite/perfschema/t/column_privilege.test28
-rw-r--r--mysql-test/suite/perfschema/t/ddl_cond_instances.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_events_waits_current.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_events_waits_history.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_ews_by_instance.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_file_instances.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_fs_by_instance.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_mutex_instances.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_performance_timers.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_rwlock_instances.test8
-rw-r--r--mysql-test/suite/perfschema/t/ddl_setup_consumers.test9
-rw-r--r--mysql-test/suite/perfschema/t/ddl_setup_instruments.test9
-rw-r--r--mysql-test/suite/perfschema/t/ddl_setup_timers.test9
-rw-r--r--mysql-test/suite/perfschema/t/ddl_threads.test8
-rw-r--r--mysql-test/suite/perfschema/t/dml_cond_instances.test22
-rw-r--r--mysql-test/suite/perfschema/t/dml_events_waits_current.test25
-rw-r--r--mysql-test/suite/perfschema/t/dml_events_waits_history.test29
-rw-r--r--mysql-test/suite/perfschema/t/dml_events_waits_history_long.test29
-rw-r--r--mysql-test/suite/perfschema/t/dml_ews_by_instance.test33
-rw-r--r--mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test25
-rw-r--r--mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test25
-rw-r--r--mysql-test/suite/perfschema/t/dml_file_instances.test22
-rw-r--r--mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test25
-rw-r--r--mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test25
-rw-r--r--mysql-test/suite/perfschema/t/dml_mutex_instances.test22
-rw-r--r--mysql-test/suite/perfschema/t/dml_performance_timers.test22
-rw-r--r--mysql-test/suite/perfschema/t/dml_rwlock_instances.test22
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_consumers.test26
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_instruments.test36
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_timers.test28
-rw-r--r--mysql-test/suite/perfschema/t/dml_threads.test33
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test95
-rw-r--r--mysql-test/suite/perfschema/t/func_mutex.test50
-rw-r--r--mysql-test/suite/perfschema/t/global_read_lock.test32
-rw-r--r--mysql-test/suite/perfschema/t/information_schema.test22
-rw-r--r--mysql-test/suite/perfschema/t/misc.test10
-rw-r--r--mysql-test/suite/perfschema/t/myisam_file_io.test12
-rw-r--r--mysql-test/suite/perfschema/t/no_threads.test22
-rw-r--r--mysql-test/suite/perfschema/t/one_thread_per_con.test4
-rw-r--r--mysql-test/suite/perfschema/t/privilege.test160
-rw-r--r--mysql-test/suite/perfschema/t/query_cache.test8
-rw-r--r--mysql-test/suite/perfschema/t/read_only.test22
-rw-r--r--mysql-test/suite/perfschema/t/schema.test34
-rw-r--r--mysql-test/suite/perfschema/t/selects.test54
-rw-r--r--mysql-test/suite/perfschema/t/server_init.test115
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_cond_class.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_cond_inst.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_file_class.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_file_inst.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_mutex_class.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_thread_class.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_thread_inst.test4
-rw-r--r--mysql-test/suite/perfschema/t/tampered_perfschema_table1.test10
-rw-r--r--mysql-test/suite/perfschema/t/thread_cache.test24
-rw-r--r--mysql-test/suite/perfschema_stress/t/modify.test2
-rw-r--r--mysql-test/suite/perfschema_stress/t/setup.test4
-rw-r--r--mysql-test/suite/perfschema_stress/t/work.test2
-rw-r--r--mysql-test/suite/rpl/r/rpl000017.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp003.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig003.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_slave.result77
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result6
-rw-r--r--mysql-test/suite/rpl/t/rpl000017.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_concurrency_error.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_cross_version-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ip_mix-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_killed_ddl.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slow_query_log.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test51
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test57
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt3
-rw-r--r--mysql-test/suite/sys_vars/inc/autocommit_func2.inc29
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/r/autocommit_func2.result46
-rw-r--r--mysql-test/suite/sys_vars/r/autocommit_func3.result42
-rw-r--r--mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/t/all_vars.test3
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func2-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func2.test1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func3-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func3.test1
-rw-r--r--mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test10
-rw-r--r--mysql-test/suite/sys_vars/t/slow_launch_time_func.test2
-rw-r--r--mysql-test/t/bug58669-master.opt1
-rw-r--r--mysql-test/t/bug58669.test22
-rw-r--r--mysql-test/t/change_user.test2
-rw-r--r--mysql-test/t/ctype_latin1.test8
-rw-r--r--mysql-test/t/ctype_ujis.test7
-rw-r--r--mysql-test/t/ctype_utf8.test41
-rw-r--r--mysql-test/t/date_formats.test16
-rw-r--r--mysql-test/t/delayed.test15
-rw-r--r--mysql-test/t/disabled.def11
-rw-r--r--mysql-test/t/errors.test16
-rw-r--r--mysql-test/t/events_2.test46
-rw-r--r--mysql-test/t/execution_constants.test2
-rw-r--r--mysql-test/t/explain.test36
-rw-r--r--mysql-test/t/fix_priv_tables.test2
-rw-r--r--mysql-test/t/flush.test67
-rw-r--r--mysql-test/t/flush_block_commit.test2
-rw-r--r--mysql-test/t/flush_block_commit_notembedded.test2
-rw-r--r--mysql-test/t/flush_read_lock.test2190
-rw-r--r--mysql-test/t/flush_read_lock_kill-master.opt1
-rw-r--r--mysql-test/t/flush_read_lock_kill.test68
-rw-r--r--mysql-test/t/fulltext.test37
-rw-r--r--mysql-test/t/func_gconcat.test11
-rw-r--r--mysql-test/t/func_math.test16
-rw-r--r--mysql-test/t/func_misc.test34
-rw-r--r--mysql-test/t/func_time.test18
-rw-r--r--mysql-test/t/grant.test15
-rw-r--r--mysql-test/t/grant3.test5
-rw-r--r--mysql-test/t/group_by.test11
-rw-r--r--mysql-test/t/information_schema.test53
-rw-r--r--mysql-test/t/join_outer.test29
-rw-r--r--mysql-test/t/key_cache-master.opt1
-rw-r--r--mysql-test/t/keywords.test100
-rw-r--r--mysql-test/t/kill.test456
-rw-r--r--mysql-test/t/lock_multi.test58
-rw-r--r--mysql-test/t/lock_sync.test114
-rw-r--r--mysql-test/t/log_tables.test19
-rwxr-xr-xmysql-test/t/lowercase_table4-master.opt1
-rwxr-xr-xmysql-test/t/lowercase_table4.test56
-rw-r--r--mysql-test/t/mdl_sync.test15
-rw-r--r--mysql-test/t/mysqlbinlog-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog.test15
-rw-r--r--mysql-test/t/mysqltest.test228
-rw-r--r--mysql-test/t/named_pipe.test2
-rw-r--r--mysql-test/t/not_embedded_server.test54
-rw-r--r--mysql-test/t/partition.test18
-rw-r--r--mysql-test/t/partition_debug_sync.test10
-rw-r--r--mysql-test/t/partition_innodb.test59
-rw-r--r--mysql-test/t/partition_innodb_plugin.test67
-rw-r--r--mysql-test/t/plugin_auth.test67
-rw-r--r--mysql-test/t/plugin_auth_qa-master.opt2
-rw-r--r--mysql-test/t/plugin_auth_qa.test338
-rw-r--r--mysql-test/t/plugin_auth_qa_1-master.opt2
-rw-r--r--mysql-test/t/plugin_auth_qa_1.test340
-rw-r--r--mysql-test/t/plugin_auth_qa_2-master.opt2
-rw-r--r--mysql-test/t/plugin_auth_qa_2.test153
-rw-r--r--mysql-test/t/plugin_auth_qa_3-master.opt2
-rw-r--r--mysql-test/t/plugin_auth_qa_3.test25
-rw-r--r--mysql-test/t/ps.test6
-rw-r--r--mysql-test/t/select.test19
-rw-r--r--mysql-test/t/shm.test2
-rw-r--r--mysql-test/t/show_check.test27
-rw-r--r--mysql-test/t/sp-bugs.test37
-rw-r--r--mysql-test/t/sp-destruct.test27
-rw-r--r--mysql-test/t/sp-error.test114
-rw-r--r--mysql-test/t/sp-lock.test165
-rw-r--r--mysql-test/t/sp-security.test37
-rw-r--r--mysql-test/t/subselect.test18
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test4
-rw-r--r--mysql-test/t/trigger_notembedded.test2
-rw-r--r--mysql-test/t/truncate_coverage.test54
-rw-r--r--mysql-test/t/type_blob.test13
-rw-r--r--mysql-test/t/type_date.test8
-rw-r--r--mysql-test/t/union.test2
-rw-r--r--mysql-test/t/user_var.test7
-rw-r--r--mysql-test/t/variables-big.test10
-rw-r--r--mysql-test/t/wait_timeout.test4
-rw-r--r--mysql-test/t/wl4435_generated.inc588
-rw-r--r--mysql-test/t/xml.test39
-rw-r--r--mysys/Makefile.am158
-rw-r--r--mysys/default.c63
-rw-r--r--mysys/mf_iocache.c48
-rw-r--r--mysys/mf_keycache.c10
-rw-r--r--mysys/my_gethostbyname.c6
-rw-r--r--mysys/my_gethwaddr.c32
-rw-r--r--mysys/my_getopt.c22
-rw-r--r--mysys/my_rdtsc.c10
-rw-r--r--mysys/my_symlink.c17
-rw-r--r--mysys/my_sync.c19
-rw-r--r--mysys/stacktrace.c4
-rw-r--r--mysys/thr_mutex.c4
-rw-r--r--packaging/Makefile.am14
-rw-r--r--packaging/WiX/CMakeLists.txt7
-rw-r--r--packaging/WiX/create_msi.cmake.in14
-rw-r--r--packaging/WiX/mysql_server.wxs.in16
-rw-r--r--plugin/Makefile.am30
-rw-r--r--plugin/audit_null/Makefile.am32
-rw-r--r--plugin/audit_null/plug.in4
-rw-r--r--plugin/auth/CMakeLists.txt8
-rw-r--r--plugin/auth/Makefile.am16
-rw-r--r--plugin/auth/dialog.c6
-rw-r--r--plugin/auth/plug.in12
-rw-r--r--plugin/auth/qa_auth_client.c127
-rw-r--r--plugin/auth/qa_auth_interface.c262
-rw-r--r--plugin/auth/qa_auth_server.c87
-rw-r--r--plugin/auth/test_plugin.c28
-rw-r--r--plugin/daemon_example/Makefile.am41
-rw-r--r--plugin/daemon_example/configure.in9
-rw-r--r--plugin/daemon_example/plug.in3
-rw-r--r--plugin/fulltext/Makefile.am25
-rw-r--r--plugin/fulltext/configure.in9
-rw-r--r--plugin/fulltext/plug.in3
-rw-r--r--plugin/semisync/Makefile.am38
-rw-r--r--plugin/semisync/configure.in9
-rw-r--r--plugin/semisync/plug.in3
-rw-r--r--regex/Makefile.am33
-rw-r--r--regex/main.c8
-rw-r--r--regex/regexec.c5
-rw-r--r--scripts/CMakeLists.txt2
-rw-r--r--scripts/Makefile.am192
-rw-r--r--scripts/make_binary_distribution.sh4
-rw-r--r--scripts/make_sharedlib_distribution.sh136
-rwxr-xr-xscripts/make_win_bin_dist4
-rw-r--r--scripts/mysql_system_tables.sql44
-rw-r--r--scripts/mysql_system_tables_data.sql10
-rw-r--r--scripts/mysql_system_tables_fix.sql9
-rw-r--r--sql-bench/CMakeLists.txt10
-rw-r--r--sql-bench/Makefile.am83
-rw-r--r--sql-common/Makefile.am17
-rw-r--r--sql-common/client.c28
-rw-r--r--sql-common/client_plugin.c4
-rw-r--r--sql-common/my_time.c7
-rw-r--r--sql/CMakeLists.txt6
-rw-r--r--sql/Makefile.am280
-rw-r--r--sql/debug_sync.cc2
-rw-r--r--sql/event_data_objects.cc47
-rw-r--r--sql/event_data_objects.h7
-rw-r--r--sql/event_db_repository.cc53
-rw-r--r--sql/event_db_repository.h2
-rw-r--r--sql/event_queue.cc32
-rw-r--r--sql/events.cc42
-rw-r--r--sql/events.h4
-rw-r--r--sql/field.cc70
-rw-r--r--sql/field.h128
-rw-r--r--sql/field_conv.cc7
-rw-r--r--sql/ha_ndbcluster.cc59
-rw-r--r--sql/ha_partition.cc109
-rw-r--r--sql/handler.cc52
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item.cc82
-rw-r--r--sql/item.h4
-rw-r--r--sql/item_cmpfunc.cc11
-rw-r--r--sql/item_func.cc117
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/item_strfunc.cc50
-rw-r--r--sql/item_subselect.cc15
-rw-r--r--sql/item_sum.cc6
-rw-r--r--sql/item_timefunc.cc16
-rw-r--r--sql/item_timefunc.h1
-rw-r--r--sql/item_xmlfunc.cc4
-rw-r--r--sql/key.cc6
-rw-r--r--sql/lock.cc363
-rw-r--r--sql/lock.h6
-rw-r--r--sql/log.cc43
-rw-r--r--sql/log.h26
-rw-r--r--sql/log_event.cc44
-rw-r--r--sql/log_event.h6
-rw-r--r--sql/mdl.cc563
-rw-r--r--sql/mdl.h187
-rw-r--r--sql/my_decimal.h2
-rw-r--r--sql/mysqld.cc53
-rw-r--r--sql/mysqld.h18
-rw-r--r--sql/opt_range.cc1
-rw-r--r--sql/opt_range.h3
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/records.cc9
-rw-r--r--sql/rpl_handler.cc21
-rw-r--r--sql/rpl_record.cc10
-rw-r--r--sql/rpl_rli.cc3
-rw-r--r--sql/rpl_rli.h10
-rw-r--r--sql/share/Makefile.am60
-rw-r--r--sql/slave.cc96
-rw-r--r--sql/sp.cc157
-rw-r--r--sql/sp.h15
-rw-r--r--sql/sp_head.cc49
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/sp_rcontext.h1
-rw-r--r--sql/sql_acl.cc195
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_audit.h17
-rw-r--r--sql/sql_base.cc144
-rw-r--r--sql/sql_base.h27
-rw-r--r--sql/sql_class.cc113
-rw-r--r--sql/sql_class.h160
-rw-r--r--sql/sql_cursor.cc3
-rw-r--r--sql/sql_db.cc275
-rw-r--r--sql/sql_error.cc3
-rw-r--r--sql/sql_error.h15
-rw-r--r--sql/sql_handler.cc35
-rw-r--r--sql/sql_handler.h2
-rw-r--r--sql/sql_help.cc2
-rw-r--r--sql/sql_insert.cc95
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h20
-rw-r--r--sql/sql_parse.cc274
-rw-r--r--sql/sql_partition.cc16
-rw-r--r--sql/sql_partition_admin.cc2
-rw-r--r--sql/sql_plugin.cc6
-rw-r--r--sql/sql_prepare.cc16
-rw-r--r--sql/sql_rename.cc13
-rw-r--r--sql/sql_select.cc26
-rw-r--r--sql/sql_show.cc73
-rw-r--r--sql/sql_show.h1
-rw-r--r--sql/sql_string.h10
-rw-r--r--sql/sql_table.cc298
-rw-r--r--sql/sql_table.h5
-rw-r--r--sql/sql_trigger.cc14
-rw-r--r--sql/sql_truncate.cc7
-rw-r--r--sql/sql_union.cc10
-rw-r--r--sql/sql_update.cc16
-rw-r--r--sql/sql_view.cc10
-rw-r--r--sql/sql_yacc.yy14
-rw-r--r--sql/sys_vars.cc11
-rw-r--r--sql/table.cc3
-rw-r--r--sql/table.h3
-rw-r--r--sql/transaction.cc25
-rw-r--r--storage/Makefile.am22
-rw-r--r--storage/archive/Makefile.am104
-rw-r--r--storage/archive/plug.in4
-rw-r--r--storage/blackhole/Makefile.am85
-rw-r--r--storage/blackhole/plug.in6
-rw-r--r--storage/csv/Makefile.am64
-rw-r--r--storage/csv/plug.in5
-rw-r--r--storage/example/Makefile.am85
-rw-r--r--storage/example/plug.in3
-rw-r--r--storage/federated/Makefile.am86
-rw-r--r--storage/federated/plug.in5
-rw-r--r--storage/heap/Makefile.am73
-rw-r--r--storage/heap/plug.in7
-rw-r--r--storage/ibmdb2i/CMakeLists.txt39
-rw-r--r--storage/ibmdb2i/Makefile.am52
-rw-r--r--storage/ibmdb2i/db2i_blobCollection.cc107
-rw-r--r--storage/ibmdb2i/db2i_blobCollection.h151
-rw-r--r--storage/ibmdb2i/db2i_charsetSupport.cc826
-rw-r--r--storage/ibmdb2i/db2i_charsetSupport.h65
-rw-r--r--storage/ibmdb2i/db2i_collationSupport.cc355
-rw-r--r--storage/ibmdb2i/db2i_collationSupport.h48
-rw-r--r--storage/ibmdb2i/db2i_constraints.cc672
-rw-r--r--storage/ibmdb2i/db2i_conversion.cc1459
-rw-r--r--storage/ibmdb2i/db2i_errors.cc297
-rw-r--r--storage/ibmdb2i/db2i_errors.h93
-rw-r--r--storage/ibmdb2i/db2i_file.cc553
-rw-r--r--storage/ibmdb2i/db2i_file.h446
-rw-r--r--storage/ibmdb2i/db2i_global.h138
-rw-r--r--storage/ibmdb2i/db2i_iconv.h51
-rw-r--r--storage/ibmdb2i/db2i_ileBridge.cc1342
-rw-r--r--storage/ibmdb2i/db2i_ileBridge.h499
-rw-r--r--storage/ibmdb2i/db2i_ioBuffers.cc332
-rw-r--r--storage/ibmdb2i/db2i_ioBuffers.h416
-rw-r--r--storage/ibmdb2i/db2i_misc.h129
-rw-r--r--storage/ibmdb2i/db2i_myconv.cc1498
-rw-r--r--storage/ibmdb2i/db2i_myconv.h3201
-rw-r--r--storage/ibmdb2i/db2i_rir.cc686
-rw-r--r--storage/ibmdb2i/db2i_safeString.h98
-rw-r--r--storage/ibmdb2i/db2i_sqlStatementStream.cc86
-rw-r--r--storage/ibmdb2i/db2i_sqlStatementStream.h151
-rw-r--r--storage/ibmdb2i/db2i_validatedPointer.h162
-rw-r--r--storage/ibmdb2i/ha_ibmdb2i.cc3366
-rw-r--r--storage/ibmdb2i/ha_ibmdb2i.h822
-rw-r--r--storage/ibmdb2i/plug.in12
-rw-r--r--storage/innobase/CMakeLists.txt44
-rw-r--r--storage/innobase/Makefile.am338
-rw-r--r--storage/innobase/btr/btr0cur.c13
-rw-r--r--storage/innobase/buf/buf0buddy.c2
-rw-r--r--storage/innobase/buf/buf0buf.c80
-rw-r--r--storage/innobase/buf/buf0flu.c93
-rw-r--r--storage/innobase/buf/buf0lru.c10
-rw-r--r--storage/innobase/dict/dict0crea.c2
-rw-r--r--storage/innobase/dict/dict0dict.c164
-rw-r--r--storage/innobase/dict/dict0load.c7
-rw-r--r--storage/innobase/fil/fil0fil.c88
-rw-r--r--storage/innobase/fsp/fsp0fsp.c50
-rw-r--r--storage/innobase/handler/ha_innodb.cc761
-rw-r--r--storage/innobase/handler/ha_innodb.h4
-rw-r--r--storage/innobase/handler/handler0alter.cc11
-rw-r--r--storage/innobase/handler/mysql_addons.cc42
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c239
-rw-r--r--storage/innobase/include/btr0btr.h49
-rw-r--r--storage/innobase/include/btr0btr.ic38
-rw-r--r--storage/innobase/include/btr0cur.h18
-rw-r--r--storage/innobase/include/buf0buddy.h2
-rw-r--r--storage/innobase/include/buf0buddy.ic4
-rw-r--r--storage/innobase/include/buf0buf.h70
-rw-r--r--storage/innobase/include/buf0buf.ic77
-rw-r--r--storage/innobase/include/buf0flu.h15
-rw-r--r--storage/innobase/include/data0type.h9
-rw-r--r--storage/innobase/include/db0err.h6
-rw-r--r--storage/innobase/include/dict0dict.h43
-rw-r--r--storage/innobase/include/fil0fil.h8
-rw-r--r--storage/innobase/include/ibuf0ibuf.h5
-rw-r--r--storage/innobase/include/mysql_addons.h33
-rw-r--r--storage/innobase/include/os0sync.h22
-rw-r--r--storage/innobase/include/rem0rec.h6
-rw-r--r--storage/innobase/include/row0ins.h5
-rw-r--r--storage/innobase/include/row0mysql.h4
-rw-r--r--storage/innobase/include/row0upd.h11
-rw-r--r--storage/innobase/include/srv0srv.h9
-rw-r--r--storage/innobase/include/sync0sync.h1
-rw-r--r--storage/innobase/include/trx0trx.h17
-rw-r--r--storage/innobase/include/trx0undo.h2
-rw-r--r--storage/innobase/include/univ.i5
-rw-r--r--storage/innobase/lock/lock0lock.c4
-rw-r--r--storage/innobase/log/log0log.c9
-rw-r--r--storage/innobase/mysql-test/patches/README30
-rw-r--r--storage/innobase/mysql-test/patches/index_merge_innodb-explain.diff31
-rw-r--r--storage/innobase/mysql-test/patches/information_schema.diff124
-rw-r--r--storage/innobase/mysql-test/patches/innodb_change_buffering_basic.diff60
-rw-r--r--storage/innobase/mysql-test/patches/innodb_file_per_table.diff47
-rw-r--r--storage/innobase/mysql-test/patches/innodb_lock_wait_timeout.diff55
-rw-r--r--storage/innobase/mysql-test/patches/innodb_thread_concurrency_basic.diff31
-rw-r--r--storage/innobase/mysql-test/patches/partition_innodb.diff59
-rw-r--r--storage/innobase/os/os0file.c34
-rw-r--r--storage/innobase/os/os0sync.c189
-rw-r--r--storage/innobase/plug.in233
-rw-r--r--storage/innobase/rem/rem0rec.c6
-rw-r--r--storage/innobase/row/row0ins.c9
-rw-r--r--storage/innobase/row/row0merge.c2
-rw-r--r--storage/innobase/row/row0mysql.c45
-rw-r--r--storage/innobase/row/row0sel.c111
-rw-r--r--storage/innobase/row/row0upd.c15
-rw-r--r--storage/innobase/srv/srv0srv.c83
-rw-r--r--storage/innobase/srv/srv0start.c23
-rw-r--r--storage/innobase/sync/sync0rw.c2
-rw-r--r--storage/innobase/sync/sync0sync.c4
-rw-r--r--storage/innobase/thr/thr0loc.c30
-rw-r--r--storage/innobase/trx/trx0i_s.c56
-rw-r--r--storage/innobase/trx/trx0trx.c12
-rw-r--r--storage/innobase/trx/trx0undo.c18
-rw-r--r--storage/innobase/ut/ut0ut.c4
-rw-r--r--storage/myisam/Makefile.am169
-rw-r--r--storage/myisam/ft_nlq_search.c2
-rw-r--r--storage/myisam/ha_myisam.cc9
-rw-r--r--storage/myisam/myisamchk.c3
-rw-r--r--storage/myisam/plug.in7
-rw-r--r--storage/myisammrg/Makefile.am62
-rw-r--r--storage/myisammrg/myrg_open.c2
-rw-r--r--storage/myisammrg/plug.in6
-rw-r--r--storage/ndb/src/mgmsrv/InitConfigFileParser.cpp2
-rw-r--r--storage/perfschema/Makefile.am76
-rw-r--r--storage/perfschema/pfs_global.h16
-rw-r--r--storage/perfschema/pfs_instr.cc23
-rw-r--r--storage/perfschema/pfs_instr.h1
-rw-r--r--storage/perfschema/pfs_instr_class.cc70
-rw-r--r--storage/perfschema/pfs_instr_class.h2
-rw-r--r--storage/perfschema/pfs_lock.h20
-rw-r--r--storage/perfschema/plug.in26
-rw-r--r--storage/perfschema/table_events_waits.cc27
-rw-r--r--storage/perfschema/table_events_waits_summary.cc4
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.cc2
-rw-r--r--storage/perfschema/table_file_instances.cc2
-rw-r--r--storage/perfschema/table_file_summary.cc4
-rw-r--r--storage/perfschema/table_performance_timers.cc2
-rw-r--r--storage/perfschema/table_setup_consumers.cc2
-rw-r--r--storage/perfschema/table_setup_instruments.cc2
-rw-r--r--storage/perfschema/table_setup_timers.cc2
-rw-r--r--storage/perfschema/table_sync_instances.cc6
-rw-r--r--storage/perfschema/table_threads.cc13
-rw-r--r--storage/perfschema/table_threads.h4
-rw-r--r--storage/perfschema/unittest/Makefile.am58
-rw-r--r--storage/perfschema/unittest/pfs-t.cc1
-rw-r--r--storage/perfschema/unittest/pfs_instr-oom-t.cc1
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc2
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc1
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc2
-rw-r--r--storage/perfschema/unittest/stub_server_misc.h21
-rw-r--r--strings/Makefile.am80
-rw-r--r--strings/bfill.c41
-rw-r--r--strings/bmove.c48
-rw-r--r--strings/ctype-uca.c2
-rw-r--r--strings/ctype-ucs2.c24
-rw-r--r--strings/ctype-utf8.c11
-rw-r--r--strings/longlong2str-x86.s216
-rw-r--r--strings/longlong2str_asm.c33
-rw-r--r--strings/my_strtoll10-x86.s418
-rw-r--r--strings/str_test.c275
-rw-r--r--strings/strings-x86.s393
-rw-r--r--strings/strstr.c52
-rw-r--r--strings/strto.c209
-rw-r--r--strings/strtol.c28
-rw-r--r--strings/strtoll.c33
-rw-r--r--strings/strtoul.c29
-rw-r--r--strings/strtoull.c34
-rw-r--r--support-files/CMakeLists.txt13
-rw-r--r--support-files/MacOSX/Makefile.am54
-rw-r--r--support-files/Makefile.am131
-rw-r--r--support-files/MySQL-shared-compat.spec.sh2
-rw-r--r--support-files/RHEL4-SElinux/Makefile.am20
-rwxr-xr-xsupport-files/SCO/INSTALL.sh29
-rw-r--r--support-files/SCO/compile.sh102
-rw-r--r--support-files/SCO/doc.sh17
-rw-r--r--support-files/SCO/mkpkg.sh47
-rw-r--r--support-files/SCO/patch96
-rw-r--r--support-files/SCO/pkginfo.ini8
-rw-r--r--support-files/SCO/postinstall30
-rw-r--r--support-files/SCO/preinstall21
-rw-r--r--support-files/SCO/preremove25
-rw-r--r--support-files/SCO/prototype.ini4
-rw-r--r--support-files/SCO/version1
-rw-r--r--support-files/my-huge.cnf.sh18
-rw-r--r--support-files/my-innodb-heavy-4G.cnf.sh18
-rw-r--r--support-files/my-large.cnf.sh18
-rw-r--r--support-files/my-medium.cnf.sh18
-rw-r--r--support-files/my-small.cnf.sh14
-rw-r--r--support-files/mysql.spec.sh28
-rw-r--r--tests/Makefile.am62
-rw-r--r--tests/mysql_client_test.c298
-rw-r--r--unittest/Makefile.am27
-rw-r--r--unittest/examples/Makefile.am24
-rw-r--r--unittest/examples/skip-t.c8
-rw-r--r--unittest/examples/skip_all-t.c8
-rw-r--r--unittest/examples/todo-t.c8
-rw-r--r--unittest/mysys/Makefile.am35
-rw-r--r--unittest/mytap/Makefile.am25
-rw-r--r--unittest/mytap/t/Makefile.am22
-rw-r--r--unittest/mytap/t/basic-t.c2
-rw-r--r--unittest/mytap/tap.c17
-rw-r--r--unittest/mytap/tap.h15
-rw-r--r--unittest/strings/Makefile.am27
-rw-r--r--vio/Makefile.am25
-rw-r--r--win/Makefile.am19
-rw-r--r--win/README102
-rw-r--r--win/build-nmake-x64.bat21
-rw-r--r--win/build-nmake.bat21
-rwxr-xr-xwin/build-vs71.bat22
-rwxr-xr-xwin/build-vs8.bat21
-rwxr-xr-xwin/build-vs8_x64.bat21
-rw-r--r--win/build-vs9.bat18
-rw-r--r--win/build-vs9_x64.bat18
-rw-r--r--win/configure.js321
-rwxr-xr-xwin/create_manifest.js96
-rw-r--r--win/mysql_manifest.cmake21
-rw-r--r--zlib/Makefile.am35
942 files changed, 26393 insertions, 43806 deletions
diff --git a/.bzrignore b/.bzrignore
index 4c437cdd36c..e420b1590d1 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -9,15 +9,20 @@
*.core
*.d
*.da
+*.dll
+*.dylib
*.exe
+*.exp
*.gcda
*.gcno
*.gcov
*.idb
+*.ilk
*.la
*.lai
*.lib
*.lo
+*.manifest
*.map
*.o
*.obj
@@ -148,6 +153,7 @@ Makefile
Makefile.in
Makefile.in'
PENDING/*
+scripts/scripts
TAGS
VC++Files/client/mysql_amd64.dsp
ac_available_languages_fragment
@@ -606,6 +612,7 @@ include/mysql_version.h
include/mysqld_ername.h
include/mysqld_error.h
include/openssl
+include/probes_mysql_dtrace.h
include/readline
include/readline/*.h
include/readline/readline.h
@@ -1981,6 +1988,7 @@ sql-bench/test-transactions
sql-bench/test-wisconsin
sql/*.cpp
sql/*.ds?
+sql/*.def
sql/*.vcproj
sql/.deps/client.Po
sql/.deps/derror.Po
@@ -2116,6 +2124,7 @@ sql/.libs/udf_example.lai
sql/.libs/udf_example.so.0
sql/.libs/udf_example.so.0.0.0
sql/client.c
+sql/cmake_dummy.cc
sql/Doxyfile
sql/f.c
sql/gen_lex_hash
@@ -3046,6 +3055,7 @@ vio/viotest.cpp
win/configure.data
win/vs71cache.txt
win/vs8cache.txt
+win/nmake_cache.txt
ylwrap
zlib/*.ds?
zlib/*.vcproj
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index b7f7a1db77e..e0d505a948f 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -4,8 +4,7 @@ extra_configs="$extra_configs $local_infile_configs"
configure="./configure $base_configs $extra_configs"
commands="\
-$make -k maintainer-clean || true
-/bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache;
+/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0`
diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am
deleted file mode 100644
index 56c86e7a80c..00000000000
--- a/BUILD/Makefile.am
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright (C) 2002, 2004-2005 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-EXTRA_DIST = FINISH.sh \
- SETUP.sh \
- autorun.sh \
- cmake_configure.sh \
- build_mccge.sh \
- check-cpu \
- cleanup \
- compile-alpha \
- compile-alpha-debug \
- compile-amd64-debug-max \
- compile-amd64-debug-max-no-ndb \
- compile-amd64-gcov \
- compile-amd64-gprof \
- compile-amd64-max \
- compile-amd64-max-sci \
- compile-amd64-valgrind-max \
- compile-darwin-mwcc \
- compile-dist \
- compile-hpux11-parisc2-aCC \
- compile-ia64-debug-max \
- compile-irix-mips64-mipspro \
- compile-pentium \
- compile-pentium-debug \
- compile-pentium-debug-max \
- compile-pentium-debug-max-no-embedded \
- compile-pentium-debug-max-no-ndb \
- compile-pentium-debug-openssl \
- compile-pentium-debug-yassl \
- compile-pentium-gcov \
- compile-pentium-gprof \
- compile-pentium-icc \
- compile-pentium-icc-valgrind-max \
- compile-pentium-icc-yassl \
- compile-pentium-max \
- compile-pentium-myodbc \
- compile-pentium-pgcc \
- compile-pentium-valgrind-max \
- compile-pentium64 \
- compile-pentium64-debug \
- compile-pentium64-debug-max \
- compile-pentium64-gcov \
- compile-pentium64-gprof \
- compile-pentium64-max \
- compile-pentium64-max-sci \
- compile-pentium64-valgrind-max \
- compile-ppc \
- compile-ppc-debug \
- compile-ppc-debug-max \
- compile-ppc-debug-max-no-ndb \
- compile-ppc-max \
- compile-solaris-amd64 \
- compile-solaris-amd64-debug \
- compile-solaris-amd64-forte \
- compile-solaris-amd64-forte-debug \
- compile-solaris-sparc \
- compile-solaris-sparc-debug \
- compile-solaris-sparc-forte \
- compile-solaris-sparc-purify
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index a23a801e7e0..a58360cc063 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -111,7 +111,7 @@ else
# C++ warnings
cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
- cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
+ cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
debug_extra_cflags="-O0 -g3 -gdwarf-2"
fi
diff --git a/BUILD/autorun.sh b/BUILD/autorun.sh
index f4508ab12b6..e4ca52f00fe 100755
--- a/BUILD/autorun.sh
+++ b/BUILD/autorun.sh
@@ -1,38 +1,9 @@
#!/bin/sh
-# Create MySQL autotools infrastructure
+# Create MySQL cmake configure wrapper
die() { echo "$@"; exit 1; }
-# Handle "glibtoolize" (e.g., for native OS X autotools) as another
-# name for "libtoolize". Use the first one, either name, found in PATH.
-LIBTOOLIZE=libtoolize # Default
-IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
-for dir in $PATH
-do
- if test -x $dir/glibtoolize
- then
- LIBTOOLIZE=glibtoolize
- break
- elif test -x $dir/libtoolize
- then
- break
- fi
-done
-IFS="$save_ifs"
-
-rm -rf configure
-aclocal || die "Can't execute aclocal"
-autoheader || die "Can't execute autoheader"
-# --force means overwrite ltmain.sh script if it already exists
-$LIBTOOLIZE --automake --force --copy || die "Can't execute libtoolize"
-
-# --add-missing instructs automake to install missing auxiliary files
-# and --force to overwrite them if they already exist
-automake --add-missing --force --copy || die "Can't execute automake"
-autoconf || die "Can't execute autoconf"
-# Do not use autotools generated configure directly. Instead, use a script
-# that will either call CMake or original configure shell script at build
-# time (CMake is preferred if installed).
-mv configure configure.am
-cp BUILD/cmake_configure.sh configure
-chmod a+x configure
+# Use a configure script that will call CMake.
+path=`dirname $0`
+cp $path/cmake_configure.sh $path/../configure
+chmod +x $path/../configure
diff --git a/BUILD/cmake_configure.sh b/BUILD/cmake_configure.sh
index 80423205274..f5efc13e011 100644
--- a/BUILD/cmake_configure.sh
+++ b/BUILD/cmake_configure.sh
@@ -1,14 +1,17 @@
#!/bin/sh
-# Choose whether to use autoconf created configure
-# of perl script that calls cmake.
# Ensure cmake and perl are there
cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no
-perl --version >/dev/null 2>&1 || HAVE_CMAKE=no
+perl --version >/dev/null 2>&1 || HAVE_PERL=no
scriptdir=`dirname $0`
if test "$HAVE_CMAKE" = "no"
then
- sh $scriptdir/configure.am "$@"
+ echo "CMake is required to build MySQL."
+ exit 1
+elif test "$HAVE_PERL" = "no"
+then
+ echo "Perl is required to build MySQL using the configure to CMake translator."
+ exit 1
else
perl $scriptdir/cmake/configure.pl "$@"
fi
diff --git a/BUILD/compile-amd64-valgrind-max b/BUILD/compile-amd64-valgrind-max
index fb8dce38df3..d9072ef56dd 100755
--- a/BUILD/compile-amd64-valgrind-max
+++ b/BUILD/compile-amd64-valgrind-max
@@ -7,18 +7,3 @@ extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
-
-if test -z "$just_print"
-then
- set +v +x
- echo "\
-******************************************************************************
-Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
---enable-assembler. When Valgrind detects an error involving an assembly
-function (for example an uninitialized value used as an argument of an
-assembly function), Valgrind will not print the stacktrace and 'valgrind
---gdb-attach=yes' will not work either. If you need a stacktrace in those
-cases, you have to run BUILD/compile-pentium-valgrind-max with the
---disable-assembler argument.
-******************************************************************************"
-fi
diff --git a/BUILD/compile-pentium-valgrind-max b/BUILD/compile-pentium-valgrind-max
index 8ef47bfbc17..9b58c4321c9 100755
--- a/BUILD/compile-pentium-valgrind-max
+++ b/BUILD/compile-pentium-valgrind-max
@@ -7,18 +7,3 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
-
-if test -z "$just_print"
-then
- set +v +x
- echo "\
-******************************************************************************
-Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
---enable-assembler. When Valgrind detects an error involving an assembly
-function (for example an uninitialized value used as an argument of an
-assembly function), Valgrind will not print the stacktrace and 'valgrind
---gdb-attach=yes' will not work either. If you need a stacktrace in those
-cases, you have to run BUILD/compile-pentium-valgrind-max with the
---disable-assembler argument.
-******************************************************************************"
-fi
diff --git a/BUILD/compile-pentium-valgrind-max-no-ndb b/BUILD/compile-pentium-valgrind-max-no-ndb
index f480f83ebf7..b78303fb136 100755
--- a/BUILD/compile-pentium-valgrind-max-no-ndb
+++ b/BUILD/compile-pentium-valgrind-max-no-ndb
@@ -7,18 +7,3 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
-
-if test -z "$just_print"
-then
- set +v +x
- echo "\
-******************************************************************************
-Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
---enable-assembler. When Valgrind detects an error involving an assembly
-function (for example an uninitialized value used as an argument of an
-assembly function), Valgrind will not print the stacktrace and 'valgrind
---gdb-attach=yes' will not work either. If you need a stacktrace in those
-cases, you have to run BUILD/compile-pentium-valgrind-max with the
---disable-assembler argument.
-******************************************************************************"
-fi
diff --git a/BUILD/compile-pentium64-valgrind-max b/BUILD/compile-pentium64-valgrind-max
index eb3d20c874d..ebc7fc68b88 100755
--- a/BUILD/compile-pentium64-valgrind-max
+++ b/BUILD/compile-pentium64-valgrind-max
@@ -7,18 +7,3 @@ extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
-
-if test -z "$just_print"
-then
- set +v +x
- echo "\
-******************************************************************************
-Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
---enable-assembler. When Valgrind detects an error involving an assembly
-function (for example an uninitialized value used as an argument of an
-assembly function), Valgrind will not print the stacktrace and 'valgrind
---gdb-attach=yes' will not work either. If you need a stacktrace in those
-cases, you have to run BUILD/compile-pentium-valgrind-max with the
---disable-assembler argument.
-******************************************************************************"
-fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5eddad4ad15..07809a8e29b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,13 @@ SET(BUILDTYPE_DOCSTRING
IF(WITH_DEBUG)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
+ SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL
+ "MySQL maintainer-specific development environment")
+ IF(UNIX AND NOT APPLE)
+ # Compiling with PIC speeds up embedded build, on PIC sensitive systems
+ # Predefine it to ON, in case user chooses to build embedded.
+ SET(WITH_PIC ON CACHE BOOL "Compile with PIC")
+ ENDIF()
SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
IF(CUSTOM_C_FLAGS)
@@ -72,12 +79,12 @@ ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
SET(OLD_WITH_DEBUG 0 CACHE INTERNAL "" FORCE)
ENDIF()
-IF(BUILD_CONFIG)
- SET(CMAKE_USER_MAKE_RULES_OVERRIDE
- ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
-ENDIF()
PROJECT(MySQL)
+IF(BUILD_CONFIG)
+ INCLUDE(
+ ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
+ENDIF()
# Include the platform-specific file. To allow exceptions, this code
# looks for files in order of how specific they are. If there is, for
@@ -108,18 +115,27 @@ ENDIF()
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
+INCLUDE (CheckCCompilerFlag)
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)
+ CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAVE_DECLARATION_AFTER_STATEMENT)
+ IF(HAVE_DECLARATION_AFTER_STATEMENT)
+ SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT "-Wdeclaration-after-statement")
+ ENDIF()
SET(MY_MAINTAINER_C_WARNINGS
- "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
- CACHE STRING "C warning options used in maintainer builds.")
+ "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror")
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()
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(MY_MAINTAINER_C_WARNINGS
+ "${MY_MAINTAINER_C_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
+ 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")
@@ -315,23 +331,33 @@ ELSE()
SET(CPACK_GENERATOR "TGZ")
ENDIF()
ADD_SUBDIRECTORY(packaging/WiX)
+
+# Create a single package with "make package"
+# (see http://public.kitware.com/Bug/view.php?id=11452)
+SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "")
+
INCLUDE(CPack)
IF(UNIX)
- INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL)
+ INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info)
ENDIF()
#
# RPM installs documentation directly from the source tree
#
IF(NOT INSTALL_LAYOUT MATCHES "RPM")
- INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
- INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
+ INSTALL(FILES COPYING LICENSE.mysql
+ DESTINATION ${INSTALL_DOCREADMEDIR}
+ COMPONENT Readme
+ OPTIONAL
+ )
+ INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
IF(UNIX)
- INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR})
+ INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
ENDIF()
# MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
+ COMPONENT Documentation
PATTERN "INSTALL-BINARY" EXCLUDE
PATTERN "Makefile.*" EXCLUDE
PATTERN "glibc*" EXCLUDE
diff --git a/Docs/Makefile.am b/Docs/Makefile.am
deleted file mode 100644
index 48030153a4e..00000000000
--- a/Docs/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-EXTRA_DIST = mysql.info INSTALL-BINARY @extra_docs@
-
-# make sure that "make install" installs the info page, too
-# automake only seems to take care of this automatically,
-# if we're building the info page from texi directly.
-install-data-hook: $(srcdir)/mysql.info
- if test `basename $(prefix)` = "mysql" ; then \
- $(mkinstalldirs) $(DESTDIR)$(prefix)/docs ; \
- $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(prefix)/docs ; \
- test ! -f $(top_srcdir)/ChangeLog || $(INSTALL_DATA) $(top_srcdir)/ChangeLog $(DESTDIR)$(prefix)/docs ; \
- else \
- $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(pkgdatadir) ; \
- $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) ; \
- test ! -f $(top_srcdir)/ChangeLog || $(INSTALL_DATA) $(top_srcdir)/ChangeLog $(DESTDIR)$(pkgdatadir) ; \
- fi
-
-uninstall-local:
- if test `basename $(prefix)` = "mysql" ; then \
- @RM@ -f $(DESTDIR)$(prefix)/docs/mysql.info ; \
- @RM@ -f $(DESTDIR)$(prefix)/docs/ChangeLog ; \
- else \
- @RM@ -f $(DESTDIR)$(infodir)/mysql.info ; \
- @RM@ -f $(DESTDIR)$(pkgdatadir)/ChangeLog ; \
- fi
diff --git a/EXCEPTIONS-CLIENT b/EXCEPTIONS-CLIENT
deleted file mode 100644
index c570ff7ba24..00000000000
--- a/EXCEPTIONS-CLIENT
+++ /dev/null
@@ -1,119 +0,0 @@
-MySQL FLOSS License Exception
-
-The MySQL AB Exception for Free/Libre and Open Source
-Software-only Applications Using MySQL Client Libraries (the
-"FLOSS Exception").
-
-Version 0.6, 7 March 2007
-
-Exception Intent
-
-We want specified Free/Libre and Open Source Software (``FLOSS'')
-applications to be able to use specified GPL-licensed MySQL client
-libraries (the ``Program'') despite the fact that not all FLOSS
-licenses are compatible with version 2 of the GNU General Public
-License (the ``GPL'').
-
-Legal Terms and Conditions
-
-As a special exception to the terms and conditions of version 2.0
-of the GPL:
-
- 1. You are free to distribute a Derivative Work that is formed
- entirely from the Program and one or more works (each, a
- "FLOSS Work") licensed under one or more of the licenses
- listed below in section 1, as long as:
- a. You obey the GPL in all respects for the Program and the
- Derivative Work, except for identifiable sections of the
- Derivative Work which are not derived from the Program,
- and which can reasonably be considered independent and
- separate works in themselves,
- b. all identifiable sections of the Derivative Work which
- are not derived from the Program, and which can
- reasonably be considered independent and separate works
- in themselves,
- i. are distributed subject to one of the FLOSS licenses
- listed below, and
- ii. the object code or executable form of those sections
- are accompanied by the complete corresponding
- machine-readable source code for those sections on
- the same medium and under the same FLOSS license as
- the corresponding object code or executable forms of
- those sections, and
- c. any works which are aggregated with the Program or with a
- Derivative Work on a volume of a storage or distribution
- medium in accordance with the GPL, can reasonably be
- considered independent and separate works in themselves
- which are not derivatives of either the Program, a
- Derivative Work or a FLOSS Work.
- If the above conditions are not met, then the Program may only
- be copied, modified, distributed or used under the terms and
- conditions of the GPL or another valid licensing option from
- MySQL AB.
-
- 2. FLOSS License List
-
-License name Version(s)/Copyright Date
-Academic Free License 2.0
-Apache Software License 1.0/1.1/2.0
-Apple Public Source License 2.0
-Artistic license From Perl 5.8.0
-BSD license "July 22 1999"
-Common Development and Distribution License (CDDL) 1.0
-Common Public License 1.0
-Eclipse Public License 1.0
-GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1
-Jabber Open Source License 1.0
-MIT license (As listed in file MIT-License.txt) ---
-Mozilla Public License (MPL) 1.0/1.1
-Open Software License 2.0
-OpenSSL license (with original SSLeay license) "2003" ("1998")
-PHP License 3.0
-Python license (CNRI Python License) ---
-Python Software Foundation License 2.1.1
-Sleepycat License "1999"
-University of Illinois/NCSA Open Source License ---
-W3C License "2001"
-X11 License "2001"
-Zlib/libpng License ---
-Zope Public License 2.0
-
- Due to the many variants of some of the above licenses, we
- require that any version follow the 2003 version of the Free
- Software Foundation's Free Software Definition
- (http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of
- the Open Source Definition by the Open Source Initiative
- (http://www.opensource.org/docs/definition.php).
-
- 3. Definitions
-
- a. Terms used, but not defined, herein shall have the
- meaning provided in the GPL.
- b. Derivative Work means a derivative work under copyright
- law.
-
- 4. Applicability: This FLOSS Exception applies to all Programs
- that contain a notice placed by MySQL AB saying that the
- Program may be distributed under the terms of this FLOSS
- Exception. If you create or distribute a work which is a
- Derivative Work of both the Program and any other work
- licensed under the GPL, then this FLOSS Exception is not
- available for that work; thus, you must remove the FLOSS
- Exception notice from that work and comply with the GPL in all
- respects, including by retaining all GPL notices. You may
- choose to redistribute a copy of the Program exclusively under
- the terms of the GPL by removing the FLOSS Exception notice
- from that copy of the Program, provided that the copy has
- never been modified by you or any third party.
-
-Appendix A. Qualified Libraries and Packages
-
-The following is a non-exhaustive list of libraries and packages
-which are covered by the FLOSS License Exception. Please note that
-this appendix is provided merely as an additional service to
-specific FLOSS projects wishing to simplify licensing information
-for their users. Compliance with one of the licenses noted under
-the "FLOSS license list" section remains a prerequisite.
-
-Package Name Qualifying License and Version
-Apache Portable Runtime (APR) Apache Software License 2.0
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index fadd73d5094..00000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,335 +0,0 @@
-# Copyright 2000-2008 MySQL AB, 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
-
-# Process this file with automake to create Makefile.in
-
-AUTOMAKE_OPTIONS = foreign
-
-# These are built from source in the Docs directory
-EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
- README COPYING EXCEPTIONS-CLIENT \
- CMakeLists.txt configure.cmake config.h.cmake BUILD-CMAKE
-
-SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
- @readline_topdir@ sql-common scripts \
- libservices \
- @sql_union_dirs@ unittest \
- @sql_server@ @man_dirs@ tests \
- @libmysqld_dirs@ \
- mysql-test support-files sql-bench \
- win \
- packaging \
- cmake
-DIST_SUBDIRS = . include Docs zlib \
- cmd-line-utils sql-common scripts \
- libservices \
- strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
- vio sql man tests \
- libmysqld \
- mysql-test support-files sql-bench \
- win \
- cmake \
- packaging \
- BUILD
-DISTCLEANFILES = ac_available_languages_fragment
-
-# Create permission databases
-init-db: all
- $(top_builddir)/scripts/mysql_install_db
-
-bin-dist: all
- $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@
-
-# Remove BK's "SCCS" subdirectories from source distribution
-# Create initial database files for Windows installations and check them.
-dist-hook:
- rm -rf `find $(distdir) -type d -name SCCS -print`
- mkdir -p $(distdir)/win
- scripts/mysql_install_db --no-defaults --cross-bootstrap \
- --builddir=$(top_builddir) \
- --datadir=$(distdir)/win/data \
- --srcdir=$(top_srcdir)
- storage/myisam/myisamchk --silent --fast $(distdir)/win/data/mysql/*.MYI
- test ! -f $(top_srcdir)/configure.am || \
- $(INSTALL_DATA) $(top_srcdir)/configure.am $(distdir)
-
-all-local: @ABI_CHECK@
-
-tags:
- support-files/build-tags
-
-.PHONY: init-db bin-dist \
- test test-force test-full test-force-full test-force-mem \
- test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \
- test-unit test-ps test-nr test-pr test-ns test-binlog-statement \
- test-ext-funcs test-ext-rpl test-ext-partitions test-ext-jp \
- test-ext-stress test-ext test-embedded test-reprepare \
- test-fast test-fast-cursor test-fast-view test-fast-prepare \
- test-full-qa
-
-# Target 'test' will run the regression test suite using the built server.
-#
-# If you are running in a shared environment, users can avoid clashing
-# port numbers by setting individual small numbers 1-100 to the
-# environment variable MTR_BUILD_THREAD. The script "mysql-test-run"
-# will then calculate the various port numbers it needs from this,
-# making sure each user use different ports.
-
-test-unit:
- cd unittest && $(MAKE) test
-
-test-ps:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=mixed
-
-test-nr:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) --mysqld=--binlog-format=row
-
-test-pr:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) $(mem) --ps-protocol --mysqld=--binlog-format=row
-
-test-ns:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed ; \
- @PERL@ ./mysql-test-run.pl $(force) $(mem) --suite=funcs_1
-
-test-binlog-statement:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) --mysqld=--binlog-format=statement
-
-# This code is duplicated in "test-bt", see the Changeset comment of 2007-Dec-07
-test-embedded:
- if [ -e bin/mysqltest_embedded -o -e libmysqld/examples/mysqltest_embedded ] ; then \
- cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=embedded --force --timer \
- --embedded-server --skip-rpl --skip-ndbcluster ; \
- else \
- echo "no program found for 'embedded' tests - skipped testing" ; \
- fi
-
-test-reprepare:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(force) $(mem) --ps-protocol \
- --mysqld=--debug=+d,reprepare_each_statement
-
-test: test-unit test-ns test-pr
-
-smoke:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --do-test=s
-
-test-full: test test-nr test-ps
-
-test-force:
- $(MAKE) -k force=--force test
-
-test-force-full:
- $(MAKE) -k force=--force test-full
-
-#used by autopush.pl to run memory based tests
-test-force-mem:
- $(MAKE) -k force=--force mem=--mem test
-
-EXP = --experimental=collections/default.experimental
-
-test-bt:
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=normal --force --timer \
- --skip-ndbcluster --report-features $(EXP)
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \
- --skip-ndbcluster --ps-protocol $(EXP)
- -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \
- cd mysql-test ; \
- MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=ndb+ps --force --timer \
- --ps-protocol --mysqld=--binlog-format=row --suite=ndb $(EXP) ; \
- MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \
- --with-ndbcluster-only $(EXP) ; \
- else \
- echo "no program found for 'ndbcluster' tests - skipped testing" ; \
- fi
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 $(EXP)
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 $(EXP)
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=partitions --suite=parts $(EXP)
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress $(EXP)
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp $(EXP)
- -if [ -d mysql-test/suite/nist ] ; then \
- cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=nist --force --suite=nist $(EXP) ; \
- fi
- -if [ -d mysql-test/suite/nist ] ; then \
- cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=nist+ps --force --suite=nist --ps-protocol $(EXP) ; \
- fi
- -if [ -e bin/mysqltest_embedded -o -e libmysqld/examples/mysqltest_embedded ] ; then \
- cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=embedded --force --timer \
- --embedded-server --skip-rpl --skip-ndbcluster $(EXP) ; \
- else \
- echo "no program found for 'embedded' tests - skipped testing" ; \
- fi
-
-test-bt-fast:
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \
- --skip-ndbcluster --ps-protocol --report-features $(EXP)
- -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \
- cd mysql-test ; \
- MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \
- --with-ndbcluster-only $(EXP) ; \
- else \
- echo "no program found for 'ndbcluster' tests - skipped testing" ; \
- fi
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress $(EXP)
-
-test-bt-debug:
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
- --skip-ndbcluster --skip-rpl --report-features $(EXP)
-
-# Keep these for a while
-test-pl: test
-test-full-pl: test-full
-test-force-pl: test-force
-test-force-pl-mem: test-force-mem
-test-force-full-pl: test-force-full
-
-test-ext-funcs:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \
- @PERL@ ./mysql-test-run.pl --force --suite=funcs_2
-
-test-ext-rpl:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --force --suite=rpl
-
-test-ext-partitions:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --force --suite=parts
-
-test-ext-jp:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --force --suite=jp
-
-test-ext-stress:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl --force --big-test --suite=stress
-
-test-ext: test-ext-funcs test-ext-rpl test-ext-partitions test-ext-jp test-ext-stress
-
-test-fast:
- cd mysql-test ; \
- @PERL@ ./mysql-test-run.pl $(subset) --force --skip-ndb --skip-innodb --skip-im --skip-rpl ; \
- @PERL@ ./mysql-test-run.pl $(subset) --force --suite=funcs_1 --do-test=myisam ; \
- @PERL@ ./mysql-test-run.pl $(subset) --force --suite=stress --do-test=ddl_myisam
-
-test-fast-view:
- $(MAKE) subset=--view-protocol test-fast
-
-test-fast-cursor:
- $(MAKE) subset=--cursor-protocol test-fast
-
-test-fast-prepare:
- $(MAKE) subset=--ps-protocol test-fast
-
-test-full-qa:
- $(MAKE) force=--force test-pr \
- test-binlog-statement test-ext test-fast-view \
- test-fast-cursor test-unit
-
-#
-# Headers which need to be checked for abi/api compatibility.
-#
-
-API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin_audit.h \
- $(top_srcdir)/include/mysql/plugin_ftparser.h \
- $(top_srcdir)/include/mysql.h \
- $(top_srcdir)/include/mysql/psi/psi_abi_v1.h \
- $(top_srcdir)/include/mysql/psi/psi_abi_v2.h \
- $(top_srcdir)/include/mysql/client_plugin.h \
- $(top_srcdir)/include/mysql/plugin_auth.h
-
-#
-# Rules for checking that the abi/api has not changed.
-#
-# The following steps are followed in the do_abi_check rule below
-#
-# 1) Generate preprocessor output for the files that need to
-# be tested for abi/api changes. use -nostdinc to prevent
-# generation of preprocessor output for system headers. This
-# results in messages in stderr saying that these headers
-# were not found. Redirect the stderr output to /dev/null
-# to prevent seeing these messages.
-# 2) sed the output to
-# 2.1) remove blank lines and lines that begin with "# "
-# 2.2) When gcc -E is run on the Mac OS and solaris sparc platforms it
-# introduces a line of output that shows up as a difference between
-# the .pp and .out files. Remove these OS specific preprocessor text
-# inserted by the preprocessor.
-# 3) diff the generated file and the canons (.pp files already in
-# the repository).
-# 4) delete the .out file that is generated.
-#
-# If the diff fails, the generated file is not removed. This will
-# be useful for analysis of ABI differences (e.g. using a visual
-# diff tool).
-#
-# A ABI change that causes a build to fail will always be accompanied
-# by new canons (.out files). The .out files that are not removed will
-# be replaced as the new .pp files.
-#
-# e.g. If include/mysql/plugin.h has an ABI change then this rule would
-# leave a <build directory>/abi_check.out file.
-#
-# A developer with a justified API change will then do a
-# mv <build directory>/abi_check.out include/mysql/plugin.pp
-# to replace the old canons with the new ones.
-#
-
-abi_check: $(API_PREPROCESSOR_HEADER)
- $(MAKE) abi_headers="$^" do_abi_check
-
-abi_check_all: abi_check
-
-do_abi_check:
- set -ex; \
- for file in $(abi_headers); do \
- @CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/include/mysql \
- -I$(top_srcdir)/sql \
- -I$(top_builddir)/include \
- -I$(top_builddir)/include/mysql \
- -I$(top_builddir)/sql \
- $$file 2>/dev/null | \
- @SED@ -e '/^# /d' \
- -e '/^[ ]*$$/d' \
- -e '/^#pragma GCC set_debug_pwd/d' \
- -e '/^#ident/d' > \
- $(top_builddir)/abi_check.out; \
- @DIFF@ -w $$file.pp $(top_builddir)/abi_check.out; \
- @RM@ $(top_builddir)/abi_check.out; \
- done
diff --git a/README b/README
index 42d80612174..5463de4a7e8 100644
--- a/README
+++ b/README
@@ -1,2210 +1,2254 @@
-This is a release of MySQL, a dual-license SQL DBMS.
-MySQL is brought to you by the MySQL team at Oracle Corporation.
-
-************************************************************
-LICENSE
-************************************************************
-License information and use restrictions of this software can
-be found in these files:
-- For GPL (free) distributions, see the COPYING file and
- the EXCEPTIONS-CLIENT file.
-- For commercial distributions, see the LICENSE.mysql file.
-
-GPLv2 Disclaimer
-For the avoidance of doubt, except that if any license choice
-other than GPL or LGPL is available it will apply instead, Oracle
-elects to use only the General Public License version 2 (GPLv2)
-at this time for any software where a choice of GPL license versions
-is made available with the language indicating that GPLv2 or any
-later version may be used, or where a choice of which version of
-the GPL is applied is otherwise unspecified.
-
-************************************************************
-FURTHER INFORMATION
-************************************************************
-For further information about MySQL or additional documentation, see:
-- The latest information about MySQL: http://dev.mysql.com/
-- The current MySQL documentation: http://dev.mysql.com/doc/
-
-Some manual sections of special interest:
-- If you are migrating from an older version of MySQL, please read
-the "Upgrading from..." section first!
-- To see what MySQL can do, take a look at the features section.
-- For installation instructions, see the Installing and Upgrading
-chapter.
-- For the new features/bugfix history, see the Change History appendix.
-- For the currently known bugs/misfeatures (known errors) see the
-Problems and Common Errors appendix.
-- For a list of developers and other contributors, see the Credits
-appendix.
-
-A local copy of the MySQL Reference Manual can be found in the Docs
-directory in GNU Info format. You can also browse the manual online or
-download it in any of several formats at the URL given earlier in this
-file.
-
-************************************************************
-IMPORTANT:
-
-Bug or error reports should be sent to http://bugs.mysql.com.
-************************************************************
-
-
-************************************************************
-THIRD-PARTY SOFTWARE
-************************************************************
-
-%%The following software may be included in this product:
-FindGTest.cmake (part of CMake 2.8.0)
-
-Use of any of this software is governed by the terms of the license below:
-
-# Copyright 2009 Kitware, Inc.
-# Copyright 2009 Philip Lowman
-# Copyright 2009 Daniel Blezek
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#===========================================================================
-==
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-#
-# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code
-
-
-Text of Copyright.txt mentioned above:
-
-CMake - Cross Platform Makefile Generator
-Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the names of Kitware, Inc., the Insight Software Consortium,
- nor the names of their contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Cmake
-
-Use of any of this software is governed by the terms of the license below:
-
-CMake is distributed under BSD License
-
- Copyright (c) 2008, Kitware, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
- * Neither the name of Kitware, Inc. nor the names of its contributors
-may be used to endorse or promote products derived from this software without
-specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY Kitware, Inc. "AS IS" AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL Kitware Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-
-Additional License(s)
-
-cmake-2.4.8/Utilities/cmtar/compat/gethostname.c:
- gethostname.c: minimal substitute for missing gethostname() function
- created 2000-Mar-02 jmk
- requires SVR4 uname() and -lc
-
- by Jim Knoble
- Copyright ? 2000 Jim Knoble
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies and
- that both that copyright notice and this permission notice appear in
- supporting documentation.
-
- This software is provided "as is", without warranty of any kind,
- express or implied, including but not limited to the warranties of
- merchantability, fitness for a particular purpose and
- noninfringement. In no event shall the author(s) be liable for any
- claim, damages or other liability, whether in an action of contract,
- tort or otherwise, arising from, out of or in connection with the
- software or the use or other dealings in the software.
-
-----------------------------------
-
-* Originally written by Steven M. Bellovin while
-* at the University of North Carolina at Chapel Hill. Later tweaked by
-* a couple of people on Usenet. Completely overhauled by Rich $alz
-* and Jim Berets in August, 1990.
-*
-* This code is in the public domain and has no copyright.
-
--------------------------------
-
- THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT.
- You may freely copy it for use as a template for your own field types.
- If you develop a field type that might be of general use, please send
- it back to the ncurses maintainers for inclusion in the next version.
-
-**************************************************************************
-
- *
- Author : Per Foreby, perf@efd.lth.se
- *
- Author : Juergen Pfeifer, juergen.pfeifer@gmx.net
- *
-
- *
-**************************************************************************
-
-----------------------------------------
-
- Copyright (c) 2002 Insight Consortium. All rights reserved.
- See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for
-details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
---------------------------------------------
-
- Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free
-Software Foundati
-on, 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; either version 2, 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison.
-
----------------------------------------------------
-
-cmake-2.4.8/Utilities/cmzlib/zlib.h:
- zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.1.4, March 11th, 2002
-
- Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must
-not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
-distribution.
-
- Jean-loup Gailly Mark Adler
-
-----------------------------------------------
-
- This source code was modified by Martin Hedenfalk
- for
- use in Curl. His latest changes were done 2000-09-18.
-
- It has since been patched away like a madman by Daniel Stenberg
- to make it better applied to curl conditions, and to
-make
- it not use globals, pollute name space and more. This source code
-awaits a
- rewrite to work around the paragraph 2 in the BSD licenses as explained
- below.
-
- Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan
- It has since been patched and modified a lot by Daniel Stenberg
- to make it better applied to curl conditions, and to
-make
- it not use globals, pollute name space and more. This source code
-awaits a
- rewrite to work around the paragraph 2 in the BSD licenses as explained
- below.
-
- Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan
- (Royal Institute of Technology, Stockholm, Sweden).
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the Institute nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE
-LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
-
----------------------------------------------
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
-
---------------------------------------------------
-
-cmake-2.4.8/Utilities/cmcurl/inet_pton.c,
-cmake-2.4.8/Source/CTest/Curl/inet_pto
-n.c:
- This is from the BIND 4.9.4 release, modified to compile by itself
-
- Copyright (c) 1996 by Internet Software Consortium.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
-DISCLAIMS
- ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-WARRANTIES
- OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-OF THIS
- SOFTWARE.
-
--------------------------------------------------------
-
-* Copyright (C) 2001 by Eric Kidd. All rights reserved.
-* Copyright (C) 2001 by Luke Howard. All rights reserved.
-* Copyright (C) 2002 Ximian, Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* 3. The name of the author may not be used to endorse or promote products
-* derived from this software without specific prior written
-permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT
-* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY
-* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-
----------------------------------------------------
-
- Copyright (c) 1994
- The Regents of the University of California. All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- Chuck Karish of Mindcraft, Inc.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- Copyright (c) 1985, 1986 The Regents of the University of California.
- All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- James A. Woods, derived from original work by Spencer Thomas
- and Joseph Orost.
-
-------------------------------------------------
-
- Copyright (c) 1989, 1993, 1994
- The Regents of the University of California. All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- Guido van Rossum.
-
- Copyright (c) 1990 The Regents of the University of California.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-------------------------------------------------------
-
- Project ___| | | | _ \| |
- / __| | | | |_) | |
- | (__| |_| | _ <| |___
- \___|\___/|_| \_\_____|
-
- Copyright (C) 1998 - 2004, Daniel Stenberg, , et al.
-
- Copyright (C) 2004, Daniel Stenberg, , et al.
-
- This software is licensed as described in the file COPYING, which
- you should have received as part of this distribution. The terms
- are also available at http://curl.haxx.se/docs/copyright.html.
-
- You may opt to use, copy, modify, merge, publish, distribute and/or sell
- copies of the Software, and permit persons to whom the Software is
- furnished to do so, under the terms of the COPYING file.
-
- This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- KIND, either express or implied.
-
-------------------------------------------------------------
-
-***************************************************************************
- Copyright (c) 1998 Free Software Foundation, Inc.
- *
- Copyright (c) 1998,2000 Free Software Foundation, Inc.
- *
-
- *
- Permission is hereby granted, free of charge, to any person obtaining
-a *
- copy of this software and associated documentation files (the
- *
- "Software"), to deal in the Software without restriction, including
- *
- without limitation the rights to use, copy, modify, merge, publish,
- *
- distribute, distribute with modifications, sublicense, and/or sell
- *
- copies of the Software, and to permit persons to whom the Software is
- *
- furnished to do so, subject to the following conditions:
- *
-
- *
- The above copyright notice and this permission notice shall be
-included *
- in all copies or substantial portions of the Software.
- *
-
- *
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS *
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. *
- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, *
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- *
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- *
- THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-
- *
-
- *
- Except as contained in this notice, the name(s) of the above
-copyright *
- holders shall not be used in advertising or otherwise to promote the
- *
- sale, use or other dealings in this Software without prior written
- *
- authorization.
- *
- ***************************************************************************
-
-------------------------------------------------------
-
- Copyright (c) 1997 Todd C. Miller
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Fred Fish's Dbug Library
-
-Use of any of this software is governed by the terms of the license below:
-
-*
- * N O T I C E *
- * *
- * Copyright Abandoned, 1987, Fred Fish *
- * *
- * *
- * This previously copyrighted work has been placed into the public *
- * domain by the author and may be freely used for any purpose, *
- * private or commercial. *
- * *
- * Because of the number of inquiries I was receiving about the use *
- * of this product in commercially developed works I have decided to *
- * simply make it public domain to further its unrestricted use. I *
- * specifically would be most happy to see this material become a *
- * part of the standard Unix distributions by AT&T and the Berkeley *
- * Computer Science Research Group, and a standard part of the GNU *
- * system from the Free Software Foundation. *
- * *
- * I would appreciate it, as a courtesy, if this notice is left in *
- * all copies and derivative works. Thank you. *
- * *
- * The author makes no warranty of any kind with respect to this *
- * product and explicitly disclaims any implied warranties of mer- *
- * chantability or fitness for any particular purpose. *
- *
-
-***************************************************************************
-
-%%The following software may be included in this product:
-dbug_analyze.c (part of Fred Fish's Dbug Library)
-
-Use of any of this software is governed by the terms of the license below:
-
-* *
-* Copyright Abandoned, 1987, Fred Fish *
-* *
-* *
-* This previously copyrighted work has been placed into the public *
-* domain by the author and may be freely used for any purpose, *
-* private or commercial. *
-* *
-* Because of the number of inquiries I was receiving about the use *
-* of this product in commercially developed works I have decided to *
-* simply make it public domain to further its unrestricted use. I *
-* specifically would be most happy to see this material become a *
-* part of the standard Unix distributions by AT&T and the Berkeley *
-* Computer Science Research Group, and a standard part of the GNU *
-* system from the Free Software Foundation. *
-* *
-* I would appreciate it, as a courtesy, if this notice is left in *
-* all copies and derivative works. Thank you. *
-* *
-* The author makes no warranty of any kind with respect to this *
-* product and explicitly disclaims any implied warranties of mer- *
-* chantability or fitness for any particular purpose.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-GNU Libtool, only ltmain.sh, libtool, auto-gen fil
-
-Use of any of this software is governed by the terms of the license below:
-
-ltmain.sh inclusion:
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007 Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit , 1996
-#
-# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-libtool inclusion:
-# libtoolT - Provide generalized library-building support services.
-# Generated automatically by (GNU mysql 5.1.30)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-# 2006, 2007 Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit , 1996
-#
-# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-Auto-generated files:
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building
-# support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit , 1996
-#
-# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-Additional License(s)
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-innochecksum.c
-
-Use of any of this software is governed by the terms of the license below:
-
-GNU GENERAL PUBLIC LICENSE
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most
-of the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom to
-distribute copies of free software (and charge for this service if you wish),
-that you receive source code or can get it if you want it, that you can change
-the software or use pieces of it in new free programs; and that you know you can
-do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show them
-these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually
-obtain patent licenses, in effect making the program proprietary. To prevent
-this, we have made it clear that any patent must be licensed for everyone's free
-use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification follow.
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program or
-work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or
-translated into another language. (Hereinafter, translation is included without
-limitation in the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such modifications
-or work under the terms of Section 1 above, provided that you also meet all of
-these conditions:
-
- a) You must cause the modified files to carry prominent notices stating that
-you changed the files and the date of any change.
- b) You must cause any work that you distribute or publish, that in whole or
-in part contains or is derived from the Program or any part thereof, to be
-licensed as a whole at no charge to all third parties under the terms of this
-License.
- c) If the modified program normally reads commands interactively when run,
-you must cause it, when started running for such interactive use in the most
-ordinary way, to print or display an announcement including an appropriate
-copyright notice and a notice that there is no warranty (or else, saying that
-you provide a warranty) and that users may redistribute the program under these
-conditions, and telling the user how to view a copy of this License. (Exception:
-if the Program itself is interactive but does not normally print such an
-announcement, your work based on the Program is not required to print an
-announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License, and
-its terms, do not apply to those sections when you distribute them as separate
-works. But when you distribute the same sections as part of a whole which is a
-work based on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the entire whole,
-and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on the
-Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this License.
-
-3. You may copy and distribute the Program (or a work based on it, under Section
-2) in object code or executable form under the terms of Sections 1 and 2 above
-provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or,
- b) Accompany it with a written offer, valid for at least three years, to
-give any third party, for a charge no more than your cost of physically
-performing source distribution, a complete machine-readable copy of the
-corresponding source code, to be distributed under the terms of Sections 1 and 2
-above on a medium customarily used for software interchange; or,
- c) Accompany it with the information you received as to the offer to
-distribute corresponding source code. (This alternative is allowed only for
-noncommercial distribution and only if you received the program in object code
-or executable form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface
-definition files, plus the scripts used to control compilation and installation
-of the executable. However, as a special exception, the source code distributed
-need not include anything that is normally distributed (in either source or
-binary form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component itself
-accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source code
-from the same place counts as distribution of the source code, even though third
-parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not
-accept this License. Therefore, by modifying or distributing the Program (or any
-work based on the Program), you indicate your acceptance of this License to do
-so, and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to
-copy, distribute or modify the Program subject to these terms and conditions.
-You may not impose any further restrictions on the recipients' exercise of the
-rights granted herein. You are not responsible for enforcing compliance by third
-parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed
-on you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your
-obligations under this License and any other pertinent obligations, then as a
-consequence you may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by all those
-who receive copies directly or indirectly through you, then the only way you
-could satisfy both it and this License would be to refrain entirely from
-distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and the
-section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices. Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose that
-choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original copyright
-holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded. In such
-case, this License incorporates the limitation as if written in the body of this
-License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems
-or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies
-a version number of this License which applies to it and "any later version",
-you have the option of following the terms and conditions either of that version
-or of any later version published by the Free Software Foundation. If the
-Program does not specify a version number of this License, you may choose any
-version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of
-all derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
-PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED
-IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS
-IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
-NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
-ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
-PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
-SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
-TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
-THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
-PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible use
-to the public, the best way to achieve this is to make it free software which
-everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach
-them to the start of each source file to most effectively convey the exclusion
-of warranty; and each file should have at least the "copyright" line and a
-pointer to where the full notice is found.
-
-one line to give the program's name and an idea of what it does.
-Copyright (C) yyyy name of author
-
-This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it
-starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
-type `show w'. This is free software, and you are welcome
-to redistribute it under certain conditions; type `show c'
-for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may be
-called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school,
-if any, to sign a "copyright disclaimer" for the program, if necessary. Here is
-a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright
-interest in the program `Gnomovision'
-(which makes passes at compilers) written
-by James Hacker.
-
-signature of Ty Coon, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may consider
-it more useful to permit linking proprietary applications with the library. If
-this is what you want to do, use the GNU Lesser General Public License instead
-of this License.
-
-Additional Documentation License(s)
-
-innochecksum.c is documented in the MySQL Reference
-Manual at http://dev.mysql.com/doc/refman/5.1/en/innochecksum.html
-The Reference Manual is not licensed under the GPL; rather, it
-is offered under normal copyright, but with permission to
-copy/redistribute electronically.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-lib_sql.cc
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright (c) 2000
- * SWsoft company
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
-
- This code was modified by the MySQL team
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-libevent
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright (c) 2000-2004 Niels Provos
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-Additional License(s)
-
-http://creativecommons.org/licenses/publicdomain
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Async DNS Library
-
-Use of any of this software is governed by the terms of the license below:
-
-/* Async DNS Library
- * Adam Langley
- * http://www.imperialviolet.org/eventdns.html
- * Public Domain code
- *
- * This software is Public Domain. To view a copy of the public domain dedication,
- * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
- * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
- *
- * I ask and expect, but do not require, that all derivative works contain an
- * attribution similar to:
- * Parts developed by Adam Langley
- *
- * You may wish to replace the word "Parts" with something else depending on
- * the amount of original code.
- *
- * (Derivative works does not include programs which link against, run or include
- * the source verbatim in their source distributions)
- *
- * Version: 0.1b
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-log.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/* $OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $ */
-
-/*
- * log.c
- *
- * Based on err.c, which was adapted from OpenBSD libc *err* *warn* code.
- *
- * Copyright (c) 2005 Nick Mathewson
- *
- * Copyright (c) 2000 Dug Song
- *
- * Copyright (c) 1993
- * The Regents of the University of California. All rights
-reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-min_heap.h
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright (c) 2006 Maxim Yegorushkin
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-win32.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright 2000-2002 Niels Provos
- * Copyright 2003 Michael A. Davis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-regex++
-
-Use of any of this software is governed by the terms of the license below:
-
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Richard A. O'Keefe strings package
-
-Use of any of this software is governed by the terms of the license below:
-
-These files are in the public domain. This includes getopt.c, which
-is the work of Henry Spencer, University of Toronto Zoology, who says of
-it "None of this software is derived from Bell software. I had no access
-to the source for Bell's versions at the time I wrote it. This software
-is hereby explicitly placed in the public domain. It may be used for
-any purpose on any machine by anyone." I would greatly prefer it if *my*
-material received no military use.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-t_ctype.h
-
-Use of any of this software is governed by the terms of the license below:
-
-http://bioinfo.mbb.yale.edu/genome/yeast/cluster/database/mysql/include/t_ctype.h
-
-/*
- Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
- Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
- Permission to use, copy, modify, distribute and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies.
- Smaphan Raruenrom and Pruet Boonma makes no representations about
- the suitability of this software for any purpose. It is provided
- "as is" without express or implied warranty.
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-SHA-1 in C
-
-Use of any of this software is governed by the terms of the license below:
-
- SHA-1 in C
- By Steve Reid
- 100% Public Domain
-
-Additional License(s)
-
-100% Public Domain
-
-***************************************************************************
-
-%%The following software may be included in this product:
-TCMalloc (part of google-perftools)
-
-Use of any of this software is governed by the terms of the license below:
-
-# Copyright (c) 1998-2006, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Additional License(s)
-
-*** File src/tests/ptmalloc/thread-m.h contains this GPLv2 (or later)
-text:
-
-/* Basic platform-independent macro definitions for mutexes and
- thread-specific data.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Wolfram Gloger , 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If
-not,
- write to the Free Software Foundation, Inc., 59 Temple Place -
-Suite 330,
- Boston, MA 02111-1307, USA. */
-
-
-
-*** File src/tests/ptmalloc/malloc-machine.h contains this BSD like text:
-
-/* Basic platform-independent macro definitions for mutexes,
- thread-specific data and parameters for malloc.
- Posix threads (pthreads) version.
- Copyright (C) 2004 Wolfram Gloger .
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that (i) the above copyright notices and this permission
-notice appear in all copies of the software and related documentation,
-and (ii) the name of Wolfram Gloger may not be used in any advertising
-or publicity relating to the software.
-
-THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
-INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
-DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
-OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-The tz database
-
-Use of any of this software is governed by the terms of the license below:
-
-Sources for Time Zone and Daylight Saving Time Data
-@(#)tz-link.htm 7.54
-
-Please send corrections to this web page to the time zone mailing list.
-The tz database
-
-The public-domain time zone database contains code and data that represent the
-history of local time for many representative locations around the globe. It is
-updated periodically to reflect changes made by political bodies to time zone
-boundaries, UTC offsets, and daylight-saving rules. This database (often called
-tz or zoneinfo) is used by several implementations, including the GNU C Library
-used in GNU/Linux, FreeBSD, NetBSD, OpenBSD, Cygwin, DJGPP, HP-UX, IRIX, Mac OS
-X, OpenVMS, Solaris, Tru64, and UnixWare.
-
-Each location in the database represents a national region where all clocks
-keeping local time have agreed since 1970. Locations are identified by continent
-or ocean and then by the name of the location, which is typically the largest
-city within the region. For example, America/New_York represents most of the US
-eastern time zone; America/Phoenix represents most of Arizona, which uses
-mountain time without daylight saving time (DST); America/Detroit represents
-most of Michigan, which uses eastern time but with different DST rules in 1975;
-and other entries represent smaller regions like Starke County, Indiana, which
-switched from central to eastern time in 1991 and switched back in 2006. To use
-the database on an extended POSIX implementation set the TZ environment variable
-to the location's full name, e.g., TZ="America/New_York".
-
-In the tz database's FTP distribution the code is in the file tzcodeC.tar.gz,
-where C is the code's version; similarly, the data are in tzdataD.tar.gz, where
-D is the data's version. The following shell commands download these files to a
-GNU/Linux or similar host; see the downloaded README file for what to do next.
-
-wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
-gzip -dc tzcode*.tar.gz | tar -xf -
-gzip -dc tzdata*.tar.gz | tar -xf -
-
-The code lets you compile the tz source files into machine-readable binary
-files, one for each location. It also lets you read a tz binary file and
-interpret time stamps for that location.
-
-The data are by no means authoritative. If you find errors, please send changes
-to the time zone mailing list. You can also subscribe to the mailing list,
-retrieve the archive of old messages (in gzip compressed format), or retrieve
-archived older versions of code and data; there is also a smaller HTTP mirror.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-UnicodeData.txt
-
-Use of any of this software is governed by the terms of the license below:
-
-Unicode Terms of Use
-
- For the general privacy policy governing access to this site, see the
-Unicode Privacy Policy. For trademark usage, see the Unicode Consortium®
-Trademarks and Logo Policy.
- Notice to End User: Terms of Use
- Carefully read the following legal agreement ("Agreement"). Use or copying
-of the software and/or codes provided with this agreement (The "Software")
-constitutes your acceptance of these terms
-
- 1. Unicode Copyright.
- 1. Copyright © 1991-2008 Unicode, Inc. All rights reserved.
- 2. Certain documents and files on this website contain a legend
-indicating that "Modification is permitted." Any person is hereby authorized,
-without fee, to modify such documents and files to create derivative works
-conforming to the Unicode® Standard, subject to Terms and Conditions herein.
- 3. Any person is hereby authorized, without fee, to view, use,
-reproduce, and distribute all documents and files solely for informational
-purposes in the creation of products supporting the Unicode Standard, subject to
-the Terms and Conditions herein.
- 4. Further specifications of rights and restrictions pertaining to
-the use of the particular set of data files known as the "Unicode Character
-Database" can be found in Exhibit 1.
- 5. Each version of the Unicode Standard has further specifications
-of rights and restrictions of use. For the book editions, these are found on the
-back of the title page. For the online edition, certain files (such as the PDF
-files for book chapters and code charts) carry specific restrictions. All other
-files are covered under these general Terms of Use. To request a permission to
-reproduce any part of the Unicode Standard, please contact the Unicode Consortium.
- 6. No license is granted to "mirror" the Unicode website where a
-fee is charged for access to the "mirror" site.
- 7. Modification is not permitted with respect to this document. All
-copies of this document must be verbatim.
- 2. Restricted Rights Legend. Any technical data or software which is
-licensed to the United States of America, its agencies and/or instrumentalities
-under this Agreement is commercial technical data or commercial computer
-software developed exclusively at private expense as defined in FAR 2.101, or
-DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
-duplication, or disclosure by the Government is subject to restrictions as set
-forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and
-this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202,
-as applicable, use, duplication or disclosure by the Government is subject to
-the restrictions set forth in this Agreement.
- 3. Warranties and Disclaimers.
- 1. This publication and/or website may include technical or
-typographical errors or other inaccuracies . Changes are periodically added to
-the information herein; these changes will be incorporated in new editions of
-the publication and/or website. Unicode may make improvements and/or changes in
-the product(s) and/or program(s) described in this publication and/or website at
-any time.
- 2. If this file has been purchased on magnetic or optical media
-from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange
-of the defective media within ninety (90) days of original purchase.
- 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR
-SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS,
-IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE
-AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS
-PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED
-TO THIS PUBLICATION OR THE UNICODE WEBSITE.
- 4. Waiver of Damages. In no event shall Unicode or its licensors be
-liable for any special, incidental, indirect or consequential damages of any
-kind, or any damages whatsoever, whether or not Unicode was advised of the
-possibility of the damage, including, without limitation, those resulting from
-the following: loss of use, data or profits, in connection with the use,
-modification or distribution of this information or its derivatives.
- 5. Trademarks.
- 1. Unicode and the Unicode logo are registered trademarks of
-Unicode, Inc.
- 2. This site contains product names and corporate names of other
-companies. All product names and company names and logos mentioned herein are
-the trademarks or registered trademarks of their respective owners. Other
-products and corporate names mentioned herein which are trademarks of a third
-party are used only for explanation and for the owners' benefit and with no
-intent to infringe.
- 3. Use of third party products or information referred to herein is
-at the user’s risk.
- 6. Miscellaneous.
- 1. Jurisdiction and Venue. This server is operated from a location
-in the State of California, United States of America. Unicode makes no
-representation that the materials are appropriate for use in other locations. If
-you access this server from other locations, you are responsible for compliance
-with local laws. This Agreement, all use of this site and any claims and damages
-resulting from use of this site are governed solely by the laws of the State of
-California without regard to any principles which would apply the laws of a
-different jurisdiction. The user agrees that any disputes regarding this site
-shall be resolved solely in the courts located in Santa Clara County,
-California. The user agrees said courts have personal jurisdiction and agree to
-waive any right to transfer the dispute to any other forum.
- 2. Modification by Unicode Unicode shall have the right to modify
-this Agreement at any time by posting it to this site. The user may not assign
-any part of this Agreement without Unicode’s prior written consent.
- 3. Taxes. The user agrees to pay any taxes arising from access to
-this website or use of the information herein, except for those based on
-Unicode’s net income.
- 4. Severability. If any provision of this Agreement is declared
-invalid or unenforceable, the remaining provisions of this Agreement shall
-remain in effect.
- 5. Entire Agreement. This Agreement constitutes the entire
-agreement between the parties.
-
-EXHIBIT 1
-UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
- Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/ . Unicode Software includes any source code
-published in the Unicode Standard or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/.
-
- NOTICE TO USER: Carefully read the following legal agreement. BY
-DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES
-("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND
-AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU
-DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES
-OR SOFTWARE.
-
- COPYRIGHT AND PERMISSION NOTICE
-
- Copyright © 1991-2008 Unicode, Inc. All rights reserved. Distributed under
-the Terms of Use in http://www.unicode.org/copyright.html.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
-of the Unicode data files and any associated documentation (the "Data Files") or
-Unicode software and any associated documentation (the "Software") to deal in
-the Data Files or Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files or
-Software are furnished to do so, provided that (a) the above copyright notice(s)
-and this permission notice appear with all copies of the Data Files or Software,
-(b) both the above copyright notice(s) and this permission notice appear in
-associated documentation, and (c) there is clear notice in each modified Data
-File or in the Software as well as in the documentation associated with the Data
-File(s) or Software that the data or software has been modified.
-
- THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
-PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
- Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in these Data Files or Software without prior written authorization of the
-copyright holder.
-
- Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
-registered in some jurisdictions. All other trademarks and registered trademarks
-mentioned herein are the property of their respective owners.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-zlib
-
-Use of any of this software is governed by the terms of the license below:
-
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.3, July 18th, 2005
-
- Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly jloup@gzip.org
- Mark Adler madler@alumni.caltech.edu
-
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-dtoa.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/****************************************************************
-
- This file incorporates work covered by the following copyright and
- permission notice:
-
- The author of this software is David M. Gay.
-
- Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose without fee is hereby granted, provided that this entire
- notice is included in all copies of any software which is or includes a copy
- or modification of this software and in all copies of the supporting
- documentation for such software.
-
- THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
- REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
- OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
-
- ***************************************************************/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-getarg.{c,h}
-
-Use of any of this software is governed by the terms of the license below:
-
-/* 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 */
-
-/*
- * Copyright (c) 1997, 1999 Kungliga Tekniska H366gskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-MD5 message-digest algorithm (md5_hash.cpp)
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * The code has been modified by Mikael Ronstroem to handle
- * calculating a hash value of a key that is always a multiple
- * of 4 bytes long. Word 0 of the calculated 4-word hash value
- * is returned as the hash value.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-nt_servc.{cc,h}
-
-Use of any of this software is governed by the terms of the license below:
-
-/**
- @file
-
- @brief
- Windows NT Service class library.
-
- Copyright Abandoned 1998 Irena Pancirov - Irnet Snc
- This file is public domain and comes with NO WARRANTY of any kind
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-GNU Readline
-
-Use of any of this software is governed by the terms of the license below:
-
-GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This 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.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
-
-***************************************************************************
+MySQL Server
+
+This is a release of MySQL, a dual-license SQL database server.
+For the avoidance of doubt, this particular copy of the software
+is released under the version 2 of the GNU General Public License.
+MySQL is brought to you by the MySQL team at Oracle.
+
+Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+
+License information can be found in the COPYING file.
+
+This distribution may include materials developed by third
+parties. For license and attribution notices for these
+materials, please refer to the documentation that accompanies
+this distribution (see the Licenses for Third-Party Components
+appendix). A copy of the license/notices is also reproduced
+below.
+
+GPLv2 Disclaimer
+For the avoidance of doubt, except that if any license choice
+other than GPL or LGPL is available it will apply instead,
+Oracle elects to use only the General Public License version 2
+(GPLv2) at this time for any software where a choice of GPL
+license versions is made available with the language indicating
+that GPLv2 or any later version may be used, or where a choice
+of which version of the GPL is applied is otherwise unspecified.
+
+For further information about MySQL or additional documentation,
+see:
+- The latest information about MySQL: http://www.mysql.com
+- The current MySQL documentation: http://dev.mysql.com/doc
+
+Some Reference Manual sections of special interest:
+- If you are migrating from an older version of MySQL, please
+ read the "Upgrading from..." section.
+- To see what MySQL can do, take a look at the features section.
+- For installation instructions, see the Installing and Upgrading
+ chapter.
+- For the new features/bugfix history, see the MySQL Change History
+ appendix.
+- For currently known bugs, see the Errors and Common Problems
+ appendix.
+
+You can browse the MySQL Reference Manual online or download it
+in any of several formats at the URL given earlier in this file.
+Source distributions include a local copy of the manual in the
+Docs directory.
+
+********************************************************************
+
+Third-Party Component Notices
+
+*********************************************************************
+
+%%The following software may be included in this product:
+FindGTest.cmake (part of CMake 2.8.0)
+
+Use of any of this software is governed by the terms of the license below:
+
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman
+# Copyright 2009 Daniel Blezek
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#===========================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+#
+# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code
+
+
+Text of Copyright.txt mentioned above:
+
+CMake - Cross Platform Makefile Generator
+Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+* Neither the names of Kitware, Inc., the Insight Software Consortium,
+ nor the names of their contributors may be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+Cmake
+
+Use of any of this software is governed by the terms of the license below:
+
+CMake is distributed under BSD License
+
+ Copyright (c) 2008, Kitware, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Kitware, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY Kitware, Inc. "AS IS" AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL Kitware Inc. BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+Additional License(s)
+
+cmake-2.4.8/Utilities/cmtar/compat/gethostname.c:
+ gethostname.c: minimal substitute for missing gethostname() function
+ created 2000-Mar-02 jmk
+ requires SVR4 uname() and -lc
+
+ by Jim Knoble
+ Copyright ? 2000 Jim Knoble
+
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and
+ that both that copyright notice and this permission notice appear in
+ supporting documentation.
+
+ This software is provided "as is", without warranty of any kind,
+ express or implied, including but not limited to the warranties of
+ merchantability, fitness for a particular purpose and
+ noninfringement. In no event shall the author(s) be liable for any
+ claim, damages or other liability, whether in an action of contract,
+ tort or otherwise, arising from, out of or in connection with the
+ software or the use or other dealings in the software.
+
+----------------------------------
+
+* Originally written by Steven M. Bellovin while
+* at the University of North Carolina at Chapel Hill. Later tweaked by
+* a couple of people on Usenet. Completely overhauled by Rich $alz
+* and Jim Berets in August, 1990.
+*
+* This code is in the public domain and has no copyright.
+
+-------------------------------
+
+ THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT.
+ You may freely copy it for use as a template for your own field types.
+ If you develop a field type that might be of general use, please send
+ it back to the ncurses maintainers for inclusion in the next version.
+
+**************************************************************************
+
+ * Author : Per Foreby, perf@efd.lth.se
+ * Author : Juergen Pfeifer, juergen.pfeifer@gmx.net
+
+**************************************************************************
+
+----------------------------------------
+
+ Copyright (c) 2002 Insight Consortium. All rights reserved.
+ See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for
+ details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+--------------------------------------------
+
+ Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software
+ Foundation, 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; either version 2, 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison.
+
+---------------------------------------------------
+
+cmake-2.4.8/Utilities/cmzlib/zlib.h:
+ zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.1.4, March 11th, 2002
+
+ Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+ Jean-loup Gailly Mark Adler
+
+----------------------------------------------
+
+ This source code was modified by Martin Hedenfalk for use in Curl. His
+ latest changes were done 2000-09-18.
+
+ It has since been patched away like a madman by Daniel Stenberg to make it
+ better applied to curl conditions, and to make it not use globals, pollute
+ name space and more. This source code awaits a rewrite to work around the
+ paragraph 2 in the BSD licenses as explained below.
+
+ Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan
+ It has since been patched and modified a lot by Daniel Stenberg to make it
+ better applied to curl conditions, and to make it not use globals, pollute
+ name space and more. This source code awaits a rewrite to work around the
+ paragraph 2 in the BSD licenses as explained below.
+
+ Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan
+ (Royal Institute of Technology, Stockholm, Sweden).
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the Institute nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+---------------------------------------------
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
+ CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
+
+--------------------------------------------------
+
+cmake-2.4.8/Utilities/cmcurl/inet_pton.c,
+cmake-2.4.8/Source/CTest/Curl/inet_pton.c:
+ This is from the BIND 4.9.4 release, modified to compile by itself
+
+ Copyright (c) 1996 by Internet Software Consortium.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
+ OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+
+-------------------------------------------------------
+
+* Copyright (C) 2001 by Eric Kidd. All rights reserved.
+* Copyright (C) 2001 by Luke Howard. All rights reserved.
+* Copyright (C) 2002 Ximian, Inc.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* 3. The name of the author may not be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+* SUCH DAMAGE.
+
+---------------------------------------------------
+
+ Copyright (c) 1994
+ The Regents of the University of California. All rights reserved.
+
+ This code is derived from software contributed to Berkeley by
+ Chuck Karish of Mindcraft, Inc.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the University nor the names of its contributors
+ Copyright (c) 1985, 1986 The Regents of the University of California.
+ All rights reserved.
+
+ This code is derived from software contributed to Berkeley by
+ James A. Woods, derived from original work by Spencer Thomas
+ and Joseph Orost.
+
+------------------------------------------------
+
+ Copyright (c) 1989, 1993, 1994
+ The Regents of the University of California. All rights reserved.
+
+ This code is derived from software contributed to Berkeley by
+ Guido van Rossum.
+
+ Copyright (c) 1990 The Regents of the University of California.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+ 4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+------------------------------------------------------
+
+ Project ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+ Copyright (C) 1998 - 2004, Daniel Stenberg, , et al.
+
+ Copyright (C) 2004, Daniel Stenberg, , et al.
+
+ This software is licensed as described in the file COPYING, which
+ you should have received as part of this distribution. The terms
+ are also available at http://curl.haxx.se/docs/copyright.html.
+
+ You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ copies of the Software, and permit persons to whom the Software is
+ furnished to do so, under the terms of the COPYING file.
+
+ This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ KIND, either express or implied.
+
+------------------------------------------------------------
+
+***************************************************************************
+ Copyright (c) 1998 Free Software Foundation, Inc.
+ Copyright (c) 1998,2000 Free Software Foundation, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, distribute with modifications, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished
+ to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+ Except as contained in this notice, the name(s) of the above copyright
+ holders shall not be used in advertising or otherwise to promote the sale,
+ use or other dealings in this Software without prior written
+ authorization.
+***************************************************************************
+
+------------------------------------------------------
+
+ Copyright (c) 1997 Todd C. Miller
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+Fred Fish's Dbug Library
+
+Use of any of this software is governed by the terms of the license below:
+
+ * N O T I C E *
+ * *
+ * Copyright Abandoned, 1987, Fred Fish *
+ * *
+ * *
+ * This previously copyrighted work has been placed into the public *
+ * domain by the author and may be freely used for any purpose, *
+ * private or commercial. *
+ * *
+ * Because of the number of inquiries I was receiving about the use *
+ * of this product in commercially developed works I have decided to *
+ * simply make it public domain to further its unrestricted use. I *
+ * specifically would be most happy to see this material become a *
+ * part of the standard Unix distributions by AT&T and the Berkeley *
+ * Computer Science Research Group, and a standard part of the GNU *
+ * system from the Free Software Foundation. *
+ * *
+ * I would appreciate it, as a courtesy, if this notice is left in *
+ * all copies and derivative works. Thank you. *
+ * *
+ * The author makes no warranty of any kind with respect to this *
+ * product and explicitly disclaims any implied warranties of mer- *
+ * chantability or fitness for any particular purpose. *
+
+***************************************************************************
+
+%%The following software may be included in this product:
+dbug_analyze.c (part of Fred Fish's Dbug Library)
+
+Use of any of this software is governed by the terms of the license below:
+
+* Copyright Abandoned, 1987, Fred Fish *
+* *
+* *
+* This previously copyrighted work has been placed into the public *
+* domain by the author and may be freely used for any purpose, *
+* private or commercial. *
+* *
+* Because of the number of inquiries I was receiving about the use *
+* of this product in commercially developed works I have decided to *
+* simply make it public domain to further its unrestricted use. I *
+* specifically would be most happy to see this material become a *
+* part of the standard Unix distributions by AT&T and the Berkeley *
+* Computer Science Research Group, and a standard part of the GNU *
+* system from the Free Software Foundation. *
+* *
+* I would appreciate it, as a courtesy, if this notice is left in *
+* all copies and derivative works. Thank you. *
+* *
+* The author makes no warranty of any kind with respect to this *
+* product and explicitly disclaims any implied warranties of mer- *
+* chantability or fitness for any particular purpose. *
+
+***************************************************************************
+
+%%The following software may be included in this product:
+GNU Libtool, only ltmain.sh, libtool, auto-gen fil
+
+Use of any of this software is governed by the terms of the license below:
+
+ltmain.sh inclusion:
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit , 1996
+#
+# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+libtool inclusion:
+# libtoolT - Provide generalized library-building support services.
+# Generated automatically by (GNU mysql 5.1.30)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+# 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit , 1996
+#
+# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+Auto-generated files:
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building
+# support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit , 1996
+#
+# This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+Additional License(s)
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+innochecksum.c
+
+Use of any of this software is governed by the terms of the license below:
+
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most
+of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you can
+do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show them
+these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually
+obtain patent licenses, in effect making the program proprietary. To prevent
+this, we have made it clear that any patent must be licensed for everyone's free
+use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program or
+work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included without
+limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and appropriately
+publish on each copy an appropriate copyright notice and disclaimer of warranty;
+keep intact all the notices that refer to this License and to the absence of any
+warranty; and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating that
+you changed the files and the date of any change.
+ b) You must cause any work that you distribute or publish, that in whole or
+in part contains or is derived from the Program or any part thereof, to be
+licensed as a whole at no charge to all third parties under the terms of this
+License.
+ c) If the modified program normally reads commands interactively when run,
+you must cause it, when started running for such interactive use in the most
+ordinary way, to print or display an announcement including an appropriate
+copyright notice and a notice that there is no warranty (or else, saying that
+you provide a warranty) and that users may redistribute the program under these
+conditions, and telling the user how to view a copy of this License. (Exception:
+if the Program itself is interactive but does not normally print such an
+announcement, your work based on the Program is not required to print an
+announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the entire whole,
+and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on the
+Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section
+2) in object code or executable form under the terms of Sections 1 and 2 above
+provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source
+code, which must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange; or,
+ b) Accompany it with a written offer, valid for at least three years, to
+give any third party, for a charge no more than your cost of physically
+performing source distribution, a complete machine-readable copy of the
+corresponding source code, to be distributed under the terms of Sections 1 and 2
+above on a medium customarily used for software interchange; or,
+ c) Accompany it with the information you received as to the offer to
+distribute corresponding source code. (This alternative is allowed only for
+noncommercial distribution and only if you received the program in object code
+or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code distributed
+need not include anything that is normally distributed (in either source or
+binary form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component itself
+accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source code
+from the same place counts as distribution of the source code, even though third
+parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not
+accept this License. Therefore, by modifying or distributing the Program (or any
+work based on the Program), you indicate your acceptance of this License to do
+so, and all its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein. You are not responsible for enforcing compliance by third
+parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement
+or for any other reason (not limited to patent issues), conditions are imposed
+on you (whether by court order, agreement or otherwise) that contradict the
+conditions of this License, they do not excuse you from the conditions of this
+License. If you cannot distribute so as to satisfy simultaneously your
+obligations under this License and any other pertinent obligations, then as a
+consequence you may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by all those
+who receive copies directly or indirectly through you, then the only way you
+could satisfy both it and this License would be to refrain entirely from
+distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and the
+section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original copyright
+holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In such
+case, this License incorporates the limitation as if written in the body of this
+License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies
+a version number of this License which applies to it and "any later version",
+you have the option of following the terms and conditions either of that version
+or of any later version published by the Free Software Foundation. If the
+Program does not specify a version number of this License, you may choose any
+version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
+PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED
+IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS
+IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
+TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
+THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
+PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+END OF TERMS AND CONDITIONS
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use
+to the public, the best way to achieve this is to make it free software which
+everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+one line to give the program's name and an idea of what it does.
+Copyright (C) yyyy name of author
+
+This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
+type `show w'. This is free software, and you are welcome
+to redistribute it under certain conditions; type `show c'
+for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary. Here is
+a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright
+interest in the program `Gnomovision'
+(which makes passes at compilers) written
+by James Hacker.
+
+signature of Ty Coon, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may consider
+it more useful to permit linking proprietary applications with the library. If
+this is what you want to do, use the GNU Lesser General Public License instead
+of this License.
+
+Additional Documentation License(s)
+
+innochecksum.c is documented in the MySQL Reference
+Manual at http://dev.mysql.com/doc/refman/5.1/en/innochecksum.html
+The Reference Manual is not licensed under the GPL; rather, it
+is offered under normal copyright, but with permission to
+copy/redistribute electronically.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+lib_sql.cc
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ * Copyright (c) 2000
+ * SWsoft company
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+
+ This code was modified by the MySQL team
+*/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+libevent
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ * Copyright (c) 2000-2004 Niels Provos
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+Additional License(s)
+
+http://creativecommons.org/licenses/publicdomain
+
+***************************************************************************
+
+%%The following software may be included in this product:
+Async DNS Library
+
+Use of any of this software is governed by the terms of the license below:
+
+/* Async DNS Library
+ * Adam Langley
+ * http://www.imperialviolet.org/eventdns.html
+ * Public Domain code
+ *
+ * This software is Public Domain. To view a copy of the public domain dedication,
+ * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
+ * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+ *
+ * I ask and expect, but do not require, that all derivative works contain an
+ * attribution similar to:
+ * Parts developed by Adam Langley
+ *
+ * You may wish to replace the word "Parts" with something else depending on
+ * the amount of original code.
+ *
+ * (Derivative works does not include programs which link against, run or include
+ * the source verbatim in their source distributions)
+ *
+ * Version: 0.1b
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+log.c
+
+Use of any of this software is governed by the terms of the license below:
+
+/* $OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $ */
+
+/*
+ * log.c
+ *
+ * Based on err.c, which was adapted from OpenBSD libc *err* *warn* code.
+ *
+ * Copyright (c) 2005 Nick Mathewson
+ *
+ * Copyright (c) 2000 Dug Song
+ *
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights
+reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+min_heap.h
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ * Copyright (c) 2006 Maxim Yegorushkin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+win32.c
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ * Copyright 2000-2002 Niels Provos
+ * Copyright 2003 Michael A. Davis
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+regex++
+
+Use of any of this software is governed by the terms of the license below:
+
+Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
+This software is not subject to any license of the American Telephone
+and Telegraph Company or of the Regents of the University of California.
+
+Permission is granted to anyone to use this software for any purpose on
+any computer system, and to alter it and redistribute it, subject
+to the following restrictions:
+
+1. The author is not responsible for the consequences of use of this
+ software, no matter how awful, even if they arise from flaws in it.
+
+2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission. Since few users ever read sources,
+ credits must appear in the documentation.
+
+3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software. Since few users
+ ever read sources, credits must appear in the documentation.
+
+4. This notice may not be removed or altered.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/*-
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+Richard A. O'Keefe strings package
+
+Use of any of this software is governed by the terms of the license below:
+
+These files are in the public domain. This includes getopt.c, which
+is the work of Henry Spencer, University of Toronto Zoology, who says of
+it "None of this software is derived from Bell software. I had no access
+to the source for Bell's versions at the time I wrote it. This software
+is hereby explicitly placed in the public domain. It may be used for
+any purpose on any machine by anyone." I would greatly prefer it if *my*
+material received no military use.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+t_ctype.h
+
+Use of any of this software is governed by the terms of the license below:
+
+http://bioinfo.mbb.yale.edu/genome/yeast/cluster/database/mysql/include/t_ctype.h
+
+/*
+ Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
+ Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
+ Permission to use, copy, modify, distribute and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies.
+ Smaphan Raruenrom and Pruet Boonma makes no representations about
+ the suitability of this software for any purpose. It is provided
+ "as is" without express or implied warranty.
+*/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+SHA-1 in C
+
+Use of any of this software is governed by the terms of the license below:
+
+ SHA-1 in C
+ By Steve Reid
+ 100% Public Domain
+
+Additional License(s)
+
+100% Public Domain
+
+***************************************************************************
+
+%%The following software may be included in this product:
+TCMalloc (part of google-perftools)
+
+Use of any of this software is governed by the terms of the license below:
+
+# Copyright (c) 1998-2006, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Additional License(s)
+
+*** File src/tests/ptmalloc/thread-m.h contains this GPLv2 (or later)
+text:
+
+/* Basic platform-independent macro definitions for mutexes and
+ thread-specific data.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Wolfram Gloger , 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite
+ 330, Boston, MA 02111-1307, USA. */
+
+
+
+*** File src/tests/ptmalloc/malloc-machine.h contains this BSD like text:
+
+/* Basic platform-independent macro definitions for mutexes,
+ thread-specific data and parameters for malloc.
+ Posix threads (pthreads) version.
+ Copyright (C) 2004 Wolfram Gloger .
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that (i) the above copyright notices and this permission
+notice appear in all copies of the software and related documentation,
+and (ii) the name of Wolfram Gloger may not be used in any advertising
+or publicity relating to the software.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
+INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
+OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+*/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+The tz database
+
+Use of any of this software is governed by the terms of the license below:
+
+Sources for Time Zone and Daylight Saving Time Data
+@(#)tz-link.htm 7.54
+
+Please send corrections to this web page to the time zone mailing list.
+The tz database
+
+The public-domain time zone database contains code and data that represent the
+history of local time for many representative locations around the globe. It is
+updated periodically to reflect changes made by political bodies to time zone
+boundaries, UTC offsets, and daylight-saving rules. This database (often called
+tz or zoneinfo) is used by several implementations, including the GNU C Library
+used in GNU/Linux, FreeBSD, NetBSD, OpenBSD, Cygwin, DJGPP, HP-UX, IRIX, Mac OS
+X, OpenVMS, Solaris, Tru64, and UnixWare.
+
+Each location in the database represents a national region where all clocks
+keeping local time have agreed since 1970. Locations are identified by continent
+or ocean and then by the name of the location, which is typically the largest
+city within the region. For example, America/New_York represents most of the US
+eastern time zone; America/Phoenix represents most of Arizona, which uses
+mountain time without daylight saving time (DST); America/Detroit represents
+most of Michigan, which uses eastern time but with different DST rules in 1975;
+and other entries represent smaller regions like Starke County, Indiana, which
+switched from central to eastern time in 1991 and switched back in 2006. To use
+the database on an extended POSIX implementation set the TZ environment variable
+to the location's full name, e.g., TZ="America/New_York".
+
+In the tz database's FTP distribution the code is in the file tzcodeC.tar.gz,
+where C is the code's version; similarly, the data are in tzdataD.tar.gz, where
+D is the data's version. The following shell commands download these files to a
+GNU/Linux or similar host; see the downloaded README file for what to do next.
+
+wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
+gzip -dc tzcode*.tar.gz | tar -xf -
+gzip -dc tzdata*.tar.gz | tar -xf -
+
+The code lets you compile the tz source files into machine-readable binary
+files, one for each location. It also lets you read a tz binary file and
+interpret time stamps for that location.
+
+The data are by no means authoritative. If you find errors, please send changes
+to the time zone mailing list. You can also subscribe to the mailing list,
+retrieve the archive of old messages (in gzip compressed format), or retrieve
+archived older versions of code and data; there is also a smaller HTTP mirror.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+UnicodeData.txt
+
+Use of any of this software is governed by the terms of the license below:
+
+Unicode Terms of Use
+
+ For the general privacy policy governing access to this site, see the
+ Unicode Privacy Policy. For trademark usage, see the Unicode
+ Consortium (R) Trademarks and Logo Policy.
+ Notice to End User: Terms of Use
+ Carefully read the following legal agreement ("Agreement"). Use or
+ copying of the software and/or codes provided with this agreement (The
+ "Software") constitutes your acceptance of these terms
+
+ 1. Unicode Copyright.
+ 1. Copyright (c) 1991-2008 Unicode, Inc. All rights reserved.
+ 2. Certain documents and files on this website contain a
+ legend indicating that "Modification is permitted." Any person
+ is hereby authorized, without fee, to modify such documents
+ and files to create derivative works conforming to the
+ Unicode (R) Standard, subject to Terms and Conditions herein.
+ 3. Any person is hereby authorized, without fee, to view, use,
+ reproduce, and distribute all documents and files solely for
+ informational purposes in the creation of products supporting
+ the Unicode Standard, subject to the Terms and Conditions
+ herein.
+ 4. Further specifications of rights and restrictions
+ pertaining to the use of the particular set of data files
+ known as the "Unicode Character Database" can be found in
+ Exhibit 1.
+ 5. Each version of the Unicode Standard has further
+ specifications of rights and restrictions of use. For the book
+ editions, these are found on the back of the title page. For
+ the online edition, certain files (such as the PDF files for
+ book chapters and code charts) carry specific restrictions.
+ All other files are covered under these general Terms of Use.
+ To request a permission to reproduce any part of the Unicode
+ Standard, please contact the Unicode Consortium.
+ 6. No license is granted to "mirror" the Unicode website where
+ a fee is charged for access to the "mirror" site.
+ 7. Modification is not permitted with respect to this
+ document. All copies of this document must be verbatim.
+ 2. Restricted Rights Legend. Any technical data or software which is
+ licensed to the United States of America, its agencies and/or
+ instrumentalities under this Agreement is commercial technical data
+ or commercial computer software developed exclusively at private
+ expense as defined in FAR 2.101, or DFARS 252.227-7014 (June 1995),
+ as applicable. For technical data, use, duplication, or disclosure
+ by the Government is subject to restrictions as set forth in DFARS
+ 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and
+ this Agreement. For Software, in accordance with FAR 12-212 or DFARS
+ 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this
+ Agreement.
+ 3. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or
+ typographical errors or other inaccuracies . Changes are
+ periodically added to the information herein; these changes
+ will be incorporated in new editions of the publication and/or
+ website. Unicode may make improvements and/or changes in the
+ product(s) and/or program(s) described in this publication
+ and/or website at any time.
+ 2. If this file has been purchased on magnetic or optical
+ media from Unicode, Inc. the sole and exclusive remedy for any
+ claim will be exchange of the defective media within ninety
+ (90) days of original purchase.
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR
+ SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
+ EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
+ LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS
+ LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN
+ THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE
+ REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE
+ WEBSITE.
+ 4. Waiver of Damages. In no event shall Unicode or its licensors be
+ liable for any special, incidental, indirect or consequential
+ damages of any kind, or any damages whatsoever, whether or not
+ Unicode was advised of the possibility of the damage, including,
+ without limitation, those resulting from the following: loss of use,
+ data or profits, in connection with the use, modification or
+ distribution of this information or its derivatives.
+ 5. Trademarks.
+ 1. Unicode and the Unicode logo are registered trademarks of
+ Unicode, Inc.
+ 2. This site contains product names and corporate names of
+ other companies. All product names and company names and logos
+ mentioned herein are the trademarks or registered trademarks
+ of their respective owners. Other products and corporate names
+ mentioned herein which are trademarks of a third party are
+ used only for explanation and for the owners' benefit and with
+ no intent to infringe.
+ 3. Use of third party products or information referred to
+ herein is at the user's risk.
+ 6. Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a
+ location in the State of California, United States of America.
+ Unicode makes no representation that the materials are
+ appropriate for use in other locations. If you access this
+ server from other locations, you are responsible for
+ compliance with local laws. This Agreement, all use of this
+ site and any claims and damages resulting from use of this
+ site are governed solely by the laws of the State of
+ California without regard to any principles which would apply
+ the laws of a different jurisdiction. The user agrees that any
+ disputes regarding this site shall be resolved solely in the
+ courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to
+ waive any right to transfer the dispute to any other forum.
+ 2. Modification by Unicode Unicode shall have the right to
+ modify this Agreement at any time by posting it to this site.
+ The user may not assign any part of this Agreement without
+ Unicode's prior written consent.
+ 3. Taxes. The user agrees to pay any taxes arising from access
+ to this website or use of the information herein, except for
+ those based on Unicode's net income.
+ 4. Severability. If any provision of this Agreement is
+ declared invalid or unenforceable, the remaining provisions of
+ this Agreement shall remain in effect.
+ 5. Entire Agreement. This Agreement constitutes the entire
+ agreement between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+ Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/ . Unicode Software includes any source code
+published in the Unicode Standard or under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/.
+
+ NOTICE TO USER: Carefully read the following legal agreement. BY
+DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES
+("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND
+AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU
+DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES
+OR SOFTWARE.
+
+ COPYRIGHT AND PERMISSION NOTICE
+
+ Copyright (c) 1991-2008 Unicode, Inc. All rights reserved. Distributed under
+the Terms of Use in http://www.unicode.org/copyright.html.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files") or
+Unicode software and any associated documentation (the "Software") to deal in
+the Data Files or Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, and/or sell copies of
+the Data Files or Software, and to permit persons to whom the Data Files or
+Software are furnished to do so, provided that (a) the above copyright notice(s)
+and this permission notice appear with all copies of the Data Files or Software,
+(b) both the above copyright notice(s) and this permission notice appear in
+associated documentation, and (c) there is clear notice in each modified Data
+File or in the Software as well as in the documentation associated with the Data
+File(s) or Software that the data or software has been modified.
+
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+
+ Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+ Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
+registered in some jurisdictions. All other trademarks and registered trademarks
+mentioned herein are the property of their respective owners.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+zlib
+
+Use of any of this software is governed by the terms of the license below:
+
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.2.3, July 18th, 2005
+
+ Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly jloup@gzip.org
+ Mark Adler madler@alumni.caltech.edu
+
+*/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+dtoa.c
+
+Use of any of this software is governed by the terms of the license below:
+
+/****************************************************************
+
+ This file incorporates work covered by the following copyright and
+ permission notice:
+
+ The author of this software is David M. Gay.
+
+ Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose without fee is hereby granted, provided that this entire
+ notice is included in all copies of any software which is or includes a copy
+ or modification of this software and in all copies of the supporting
+ documentation for such software.
+
+ THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
+ REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+
+ ***************************************************************/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+getarg.{c,h}
+
+Use of any of this software is governed by the terms of the license below:
+
+/* 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 */
+
+/*
+ * Copyright (c) 1997, 1999 Kungliga Tekniska H366gskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+MD5 message-digest algorithm (md5_hash.cpp)
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * The code has been modified by Mikael Ronstroem to handle
+ * calculating a hash value of a key that is always a multiple
+ * of 4 bytes long. Word 0 of the calculated 4-word hash value
+ * is returned as the hash value.
+ */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+nt_servc.{cc,h}
+
+Use of any of this software is governed by the terms of the license below:
+
+/**
+ @file
+
+ @brief
+ Windows NT Service class library.
+
+ Copyright Abandoned 1998 Irena Pancirov - Irnet Snc
+ This file is public domain and comes with NO WARRANTY of any kind
+*/
+
+***************************************************************************
+
+%%The following software may be included in this product:
+GNU Readline
+
+Use of any of this software is governed by the terms of the license below:
+
+GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
+***************************************************************************
+
+%%The following software may be included in this product:
+pstack (part of GNU Binutils)
+
+Use of any of this software is governed by the terms of the license below:
+
+pstack is comprised of various .c and .h files; all begin like this:
+
+/* bucomm.h -- binutils common include file.
+ Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+
+This file is part of GNU Binutils.
+
+This 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. */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+libiberty.h (part of pstack GNU Binutils)
+
+Use of any of this software is governed by the terms of the license below:
+
+See
+http://www.koders.com/c/fid99F596804BBE22C076522B848D5575F142079064.aspx
+
+/* Function declarations for libiberty.
+ Written by Cygnus Support, 1994.
+
+ The libiberty library provides a number of functions which are
+ missing on some operating systems. We do not declare those here,
+ to avoid conflicts with the system header files on operating
+ systems that do support those functions. In this file we only
+ declare those functions which are specific to libiberty. */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+ieee.h (part of pstack GNU Binutils)
+
+Use of any of this software is governed by the terms of the license below:
+
+See
+http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee.h
+
+
+/* IEEE Standard 695-1980 "Universal Format for Object Modules"
+ header file
+ Contributed by Cygnus Support. */
+
+***************************************************************************
+
+%%The following software may be included in this product:
+pstack.c (part of pstack GNU Binutils)
+
+Use of any of this software is governed by the terms of the license below:
+
+/*
+ pstack.c -- asynchronous stack trace of a running process
+ Copyright (c) 1999 Ross Thompson
+ Author: Ross Thompson
+ Critical bug fix: Tim Waugh
+*/
+
+/*
+ This file 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.
+*/
+
+**********************************************************************
diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000000..f85cac84d7e
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,4 @@
+MYSQL_VERSION_MAJOR=5
+MYSQL_VERSION_MINOR=5
+MYSQL_VERSION_PATCH=9
+MYSQL_VERSION_EXTRA=
diff --git a/client/Makefile.am b/client/Makefile.am
deleted file mode 100644
index 393573a061e..00000000000
--- a/client/Makefile.am
+++ /dev/null
@@ -1,125 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# This file is public domain and comes with NO WARRANTY of any kind
-
-if THREAD_SAFE_CLIENT
-LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql_r/libmysqlclient_r.la
-else
-LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql/libmysqlclient.la
-endif
-
-INCLUDES = -I$(top_builddir)/include \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/regex \
- $(openssl_includes)
-
-LIBS = @CLIENT_LIBS@
-
-LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
- $(top_builddir)/libmysql/libmysqlclient.la
-
-noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
- client_priv.h
-
-EXTRA_DIST = get_password.c CMakeLists.txt echo.c
-
-BUILT_SOURCES = link_sources
-
-CLEANFILES = $(BUILT_SOURCES)
-
-bin_PROGRAMS = mysql \
- mysqladmin \
- mysqlbinlog \
- mysqlcheck \
- mysqldump \
- mysqlimport \
- mysqlshow \
- mysqlslap \
- mysqltest \
- mysql_upgrade
-
-mysql_SOURCES = mysql.cc readline.cc sql_string.cc \
- completion_hash.cc
-mysql_LDADD = @readline_link@ @TERMCAP_LIB@ \
- $(LDADD) $(CXXLDFLAGS)
-mysqladmin_SOURCES = mysqladmin.cc
-
-mysqlbinlog_SOURCES = mysqlbinlog.cc \
- $(top_srcdir)/mysys/mf_tempdir.c \
- $(top_srcdir)/mysys/my_new.cc \
- $(top_srcdir)/mysys/my_bit.c \
- $(top_srcdir)/mysys/my_bitmap.c \
- $(top_srcdir)/mysys/base64.c
-mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
-
-mysqldump_SOURCES= mysqldump.c \
- my_user.c \
- $(top_srcdir)/mysys/mf_getdate.c
-
-mysqlimport_SOURCES= mysqlimport.c
-mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
-mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
- @CLIENT_EXTRA_LDFLAGS@ \
- $(LIBMYSQLCLIENT_LA) \
- $(top_builddir)/mysys/libmysys.a
-
-mysqlshow_SOURCES= mysqlshow.c
-
-mysqlslap_SOURCES= mysqlslap.c
-mysqlslap_CFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
-mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
- @CLIENT_EXTRA_LDFLAGS@ \
- $(LIBMYSQLCLIENT_LA) \
- $(top_builddir)/mysys/libmysys.a
-
-mysqltest_SOURCES= mysqltest.cc
-mysqltest_CXXFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
-mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
- @CLIENT_EXTRA_LDFLAGS@ \
- $(LIBMYSQLCLIENT_LA) \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/regex/libregex.a \
- $(CLIENT_THREAD_LIBS)
-
-mysql_upgrade_SOURCES= mysql_upgrade.c \
- $(top_srcdir)/mysys/my_getpagesize.c
-
-# Fix for mit-threads
-DEFS = -DMYSQL_CLIENT_NO_THREADS \
- -DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
- -DMYSQL_DATADIR="\"$(localstatedir)\""
-
-sql_src=log_event.h sql_priv.h rpl_constants.h \
- rpl_tblmap.h rpl_tblmap.cc \
- log_event.cc my_decimal.h my_decimal.cc \
- log_event_old.h log_event_old.cc \
- rpl_record_old.h rpl_record_old.cc \
- rpl_utility.h rpl_utility.cc \
- transaction.h sql_const.h
-strings_src=decimal.c dtoa.c
-
-link_sources:
- for f in $(sql_src) ; do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
- done; \
- for f in $(strings_src) ; do \
- rm -f $(srcdir)/$$f; \
- @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
- done; \
- rm -f $(srcdir)/my_user.c; \
- @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
- echo timestamp > link_sources;
diff --git a/client/mysql.cc b/client/mysql.cc
index 4a8579bbd4d..51c8b34b0a8 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3739,7 +3739,8 @@ print_tab_data(MYSQL_RES *result)
}
static int
-com_tee(String *buffer, char *line __attribute__((unused)))
+com_tee(String *buffer __attribute__((unused)),
+ char *line __attribute__((unused)))
{
char file_name[FN_REFLEN], *end, *param;
@@ -3798,7 +3799,8 @@ com_notee(String *buffer __attribute__((unused)),
#ifdef USE_POPEN
static int
-com_pager(String *buffer, char *line __attribute__((unused)))
+com_pager(String *buffer __attribute__((unused)),
+ char *line __attribute__((unused)))
{
char pager_name[FN_REFLEN], *end, *param;
@@ -3923,7 +3925,8 @@ com_rehash(String *buffer __attribute__((unused)),
#ifdef USE_POPEN
static int
-com_shell(String *buffer, char *line __attribute__((unused)))
+com_shell(String *buffer __attribute__((unused)),
+ char *line __attribute__((unused)))
{
char *shell_cmd;
@@ -4015,7 +4018,8 @@ com_connect(String *buffer, char *line)
}
-static int com_source(String *buffer, char *line)
+static int com_source(String *buffer __attribute__((unused)),
+ char *line)
{
char source_name[FN_REFLEN], *end, *param;
LINE_BUFFER *line_buff;
@@ -4929,7 +4933,8 @@ static void init_username()
}
}
-static int com_prompt(String *buffer, char *line)
+static int com_prompt(String *buffer __attribute__((unused)),
+ char *line)
{
char *ptr=strchr(line, ' ');
prompt_counter = 0;
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 226776e4404..bf4920c6f77 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1010,10 +1010,11 @@ static struct my_option my_long_options[] =
"row-based events; 'decode-rows' decodes row events into commented SQL "
"statements if the --verbose option is also given; 'auto' prints base64 "
"only when necessary (i.e., for row-based events and format description "
- "events); 'always' prints base64 whenever possible. 'always' is for "
- "debugging only and should not be used in a production system. If this "
- "argument is not given, the default is 'auto'; if it is given with no "
- "argument, 'always' is used.",
+ "events); 'always' prints base64 whenever possible. 'always' is "
+ "deprecated, will be removed in a future version, and should not be used "
+ "in a production system. --base64-output with no 'name' argument is "
+ "equivalent to --base64-output=always and is also deprecated. If no "
+ "--base64-output[=name] option is given at all, the default is 'auto'.",
&opt_base64_output_mode_str, &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
/*
@@ -2024,6 +2025,13 @@ int main(int argc, char** argv)
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
opt_base64_output_mode= BASE64_OUTPUT_AUTO;
+ if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ warning("The --base64-output=always flag and the --base64-output flag "
+ "(with '=MODE' omitted), are deprecated. "
+ "The output generated when these flags are used cannot be "
+ "parsed by mysql 5.6.0 and later. "
+ "The flags will be removed in a future version. "
+ "Please use --base64-output=auto instead.");
my_set_max_open_files(open_files_limit);
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 376ce0fa59d..e0fed9704a5 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -487,7 +487,8 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
int val_len);
VAR* var_get(const char *var_name, const char** var_name_end,
my_bool raw, my_bool ignore_not_existing);
-void eval_expr(VAR* v, const char *p, const char** p_end);
+void eval_expr(VAR* v, const char *p, const char** p_end,
+ bool open_end=false, bool backtick=true);
my_bool match_delimiter(int c, const char *delim, uint length);
void dump_result_to_reject_file(char *buf, int size);
void dump_warning_messages();
@@ -2045,9 +2046,11 @@ static void var_free(void *v)
C_MODE_END
-void var_set_int(VAR *v, const char *str)
+void var_check_int(VAR *v)
{
char *endptr;
+ char *str= v->str_val;
+
/* Initially assume not a number */
v->int_val= 0;
v->is_int= false;
@@ -2094,7 +2097,7 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
memcpy(tmp_var->str_val, val, val_len);
tmp_var->str_val[val_len]= 0;
}
- var_set_int(tmp_var, val);
+ var_check_int(tmp_var);
tmp_var->name_len = name_len;
tmp_var->str_val_len = val_len;
tmp_var->alloced_len = val_alloc_len;
@@ -2335,7 +2338,8 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
dynstr_append_mem(&result, "\t", 1);
}
end= result.str + result.length-1;
- eval_expr(var, result.str, (const char**) &end);
+ /* Evaluation should not recurse via backtick */
+ eval_expr(var, result.str, (const char**) &end, false, false);
dynstr_free(&result);
}
else
@@ -2545,7 +2549,8 @@ void var_copy(VAR *dest, VAR *src)
}
-void eval_expr(VAR *v, const char *p, const char **p_end)
+void eval_expr(VAR *v, const char *p, const char **p_end,
+ bool open_end, bool backtick)
{
DBUG_ENTER("eval_expr");
@@ -2563,14 +2568,14 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
/* Make sure there was just a $variable and nothing else */
const char* end= *p_end + 1;
- if (end < expected_end)
+ if (end < expected_end && !open_end)
die("Found junk '%.*s' after $variable in expression",
(int)(expected_end - end - 1), end);
DBUG_VOID_RETURN;
}
- if (*p == '`')
+ if (*p == '`' && backtick)
{
var_query_set(v, p, p_end);
DBUG_VOID_RETURN;
@@ -2610,7 +2615,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
v->str_val_len = new_val_len;
memcpy(v->str_val, p, new_val_len);
v->str_val[new_val_len] = 0;
- var_set_int(v, p);
+ var_check_int(v);
}
DBUG_VOID_RETURN;
}
@@ -4240,7 +4245,7 @@ int do_save_master_pos()
const char latest_applied_binlog_epoch_str[]=
"latest_applied_binlog_epoch=";
if (count)
- sleep(1);
+ my_sleep(100*1000); /* 100ms */
if (mysql_query(mysql, query= "show engine ndb status"))
die("failed in '%s': %d %s", query,
mysql_errno(mysql), mysql_error(mysql));
@@ -4329,7 +4334,7 @@ int do_save_master_pos()
count++;
if (latest_handled_binlog_epoch >= start_epoch)
do_continue= 0;
- else if (count > 30)
+ else if (count > 300) /* 30s */
{
break;
}
@@ -5398,8 +5403,13 @@ void do_connect(struct st_command *command)
opt_charsets_dir);
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- if (opt_use_ssl || con_ssl)
+ if (opt_use_ssl)
+ con_ssl= 1;
+#endif
+
+ if (con_ssl)
{
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000
@@ -5408,36 +5418,37 @@ void do_connect(struct st_command *command)
mysql_options(&con_slot->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert);
#endif
- }
#endif
+ }
-#ifdef __WIN__
if (con_pipe)
{
+#ifdef __WIN__
opt_protocol= MYSQL_PROTOCOL_PIPE;
- }
#endif
+ }
if (opt_protocol)
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
-#ifdef HAVE_SMEM
if (con_shm)
{
+#ifdef HAVE_SMEM
uint protocol= MYSQL_PROTOCOL_MEMORY;
if (!ds_shm.length)
die("Missing shared memory base name");
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
+#endif
}
- else if(shared_memory_base_name)
+#ifdef HAVE_SMEM
+ else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
- shared_memory_base_name);
+ shared_memory_base_name);
}
#endif
-
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@@ -5515,6 +5526,40 @@ int do_done(struct st_command *command)
return 0;
}
+/* Operands available in if or while conditions */
+
+enum block_op {
+ EQ_OP,
+ NE_OP,
+ GT_OP,
+ GE_OP,
+ LT_OP,
+ LE_OP,
+ ILLEG_OP
+};
+
+
+enum block_op find_operand(const char *start)
+{
+ char first= *start;
+ char next= *(start+1);
+
+ if (first == '=' && next == '=')
+ return EQ_OP;
+ if (first == '!' && next == '=')
+ return NE_OP;
+ if (first == '>' && next == '=')
+ return GE_OP;
+ if (first == '>')
+ return GT_OP;
+ if (first == '<' && next == '=')
+ return LE_OP;
+ if (first == '<')
+ return LT_OP;
+
+ return ILLEG_OP;
+}
+
/*
Process start of a "if" or "while" statement
@@ -5540,6 +5585,13 @@ int do_done(struct st_command *command)
A '!' can be used before the <expr> to indicate it should
be executed if it evaluates to zero.
+ <expr> can also be a simple comparison condition:
+
+ <variable> <op> <expr>
+
+ The left hand side must be a variable, the right hand side can be a
+ variable, number, string or `query`. Operands are ==, !=, <, <=, >, >=.
+ == and != can be used for strings, all can be used for numerical values.
*/
void do_block(enum block_cmd cmd, struct st_command* command)
@@ -5575,11 +5627,16 @@ void do_block(enum block_cmd cmd, struct st_command* command)
if (!expr_start++)
die("missing '(' in %s", cmd_name);
+ while (my_isspace(charset_info, *expr_start))
+ expr_start++;
+
/* Check for !<expr> */
if (*expr_start == '!')
{
not_expr= TRUE;
- expr_start++; /* Step past the '!' */
+ expr_start++; /* Step past the '!', then any whitespace */
+ while (*expr_start && my_isspace(charset_info, *expr_start))
+ expr_start++;
}
/* Find ending ')' */
expr_end= strrchr(expr_start, ')');
@@ -5593,14 +5650,96 @@ void do_block(enum block_cmd cmd, struct st_command* command)
die("Missing '{' after %s. Found \"%s\"", cmd_name, p);
var_init(&v,0,0,0,0);
- eval_expr(&v, expr_start, &expr_end);
+ /* If expression starts with a variable, it may be a compare condition */
+
+ if (*expr_start == '$')
+ {
+ const char *curr_ptr= expr_end;
+ eval_expr(&v, expr_start, &curr_ptr, true);
+ while (my_isspace(charset_info, *++curr_ptr))
+ {}
+ /* If there was nothing past the variable, skip condition part */
+ if (curr_ptr == expr_end)
+ goto NO_COMPARE;
+
+ enum block_op operand= find_operand(curr_ptr);
+ if (operand == ILLEG_OP)
+ die("Found junk '%.*s' after $variable in condition",
+ (int)(expr_end - curr_ptr), curr_ptr);
+
+ /* We could silently allow this, but may be confusing */
+ if (not_expr)
+ die("Negation and comparison should not be combined, please rewrite");
+
+ /* Skip the 1 or 2 chars of the operand, then white space */
+ if (operand == LT_OP || operand == GT_OP)
+ {
+ curr_ptr++;
+ }
+ else
+ {
+ curr_ptr+= 2;
+ }
+ while (my_isspace(charset_info, *curr_ptr))
+ curr_ptr++;
+
+ VAR v2;
+ var_init(&v2,0,0,0,0);
+ eval_expr(&v2, curr_ptr, &expr_end);
+
+ if ((operand!=EQ_OP && operand!=NE_OP) && ! (v.is_int && v2.is_int))
+ die ("Only == and != are supported for string values");
+
+ /* Now we overwrite the first variable with 0 or 1 (for false or true) */
+
+ switch (operand)
+ {
+ case EQ_OP:
+ if (v.is_int)
+ v.int_val= (v2.is_int && v2.int_val == v.int_val);
+ else
+ v.int_val= !strcmp (v.str_val, v2.str_val);
+ break;
+
+ case NE_OP:
+ if (v.is_int)
+ v.int_val= ! (v2.is_int && v2.int_val == v.int_val);
+ else
+ v.int_val= (strcmp (v.str_val, v2.str_val) != 0);
+ break;
+
+ case LT_OP:
+ v.int_val= (v.int_val < v2.int_val);
+ break;
+ case LE_OP:
+ v.int_val= (v.int_val <= v2.int_val);
+ break;
+ case GT_OP:
+ v.int_val= (v.int_val > v2.int_val);
+ break;
+ case GE_OP:
+ v.int_val= (v.int_val >= v2.int_val);
+ break;
+ case ILLEG_OP:
+ die("Impossible operator, this cannot happen");
+ }
+
+ v.is_int= TRUE;
+ } else
+ {
+ if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start))
+ die("Expression in if/while must beging with $, ` or a number");
+ eval_expr(&v, expr_start, &expr_end);
+ }
+
+ NO_COMPARE:
/* Define inner block */
cur_block++;
cur_block->cmd= cmd;
- if (v.int_val)
+ if (v.is_int)
{
- cur_block->ok= TRUE;
+ cur_block->ok= (v.int_val != 0);
} else
/* Any non-empty string which does not begin with 0 is also TRUE */
{
@@ -5877,7 +6016,7 @@ int read_line(char *buf, int size)
/* Could be a multibyte character */
/* This code is based on the code in "sql_load.cc" */
#ifdef USE_MB
- int charlen = my_mbcharlen(charset_info, c);
+ int charlen = my_mbcharlen(charset_info, (unsigned char) c);
/* We give up if multibyte character is started but not */
/* completed before we pass buf_end */
if ((charlen > 1) && (p + charlen) <= buf_end)
@@ -5889,16 +6028,16 @@ int read_line(char *buf, int size)
for (i= 1; i < charlen; i++)
{
+ c= my_getc(cur_file->file);
if (feof(cur_file->file))
goto found_eof;
- c= my_getc(cur_file->file);
*p++ = c;
}
if (! my_ismbchar(charset_info, mb_start, p))
{
/* It was not a multiline char, push back the characters */
/* We leave first 'c', i.e. pretend it was a normal char */
- while (p > mb_start)
+ while (p-1 > mb_start)
my_ungetc(*--p);
}
}
@@ -9959,6 +10098,7 @@ void free_pointer_array(POINTER_ARRAY *pa)
void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
const char *val, int len)
{
+ char lower[512];
#ifdef __WIN__
fix_win_paths(val, len);
#endif
@@ -9966,7 +10106,6 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
if (display_result_lower)
{
/* Convert to lower case, and do this first */
- char lower[512];
char *c= lower;
for (const char *v= val; *v; v++)
*c++= my_tolower(charset_info, *v);
diff --git a/client/sql_string.h b/client/sql_string.h
index bafc287c73e..f406da28995 100644
--- a/client/sql_string.h
+++ b/client/sql_string.h
@@ -69,9 +69,13 @@ public:
}
static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); }
- static void operator delete(void *ptr_arg,size_t size)
- { TRASH(ptr_arg, size); }
- static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
+ static void operator delete(void *ptr_arg, size_t size)
+ {
+ (void) ptr_arg;
+ (void) size;
+ TRASH(ptr_arg, size);
+ }
+ static void operator delete(void *, MEM_ROOT *)
{ /* never called */ }
~String() { free(); }
diff --git a/cmake/Makefile.am b/cmake/Makefile.am
deleted file mode 100644
index af3ec4f980d..00000000000
--- a/cmake/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-EXTRA_DIST = \
- cmake_parse_arguments.cmake \
- cpack_source_ignore_files.cmake \
- package_name.cmake \
- configurable_file_content.in \
- check_minimal_version.cmake \
- create_initial_db.cmake.in \
- make_dist.cmake.in \
- dtrace.cmake \
- abi_check.cmake \
- bison.cmake \
- configure.pl \
- character_sets.cmake \
- libutils.cmake \
- readline.cmake \
- mysql_version.cmake \
- install_macros.cmake \
- ssl.cmake \
- plugin.cmake \
- zlib.cmake \
- stack_direction.c \
- do_abi_check.cmake \
- merge_archives_unix.cmake.in \
- dtrace_prelink.cmake \
- versioninfo.rc.in \
- mysql_add_executable.cmake \
- tags.cmake \
- install_layout.cmake \
- build_configurations/mysql_release.cmake \
- os/Windows.cmake \
- os/WindowsCache.cmake \
- os/Linux.cmake \
- os/SunOS.cmake \
- os/Darwin.cmake \
- os/HP-UX.cmake \
- os/AIX.cmake \
- os/OS400.cmake \
- os/Cygwin.cmake
-
-
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index b9ff9f7af73..2488bcefe33 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -27,12 +27,14 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
ELSE()
SET(COMPILER ${CMAKE_C_COMPILER})
ENDIF()
- SET(API_PREPROCESSOR_HEADER
+ SET(API_PREPROCESSOR_HEADER
${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h
${CMAKE_SOURCE_DIR}/include/mysql.h
- ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h
)
ADD_CUSTOM_TARGET(abi_check ALL
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 48d3765ea67..56a6d897318 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -101,8 +101,10 @@ IF(NOT COMPILATION_COMMENT)
ENDIF()
IF(WIN32)
- # Sign executables with authenticode certificate
- SET(SIGNCODE 1 CACHE BOOL "")
+ IF(NOT CMAKE_USING_VC_FREE_TOOLS)
+ # Sign executables with authenticode certificate
+ SET(SIGNCODE 1 CACHE BOOL "")
+ ENDIF()
ENDIF()
IF(UNIX)
@@ -120,7 +122,13 @@ IF(UNIX)
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")
+ MESSAGE(FATAL_ERROR "
+ aio is required on Linux, you need to install the required library:
+
+ Debian/Ubuntu: apt-get install libaio-dev
+ RedHat/Fedora/Oracle Linux: yum install libaio-devel
+ SuSE: zypper install libaio-devel
+ ")
ENDIF()
ENDIF()
@@ -219,22 +227,4 @@ IF(UNIX)
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 "RelWithDebInfo C++ compile flags")
- ENDIF()
-
ENDIF()
diff --git a/cmake/configure.pl b/cmake/configure.pl
index 1dc8080810c..b24afa034c7 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -185,6 +185,11 @@ foreach my $option (@ARGV)
($option =~ /enable/ ? "1" : "0");
next;
}
+ if ($option =~ /with-comment=/)
+ {
+ $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\"";
+ next;
+ }
$option = uc($option);
$option =~ s/-/_/g;
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 19a8a61df2d..601e208d96d 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -26,7 +26,7 @@
# Build as per default RPM layout, with prefix=/usr
#
# DEB
-# Build as per STANDALONE, prefix=/opt/mysql-$major.$minor
+# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor
#
# SVR4
# Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql
@@ -74,7 +74,7 @@ IF(UNIX)
IF(INSTALL_LAYOUT MATCHES "RPM")
SET(default_prefix "/usr")
ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
- SET(default_prefix "/opt/${MYSQL_BASE_VERSION}")
+ SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}")
# This is required to avoid "cpack -GDEB" default of prefix=/usr
SET(CPACK_SET_DESTDIR ON)
ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index bc8d9945690..e244e4262e0 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -78,7 +78,9 @@ FUNCTION(INSTALL_MANPAGE file)
ELSE()
SET(SECTION man8)
ENDIF()
- INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}")
+ MESSAGE("huj!")
+ INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
+ COMPONENT ManPages)
ENDIF()
ENDFUNCTION()
@@ -137,12 +139,7 @@ IF(UNIX)
STRING(REPLACE "${CMAKE_CFG_INTDIR}"
"\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
ENDIF()
- IF(component)
- SET(COMP COMPONENT ${component})
- ELSE()
- SET(COMP)
- ENDIF()
- INSTALL(FILES ${output} DESTINATION ${destination} ${COMP})
+ INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component})
ENDIF()
ENDMACRO()
@@ -224,8 +221,6 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
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)
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 0cc8895f43e..89eb5a74d80 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -250,6 +250,9 @@ MACRO(MERGE_LIBRARIES)
ENDFOREACH()
ENDIF()
CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}")
+ IF(NOT ARG_NOINSTALL)
+ ADD_VERSION_INFO(${TARGET} SHARED SRC)
+ ENDIF()
ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC})
TARGET_LINK_LIBRARIES(${TARGET} ${LIBS})
IF(ARG_OUTPUT_NAME)
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index 13950e08553..95412370c28 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -14,19 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Make source distribution
-# If bzr is present, run bzr export, add output of BUILD/autorun.sh
-# if autotools are present, also pack bison output into it.
+# If bzr is present, run bzr export.
# Otherwise, just run cpack with source configuration.
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "@CPACK_SOURCE_PACKAGE_FILE_NAME@")
-SET(GLIBTOOLIZE_EXECUTABLE "@GLIBTOOLIZE_EXECUTABLE@")
-SET(LIBTOOLIZE_EXECUTABLE "@LIBTOOLIZE_EXECUTABLE@")
-SET(ACLOCAL_EXECUTABLE "@ACLOCAL_EXECUTABLE@")
-SET(AUTOCONF_EXECUTABLE "@AUTOCONF_EXECUTABLE@")
-SET(AUTOHEADER_EXECUTABLE "@AUTOHEADER_EXECUTABLE@")
-SET(AUTOMAKE_EXECUTABLE "@AUTOMAKE_EXECUTABLE@")
SET(CMAKE_CPACK_COMMAND "@CMAKE_CPACK_COMMAND@")
SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
@@ -101,28 +94,6 @@ IF(NOT BZR_EXECUTABLE)
)
ENDIF()
-# Try to pack output of BUILD/autorun, if autotools are present
-IF(GLIBTOOLIZE_EXECUTABLE OR LIBTOOLIZE_EXECUTABLE)
- IF(ACLOCAL_EXECUTABLE AND AUTOMAKE_EXECUTABLE AND AUTOCONF_EXECUTABLE
- AND AUTOHEADER_EXECUTABLE)
- SET(HAVE_AUTOTOOLS 1)
- ENDIF()
-ENDIF()
-
-IF(HAVE_AUTOTOOLS)
- EXECUTE_PROCESS(COMMAND BUILD/autorun.sh
- WORKING_DIRECTORY ${PACKAGE_DIR})
-ELSE()
- MESSAGE( "Autotools not found, resulting source package can only be built"
- " with cmake")
- CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/configure.pl
- ${PACKAGE_DIR}/configure
- COPYONLY)
- IF(UNIX)
- EXECUTE_PROCESS(COMMAND chmod +x ${PACKAGE_DIR}/configure)
- ENDIF()
-ENDIF()
-
# Copy bison output
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${PACKAGE_DIR}/sql/sql_yacc.h COPYONLY)
@@ -138,7 +109,6 @@ ENDIF()
# In case we used CPack, it could have copied some
# extra files that are not usable on different machines.
FILE(REMOVE ${PACKAGE_DIR}/CMakeCache.txt)
-FILE(REMOVE_RECURSE ${PACKAGE_DIR}/autom4te.cache)
# When packing source, prefer gnu tar to "cmake -P tar"
# cmake does not preserve timestamps.gnuwin32 tar is broken, cygwin is ok
diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake
index b49a737716c..ac812fbcdfd 100644
--- a/cmake/mysql_add_executable.cmake
+++ b/cmake/mysql_add_executable.cmake
@@ -37,7 +37,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
SET(sources ${ARG_DEFAULT_ARGS})
-
+ ADD_VERSION_INFO(${target} EXECUTABLE sources)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index 6adca2ccc2f..b4be85ff657 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -13,16 +13,24 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# Read value for a variable from configure.in
+#
+# Global constants, only to be changed between major releases.
+#
+
+SET(SHARED_LIB_MAJOR_VERSION "16")
+SET(PROTOCOL_VERSION "10")
+SET(DOT_FRM_VERSION "6")
+
+# Read value for a variable from VERSION.
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
- IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
- FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=")
+ IF (EXISTS ${CMAKE_SOURCE_DIR}/VERSION)
+ FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
- STRING(REGEX REPLACE "[ ].*" "" str ${str})
- SET(${var} ${str} CACHE INTERNAL "Config variable")
+ STRING(REGEX REPLACE "[ ].*" "" str "${str}")
+ SET(${var} ${str})
ENDIF()
ENDIF()
ENDIF()
@@ -32,57 +40,32 @@ ENDMACRO()
# Read mysql version for configure script
MACRO(GET_MYSQL_VERSION)
+ MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MAJOR" MAJOR_VERSION)
+ MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION)
+ MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION)
+ MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION)
- IF(NOT VERSION_STRING)
- IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
- FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE")
- STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}")
- IF(NOT VERSION_STRING)
- STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
- IF(NOT VERSION_STRING)
- FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
- STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}")
- ENDIF()
- ENDIF()
- ENDIF()
+ IF(NOT MAJOR_VERSION OR NOT MINOR_VERSION OR NOT PATCH_VERSION)
+ MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.")
ENDIF()
-
- IF(NOT VERSION_STRING)
- MESSAGE(FATAL_ERROR
- "VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra"
- "when calling cmake")
- ENDIF()
-
- SET(VERSION ${VERSION_STRING})
- STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}")
-
- # Remove trailing (non-numeric) part of the version string
- STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
-
- STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
- STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
- STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
+ SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
+ MESSAGE("-- MySQL ${VERSION}")
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
- SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
- MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
+ SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
+ STRING(REPLACE "-" "_" MYSQL_RPM_VERSION "${VERSION}")
+ MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}")
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
- SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
+ SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
ENDMACRO()
# Get mysql version and other interesting variables
GET_MYSQL_VERSION()
-MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION)
-MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION)
-MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT)
-MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT)
-MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION)
-IF(NOT MYSQL_TCP_PORT_DEFAULT)
- SET(MYSQL_TCP_PORT_DEFAULT "3306")
-ENDIF()
+SET(MYSQL_TCP_PORT_DEFAULT "3306")
+
IF(NOT MYSQL_TCP_PORT)
SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
SET(MYSQL_TCP_PORT_DEFAULT "0")
@@ -130,9 +113,8 @@ ENDIF()
# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
# for more info.
IF(MSVC)
- GET_TARGET_PROPERTY(location gen_versioninfo LOCATION)
- IF(NOT location)
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
SET(FILETYPE VFT_APP)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
@@ -140,31 +122,14 @@ IF(MSVC)
SET(FILETYPE VFT_DLL)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_BINARY_DIR}/versioninfo_exe.res
- ${CMAKE_BINARY_DIR}/versioninfo_dll.res
- COMMAND ${CMAKE_RC_COMPILER} versioninfo_exe.rc
- COMMAND ${CMAKE_RC_COMPILER} versioninfo_dll.rc
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- )
- ADD_CUSTOM_TARGET(gen_versioninfo
- DEPENDS
- ${CMAKE_BINARY_DIR}/versioninfo_exe.res
- ${CMAKE_BINARY_DIR}/versioninfo_dll.res
- )
- ENDIF()
-
- FUNCTION(ADD_VERSION_INFO target)
- GET_TARGET_PROPERTY(target_type ${target} TYPE)
- ADD_DEPENDENCIES(${target} gen_versioninfo)
- IF(target_type MATCHES "SHARED" OR target_type MATCHES "MODULE")
- SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
- "\"${CMAKE_BINARY_DIR}/versioninfo_dll.res\"")
- ELSEIF(target_type MATCHES "EXE")
- SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
- "${target_link_flags} \"${CMAKE_BINARY_DIR}/versioninfo_exe.res\"")
+
+ FUNCTION(ADD_VERSION_INFO target target_type sources_var)
+ IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
+ ELSEIF("${target_type}" MATCHES "EXE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
ENDIF()
+ SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE)
ENDFUNCTION()
ELSE()
FUNCTION(ADD_VERSION_INFO)
diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake
index 946e020d6f4..10d3a719609 100644
--- a/cmake/os/Linux.cmake
+++ b/cmake/os/Linux.cmake
@@ -33,7 +33,7 @@ ENDFOREACH()
# Ensure we have clean build for shared libraries
# without unresolved symbols
-SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined")
+SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined")
# 64 bit file offset support flag
SET(_FILE_OFFSET_BITS 64)
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index aac7e484f26..0dbfde5294c 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -91,7 +91,6 @@ IF(MSVC)
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
ENDFOREACH()
- ADD_DEFINITIONS(-DPTHREAD_STACK_MIN=1048576)
# Mark 32 bit executables large address aware so they can
# use > 2GB address space
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
@@ -105,14 +104,9 @@ IF(MSVC)
ENDIF()
#TODO: update the code and remove the disabled warnings
- ADD_DEFINITIONS(/wd4800 /wd4805)
- IF (MSVC_VERSION GREATER 1310)
- ADD_DEFINITIONS(/wd4996)
- ENDIF()
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")
- # 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.
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 4936ae369bc..ff068bfeaf6 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -57,6 +57,7 @@ SET(HAVE_FCNTL_H 1 CACHE INTERNAL "")
SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "")
SET(HAVE_FCONVERT CACHE INTERNAL "")
SET(HAVE_FDATASYNC CACHE INTERNAL "")
+SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "")
SET(HAVE_FENV_H CACHE INTERNAL "")
SET(HAVE_FESETROUND CACHE INTERNAL "")
SET(HAVE_FGETLN CACHE INTERNAL "")
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 94fdc8bf1e9..bf34407db25 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -151,6 +151,7 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ENDIF()
+ ADD_VERSION_INFO(${target} MODULE SOURCES)
ADD_LIBRARY(${target} MODULE ${SOURCES})
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
diff --git a/cmake/versioninfo.rc.in b/cmake/versioninfo.rc.in
index 97c45ec86c0..c625ce8c7f4 100644
--- a/cmake/versioninfo.rc.in
+++ b/cmake/versioninfo.rc.in
@@ -1,7 +1,7 @@
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
-FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
-PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
+FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
@@ -12,8 +12,8 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
- VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
- VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
END
END
BLOCK "VarFileInfo"
diff --git a/cmd-line-utils/Makefile.am b/cmd-line-utils/Makefile.am
deleted file mode 100644
index 622aa72fd43..00000000000
--- a/cmd-line-utils/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2004 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-SUBDIRS= @readline_basedir@
-DIST_SUBDIRS= libedit readline
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am
deleted file mode 100644
index 88ea97afffd..00000000000
--- a/cmd-line-utils/libedit/Makefile.am
+++ /dev/null
@@ -1,92 +0,0 @@
-## Process this file with automake to create Makefile.in
-
-ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
-AHDR = vi.h emacs.h common.h
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-
-noinst_LIBRARIES = libedit.a
-
-libedit_a_SOURCES = chared.c el.c history.c map.c prompt.c readline.c \
- search.c tokenizer.c vi.c common.c emacs.c \
- hist.c key.c parse.c read.c refresh.c sig.c term.c \
- tty.c help.c fcns.c filecomplete.c \
- np/unvis.c np/strlcpy.c np/vis.c np/strlcat.c \
- np/fgetln.c
-
-libedit_a_LIBADD = @LIBEDIT_LOBJECTS@
-libedit_a_DEPENDENCIES = @LIBEDIT_LOBJECTS@
-
-pkginclude_HEADERS = readline/readline.h
-
-noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \
- sys.h config.h hist.h map.h prompt.h read.h \
- search.h tty.h filecomplete.h np/vis.h
-
-EXTRA_DIST = makelist.sh CMakeLists.txt
-
-CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''AWK''@!@AWK@!' \
- $< > $@-t
- @MV@ $@-t $@
-
-vi.h: $(srcdir)/vi.c makelist
- sh ./makelist -h $(srcdir)/vi.c > $@.tmp && \
- mv $@.tmp $@
-
-emacs.h: $(srcdir)/emacs.c makelist
- sh ./makelist -h $(srcdir)/emacs.c > $@.tmp && \
- mv $@.tmp $@
-
-common.h: $(srcdir)/common.c makelist
- sh ./makelist -h $(srcdir)/common.c > $@.tmp && \
- mv $@.tmp $@
-
-help.c: ${ASRC} makelist
- sh ./makelist -bc ${ASRC} > $@.tmp && \
- mv $@.tmp $@
-
-help.h: ${ASRC} makelist
- sh ./makelist -bh ${ASRC} > $@.tmp && \
- mv $@.tmp $@
-
-fcns.h: ${AHDR} makelist
- sh ./makelist -fh ${AHDR} > $@.tmp && \
- mv $@.tmp $@
-
-fcns.c: ${AHDR} fcns.h makelist
- sh ./makelist -fc ${AHDR} > $@.tmp && \
- mv $@.tmp $@
-
-#%.o: vi.h emacs.h common.h help.h fcns.h
-#objects := $(patsubst %.c,%.o,$(wildcard *.c))
-#$(objects): vi.h emacs.h
-
-chared.o: vi.h emacs.h common.h help.h fcns.h
-el.o: vi.h emacs.h common.h help.h fcns.h
-history.o: vi.h emacs.h common.h help.h fcns.h
-map.o: vi.h emacs.h common.h help.h fcns.h
-prompt.o: vi.h emacs.h common.h help.h fcns.h
-readline.o: vi.h emacs.h common.h help.h fcns.h
-search.o: vi.h emacs.h common.h help.h fcns.h
-tokenizer.o: vi.h emacs.h common.h help.h fcns.h
-vi.o: vi.h emacs.h common.h help.h fcns.h
-common.o: vi.h emacs.h common.h help.h fcns.h
-emacs.o: vi.h emacs.h common.h help.h fcns.h
-hist.o: vi.h emacs.h common.h help.h fcns.h
-key.o: vi.h emacs.h common.h help.h fcns.h
-parse.o: vi.h emacs.h common.h help.h fcns.h
-read.o: vi.h emacs.h common.h help.h fcns.h
-refresh.o: vi.h emacs.h common.h help.h fcns.h
-sig.o: vi.h emacs.h common.h help.h fcns.h
-term.o: vi.h emacs.h common.h help.h fcns.h
-tty.o: vi.h emacs.h common.h help.h fcns.h
-help.o: vi.h emacs.h common.h help.h fcns.h
-fcns.o: vi.h emacs.h common.h help.h fcns.h
-filecomplete.o: vi.h emacs.h common.h help.h fcns.h
diff --git a/cmd-line-utils/libedit/common.c b/cmd-line-utils/libedit/common.c
index d4d024eae10..ba5890fa606 100644
--- a/cmd-line-utils/libedit/common.c
+++ b/cmd-line-utils/libedit/common.c
@@ -136,7 +136,7 @@ ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_next_char(EditLine *el, int c)
+ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
{
#ifdef notdef /* XXX */
#define EL el->el_line
@@ -431,7 +431,8 @@ ed_argument_digit(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_unassigned(EditLine *el, int c __attribute__((__unused__)))
+ed_unassigned(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
{
return (CC_ERROR);
diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c
index 1f1b18c97d8..0318ab409b3 100644
--- a/cmd-line-utils/libedit/readline.c
+++ b/cmd-line-utils/libedit/readline.c
@@ -202,7 +202,7 @@ _move_history(int op)
*/
static int
/*ARGSUSED*/
-_getc_function(EditLine *el, char *c)
+_getc_function(EditLine *el __attribute__((__unused__)), char *c)
{
int i;
@@ -1613,7 +1613,8 @@ rl_insert(int count, int c)
/*ARGSUSED*/
int
-rl_newline(int count, int c)
+rl_newline(int count __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
{
/*
* Readline-4.0 appears to ignore the args.
@@ -1623,7 +1624,7 @@ rl_newline(int count, int c)
/*ARGSUSED*/
static unsigned char
-rl_bind_wrapper(EditLine *el, unsigned char c)
+rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c)
{
if (map[c] == NULL)
return CC_ERROR;
@@ -1718,7 +1719,7 @@ rl_get_previous_history(int count, int key)
void
/*ARGSUSED*/
-rl_prep_terminal(int meta_flag)
+rl_prep_terminal(int meta_flag __attribute__((__unused__)))
{
el_set(e, EL_PREP_TERM, 1);
}
@@ -1922,7 +1923,8 @@ _rl_qsort_string_compare(char **s1, char **s2)
int
/*ARGSUSED*/
-rl_kill_text(int from, int to)
+rl_kill_text(int from __attribute__((__unused__)),
+ int to __attribute__((__unused__)))
{
return 0;
}
@@ -1941,20 +1943,25 @@ rl_get_keymap(void)
void
/*ARGSUSED*/
-rl_set_keymap(Keymap k)
+rl_set_keymap(Keymap k __attribute__((__unused__)))
{
}
int
/*ARGSUSED*/
-rl_generic_bind(int type, const char * keyseq, const char * data, Keymap k)
+rl_generic_bind(int type __attribute__((__unused__)),
+ const char * keyseq __attribute__((__unused__)),
+ const char * data __attribute__((__unused__)),
+ Keymap k __attribute__((__unused__)))
{
return 0;
}
int
/*ARGSUSED*/
-rl_bind_key_in_map(int key, Function *fun, Keymap k)
+rl_bind_key_in_map(int key __attribute__((__unused__)),
+ Function *fun __attribute__((__unused__)),
+ Keymap k __attribute__((__unused__)))
{
return 0;
}
diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c
index 00a9f493a9b..d628f076a1d 100644
--- a/cmd-line-utils/libedit/vi.c
+++ b/cmd-line-utils/libedit/vi.c
@@ -145,7 +145,7 @@ vi_paste_prev(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-vi_prev_big_word(EditLine *el, int c)
+vi_prev_big_word(EditLine *el, int c __attribute__((__unused__)))
{
if (el->el_line.cursor == el->el_line.buffer)
@@ -195,7 +195,7 @@ vi_prev_word(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-vi_next_big_word(EditLine *el, int c)
+vi_next_big_word(EditLine *el, int c __attribute__((__unused__)))
{
if (el->el_line.cursor >= el->el_line.lastchar - 1)
@@ -462,7 +462,7 @@ vi_delete_meta(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-vi_end_big_word(EditLine *el, int c)
+vi_end_big_word(EditLine *el, int c __attribute__((__unused__)))
{
if (el->el_line.cursor == el->el_line.lastchar)
@@ -797,7 +797,7 @@ vi_repeat_prev_char(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-vi_match(EditLine *el, int c)
+vi_match(EditLine *el, int c __attribute__((__unused__)))
{
const char match_chars[] = "()[]{}";
char *cp;
@@ -844,7 +844,7 @@ vi_match(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_undo_line(EditLine *el, int c)
+vi_undo_line(EditLine *el, int c __attribute__((__unused__)))
{
cv_undo(el);
@@ -858,7 +858,7 @@ vi_undo_line(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_to_column(EditLine *el, int c)
+vi_to_column(EditLine *el, int c __attribute__((__unused__)))
{
el->el_line.cursor = el->el_line.buffer;
@@ -872,7 +872,7 @@ vi_to_column(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_yank_end(EditLine *el, int c)
+vi_yank_end(EditLine *el, int c __attribute__((__unused__)))
{
cv_yank(el, el->el_line.cursor,
@@ -886,7 +886,7 @@ vi_yank_end(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_yank(EditLine *el, int c)
+vi_yank(EditLine *el, int c __attribute__((__unused__)))
{
return cv_action(el, YANK);
@@ -898,7 +898,7 @@ vi_yank(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_comment_out(EditLine *el, int c)
+vi_comment_out(EditLine *el, int c __attribute__((__unused__)))
{
el->el_line.cursor = el->el_line.buffer;
@@ -919,7 +919,8 @@ extern char *get_alias_text(const char *) __weak_reference(get_alias_text);
#endif
protected el_action_t
/*ARGSUSED*/
-vi_alias(EditLine *el, int c)
+vi_alias(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
{
#if defined(__weak_reference) && !defined(__FreeBSD__)
char alias_name[3];
@@ -949,7 +950,7 @@ vi_alias(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_to_history_line(EditLine *el, int c)
+vi_to_history_line(EditLine *el, int c __attribute__((__unused__)))
{
int sv_event_no = el->el_history.eventno;
el_action_t rval;
@@ -994,7 +995,7 @@ vi_to_history_line(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_histedit(EditLine *el, int c)
+vi_histedit(EditLine *el, int c __attribute__((__unused__)))
{
int fd;
pid_t pid;
@@ -1050,7 +1051,7 @@ vi_histedit(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_history_word(EditLine *el, int c)
+vi_history_word(EditLine *el, int c __attribute__((__unused__)))
{
const char *wp = HIST_FIRST(el);
const char *wep, *wsp;
@@ -1099,7 +1100,7 @@ vi_history_word(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-vi_redo(EditLine *el, int c)
+vi_redo(EditLine *el, int c __attribute__((__unused__)))
{
c_redo_t *r = &el->el_chared.c_redo;
diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am
deleted file mode 100644
index 48d3af34412..00000000000
--- a/cmd-line-utils/readline/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-## Process this file with automake to create Makefile.in
-# Makefile for the GNU readline library.
-# Copyright (C) 1994,1996,1997 Free Software Foundation, Inc.
-
-# Last -I$(top_srcdir) needed for RedHat!
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)
-
-noinst_LIBRARIES = libreadline.a
-
-libreadline_a_SOURCES = readline.c funmap.c keymaps.c \
- vi_mode.c parens.c rltty.c \
- complete.c bind.c isearch.c \
- display.c signals.c \
- util.c kill.c \
- undo.c macro.c input.c \
- callback.c terminal.c xmalloc.c \
- history.c histsearch.c histexpand.c \
- histfile.c nls.c search.c \
- shell.c tilde.c misc.c text.c mbutil.c \
- compat.c savestring.c
-
-noinst_HEADERS = readline.h chardefs.h keymaps.h \
- history.h tilde.h rlmbutil.h rltypedefs.h rlprivate.h \
- rlshell.h xmalloc.h \
-\
- config_readline.h rldefs.h histlib.h rlwinsize.h \
- posixstat.h posixdir.h posixjmp.h \
- tilde.h rlconf.h rltty.h ansi_stdlib.h \
- tcap.h rlstdc.h
-
-EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt
-
-DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1
diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c
index c669322f436..0ea8b1ca126 100644
--- a/cmd-line-utils/readline/bind.c
+++ b/cmd-line-utils/readline/bind.c
@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_level)
{
register int i;
char *buffer, *openname, *line, *end;
- size_t file_size;
+ size_t file_size = 0;
current_readline_init_file = filename;
current_readline_init_include_level = include_level;
diff --git a/cmd-line-utils/readline/complete.c b/cmd-line-utils/readline/complete.c
index 2745e4e4801..d11ea2493a6 100644
--- a/cmd-line-utils/readline/complete.c
+++ b/cmd-line-utils/readline/complete.c
@@ -1839,8 +1839,11 @@ rl_username_completion_function (text, state)
#else /* !__WIN32__ && !__OPENNT) */
static char *username = (char *)NULL;
static struct passwd *entry;
- static int namelen, first_char, first_char_loc;
+ static int first_char, first_char_loc;
char *value;
+#if defined (HAVE_GETPWENT)
+ static int namelen;
+#endif
if (state == 0)
{
@@ -1850,7 +1853,9 @@ rl_username_completion_function (text, state)
first_char_loc = first_char == '~';
username = savestring (&text[first_char_loc]);
+#if defined (HAVE_GETPWENT)
namelen = strlen (username);
+#endif
setpwent ();
}
diff --git a/cmd-line-utils/readline/histexpand.c b/cmd-line-utils/readline/histexpand.c
index ab8d8ecc866..7b51c369827 100644
--- a/cmd-line-utils/readline/histexpand.c
+++ b/cmd-line-utils/readline/histexpand.c
@@ -693,7 +693,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
case 's':
{
char *new_event;
- int delimiter, failed, si, l_temp, ws, we;
+ int delimiter, failed, si, l_temp, we;
if (c == 's')
{
@@ -792,7 +792,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{
for (; temp[si] && whitespace (temp[si]); si++)
;
- ws = si;
we = history_tokenize_word (temp, si);
}
diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c
index cbd367542ce..1a6d69b6684 100644
--- a/cmd-line-utils/readline/histfile.c
+++ b/cmd-line-utils/readline/histfile.c
@@ -402,6 +402,7 @@ history_truncate_file (fname, lines)
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
bytes_written= write (file, bp, chars_read - (bp - buffer));
+ (void) bytes_written;
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
diff --git a/cmd-line-utils/readline/isearch.c b/cmd-line-utils/readline/isearch.c
index 305c847d8da..977e08eb9ba 100644
--- a/cmd-line-utils/readline/isearch.c
+++ b/cmd-line-utils/readline/isearch.c
@@ -617,7 +617,7 @@ rl_search_history (direction, invoking_key)
int direction, invoking_key __attribute__((unused));
{
_rl_search_cxt *cxt; /* local for now, but saved globally */
- int c, r;
+ int r;
RL_SETSTATE(RL_STATE_ISEARCH);
cxt = _rl_isearch_init (direction);
@@ -632,7 +632,7 @@ rl_search_history (direction, invoking_key)
r = -1;
for (;;)
{
- c = _rl_search_getchar (cxt);
+ _rl_search_getchar (cxt);
/* We might want to handle EOF here (c == 0) */
r = _rl_isearch_dispatch (cxt, cxt->lastc);
if (r <= 0)
@@ -655,9 +655,9 @@ int
_rl_isearch_callback (cxt)
_rl_search_cxt *cxt;
{
- int c, r;
+ int r;
- c = _rl_search_getchar (cxt);
+ _rl_search_getchar (cxt);
/* We might want to handle EOF here */
r = _rl_isearch_dispatch (cxt, cxt->lastc);
diff --git a/cmd-line-utils/readline/parens.c b/cmd-line-utils/readline/parens.c
index fe1578ed3e2..58f22291172 100644
--- a/cmd-line-utils/readline/parens.c
+++ b/cmd-line-utils/readline/parens.c
@@ -115,7 +115,7 @@ rl_insert_close (count, invoking_key)
else
{
#if defined (HAVE_SELECT)
- int orig_point, match_point, ready;
+ int orig_point, match_point;
struct timeval timer;
fd_set readfds;
@@ -136,7 +136,7 @@ rl_insert_close (count, invoking_key)
orig_point = rl_point;
rl_point = match_point;
(*rl_redisplay_function) ();
- ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+ select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
rl_point = orig_point;
#else /* !HAVE_SELECT */
_rl_insert_char (count, invoking_key);
diff --git a/cmd-line-utils/readline/readline.c b/cmd-line-utils/readline/readline.c
index fb92becdbf9..95947551823 100644
--- a/cmd-line-utils/readline/readline.c
+++ b/cmd-line-utils/readline/readline.c
@@ -447,11 +447,10 @@ readline_internal_char ()
readline_internal_charloop ()
#endif
{
- static int lastc, eof_found;
+ static int lastc;
int c, code, lk;
lastc = -1;
- eof_found = 0;
#if !defined (READLINE_CALLBACKS)
while (rl_done == 0)
diff --git a/cmd-line-utils/readline/terminal.c b/cmd-line-utils/readline/terminal.c
index 3f92821f9dd..e2785908160 100644
--- a/cmd-line-utils/readline/terminal.c
+++ b/cmd-line-utils/readline/terminal.c
@@ -268,7 +268,7 @@ _rl_get_screen_size (tty, ignore_env)
#if !defined (__DJGPP__)
if (_rl_screenwidth <= 0 && term_string_buffer)
- _rl_screenwidth = tgetnum ("co");
+ _rl_screenwidth = tgetnum ((char *)"co");
#endif
}
@@ -284,7 +284,7 @@ _rl_get_screen_size (tty, ignore_env)
#if !defined (__DJGPP__)
if (_rl_screenheight <= 0 && term_string_buffer)
- _rl_screenheight = tgetnum ("li");
+ _rl_screenheight = tgetnum ((char *)"li");
#endif
}
@@ -516,7 +516,7 @@ _rl_init_terminal_io (terminal_name)
if (!_rl_term_cr)
_rl_term_cr = "\r";
- _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
+ _rl_term_autowrap = tgetflag ((char *)"am") && tgetflag ((char *)"xn");
/* Allow calling application to set default height and width, using
rl_set_screen_size */
@@ -531,7 +531,7 @@ _rl_init_terminal_io (terminal_name)
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
- term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
+ term_has_meta = (tgetflag ((char *)"km") || tgetflag ((char *)"MT"));
if (!term_has_meta)
_rl_term_mm = _rl_term_mo = (char *)NULL;
diff --git a/cmd-line-utils/readline/text.c b/cmd-line-utils/readline/text.c
index bb0f5d97160..02b28750c86 100644
--- a/cmd-line-utils/readline/text.c
+++ b/cmd-line-utils/readline/text.c
@@ -811,11 +811,10 @@ _rl_overwrite_char (count, c)
int i;
#if defined (HANDLE_MULTIBYTE)
char mbkey[MB_LEN_MAX];
- int k;
/* Read an entire multibyte character sequence to insert COUNT times. */
if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
+ _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
#endif
rl_begin_undo_group ();
diff --git a/config/ac-macros/alloca.m4 b/config/ac-macros/alloca.m4
deleted file mode 100644
index 8c730dd671f..00000000000
--- a/config/ac-macros/alloca.m4
+++ /dev/null
@@ -1,68 +0,0 @@
-AC_DEFUN([MYSQL_FUNC_ALLOCA],
-[
-# Since we have heard that alloca fails on IRIX never define it on a
-# SGI machine
-if test ! "$host_vendor" = "sgi"
-then
- AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
- # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
- # for constant arguments. Useless!
- AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h,
- [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
- ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])
- if test "$ac_cv_header_alloca_h" = "yes"
- then
- AC_DEFINE(HAVE_ALLOCA, 1)
- fi
-
- AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
- [AC_TRY_LINK([
- #ifdef __GNUC__
- # define alloca __builtin_alloca
- #else
- # if HAVE_ALLOCA_H
- # include <alloca.h>
- # else
- # ifdef _AIX
- #pragma alloca
- # else
- # ifndef alloca /* predefined by HP cc +Olibcalls */
- char *alloca ();
- # endif
- # endif
- # endif
- #endif
- ], [char *p = (char *) alloca(1);],
- ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
- if test "$ac_cv_func_alloca_works" = "yes"; then
- AC_DEFINE([HAVE_ALLOCA], [1], [If we have a working alloca() implementation])
- fi
-
- if test "$ac_cv_func_alloca_works" = "no"; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.o
- AC_DEFINE(C_ALLOCA, 1)
-
- AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
- [AC_EGREP_CPP(webecray,
- [#if defined(CRAY) && ! defined(CRAY2)
- webecray
- #else
- wenotbecray
- #endif
- ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
- if test "$ac_cv_os_cray" = "yes"; then
- for ac_func in _getb67 GETB67 getb67; do
- AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func)
- break])
- done
- fi
- fi
- AC_SUBST(ALLOCA)dnl
-else
- AC_MSG_RESULT("Skipped alloca tests")
-fi
-])
diff --git a/config/ac-macros/character_sets.m4 b/config/ac-macros/character_sets.m4
deleted file mode 100644
index c49e4f89316..00000000000
--- a/config/ac-macros/character_sets.m4
+++ /dev/null
@@ -1,501 +0,0 @@
-dnl In order to add new charset, you must add charset name to
-dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index.xml.
-dnl If the character set uses strcoll or other special handling,
-dnl you must also create strings/ctype-$charset_name.c
-
-AC_DIVERT_PUSH(0)
-
-define(CHARSETS_AVAILABLE0,binary)
-define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
-define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8)
-define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
-define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
-define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32)
-
-DEFAULT_CHARSET=latin1
-CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE1 CHARSETS_AVAILABLE2 CHARSETS_AVAILABLE3 CHARSETS_AVAILABLE4 CHARSETS_AVAILABLE5"
-CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32"
-
-AC_DIVERT_POP
-
-AC_ARG_WITH(charset,
- [ --with-charset=CHARSET
- Default character set, use one of:
- CHARSETS_AVAILABLE0
- CHARSETS_AVAILABLE1
- CHARSETS_AVAILABLE2
- CHARSETS_AVAILABLE3
- CHARSETS_AVAILABLE4
- CHARSETS_AVAILABLE5],
- [default_charset="$withval"],
- [default_charset="$DEFAULT_CHARSET"])
-
-AC_ARG_WITH(collation,
- [ --with-collation=COLLATION
- Default collation],
- [default_collation="$withval"],
- [default_collation="default"])
-
-
-AC_ARG_WITH(extra-charsets,
- [ --with-extra-charsets=CHARSET[,CHARSET,...]
- Use charsets in addition to default (none, complex,
- all, or a list selected from the above sets)],
- [extra_charsets="$withval"],
- [extra_charsets="none"])
-
-
-AC_MSG_CHECKING("character sets")
-
-CHARSETS="$default_charset latin1 utf8mb4 utf8"
-
-if test "$extra_charsets" = no; then
- CHARSETS="$CHARSETS"
-elif test "$extra_charsets" = none; then
- CHARSETS="$CHARSETS"
-elif test "$extra_charsets" = complex; then
- CHARSETS="$CHARSETS $CHARSETS_COMPLEX"
- AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
-elif test "$extra_charsets" = all; then
- CHARSETS="$CHARSETS $CHARSETS_AVAILABLE"
- AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
-else
- EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
- CHARSETS="$CHARSETS $EXTRA_CHARSETS"
-fi
-
-for cs in $CHARSETS
-do
- case $cs in
- armscii8)
- AC_DEFINE(HAVE_CHARSET_armscii8, 1,
- [Define to enable charset armscii8])
- ;;
- ascii)
- AC_DEFINE(HAVE_CHARSET_ascii, 1,
- [Define to enable ascii character set])
- ;;
- big5)
- AC_DEFINE(HAVE_CHARSET_big5, 1, [Define to enable charset big5])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, [1], [ ])
- ;;
- binary)
- ;;
- cp1250)
- AC_DEFINE(HAVE_CHARSET_cp1250, 1, [Define to enable cp1250])
- ;;
- cp1251)
- AC_DEFINE(HAVE_CHARSET_cp1251, 1, [Define to enable charset cp1251])
- ;;
- cp1256)
- AC_DEFINE(HAVE_CHARSET_cp1256, 1, [Define to enable charset cp1256])
- ;;
- cp1257)
- AC_DEFINE(HAVE_CHARSET_cp1257, 1, [Define to enable charset cp1257])
- ;;
- cp850)
- AC_DEFINE(HAVE_CHARSET_cp850, 1, [Define to enable charset cp850])
- ;;
- cp852)
- AC_DEFINE(HAVE_CHARSET_cp852, 1, [Define to enable charset cp852])
- ;;
- cp866)
- AC_DEFINE(HAVE_CHARSET_cp866, 1, [Define to enable charset cp866])
- ;;
- cp932)
- AC_DEFINE(HAVE_CHARSET_cp932, 1, [Define to enable charset cp932])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- dec8)
- AC_DEFINE(HAVE_CHARSET_dec8, 1, [Define to enable charset dec8])
- ;;
- eucjpms)
- AC_DEFINE(HAVE_CHARSET_eucjpms, 1, [Define to enable charset eucjpms])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- euckr)
- AC_DEFINE(HAVE_CHARSET_euckr, 1, [Define to enable charset euckr])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- gb2312)
- AC_DEFINE(HAVE_CHARSET_gb2312, 1, [Define to enable charset gb2312])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- gbk)
- AC_DEFINE(HAVE_CHARSET_gbk, 1, [Define to enable charset gbk])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- geostd8)
- AC_DEFINE(HAVE_CHARSET_geostd8, 1, [Define to enable charset geostd8])
- ;;
- greek)
- AC_DEFINE(HAVE_CHARSET_greek, 1, [Define to enable charset greek])
- ;;
- hebrew)
- AC_DEFINE(HAVE_CHARSET_hebrew, 1, [Define to enable charset hebrew])
- ;;
- hp8)
- AC_DEFINE(HAVE_CHARSET_hp8, 1, [Define to enable charset hp8])
- ;;
- keybcs2)
- AC_DEFINE(HAVE_CHARSET_keybcs2, 1, [Define to enable charset keybcs2])
- ;;
- koi8r)
- AC_DEFINE(HAVE_CHARSET_koi8r, 1, [Define to enable charset koi8r])
- ;;
- koi8u)
- AC_DEFINE(HAVE_CHARSET_koi8u, 1, [Define to enable charset koi8u])
- ;;
- latin1)
- AC_DEFINE(HAVE_CHARSET_latin1, 1, [Define to enable charset latin1])
- ;;
- latin2)
- AC_DEFINE(HAVE_CHARSET_latin2, 1, [Define to enable charset latin2])
- ;;
- latin5)
- AC_DEFINE(HAVE_CHARSET_latin5, 1, [Define to enable charset latin5])
- ;;
- latin7)
- AC_DEFINE(HAVE_CHARSET_latin7, 1, [Define to enable charset latin7])
- ;;
- macce)
- AC_DEFINE(HAVE_CHARSET_macce, 1, [Define to enable charset macce])
- ;;
- macroman)
- AC_DEFINE(HAVE_CHARSET_macroman, 1,
- [Define to enable charset macroman])
- ;;
- sjis)
- AC_DEFINE(HAVE_CHARSET_sjis, 1, [Define to enable charset sjis])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- swe7)
- AC_DEFINE(HAVE_CHARSET_swe7, 1, [Define to enable charset swe7])
- ;;
- tis620)
- AC_DEFINE(HAVE_CHARSET_tis620, 1, [Define to enable charset tis620])
- ;;
- ucs2)
- AC_DEFINE(HAVE_CHARSET_ucs2, 1, [Define to enable charset ucs2])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- ujis)
- AC_DEFINE(HAVE_CHARSET_ujis, 1, [Define to enable charset ujis])
- AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- utf8mb4)
- AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable utf8mb4])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- utf8)
- AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable utf8])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- utf16)
- AC_DEFINE(HAVE_CHARSET_utf16, 1, [Define to enable utf16])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- utf32)
- AC_DEFINE(HAVE_CHARSET_utf32, 1, [Define to enable utf32])
- AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
- AC_DEFINE(USE_MB_IDENT, 1)
- ;;
- *)
- AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE).
- See the Installation chapter in the Reference Manual.])
- esac
-done
-
-
- default_charset_collations=""
-
-case $default_charset in
- armscii8)
- default_charset_default_collation="armscii8_general_ci"
- default_charset_collations="armscii8_general_ci armscii8_bin"
- ;;
- ascii)
- default_charset_default_collation="ascii_general_ci"
- default_charset_collations="ascii_general_ci ascii_bin"
- ;;
- big5)
- default_charset_default_collation="big5_chinese_ci"
- default_charset_collations="big5_chinese_ci big5_bin"
- ;;
- binary)
- default_charset_default_collation="binary"
- default_charset_collations="binary"
- ;;
- cp1250)
- default_charset_default_collation="cp1250_general_ci"
- default_charset_collations="cp1250_general_ci cp1250_czech_cs cp1250_bin"
- ;;
- cp1251)
- default_charset_default_collation="cp1251_general_ci"
- default_charset_collations="cp1251_general_ci cp1251_general_cs cp1251_bin cp1251_bulgarian_ci cp1251_ukrainian_ci"
- ;;
- cp1256)
- default_charset_default_collation="cp1256_general_ci"
- default_charset_collations="cp1256_general_ci cp1256_bin"
- ;;
- cp1257)
- default_charset_default_collation="cp1257_general_ci"
- default_charset_collations="cp1257_general_ci cp1257_lithuanian_ci cp1257_bin"
- ;;
- cp850)
- default_charset_default_collation="cp850_general_ci"
- default_charset_collations="cp850_general_ci cp850_bin"
- ;;
- cp852)
- default_charset_default_collation="cp852_general_ci"
- default_charset_collations="cp852_general_ci cp852_bin"
- ;;
- cp866)
- default_charset_default_collation="cp866_general_ci"
- default_charset_collations="cp866_general_ci cp866_bin"
- ;;
- cp932)
- default_charset_default_collation="cp932_japanese_ci"
- default_charset_collations="cp932_japanese_ci cp932_bin"
- ;;
- dec8)
- default_charset_default_collation="dec8_swedish_ci"
- default_charset_collations="dec8_swedish_ci dec8_bin"
- ;;
- eucjpms)
- default_charset_default_collation="eucjpms_japanese_ci"
- default_charset_collations="eucjpms_japanese_ci ujis_bin"
- ;;
- euckr)
- default_charset_default_collation="euckr_korean_ci"
- default_charset_collations="euckr_korean_ci euckr_bin"
- ;;
- gb2312)
- default_charset_default_collation="gb2312_chinese_ci"
- default_charset_collations="gb2312_chinese_ci gb2312_bin"
- ;;
- gbk)
- default_charset_default_collation="gbk_chinese_ci"
- default_charset_collations="gbk_chinese_ci gbk_bin"
- ;;
- geostd8)
- default_charset_default_collation="geostd8_general_ci"
- default_charset_collations="geostd8_general_ci geostd8_bin"
- ;;
- greek)
- default_charset_default_collation="greek_general_ci"
- default_charset_collations="greek_general_ci greek_bin"
- ;;
- hebrew)
- default_charset_default_collation="hebrew_general_ci"
- default_charset_collations="hebrew_general_ci hebrew_bin"
- ;;
- hp8)
- default_charset_default_collation="hp8_english_ci"
- default_charset_collations="hp8_english_ci hp8_bin"
- ;;
- keybcs2)
- default_charset_default_collation="keybcs2_general_ci"
- default_charset_collations="keybcs2_general_ci keybcs2_bin"
- ;;
- koi8r)
- default_charset_default_collation="koi8r_general_ci"
- default_charset_collations="koi8r_general_ci koi8r_bin"
- ;;
- koi8u)
- default_charset_default_collation="koi8u_general_ci"
- default_charset_collations="koi8u_general_ci koi8u_bin"
- ;;
- latin1)
- default_charset_default_collation="latin1_swedish_ci"
- default_charset_collations="latin1_general_ci latin1_general_cs latin1_bin latin1_german1_ci latin1_german2_ci latin1_danish_ci latin1_spanish_ci latin1_swedish_ci"
- ;;
- latin2)
- default_charset_default_collation="latin2_general_ci"
- default_charset_collations="latin2_general_ci latin2_bin latin2_czech_cs latin2_hungarian_ci latin2_croatian_ci"
- ;;
- latin5)
- default_charset_default_collation="latin5_turkish_ci"
- default_charset_collations="latin5_turkish_ci latin5_bin"
- ;;
- latin7)
- default_charset_default_collation="latin7_general_ci"
- default_charset_collations="latin7_general_ci latin7_general_cs latin7_bin latin7_estonian_cs"
- ;;
- macce)
- default_charset_default_collation="macce_general_ci"
- default_charset_collations="macce_general_ci macce_bin"
- ;;
- macroman)
- default_charset_default_collation="macroman_general_ci"
- default_charset_collations="macroman_general_ci macroman_bin"
- ;;
- sjis)
- default_charset_default_collation="sjis_japanese_ci"
- default_charset_collations="sjis_japanese_ci sjis_bin"
- ;;
- swe7)
- default_charset_default_collation="swe7_swedish_ci"
- default_charset_collations="swe7_swedish_ci swe7_bin"
- ;;
- tis620)
- default_charset_default_collation="tis620_thai_ci"
- default_charset_collations="tis620_thai_ci tis620_bin"
- ;;
- ucs2)
- default_charset_default_collation="ucs2_general_ci"
- define(UCSC1, ucs2_general_ci ucs2_bin)
- define(UCSC2, ucs2_czech_ci ucs2_danish_ci)
- define(UCSC3, ucs2_esperanto_ci ucs2_estonian_ci ucs2_hungarian_ci)
- define(UCSC4, ucs2_icelandic_ci ucs2_latvian_ci ucs2_lithuanian_ci)
- define(UCSC5, ucs2_persian_ci ucs2_polish_ci ucs2_romanian_ci)
- define(UCSC6, ucs2_slovak_ci ucs2_slovenian_ci)
- define(UCSC7, ucs2_spanish2_ci ucs2_spanish_ci)
- define(UCSC8, ucs2_swedish_ci ucs2_turkish_ci)
- define(UCSC9, ucs2_unicode_ci)
- UCSC="UCSC1 UCSC2 UCSC3 UCSC4 UCSC5 UCSC6 UCSC7 UCSC8 UCSC9"
- default_charset_collations="$UCSC"
- ;;
- ujis)
- default_charset_default_collation="ujis_japanese_ci"
- default_charset_collations="ujis_japanese_ci ujis_bin"
- ;;
- utf8)
- default_charset_default_collation="utf8_general_ci"
- if test "$default_collation" = "utf8_general_cs"; then
- # For those who explicitly desire "utf8_general_cs", support it,
- # and then also set the CPP switch enabling that code.
- UTFC="utf8_general_cs"
- AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
- else
- define(UTFC1, utf8_general_ci utf8_bin)
- define(UTFC2, utf8_czech_ci utf8_danish_ci)
- define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_hungarian_ci)
- define(UTFC4, utf8_icelandic_ci utf8_latvian_ci utf8_lithuanian_ci)
- define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
- define(UTFC6, utf8_slovak_ci utf8_slovenian_ci)
- define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
- define(UTFC8, utf8_swedish_ci utf8_turkish_ci)
- define(UTFC9, utf8_unicode_ci)
- UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
- fi
- default_charset_collations="$UTFC"
- ;;
- utf8mb4)
- default_charset_default_collation="utf8mb4_general_ci"
- define(UTFC1, utf8mb4_general_ci utf8mb4_bin)
- define(UTFC2, utf8mb4_czech_ci utf8mb4_danish_ci)
- define(UTFC3, utf8mb4_esperanto_ci utf8mb4_estonian_ci utf8mb4_hungarian_ci)
- define(UTFC4, utf8mb4_icelandic_ci utf8mb4_latvian_ci utf8mb4_lithuanian_ci)
- define(UTFC5, utf8mb4_persian_ci utf8mb4_polish_ci utf8mb4_romanian_ci)
- define(UTFC6, utf8mb4_sinhala_ci utf8mb4_slovak_ci utf8mb4_slovenian_ci)
- define(UTFC7, utf8mb4_spanish2_ci utf8mb4_spanish_ci)
- define(UTFC8, utf8mb4_swedish_ci utf8mb4_turkish_ci)
- define(UTFC9, utf8mb4_unicode_ci)
- UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
- default_charset_collations="$UTFC"
- ;;
- utf16)
- default_charset_default_collation="utf16_general_ci"
- define(UTFC1, utf16_general_ci utf16_bin)
- define(UTFC2, utf16_czech_ci utf16_danish_ci)
- define(UTFC3, utf16_esperanto_ci utf16_estonian_ci utf16_hungarian_ci)
- define(UTFC4, utf16_icelandic_ci utf16_latvian_ci utf16_lithuanian_ci)
- define(UTFC5, utf16_persian_ci utf16_polish_ci utf16_romanian_ci)
- define(UTFC6, utf16_sinhala_ci utf16_slovak_ci utf16_slovenian_ci)
- define(UTFC7, utf16_spanish2_ci utf16_spanish_ci)
- define(UTFC8, utf16_swedish_ci utf16_turkish_ci)
- define(UTFC9, utf16_unicode_ci)
- UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
- default_charset_collations="$UTFC"
- ;;
- utf32)
- default_charset_default_collation="utf32_general_ci"
- define(UTFC1, utf32_general_ci utf32_bin)
- define(UTFC2, utf32_czech_ci utf32_danish_ci)
- define(UTFC3, utf32_esperanto_ci utf32_estonian_ci utf32_hungarian_ci)
- define(UTFC4, utf32_icelandic_ci utf32_latvian_ci utf32_lithuanian_ci)
- define(UTFC5, utf32_persian_ci utf32_polish_ci utf32_romanian_ci)
- define(UTFC6, utf32_sinhala_ci utf32_slovak_ci utf32_slovenian_ci)
- define(UTFC7, utf32_spanish2_ci utf32_spanish_ci)
- define(UTFC8, utf32_swedish_ci utf32_turkish_ci)
- define(UTFC9, utf32_unicode_ci)
- UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
- default_charset_collations="$UTFC"
- ;;
- *)
- AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
- See the Installation chapter in the Reference Manual.])
-esac
-
-if test "$default_collation" = default; then
- default_collation=$default_charset_default_collation
-fi
-
-valid_default_collation=no
-for cl in $default_charset_collations
-do
- if test x"$cl" = x"$default_collation"
- then
- valid_default_collation=yes
- break
- fi
-done
-
-if test x$valid_default_collation = xyes
-then
- AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS])
-else
- AC_MSG_ERROR([
- Collation $default_collation is not valid for character set $default_charset.
- Valid collations are: $default_charset_collations.
- See the Installation chapter in the Reference Manual.
- ])
-fi
-
-AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_CHARSET_NAME], ["$default_charset"],
- [Define the default charset name])
-AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_COLLATION_NAME], ["$default_collation"],
- [Define the default charset name])
-
-# Shall we build the UCA-based Unicode collations
-AC_ARG_WITH(uca,
- [ --without-uca Skip building of the national Unicode collations.],
- [with_uca=$withval],
- [with_uca=yes]
-)
-
-AC_MSG_CHECKING([whether to compile national Unicode collations])
-
-if test "$with_uca" = "yes"
-then
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_UCA_COLLATIONS], [1], [national Unicode collations])
-else
- AC_MSG_RESULT(no)
-fi
-
-
-# Shall we build experimental collations
-AC_ARG_WITH(experimental-collations,
- [],
- [with_exp_coll=$withval],
- [with_exp_coll=no]
-)
-
-if test "$with_exp_coll" = "yes"
-then
- AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
-fi
diff --git a/config/ac-macros/check_cpu.m4 b/config/ac-macros/check_cpu.m4
deleted file mode 100644
index d551f47769e..00000000000
--- a/config/ac-macros/check_cpu.m4
+++ /dev/null
@@ -1,47 +0,0 @@
-AC_DEFUN([MYSQL_CHECK_CPU],
-[AC_CACHE_CHECK([if compiler supports optimizations for current cpu],
-mysql_cv_cpu,[
-
-ac_save_CFLAGS="$CFLAGS"
-if test -r /proc/cpuinfo ; then
- cpuinfo="cat /proc/cpuinfo"
- cpu_family=`$cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
- cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
-fi
-if test "$cpu_vendor" = "AuthenticAMD"; then
- if test $cpu_family -ge 6; then
- cpu_set="athlon pentiumpro k5 pentium i486 i386";
- elif test $cpu_family -eq 5; then
- cpu_set="k5 pentium i486 i386";
- elif test $cpu_family -eq 4; then
- cpu_set="i486 i386"
- else
- cpu_set="i386"
- fi
-elif test "$cpu_vendor" = "GenuineIntel"; then
- if test $cpu_family -ge 6; then
- cpu_set="pentiumpro pentium i486 i386";
- elif test $cpu_family -eq 5; then
- cpu_set="pentium i486 i386";
- elif test $cpu_family -eq 4; then
- cpu_set="i486 i386"
- else
- cpu_set="i386"
- fi
-fi
-
-for ac_arg in $cpu_set;
-do
- CFLAGS="$ac_save_CFLAGS -mcpu=$ac_arg -march=$ac_arg -DCPU=$ac_arg"
- AC_TRY_COMPILE([],[int i],mysql_cv_cpu=$ac_arg; break;, mysql_cv_cpu="unknown")
-done
-
-if test "$mysql_cv_cpu" = "unknown"
-then
- CFLAGS="$ac_save_CFLAGS"
- AC_MSG_RESULT(none)
-else
- AC_MSG_RESULT($mysql_cv_cpu)
-fi
-])])
-
diff --git a/config/ac-macros/compiler_flag.m4 b/config/ac-macros/compiler_flag.m4
deleted file mode 100644
index ce2ce6cbdfa..00000000000
--- a/config/ac-macros/compiler_flag.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-# option, cache_name, variable,
-# code to execute if yes, code to exectute if fail
-AC_DEFUN([AC_SYS_COMPILER_FLAG],
-[
- AC_MSG_CHECKING($1)
- OLD_CFLAGS="[$]CFLAGS"
- AC_CACHE_VAL(mysql_cv_option_$2,
- [
- CFLAGS="[$]OLD_CFLAGS $1"
- AC_TRY_LINK([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no)
- ])
-
- CFLAGS="[$]OLD_CFLAGS"
-
- if test x"[$]mysql_cv_option_$2" = "xyes" ; then
- $3="[$]$3 $1"
- AC_MSG_RESULT(yes)
- $5
- else
- AC_MSG_RESULT(no)
- $4
- fi
-])
-
-# arch, option, cache_name, variable
-AC_DEFUN([AC_SYS_CPU_COMPILER_FLAG],
-[
- if test "`uname -m 2>/dev/null`" = "$1" ; then
- AC_SYS_COMPILER_FLAG($2,$3,$4)
- fi
-])
-
-# os, option, cache_name, variable
-AC_DEFUN([AC_SYS_OS_COMPILER_FLAG],
-[
- if test "x$mysql_cv_sys_os" = "x$1" ; then
- AC_SYS_COMPILER_FLAG($2,$3,$4)
- fi
-])
-
-AC_DEFUN([AC_CHECK_NOEXECSTACK],
-[
- AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
- mysql_cv_as_noexecstack, [dnl
- cat > conftest.c <<EOF
-void foo (void) { }
-EOF
- if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
- -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
- && grep .note.GNU-stack conftest.s >/dev/null \
- && AC_TRY_COMMAND([${CC-cc} $CCASFLAGS $CPPFLAGS -Wa,--noexecstack
- -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
- then
- mysql_cv_as_noexecstack=yes
- else
- mysql_cv_as_noexecstack=no
- fi
- rm -f conftest*])
- if test $mysql_cv_as_noexecstack = yes; then
- CCASFLAGS="$CCASFLAGS -Wa,--noexecstack"
- fi
-])
diff --git a/config/ac-macros/dtrace.m4 b/config/ac-macros/dtrace.m4
deleted file mode 100644
index a42d78d97fe..00000000000
--- a/config/ac-macros/dtrace.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl ---------------------------------------------------------------------------
-dnl Macro: DTRACE_TEST
-dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(dtrace,
- AC_HELP_STRING([--enable-dtrace],[Build with support for the DTRACE.]),
- [
- ENABLE_DTRACE="$enable_dtrace"
- ],
- [
- ENABLE_DTRACE="yes"
- ]
-)
-DTRACEFLAGS=""
-HAVE_DTRACE=""
-HAVE_DTRACE_DASH_G=""
-if test "$ENABLE_DTRACE" = "yes"; then
- AC_PATH_PROGS(DTRACE, dtrace, [not found], [$PATH:/usr/sbin])
- if test "$DTRACE" = "not found"; then
- ENABLE_DTRACE="no"
- else
- AC_DEFINE([HAVE_DTRACE], [1], [Defined to 1 if DTrace support is enabled])
- case "$target_os" in
- *solaris*)
- HAVE_DTRACE_DASH_G="yes"
- ;;
- *)
- HAVE_DTRACE_DASH_G="no"
- ;;
- esac
- fi
-fi
-AC_SUBST(DTRACEFLAGS)
-AC_SUBST(HAVE_DTRACE)
-AM_CONDITIONAL([HAVE_DTRACE], [ test "$ENABLE_DTRACE" = "yes" ])
-AM_CONDITIONAL([HAVE_DTRACE_DASH_G], [ test "$HAVE_DTRACE_DASH_G" = "yes" ])
-dnl ---------------------------------------------------------------------------
-dnl End Macro: DTRACE_TEST
-dnl ---------------------------------------------------------------------------
diff --git a/config/ac-macros/large_file.m4 b/config/ac-macros/large_file.m4
deleted file mode 100644
index 279ce6d60f1..00000000000
--- a/config/ac-macros/large_file.m4
+++ /dev/null
@@ -1,142 +0,0 @@
-
-dnl By default, many hosts won't let programs access large files;
-dnl one must use special compiler options to get large-file access to work.
-dnl For more details about this brain damage please see:
-dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
-
-dnl Written by Paul Eggert <eggert@twinsun.com>.
-
-dnl Internal subroutine of AC_SYS_LARGEFILE.
-dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
-AC_DEFUN([AC_SYS_LARGEFILE_FLAGS],
- [AC_CACHE_CHECK([for $1 value to request large file support],
- ac_cv_sys_largefile_$1,
- [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
- then
- ac_cv_sys_largefile_$1=`cat conftest.1`
- else
- ac_cv_sys_largefile_$1=no
- ifelse($1, CFLAGS,
- [case "$host_os" in
- # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
-changequote(, )dnl
- hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
-changequote([, ])dnl
- if test "$GCC" = yes; then
- case `$CC --version 2>/dev/null` in
- 2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
- esac
- fi
- ;;
- # IRIX 6.2 and later require cc -n32.
-changequote(, )dnl
- irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
-changequote([, ])dnl
- if test "$GCC" != yes; then
- ac_cv_sys_largefile_CFLAGS=-n32
- fi
- esac
- if test "$ac_cv_sys_largefile_CFLAGS" != no; then
- ac_save_CC="$CC"
- CC="$CC $ac_cv_sys_largefile_CFLAGS"
- AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
- CC="$ac_save_CC"
- fi])
- fi
- rm -f conftest*])])
-
-dnl Internal subroutine of AC_SYS_LARGEFILE.
-dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
-AC_DEFUN([AC_SYS_LARGEFILE_SPACE_APPEND],
- [case $2 in
- no) ;;
- ?*)
- case "[$]$1" in
- '') $1=$2 ;;
- *) $1=[$]$1' '$2 ;;
- esac ;;
- esac])
-
-dnl Internal subroutine of AC_SYS_LARGEFILE.
-dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
-AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
- [AC_CACHE_CHECK([for $1], $2,
- [$2=no
-changequote(, )dnl
- for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
- case "$ac_flag" in
- -D$1)
- $2=1 ;;
- -D$1=*)
- $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
- esac
- done
- $4
-changequote([, ])dnl
- ])
- if test "[$]$2" != no; then
- AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
- fi])
-
-AC_DEFUN([MYSQL_SYS_LARGEFILE],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- AC_ARG_ENABLE(largefile,
- [ --disable-largefile Omit support for large files])
- if test "$enable_largefile" != no; then
- AC_CHECK_TOOL(GETCONF, getconf)
- AC_SYS_LARGEFILE_FLAGS(CFLAGS)
- AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
- AC_SYS_LARGEFILE_FLAGS(LIBS)
-
- for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
- case "$ac_flag" in
- no) ;;
- -D_FILE_OFFSET_BITS=*) ;;
- -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
- -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
- -D?* | -I?*)
- AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
- *)
- AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
- esac
- done
- AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
- AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
-
- AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
- ac_cv_sys_file_offset_bits,
- [Number of bits in a file offset, on hosts where this is settable.],
- [case "$host_os" in
- # HP-UX 10.20 and later
- hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
- ac_cv_sys_file_offset_bits=64 ;;
- # We can't declare _FILE_OFFSET_BITS here as this will cause
- # compile errors as AC_PROG_CC adds include files in confdefs.h
- # We solve this (until autoconf is fixed) by instead declaring it
- # as define instead
- solaris2.[8,9])
- CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
- CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
- ac_cv_sys_file_offset_bits=no ;;
- esac])
- AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
- ac_cv_sys_largefile_source,
- [makes fseeko etc. visible, on some hosts.],
- [case "$host_os" in
- # HP-UX 10.20 and later
- hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
- ac_cv_sys_largefile_source=1 ;;
- esac])
-
- AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
- ac_cv_sys_large_files,
- [Large files support on AIX-style hosts.],
- [case "$host_os" in
- # Large file support on AIX is available starting from version 4.2
- # Tested only on 5.2 and up
- aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
- ac_cv_sys_large_files=1 ;;
- esac])
- fi
- ])
-
diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4
deleted file mode 100644
index 24be31395f2..00000000000
--- a/config/ac-macros/maintainer.m4
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# 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 -Wno-strict-aliasing -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
deleted file mode 100644
index 89de1e5f8fa..00000000000
--- a/config/ac-macros/misc.m4
+++ /dev/null
@@ -1,688 +0,0 @@
-# Local macros for automake & autoconf
-
-#---START: Used in for client configure
-AC_DEFUN([MYSQL_TYPE_ACCEPT],
-[ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
-AC_LANG_PUSH(C++)
-if test "$ac_cv_prog_gxx" = "yes"
-then
- # Add -Werror, remove -fbranch-probabilities (Bug #268)
- CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
-fi
-mysql_cv_btype_last_arg_accept=none
-[AC_TRY_COMPILE([#if defined(inline)
-#undef inline
-#endif
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);],
-mysql_cv_btype_last_arg_accept=socklen_t)]
-if test "$mysql_cv_btype_last_arg_accept" = "none"; then
-[AC_TRY_COMPILE([#if defined(inline)
-#undef inline
-#endif
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);],
-mysql_cv_btype_last_arg_accept=size_t)]
-fi
-if test "$mysql_cv_btype_last_arg_accept" = "none"; then
-mysql_cv_btype_last_arg_accept=int
-fi)
-AC_LANG_POP(C++)
-AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
- [The base type of the last arg to accept])
-CXXFLAGS="$ac_save_CXXFLAGS"
-])
-#---END:
-
-dnl Find type of qsort
-AC_DEFUN([MYSQL_TYPE_QSORT],
-[AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
-[AC_TRY_COMPILE([#include <stdlib.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-void qsort(void *base, size_t nel, size_t width,
- int (*compar) (const void *, const void *));
-],
-[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
-AC_DEFINE_UNQUOTED([RETQSORTTYPE], [$mysql_cv_type_qsort],
- [The return type of qsort (int or void).])
-if test "$mysql_cv_type_qsort" = "void"
-then
- AC_DEFINE_UNQUOTED([QSORT_TYPE_IS_VOID], [1], [qsort returns void])
-fi
-])
-
-#---START: Figure out whether to use 'struct rlimit' or 'struct rlimit64'
-AC_DEFUN([MYSQL_TYPE_STRUCT_RLIMIT],
-[ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([struct type to use with setrlimit], mysql_cv_btype_struct_rlimit,
-AC_LANG_PUSH(C++)
-if test "$ac_cv_prog_gxx" = "yes"
-then
- # Add -Werror, remove -fbranch-probabilities (Bug #268)
- CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
-fi
-mysql_cv_btype_struct_rlimit=none
-[AC_TRY_COMPILE([#if defined(inline)
-#undef inline
-#endif
-#include <stdlib.h>
-#include <sys/resource.h>
-],
-[struct rlimit64 rl; setrlimit(RLIMIT_CORE, &rl);],
-mysql_cv_btype_struct_rlimit="struct rlimit64")]
-if test "$mysql_cv_btype_struct_rlimit" = "none"; then
-mysql_cv_btype_struct_rlimit="struct rlimit"
-fi)
-AC_LANG_POP(C++)
-AC_DEFINE_UNQUOTED([STRUCT_RLIMIT], [$mysql_cv_btype_struct_rlimit],
- [The struct rlimit type to use with setrlimit])
-CXXFLAGS="$ac_save_CXXFLAGS"
-])
-#---END:
-
-AC_DEFUN([MYSQL_TIMESPEC_TS],
-[AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts,
-[AC_TRY_COMPILE([#include <pthread.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-],
-[struct timespec abstime;
-
-abstime.ts_sec = time(NULL)+1;
-abstime.ts_nsec = 0;
-], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)])
-if test "$mysql_cv_timespec_ts" = "yes"
-then
- AC_DEFINE([HAVE_TIMESPEC_TS_SEC], [1],
- [Timespec has a ts_sec instead of tv_sev])
-fi
-])
-
-AC_DEFUN([MYSQL_TZNAME],
-[AC_CACHE_CHECK([if we have tzname variable], mysql_cv_tzname,
-[AC_TRY_COMPILE([#include <time.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-],
-[ tzset();
- return tzname[0] != 0;
-], mysql_cv_tzname=yes, mysql_cv_tzname=no)])
-if test "$mysql_cv_tzname" = "yes"
-then
- AC_DEFINE([HAVE_TZNAME], [1], [Have the tzname variable])
-fi
-])
-
-
-AC_DEFUN([MYSQL_PTHREAD_YIELD],
-[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
-[AC_TRY_LINK([#define _GNU_SOURCE
-#include <pthread.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-],
-[
- pthread_yield();
-], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
-if test "$ac_cv_pthread_yield_zero_arg" = "yes"
-then
- AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
- [pthread_yield that doesn't take any arguments])
-fi
-]
-[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
-[AC_TRY_LINK([#define _GNU_SOURCE
-#include <pthread.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-],
-[
- pthread_yield(0);
-], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
-if test "$ac_cv_pthread_yield_one_arg" = "yes"
-then
- AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
- [pthread_yield function with one argument])
-fi
-]
-)
-
-
-
-#---END:
-
-# From fileutils-3.14/aclocal.m4
-
-# @defmac AC_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so. This macro tries various
-# options that select ANSI C on some system or another. It considers the
-# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
-# handles function prototypes correctly.
-#
-# Patched by monty to only check if __STDC__ is defined. With the original
-# check it's impossible to get things to work with the Sunpro compiler from
-# Workshop 4.2
-#
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
-AC_CACHE_VAL(am_cv_prog_cc_stdc,
-[am_cv_prog_cc_stdc=no
-ac_save_CC="$CC"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-# removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
-for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
-do
- CC="$ac_save_CC $ac_arg"
- AC_TRY_COMPILE(
-[#if !defined(__STDC__)
-choke me
-#endif
-/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif
-], [
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};],
-[am_cv_prog_cc_stdc="$ac_arg"; break])
-done
-CC="$ac_save_CC"
-])
-AC_MSG_RESULT($am_cv_prog_cc_stdc)
-case "x$am_cv_prog_cc_stdc" in
- x|xno) ;;
- *) CC="$CC $am_cv_prog_cc_stdc" ;;
-esac
-])
-
-# Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty.
-
-AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
-[
-AC_CACHE_VAL(mysql_cv_termcap_lib,
- [AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
- [AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
- [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
- [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
- [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
- mysql_cv_termcap_lib=NOT_FOUND)])])])])])
-AC_MSG_CHECKING(for termcap functions library)
-if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
-AC_MSG_ERROR([No curses/termcap library found])
-elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
-TERMCAP_LIB=-ltermcap
-elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
-TERMCAP_LIB=-lncursesw
-elif test "$mysql_cv_termcap_lib" = "libncurses"; then
-TERMCAP_LIB=-lncurses
-elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
-TERMCAP_LIB=-ltinfo
-else
-TERMCAP_LIB=-lcurses
-fi
-AC_MSG_RESULT($TERMCAP_LIB)
-])
-
-dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
-AC_DEFUN([MYSQL_SIGNAL_CHECK],
-[AC_REQUIRE([AC_TYPE_SIGNAL])
-AC_MSG_CHECKING(for type of signal functions)
-AC_CACHE_VAL(mysql_cv_signal_vintage,
-[
- AC_TRY_LINK([#include <signal.h>],[
- sigset_t ss;
- struct sigaction sa;
- sigemptyset(&ss); sigsuspend(&ss);
- sigaction(SIGINT, &sa, (struct sigaction *) 0);
- sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
- ], mysql_cv_signal_vintage=posix,
- [
- AC_TRY_LINK([#include <signal.h>], [
- int mask = sigmask(SIGINT);
- sigsetmask(mask); sigblock(mask); sigpause(mask);
- ], mysql_cv_signal_vintage=4.2bsd,
- [
- AC_TRY_LINK([
- #include <signal.h>
- RETSIGTYPE foo() { }], [
- int mask = sigmask(SIGINT);
- sigset(SIGINT, foo); sigrelse(SIGINT);
- sighold(SIGINT); sigpause(SIGINT);
- ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
- )]
- )]
-)
-])
-AC_MSG_RESULT($mysql_cv_signal_vintage)
-if test "$mysql_cv_signal_vintage" = posix; then
-AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
- [Signal handling is POSIX (sigset/sighold, etc)])
-elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
-AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
-elif test "$mysql_cv_signal_vintage" = svr3; then
-AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
-fi
-])
-
-AC_DEFUN([MYSQL_CHECK_GETPW_FUNCS],
-[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
-AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <pwd.h>
-extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
- mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
-AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
-if test "$mysql_cv_can_redecl_getpw" = "no"; then
-AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
-fi
-])
-
-AC_DEFUN([MYSQL_HAVE_TIOCGWINSZ],
-[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
-AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
- mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
-AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
-if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then
-AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
- [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
-fi
-])
-
-AC_DEFUN([MYSQL_HAVE_FIONREAD],
-[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
-AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/ioctl.h>], [int x = FIONREAD;],
- mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
-AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
-if test "$mysql_cv_fionread_in_ioctl" = "yes"; then
-AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
-fi
-])
-
-AC_DEFUN([MYSQL_HAVE_TIOCSTAT],
-[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
-AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/ioctl.h>], [int x = TIOCSTAT;],
- mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
-AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
-if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then
-AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
- [declaration of TIOCSTAT in sys/ioctl.h])
-fi
-])
-
-AC_DEFUN([MYSQL_STRUCT_DIRENT_D_INO],
-[AC_REQUIRE([AC_HEADER_DIRENT])
-AC_MSG_CHECKING(if struct dirent has a d_ino member)
-AC_CACHE_VAL(mysql_cv_dirent_has_dino,
-[AC_TRY_COMPILE([
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#if defined(HAVE_DIRENT_H)
-# include <dirent.h>
-#else
-# define dirent direct
-# ifdef HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif /* SYSNDIR */
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif /* SYSDIR */
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif /* HAVE_DIRENT_H */
-],[
-struct dirent d; int z; z = d.d_ino;
-], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
-AC_MSG_RESULT($mysql_cv_dirent_has_dino)
-if test "$mysql_cv_dirent_has_dino" = "yes"; then
-AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
- [d_ino member present in struct dirent])
-fi
-])
-
-AC_DEFUN([MYSQL_STRUCT_DIRENT_D_NAMLEN],
-[AC_REQUIRE([AC_HEADER_DIRENT])
-AC_MSG_CHECKING(if struct dirent has a d_namlen member)
-AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
-[AC_TRY_COMPILE([
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#if defined(HAVE_DIRENT_H)
-# include <dirent.h>
-#else
-# define dirent direct
-# ifdef HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif /* SYSNDIR */
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif /* SYSDIR */
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif /* HAVE_DIRENT_H */
-],[
-struct dirent d; int z; z = (int)d.d_namlen;
-], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
-AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
-if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
-AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
- [d_namlen member present in struct dirent])
-fi
-])
-
-
-AC_DEFUN([MYSQL_TYPE_SIGHANDLER],
-[AC_MSG_CHECKING([whether signal handlers are of type void])
-AC_CACHE_VAL(mysql_cv_void_sighandler,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C"
-#endif
-void (*signal ()) ();],
-[int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
-AC_MSG_RESULT($mysql_cv_void_sighandler)
-if test "$mysql_cv_void_sighandler" = "yes"; then
-AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
-fi
-])
-
-AC_DEFUN([MYSQL_CXX_BOOL],
-[
-AC_REQUIRE([AC_PROG_CXX])
-AC_MSG_CHECKING(if ${CXX} supports bool types)
-AC_CACHE_VAL(mysql_cv_have_bool,
-[
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-AC_TRY_COMPILE(,[bool b = true;],
-mysql_cv_have_bool=yes,
-mysql_cv_have_bool=no)
-AC_LANG_RESTORE
-])
-AC_MSG_RESULT($mysql_cv_have_bool)
-if test "$mysql_cv_have_bool" = yes; then
-AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
-fi
-])dnl
-
-AC_DEFUN([MYSQL_STACK_DIRECTION],
- [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
- [AC_TRY_RUN([#include <stdlib.h>
- /* Prevent compiler optimization by HP's compiler, see bug#42213 */
-#if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux)
-#pragma noinline
-#endif
- int find_stack_direction ()
- {
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
- }
- int main ()
- {
- exit (find_stack_direction() < 0);
- }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
- ac_cv_c_stack_direction=)])
- AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-])dnl
-
-AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
-[
-AC_MSG_CHECKING(if conversion of longlong to float works)
-AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
-[AC_TRY_RUN([#include <stdio.h>
-typedef long long longlong;
-int main()
-{
- longlong ll=1;
- float f;
- FILE *file=fopen("conftestval", "w");
- f = (float) ll;
- fprintf(file,"%g\n",f);
- fclose(file);
- return (0);
-}], ac_cv_conv_longlong_to_float=`cat conftestval`,
- ac_cv_conv_longlong_to_float=0,
- ac_cv_conv_longlong_to_float="yes")])dnl # Cross compiling, assume can convert
-if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
-then
- ac_cv_conv_longlong_to_float=yes
-else
- ac_cv_conv_longlong_to_float=no
-fi
-AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
-])
-
-AC_DEFUN([MYSQL_CHECK_VIO], [
-dnl
-dnl we always use vio: no need for special defines
-dnl
- AC_DEFINE([HAVE_VIO_READ_BUFF], [1],
- [Define to enable buffered read. This works only if syscalls
- read/recv return as soon as there is some data in the kernel
- buffer, no matter how big the given buffer is.])
-])
-
-# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
-# include #stdlib.h as default as this breaks things on Solaris
-# (Conflicts with pthreads and big file handling)
-
-m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
-[for ac_declaration in \
- ''\
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);' \
- '#include <stdlib.h>'
-do
- _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
-@%:@include <stdlib.h>],
- [exit (42);])],
- [],
- [continue])
- _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration],
- [exit (42);])],
- [break])
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-])# _AC_PROG_CXX_EXIT_DECLARATION
-
-dnl ---------------------------------------------------------------------------
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_CHECK_BIG_TABLES
-dnl Sets BIG_TABLES if --with-big-tables is used
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
- AC_ARG_WITH([big-tables],
- AS_HELP_STRING([--with-big-tables],
- [Support tables with more than 4 G rows even on 32 bit platforms]),
- [bigtables="$withval"],
- [bigtables=no])
- AC_MSG_CHECKING([for big tables support])
-
- case "$bigtables" in
- yes )
- AC_DEFINE([BIG_TABLES], [1], [Support big tables])
- AC_MSG_RESULT([yes])
- ;;
- * )
- AC_MSG_RESULT([no])
- ;;
- esac
-
-])
-dnl ---------------------------------------------------------------------------
-dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
-dnl ---------------------------------------------------------------------------
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_CHECK_MAX_INDEXES
-dnl Sets MAX_INDEXES
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [
- AC_ARG_WITH([max-indexes],
- AS_HELP_STRING([--with-max-indexes=N],
- [Sets the maximum number of indexes per table, default 64]),
- [max_indexes="$withval"],
- [max_indexes=64])
- AC_MSG_CHECKING([max indexes per table])
- AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
- [Maximum number of indexes per table])
- AC_MSG_RESULT([$max_indexes])
-])
-dnl ---------------------------------------------------------------------------
-dnl END OF MYSQL_CHECK_MAX_INDEXES SECTION
-dnl ---------------------------------------------------------------------------
-
-
-dnl MYSQL_NEEDS_MYSYS_NEW
-AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
-[AC_CACHE_CHECK([needs mysys_new helpers], mysql_cv_use_mysys_new,
-[
-AC_LANG_PUSH(C++)
-AC_TRY_LINK([], [
-class A { public: int b; }; A *a=new A; a->b=10; delete a;
-], mysql_cv_use_mysys_new=no, mysql_cv_use_mysys_new=yes)
-AC_LANG_POP(C++)
-])
-if test "$mysql_cv_use_mysys_new" = "yes"
-then
- AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
-fi
-])
-
-
-AC_DEFUN([MYSQL_CHECK_CXX_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
-if test "$CXX_VERSION"
-then
- AC_MSG_CHECKING("C++ compiler version")
- AC_MSG_RESULT("$CXX $CXX_VERSION")
-fi
-AC_SUBST(CXX_VERSION)
-])
-
-AC_DEFUN([MYSQL_PROG_AR], [
-case $CXX_VERSION in
- MIPSpro*)
- AR=$CXX
- ARFLAGS="-ar -o"
- ;;
- *Forte*)
- AR=$CXX
- ARFLAGS="-xar -o"
- ;;
- *)
- AC_CHECK_PROG([AR], [ar], [ar])
- if test -z "$AR" || test "$AR" = "false"
- then
- AC_MSG_ERROR([You need ar to build the library])
- fi
- if test -z "$ARFLAGS"
- then
- ARFLAGS="cru"
- fi
-esac
-AC_SUBST(AR)
-AC_SUBST(ARFLAGS)
-])
-
-dnl
-dnl Macro to check time_t range: according to C standard
-dnl array index must be greater than 0 => if time_t is signed,
-dnl the code in the macros below won't compile.
-dnl
-
-AC_DEFUN([MYSQL_CHECK_TIME_T],[
- AC_MSG_CHECKING(if time_t is unsigned)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[
-#include <time.h>
- ]],
- [[
- int array[(((time_t)-1) > 0) ? 1 : -1];
- ]] )
- ], [
- AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
- AC_MSG_RESULT(yes)
- ],
- [AC_MSG_RESULT(no)]
- )
-])
-
diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4
deleted file mode 100644
index 2aed1267fe6..00000000000
--- a/config/ac-macros/plugins.m4
+++ /dev/null
@@ -1,862 +0,0 @@
-dnl ===========================================================================
-dnl Support for mysql server plugins
-dnl ===========================================================================
-dnl
-dnl WorkLog#3201
-dnl
-dnl Framework for pluggable static and dynamic plugins for mysql
-dnl
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN([name],[Plugin name],
-dnl [Plugin description],
-dnl [group,group...])
-dnl
-dnl DESCRIPTION
-dnl First declaration for a plugin (mandatory).
-dnl Adds plugin as member to configuration groups (if specified)
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN],[
- _MYSQL_PLUGIN(
- [$1],
- [__MYSQL_PLUGIN_]AS_TR_CPP([$1])[__],
- m4_default([$2], [$1 plugin]),
- m4_default([$3], [plugin for $1]),
- m4_default([$4], []),
- )
-])
-
-AC_DEFUN([_MYSQL_PLUGIN],[
- m4_ifdef([$2], [
- AC_FATAL([Duplicate MYSQL_PLUGIN declaration for $3])
- ],[
- m4_define([$2], [$1])
- _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1])
- m4_define([MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]), [$3])
- m4_define([MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]), [$4])
- _MYSQL_PLUGAPPEND_META([$1], $5)
- ifelse(m4_bregexp(__mysql_include__,[/plug\.in$]),-1,[],[
- MYSQL_PLUGIN_DIRECTORY([$1],
- m4_bregexp(__mysql_include__,[^\(.*\)/plug\.in$],[\1]))
- ])
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_STORAGE_ENGINE
-dnl
-dnl SYNOPSIS
-dnl MYSQL_STORAGE_ENGINE([name],[legacy-option],[Storage engine name],
-dnl [Storage engine description],[group,group...])
-dnl
-dnl DESCRIPTION
-dnl Short cut for storage engine declarations
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_STORAGE_ENGINE],[
- MYSQL_PLUGIN([$1], [$3], [$4], [[$5]])
- MYSQL_PLUGIN_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE])
- ifelse([$2],[no],[],[
- _MYSQL_LEGACY_STORAGE_ENGINE(
- m4_bpatsubst([$1], -, _),
- m4_bpatsubst(m4_default([$2], [$1-storage-engine]), -, _))
- ])
-])
-
-AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[
-if test "[${with_]$2[+set}]" = set; then
- [with_plugin_]$1="[$with_]$2"
-fi
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DEFINE
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DEFINE([name],[MYSQL_CPP_DEFINE])
-dnl
-dnl DESCRIPTION
-dnl When a plugin is to be statically linked, define the C macro
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DEFINE],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]), [$2])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DIRECTORY
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DIRECTORY([name],[plugin/dir])
-dnl
-dnl DESCRIPTION
-dnl Adds a directory to the build process
-dnl if it contains 'configure' it will be picked up automatically
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DIRECTORY],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]), [$2])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_STATIC
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a])
-dnl
-dnl DESCRIPTION
-dnl Declare the name for the static library
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_STATIC],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), [$2])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DYNAMIC
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DYNAMIC([name],[myplugin.la])
-dnl
-dnl DESCRIPTION
-dnl Declare the name for the shared library
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DYNAMIC],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]), [$2])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_MANDATORY
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_MANDATORY([name])
-dnl
-dnl DESCRIPTION
-dnl Marks the specified plugin as a mandatory plugin
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_MANDATORY],[
- MYSQL_REQUIRE_PLUGIN([$1])
- _MYSQL_PLUGIN_MANDATORY([$1],
- [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1])
- )
-])
-
-AC_DEFUN([_MYSQL_PLUGIN_MANDATORY],[
- m4_define([$2], [yes])
- m4_ifdef([$3], [
- AC_FATAL([mandatory plugin $1 has been disabled])
- m4_undefine([$2])
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DISABLED
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DISABLED([name])
-dnl
-dnl DESCRIPTION
-dnl Marks the specified plugin as a disabled plugin
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DISABLED],[
- MYSQL_REQUIRE_PLUGIN([$1])
- _MYSQL_PLUGIN_DISABLED([$1],
- [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1])
- )
-])
-
-AC_DEFUN([_MYSQL_PLUGIN_DISABLED],[
- m4_define([$2], [yes])
- m4_ifdef([$3], [
- AC_FATAL([attempt to disable mandatory plugin $1])
- m4_undefine([$2])
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DEPENDS
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DEPENDS([name],[prereq,prereq...])
-dnl
-dnl DESCRIPTION
-dnl Enables other plugins neccessary for the named plugin
-dnl Dependency checking is not recursive so if any
-dnl required plugin requires further plugins, list them
-dnl here too!
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DEPENDS],[
- MYSQL_REQUIRE_PLUGIN([$1])
- ifelse($#, 2, [
- _MYSQL_PLUGIN_DEPEND([$1], $2)
- ], [
- AC_FATAL([bad number of arguments])
- ])
-])
-
-AC_DEFUN([_MYSQL_PLUGIN_DEPEND],[
- ifelse($#, 1, [], [$#:$2], [2:], [], [
- MYSQL_REQUIRE_PLUGIN([$2])
- _MYSQL_PLUGAPPEND([__mysql_plugdepends_$1__],[$2])
- _MYSQL_PLUGIN_DEPEND([$1], m4_shift(m4_shift($@)))
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_ACTIONS
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_ACTIONS([name],[PLUGIN_CONFIGURE_STUFF])
-dnl
-dnl DESCRIPTION
-dnl Declares additional autoconf actions required to configure the plugin
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_ACTIONS],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_ifdef([$2],[
- m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2]))
- ],[
- m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]), [$2])
- ])
-])
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS([name],[file name])
-dnl
-dnl DESCRIPTION
-dnl Some modules in plugins keep dependance on structures
-dnl declared in sql/ (THD class usually)
-dnl That has to be fixed in the future, but until then
-dnl we have to recompile these modules when we want to
-dnl to compile server parts with the different #defines
-dnl Normally it happens when we compile the embedded server
-dnl Thus one should mark such files in his handler using this macro
-dnl (currently only one such a file per plugin is supported)
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]), [$2])
-])
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_CONFIGURE_PLUGINS
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DEPENDS([name,name...])
-dnl
-dnl DESCRIPTION
-dnl Used last, emits all required shell code to configure the plugins
-dnl Argument is a list of default plugins or meta-plugin
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
- m4_ifdef([__mysql_plugin_configured__],[
- AC_FATAL([cannot use [MYSQL_CONFIGURE_PLUGINS] multiple times])
- ],[
- m4_define([__mysql_plugin_configured__],[done])
- _MYSQL_INCLUDE_LIST(
- m4_bpatsubst(m4_esyscmd([ls plugin/*/plug.in storage/*/plug.in 2>/dev/null]),
-[[
-]],[,]))
- m4_ifdef([__mysql_plugin_list__],[
- _MYSQL_CHECK_PLUGIN_ARGS([$1])
- _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
- _MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
- AC_SUBST([mysql_se_dirs])
- AC_SUBST([mysql_se_distdirs])
- AC_SUBST([mysql_pg_dirs])
- AC_SUBST([mysql_pg_distdirs])
- AC_SUBST([mysql_se_unittest_dirs])
- AC_SUBST([mysql_pg_unittest_dirs])
- AC_SUBST([condition_dependent_plugin_modules])
- AC_SUBST([condition_dependent_plugin_objects])
- AC_SUBST([condition_dependent_plugin_links])
- AC_SUBST([condition_dependent_plugin_includes])
- ])
- ])
-])
-
-AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[
- ifelse($#, 0, [], $#, 1, [
- _MYSQL_EMIT_CHECK_PLUGIN([$1])
- ],[
- _MYSQL_EMIT_CHECK_PLUGIN([$1])
- _MYSQL_CONFIGURE_PLUGINS(m4_shift($@))
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_CHECK_PLUGIN],[
- __MYSQL_EMIT_CHECK_PLUGIN(
- [$1],
- m4_bpatsubst([$1], -, _),
- [MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1])
- )
-])
-
-AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
- m4_ifdef([$5],[
- AH_TEMPLATE($5, [Include ]$4[ into mysqld])
- ])
- AC_MSG_CHECKING([whether to use ]$3)
- mysql_use_plugin_dir=""
- m4_ifdef([$10],[
- if test "X[$mysql_plugin_]$2" = Xyes -a \
- "X[$with_plugin_]$2" != Xno -o \
- "X[$with_plugin_]$2" = Xyes; then
- AC_MSG_RESULT([error])
- AC_MSG_ERROR([disabled])
- fi
- AC_MSG_RESULT([no])
- ],[
-
- # Plugin is not disabled, determine if it should be built,
- # or only distributed
-
- m4_ifdef([$6], [
- if test ! -d "$srcdir/$6"; then
- # Plugin directory was removed after autoconf was run; treat
- # this as a disabled plugin
- if test "X[$with_plugin_]$2" = Xyes; then
- AC_MSG_RESULT([error])
- AC_MSG_ERROR([disabled])
- fi
-
- # The result message will be printed below
- [with_plugin_]$2=no
- fi
- ])
-
- m4_ifdef([$9],[
- if test "X[$with_plugin_]$2" = Xno; then
- AC_MSG_RESULT([error])
- AC_MSG_ERROR([cannot disable mandatory plugin])
- fi
- [mysql_plugin_]$2=yes
- ],[
- case "$with_mysqld_ldflags " in
- *"-all-static "*)
- # No need to build shared plugins when mysqld is linked with
- # -all-static as it won't be able to load them.
- if test "X[$mysql_plugin_]$2" != Xyes -a \
- "X[$with_plugin_]$2" != Xyes; then
- [with_plugin_]$2=no
- fi
- ;;
- esac
- ])
-
-
- if test "X[$with_plugin_]$2" = Xno; then
- AC_MSG_RESULT([no])
- else
- m4_ifdef([$8],m4_ifdef([$7],[],[[with_plugin_]$2='']))
- if test "X[$mysql_plugin_]$2" != Xyes -a \
- "X[$with_plugin_]$2" != Xyes; then
- m4_ifdef([$8],[
- m4_ifdef([$6],[
- if test -d "$srcdir/$6" ; then
- mysql_use_plugin_dir="$6"
- ])
- AC_SUBST([plugin_]$2[_shared_target], "$8")
- AC_SUBST([plugin_]$2[_static_target], [""])
- [with_plugin_]$2=yes
- AC_MSG_RESULT([plugin])
- m4_ifdef([$6],[
- else
- [mysql_plugin_]$2=no
- AC_MSG_RESULT([no])
- fi
- ])
- ],[
- [with_plugin_]$2=no
- AC_MSG_RESULT([no])
- ])
- else
- m4_ifdef([$7],[
- ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [
-dnl change above "-2" to "0" to enable this section
-dnl Although this is "pretty", it breaks libmysqld build
- m4_ifdef([$6],[
- mysql_use_plugin_dir="$6"
- mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6"
- ])
- mysql_plugin_libs="$mysql_plugin_libs dnl
-[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])"
- ], m4_bregexp($7, [^\\\$]), 0, [
- m4_ifdef([$6],[
- mysql_use_plugin_dir="$6"
- ])
- mysql_plugin_libs="$mysql_plugin_libs $7"
- ], [
- m4_ifdef([$6],[
- mysql_use_plugin_dir="$6"
- mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7"
- ],[
- mysql_plugin_libs="$mysql_plugin_libs $7"
- ])
- ])
- m4_ifdef([$5],[
- AC_DEFINE($5)
- ])
- AC_SUBST([plugin_]$2[_static_target], "$7")
- AC_SUBST([plugin_]$2[_shared_target], [""])
- ],[
- m4_ifdef([$6],[
- AC_MSG_RESULT([error])
- AC_MSG_ERROR([Plugin $1 does not support static linking])
- ],[
- m4_ifdef([$5],[
- AC_DEFINE($5)
- AC_SUBST([plugin_]$2[_static_target], ["yes"])
- AC_SUBST([plugin_]$2[_shared_target], [""])
- ])
- ])
- ])
- m4_ifdef([$9],[
- mysql_mandatory_plugins="$mysql_mandatory_plugins [builtin_]$2[_plugin],"
- ],[
- mysql_optional_plugins="$mysql_optional_plugins [builtin_]$2[_plugin],"
- ])
- [with_plugin_]$2=yes
- AC_MSG_RESULT([yes])
- m4_ifdef([$11],[
- condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp($11, [[^/]+$], [\&])"
- condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp($11, [[^/]+\.], [\&o])"
- condition_dependent_plugin_links="$condition_dependent_plugin_links $6/$11"
- condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])"
- ])
- fi
- fi
-
- m4_ifdef([$6], [
- if test -d "$srcdir/$6"; then
- # Even if we don't build a plugin, we bundle its source into the dist
- # file. So its Makefile (and Makefiles for any subdirs) must be
- # generated for 'make dist' to work.
- m4_syscmd([test -f "]$6[/configure"])
- ifelse(m4_sysval, 0,
- [AC_CONFIG_SUBDIRS($6)],
- [
- # autoconf doesn't provide an automatic way to configure DIST_SUBDIRS of
- # a subdir; for our purposes, it's enough to just check for existing
- # Makefile.am files and add them in here
-dnl
-dnl Warning, don't try to quote the m4_esyscmd() macro, it doesn't
-dnl work. Quoting here is tricky.
-dnl
-dnl The $FIND or $SED variable can be set by the user when calling autoconf itself
-dnl to if they need to pass a specific path. This is *NOT* used when calling
-dnl running configure!
-dnl
- AC_CONFIG_FILES(m4_esyscmd([${FIND-find} "]$6[" -name Makefile.am -print | ${SED-sed} 's,\.am$,,']))
- ]
- )
-
- ifelse(
- m4_substr($6, 0, 8), [storage/], [
- mysql_se_distdirs="$mysql_se_distdirs m4_substr($6, 8)"
- if test -n "$mysql_use_plugin_dir" ; then
- mysql_se_dirs="$mysql_se_dirs m4_substr($6, 8)"
- mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
- fi],
-
- m4_substr($6, 0, 7), [plugin/], [
- mysql_pg_distdirs="$mysql_pg_distdirs m4_substr($6, 7)"
- if test -n "$mysql_use_plugin_dir" ; then
- mysql_pg_dirs="$mysql_pg_dirs m4_substr($6, 7)"
- mysql_pg_unittest_dirs="$mysql_pg_unittest_dirs ../$6"
- fi],
- [AC_FATAL([don't know how to handle plugin dir ]$6)])
- fi
- ])
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_PLUGIN_ACTIONS],[
- ifelse($#, 0, [], $#, 1, [
- _MYSQL_EMIT_PLUGIN_ACTION([$1])
- ],[
- _MYSQL_EMIT_PLUGIN_ACTION([$1])
- _MYSQL_EMIT_PLUGIN_ACTIONS(m4_shift($@))
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_PLUGIN_ACTION],[
- __MYSQL_EMIT_PLUGIN_ACTION(
- [$1],
- m4_bpatsubst([$1], -, _),
- [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1])
- )
-])
-
-
-AC_DEFUN([__MYSQL_EMIT_PLUGIN_ACTION],[
- m4_ifdef([$3], [], [
- if test "X[$with_plugin_]$2" = Xyes; then
- if test "X[$plugin_]$2[_static_target]" = X -a \
- "X[$plugin_]$2[_shared_target]" = X; then
- AC_MSG_ERROR([that's strange, $1 failed sanity check])
- fi
- $4
- fi
- ])
-])
-
-
-
-dnl ===========================================================================
-dnl Private helper macros
-dnl ===========================================================================
-
-
-dnl SYNOPSIS
-dnl MYSQL_REQUIRE_PLUGIN([name])
-dnl
-dnl DESCRIPTION
-dnl Checks that the specified plugin does exist
-
-AC_DEFUN([MYSQL_REQUIRE_PLUGIN],[
- _MYSQL_REQUIRE_PLUGIN([$1], [__MYSQL_PLUGIN_]AS_TR_CPP([$1])[__])
-])
-
-define([_MYSQL_REQUIRE_PLUGIN],[
- ifdef([$2],[
- ifelse($2, [$1], [], [
- AC_FATAL([Misspelt MYSQL_PLUGIN declaration for $1])
- ])
- ],[
- AC_FATAL([Missing MYSQL_PLUGIN declaration for $1])
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-
-
-dnl SYNOPSIS
-dnl _MYSQL_EMIT_METAPLUGINS([name,name...])
-dnl
-dnl DESCRIPTION
-dnl Emits shell code for metaplugins
-
-AC_DEFUN([_MYSQL_EMIT_METAPLUGINS], [ifelse($#, 0, [], $#, 1,
-[_MYSQL_EMIT_METAPLUGIN([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__])
-],
-[_MYSQL_EMIT_METAPLUGIN([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__])
-_MYSQL_EMIT_METAPLUGINS(m4_shift($@))])
-])
-
-AC_DEFUN([_MYSQL_EMIT_METAPLUGIN], [
- [$1] )
-m4_ifdef([$2], [
- mysql_plugins='m4_bpatsubst($2, :, [ ])'
-],[
- mysql_plugins=''
-])
- ;;
-])
-
-
-dnl ---------------------------------------------------------------------------
-
-
-dnl SYNOPSIS
-dnl _MYSQL_PLUGAPPEND([name],[to-append])
-dnl
-dnl DESCRIPTION
-dnl Helper macro for appending to colon-delimited lists
-dnl Optinal 3rd argument is for actions only required when defining
-dnl macro named for the first time.
-
-AC_DEFUN([_MYSQL_PLUGAPPEND],[
- m4_ifdef([$1],[
- m4_define([__plugin_append_tmp__], m4_defn([$1]))
- m4_undefine([$1])
- m4_define([$1], __plugin_append_tmp__[:$2])
- m4_undefine([__plugin_append_tmp__])
- ],[
- m4_define([$1], [$2])
- $3
- ])
-])
-
-
-dnl SYNOPSIS
-dnl _MYSQL_PLUGAPPEND_META([name],[meta,meta...])
-dnl
-dnl DESCRIPTION
-dnl Helper macro for adding plugins to meta plugins
-
-AC_DEFUN([_MYSQL_PLUGAPPEND_META],[
- ifelse($#, 1, [], [$#:$2], [2:], [], [$2], [all], [
- AC_FATAL([protected plugin group: all])
- ], [$2], [none], [
- AC_FATAL([protected plugin group: none])
- ],[
- _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2])
- _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [
- _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2])
- ])
- _MYSQL_PLUGAPPEND_META([$1], m4_shift(m4_shift($@)))
- ])
-])
-
-
-dnl ---------------------------------------------------------------------------
-
-
-dnl SYNOPSIS
-dnl MYSQL_LIST_PLUGINS
-dnl
-dnl DESCRIPTION
-dnl Emits formatted list of declared plugins
-
-AC_DEFUN([MYSQL_LIST_PLUGINS],[dnl
- m4_ifdef([__mysql_plugin_list__],[dnl
- _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))dnl
- ])dnl
-])
-
-AC_DEFUN([_MYSQL_LIST_PLUGINS],[dnl
- ifelse($#, 0, [], $#, 1, [dnl
- MYSQL_SHOW_PLUGIN([$1])dnl
- ],[dnl
- MYSQL_SHOW_PLUGIN([$1])dnl
- _MYSQL_LIST_PLUGINS(m4_shift($@))dnl
- ])dnl
-])
-
-AC_DEFUN([MYSQL_SHOW_PLUGIN],[
- _MYSQL_SHOW_PLUGIN(
- [$1],
- [$1-plugin],
- [MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DESC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DEFINE_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DIRECTORY_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]),
- __mysql_[$1]_configs__,
- )
-])
-
-AC_DEFUN([_MYSQL_SHOW_PLUGIN],[dnl
- === $3 ===
- Plugin Name: [$1]
- Description: $4
- Supports build: _PLUGIN_BUILD_TYPE([$7],[$8])[]dnl
-m4_ifdef([$12],[
- Configurations: m4_bpatsubst($12, :, [, ])])[]dnl
-m4_ifdef([$10],[
- Status: disabled])[]dnl
-m4_ifdef([$9],[
- Status: mandatory])[]dnl
-])
-
-AC_DEFUN([_PLUGIN_BUILD_TYPE],
-[m4_ifdef([$1],[static ]m4_ifdef([$2],[and dnl
-]))[]m4_ifdef([$2],[dynamic],[m4_ifdef([$1],[],[static])])])
-
-
-dnl ---------------------------------------------------------------------------
-
-
-AC_DEFUN([_MYSQL_EMIT_PLUGINS],[
- ifelse($#, 0, [], [$#:$1], [1:], [], [
- m4_ifdef([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]), [], [
- m4_define([MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]),[ ])
- ])
- [$1] )
- m4_ifdef([MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),[
- AC_MSG_ERROR([plugin $1 is disabled])
- ],[
- _MYSQL_EMIT_PLUGIN_ENABLE([$1], m4_bpatsubst([$1], -, _),
- [MYSQL_PLUGIN_NAME_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]))
- ])
- ;;
- _MYSQL_EMIT_PLUGINS(m4_shift($@))
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_PLUGIN_ENABLE],[
- m4_ifdef([$5],m4_ifdef([$4],[
- [mysql_plugin_]$2=yes
- ],[
- AC_MSG_WARN([$3 can only be built as a plugin])
- ]),[
- [mysql_plugin_]$2=yes
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_PLUGIN_DEPENDS], [
- ifelse($#, 0, [], [$#:$1], [1:], [], [
- _MYSQL_EMIT_CHECK_DEPENDS(m4_bpatsubst([$1], -, _),
- [__mysql_plugdepends_$1__])
- _MYSQL_EMIT_PLUGIN_DEPENDS(m4_shift($@))
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_CHECK_DEPENDS], [
- m4_ifdef([$2], [
- if test "X[$mysql_plugin_]$1" = Xyes -a \
- "X[$with_plugin_]$1" != Xno -o \
- "X[$with_plugin_]$1" = Xyes; then
- _MYSQL_EMIT_PLUGIN_DEPENDENCIES(m4_bpatsubst($2, :, [,]))
- fi
- ])
-])
-
-AC_DEFUN([_MYSQL_EMIT_PLUGIN_DEPENDENCIES], [
- ifelse([$1], [], [], [
- m4_ifdef([MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),[
- AC_MSG_ERROR([depends upon disabled plugin $1])
- ],[
- [mysql_plugin_]m4_bpatsubst([$1], -, _)=yes
- if test "X[$with_plugin_]m4_bpatsubst([$1], -, _)" = Xno; then
- AC_MSG_ERROR([depends upon disabled plugin $1])
- fi
- ])
- _MYSQL_EMIT_PLUGIN_DEPENDENCIES(m4_shift($@))
- ])
-])
-
-dnl SYNOPSIS
-dnl _MYSQL_CHECK_PLUGIN_ARGS([plugin],[plugin]...)
-dnl
-dnl DESCRIPTION
-dnl Emits shell script for checking configure arguments
-dnl Arguments to this macro is default value for selected plugins
-
-AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[
- __MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [default]))
-])
-
-AC_DEFUN([__MYSQL_CHECK_PLUGIN_ARGS],[
- AC_ARG_WITH([plugins],
-AS_HELP_STRING([--with-plugins=PLUGIN[[[[[,PLUGIN..]]]]]],
- [Plugins to include in mysqld. (default is: $1) Must be a
- configuration name or a comma separated list of plugins.])
-AS_HELP_STRING([],
- [Available configurations are:] dnl
-m4_bpatsubst([none:]m4_ifdef([__mysql_metaplugin_list__],
- __mysql_metaplugin_list__:)[all], :, [ ])[.])
-AS_HELP_STRING([],
- [Available plugins are:] dnl
-m4_bpatsubst(__mysql_plugin_list__, :, [ ])[.])
-AS_HELP_STRING([--without-plugin-PLUGIN],
- [Disable the named plugin from being built. Otherwise, for
- plugins which are not selected for inclusion in mysqld will be
- built dynamically (if supported)])
-AS_HELP_STRING([--with-plugin-PLUGIN],
- [Forces the named plugin to be linked into mysqld statically.]),
- [mysql_plugins="`echo $withval | tr ',.:;*[]' ' '`"],
- [mysql_plugins=['$1']])
-
-m4_divert_once([HELP_VAR_END],[
-Description of plugins:
-MYSQL_LIST_PLUGINS])
-
- case "$mysql_plugins" in
- all )
- mysql_plugins='m4_bpatsubst(__mysql_plugin_list__, :, [ ])'
- ;;
- none )
- mysql_plugins=''
- ;;
-m4_ifdef([__mysql_metaplugin_list__],[
-_MYSQL_EMIT_METAPLUGINS(m4_bpatsubst(__mysql_metaplugin_list__, :, [,]))
-])
- esac
-
- for plugin in $mysql_plugins; do
- case "$plugin" in
- all | none )
- AC_MSG_ERROR([bad plugin name: $plugin])
- ;;
-_MYSQL_EMIT_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
- * )
- AC_MSG_ERROR([unknown plugin: $plugin])
- ;;
- esac
- done
-
- _MYSQL_EMIT_PLUGIN_DEPENDS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
-])
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: _MYSQL_INCLUDE_LIST
-dnl
-dnl SYNOPSIS
-dnl _MYSQL_INCLUDE_LIST([filename,filename...])
-dnl
-dnl DESCRIPTION
-dnl includes all files from the list
-dnl
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([_MYSQL_INCLUDE_LIST],[
- ifelse([$1], [], [], [
- m4_define([__mysql_include__],[$1])
- dnl We have to use builtin(), because sinclude would generate an error
- dnl "file $1 does not exists" in aclocal-1.8 - which is a bug, clearly
- dnl violating m4 specs, and which is fixed in aclocal-1.9
- builtin([include],$1)
- m4_undefine([__mysql_include__])
- _MYSQL_INCLUDE_LIST(m4_shift($@))
- ])
-])
-
-dnl ===========================================================================
diff --git a/config/ac-macros/readline.m4 b/config/ac-macros/readline.m4
deleted file mode 100644
index e1ed8420bfb..00000000000
--- a/config/ac-macros/readline.m4
+++ /dev/null
@@ -1,143 +0,0 @@
-AC_DEFUN([MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY], [
- AC_CACHE_CHECK([HIST_ENTRY is declared in readline/readline.h], mysql_cv_hist_entry_declared,
- AC_TRY_COMPILE(
- [
- #include "stdio.h"
- #include "readline/readline.h"
- ],
- [
- HIST_ENTRY entry;
- ],
- [
- mysql_cv_hist_entry_declared=yes
- AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, [1],
- [HIST_ENTRY is defined in the outer libeditreadline])
- ],
- [mysql_cv_libedit_interface=no]
- )
- )
-])
-
-AC_DEFUN([MYSQL_CHECK_LIBEDIT_INTERFACE], [
- AC_CACHE_CHECK([libedit variant of rl_completion_entry_function], mysql_cv_libedit_interface,
- AC_TRY_COMPILE(
- [
- #include "stdio.h"
- #include "readline/readline.h"
- ],
- [
- char res= *(*rl_completion_entry_function)(0,0);
- completion_matches(0,0);
- ],
- [
- mysql_cv_libedit_interface=yes
- AC_DEFINE_UNQUOTED([USE_LIBEDIT_INTERFACE], [1],
- [used libedit interface (can we dereference result of rl_completion_entry_function)])
- ],
- [mysql_cv_libedit_interface=no]
- )
- )
-])
-
-AC_DEFUN([MYSQL_CHECK_NEW_RL_INTERFACE], [
- AC_CACHE_CHECK([defined rl_compentry_func_t and rl_completion_func_t], mysql_cv_new_rl_interface,
- AC_TRY_COMPILE(
- [
- #include "stdio.h"
- #include "readline/readline.h"
- ],
- [
- rl_completion_func_t *func1= (rl_completion_func_t*)0;
- rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
- ],
- [
- mysql_cv_new_rl_interface=yes
- AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1],
- [used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)])
- ],
- [mysql_cv_new_rl_interface=no]
- )
- )
-])
-
-dnl
-dnl check for availability of multibyte characters and functions
-dnl (Based on BASH_CHECK_MULTIBYTE in aclocal.m4 of readline-5.0)
-dnl
-AC_DEFUN([MYSQL_CHECK_MULTIBYTE],
-[
-AC_CHECK_HEADERS(wctype.h)
-AC_CHECK_HEADERS(wchar.h)
-AC_CHECK_HEADERS(langinfo.h)
-
-AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN,[],[Define if you have mbrlen]))
-AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP,[],[Define if you have mbscmp]))
-AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS,[],[Define if you have mbsrtowcs]))
-
-AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB,[],[Define if you have wcrtomb]))
-AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC,[],[Define if you have mbrtowc]))
-AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL,[],[Define if you have wcscoll]))
-AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP,[],[Define if you have wcsdup]))
-AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH,[],[Define if you have wcwidth]))
-AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE,[],[Define if you have wctype]))
-
-AC_CACHE_CHECK([for mbstate_t], mysql_cv_have_mbstate_t,
-[AC_TRY_COMPILE([
-#include <wchar.h>], [
- mbstate_t ps;
- mbstate_t *psp;
- psp = (mbstate_t *)0;
-], mysql_cv_have_mbstate_t=yes, mysql_cv_have_mbstate_t=no)])
-if test $mysql_cv_have_mbstate_t = yes; then
- AC_DEFINE([HAVE_MBSTATE_T],[],[Define if mysql_cv_have_mbstate_t=yes])
-fi
-
-AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
-
-AC_CACHE_CHECK([for nl_langinfo and CODESET], mysql_cv_langinfo_codeset,
-[AC_TRY_LINK(
-[#include <langinfo.h>],
-[char* cs = nl_langinfo(CODESET);],
-mysql_cv_langinfo_codeset=yes, mysql_cv_langinfo_codeset=no)])
-if test $mysql_cv_langinfo_codeset = yes; then
- AC_DEFINE([HAVE_LANGINFO_CODESET],[],[Define if mysql_cv_langinfo_codeset=yes])
-fi
-
-dnl check for wchar_t in <wchar.h>
-AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
-[AC_TRY_COMPILE(
-[#include <wchar.h>
-],
-[
- wchar_t foo;
- foo = 0;
-], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
-if test $bash_cv_type_wchar_t = yes; then
- AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
-fi
-
-dnl check for wctype_t in <wctype.h>
-AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
-[AC_TRY_COMPILE(
-[#include <wctype.h>],
-[
- wctype_t foo;
- foo = 0;
-], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
-if test $bash_cv_type_wctype_t = yes; then
- AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
-fi
-
-dnl check for wint_t in <wctype.h>
-AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
-[AC_TRY_COMPILE(
-[#include <wctype.h>],
-[
- wint_t foo;
- foo = 0;
-], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
-if test $bash_cv_type_wint_t = yes; then
- AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
-fi
-
-])
diff --git a/config/ac-macros/ssl.m4 b/config/ac-macros/ssl.m4
deleted file mode 100644
index fc55f93d8d6..00000000000
--- a/config/ac-macros/ssl.m4
+++ /dev/null
@@ -1,219 +0,0 @@
-dnl ===========================================================================
-dnl Support for SSL
-dnl ===========================================================================
-dnl
-dnl
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_USE_BUNDLED_YASSL
-dnl
-dnl SYNOPSIS
-dnl MYSQL_USE_BUNDLED_YASSL()
-dnl
-dnl DESCRIPTION
-dnl Add defines so yassl is built and linked with
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
-
- with_bundled_yassl="yes"
-
- yassl_dir="yassl"
- AC_SUBST([yassl_dir])
-
- yassl_libs="\$(top_builddir)/extra/yassl/src/libyassl.la \
- \$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la"
- AC_SUBST(yassl_libs)
-
- AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for SSL.])
- AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for SSL.])
-
- # System specific checks
- yassl_integer_extra_cxxflags=""
- case $host_cpu--$CXX_VERSION in
- sparc*--*Sun*C++*5.6*)
- # Disable inlining when compiling taocrypt/src/
- yassl_taocrypt_extra_cxxflags="+d"
- AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/])
- ;;
- esac
- AC_SUBST([yassl_taocrypt_extra_cxxflags])
-
- # Thread safe check
- yassl_thread_cxxflags=""
- yassl_thread_safe=""
- if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"; then
- yassl_thread_cxxflags="-DYASSL_THREAD_SAFE"
- yassl_thread_safe="(thread-safe)"
- fi
- AC_SUBST([yassl_thread_cxxflags])
-
- # Link extra/yassl/include/openssl subdir to include/
- yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
- AC_SUBST(yassl_h_ln_cmd)
-
- AC_MSG_RESULT([using bundled yaSSL $yassl_thread_safe])
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_CHECK_SSL_DIR
-dnl
-dnl SYNOPSIS
-dnl MYSQL_CHECK_SSL_DIR(includes, libs)
-dnl
-dnl DESCRIPTION
-dnl Auxiliary macro to check for ssl at given path
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_CHECK_SSL_DIR], [
-ssl_incs="$1"
-ssl_libs="$2"
-save_CPPFLAGS="$CPPFLAGS"
-save_LIBS="$LIBS"
-CPPFLAGS="$ssl_incs $CPPFLAGS"
-LIBS="$LIBS $ssl_libs"
-AC_TRY_LINK([#include <openssl/ssl.h>],
- [return SSL_library_init();],
- [mysql_ssl_found="yes"],
- [mysql_ssl_found="no"])
-CPPFLAGS="$save_CPPFLAGS"
-LIBS="$save_LIBS"
-])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_FIND_OPENSSL
-dnl
-dnl SYNOPSIS
-dnl MYSQL_FIND_OPENSSL(location)
-dnl
-dnl DESCRIPTION
-dnl Search the location for OpenSSL support
-dnl
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([MYSQL_FIND_OPENSSL], [
- location="$1"
-
- #
- # Set include paths
- #
- openssl_include="$location/include"
- openssl_includes=""
-
- # Don't set ssl_includes to /usr/include as this gives us a lot of
- # compiler warnings when using gcc 3.x
- if test "$openssl_include" != "/usr/include"
- then
- openssl_includes="-I$openssl_include"
- fi
-
- #
- # Try to link with openSSL libs in <location>
- #
- openssl_libs="-L$location/lib/ -lssl -lcrypto"
- MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
-
- if test "$mysql_ssl_found" == "no"
- then
- #
- # BUG 764: Compile failure with OpenSSL on Red Hat Linux (krb5.h missing)
- # Try to link with include paths to kerberos set
- #
- openssl_includes="$openssl_includes -I/usr/kerberos/include"
- MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
- fi
-
- if test "$mysql_ssl_found" == "no"
- then
- AC_MSG_ERROR([Could not link with SSL libs at $location])
- fi
-
- # openssl-devel-0.9.6 requires dlopen() and we can't link staticly
- # on many platforms (We should actually test this here, but it's quite
- # hard to do as we are doing libtool for linking.)
- case "$CLIENT_EXTRA_LDFLAGS $MYSQLD_EXTRA_LDFLAGS" in
- *-all-static*)
- AC_MSG_ERROR([You can't use the --all-static link option when using openssl.])
- ;;
- esac
-
- AC_SUBST(openssl_includes)
- AC_SUBST(openssl_libs)
-
- NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
-
- AC_DEFINE([HAVE_OPENSSL], [1], [OpenSSL])
- AC_MSG_RESULT([using openSSL from $location])
-])
-
-
-
-dnl ------------------------------------------------------------------------
-dnl Macro: MYSQL_CHECK_SSL
-dnl
-dnl SYNOPSIS
-dnl MYSQL_CHECK_SSL
-dnl
-dnl Provides the following configure options:
-dnl --with-ssl=DIR
-dnl Possible DIR values are:
-dnl - no - the macro will disable use of ssl
-dnl - bundled, empty or not specified - means use ssl lib
-dnl bundled along with MySQL sources
-dnl - ssl location prefix - given location prefix, the macro expects
-dnl to find the header files in $prefix/include/, and libraries in
-dnl $prefix/lib. If headers or libraries weren't found at $prefix, the
-dnl macro bails out with error.
-dnl
-dnl ------------------------------------------------------------------------
-AC_DEFUN([MYSQL_CHECK_SSL], [
-
- AC_CONFIG_FILES(extra/yassl/Makefile dnl
- extra/yassl/taocrypt/Makefile dnl
- extra/yassl/taocrypt/benchmark/Makefile dnl
- extra/yassl/taocrypt/src/Makefile dnl
- extra/yassl/taocrypt/test/Makefile dnl
- extra/yassl/src/Makefile dnl
- extra/yassl/testsuite/Makefile)
-
-AC_MSG_CHECKING(for SSL)
- AC_ARG_WITH([ssl],
- [ --with-ssl[=DIR] Include SSL support],
- [mysql_ssl_dir="$withval"],
- [mysql_ssl_dir=no])
-
- if test "$with_yassl"
- then
- AC_MSG_ERROR([The flag --with-yassl is deprecated, use --with-ssl])
- fi
-
- if test "$with_openssl"
- then
- AC_MSG_ERROR([The flag --with-openssl is deprecated, use --with-ssl])
- fi
-
- case "$mysql_ssl_dir" in
- "no")
- #
- # Don't include SSL support
- #
- AC_MSG_RESULT([disabled])
- ;;
-
- "bundled"|"yes")
- #
- # Use the bundled SSL implementation (yaSSL)
- #
- MYSQL_USE_BUNDLED_YASSL
- ;;
-
- *)
- #
- # A location where to search for OpenSSL was specified
- #
- MYSQL_FIND_OPENSSL([$mysql_ssl_dir])
- ;;
- esac
- AM_CONDITIONAL([HAVE_YASSL], [ test "$with_bundled_yassl" = "yes" ])
-])
diff --git a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4
deleted file mode 100644
index f62bb056249..00000000000
--- a/config/ac-macros/zlib.m4
+++ /dev/null
@@ -1,132 +0,0 @@
-dnl Define zlib paths to point at bundled zlib
-
-AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
-ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
-ZLIB_LIBS="\$(top_builddir)/zlib/libzlt.la"
-dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps.
-ZLIB_DEPS="-lz"
-zlib_dir="zlib"
-AC_SUBST([zlib_dir])
-mysql_cv_compress="yes"
-])
-
-dnl Auxiliary macro to check for zlib at given path.
-dnl We are strict with the server, as "archive" engine
-dnl needs zlibCompileFlags(), but for client only we
-dnl are less strict, and take the zlib we find.
-
-AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
-save_CPPFLAGS="$CPPFLAGS"
-save_LIBS="$LIBS"
-CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
-LIBS="$LIBS $ZLIB_LIBS"
-if test X"$with_server" = Xno
-then
- zlibsym=zlibVersion
-else
- zlibsym=zlibCompileFlags
-fi
-AC_CACHE_VAL([mysql_cv_compress],
- [AC_TRY_LINK([#include <zlib.h>],
- [return $zlibsym();],
- [mysql_cv_compress="yes"
- AC_MSG_RESULT([ok])],
- [mysql_cv_compress="no"])
- ])
-CPPFLAGS="$save_CPPFLAGS"
-LIBS="$save_LIBS"
-])
-
-dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
-dnl ------------------------------------------------------------------------
-dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
-dnl
-dnl Provides the following configure options:
-dnl --with-zlib-dir=DIR
-dnl Possible DIR values are:
-dnl - "no" - the macro will disable use of compression functions
-dnl - "bundled" - means use zlib bundled along with MySQL sources
-dnl - empty, or not specified - the macro will try default system
-dnl library (if present), and in case of error will fall back to
-dnl bundled zlib
-dnl - zlib location prefix - given location prefix, the macro expects
-dnl to find the library headers in $prefix/include, and binaries in
-dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
-dnl macro bails out with error.
-dnl
-dnl If the library was found, this function #defines HAVE_COMPRESS
-dnl and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include),
-dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz) and ZLIB_DEPS which is
-dnl used in mysql_config and is always the same as ZLIB_LIBS except to
-dnl when we use the bundled zlib. In the latter case ZLIB_LIBS points to the
-dnl build dir ($top_builddir/zlib), while mysql_config must point to the
-dnl installation dir ($pkglibdir), so ZLIB_DEPS is set to point to
-dnl $pkglibdir.
-
-AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
-
-AC_CONFIG_FILES(zlib/Makefile)
-
-AC_MSG_CHECKING([for zlib compression library])
-case $SYSTEM_TYPE in
-*netware* | *modesto*)
- AC_MSG_RESULT(ok)
- AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
- ;;
- *)
- AC_ARG_WITH([zlib-dir],
- AC_HELP_STRING([--with-zlib-dir=no|bundled|DIR],
- [Provide MySQL with a custom location of
- compression library. Given DIR, zlib binary is
- assumed to be in $DIR/lib and header files
- in $DIR/include.]),
- [mysql_zlib_dir=${withval}],
- [mysql_zlib_dir=""])
- case "$mysql_zlib_dir" in
- "no")
- mysql_cv_compress="no"
- AC_MSG_RESULT([disabled])
- ;;
- "bundled")
- MYSQL_USE_BUNDLED_ZLIB
- AC_MSG_RESULT([using bundled zlib])
- ;;
- "")
- ZLIB_INCLUDES=""
- ZLIB_LIBS="-lz"
- MYSQL_CHECK_ZLIB_DIR
- if test "$mysql_cv_compress" = "no"; then
- MYSQL_USE_BUNDLED_ZLIB
- AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
- fi
- ;;
- *)
- # Test for libz using all known library file endings
- if test \( -f "$mysql_zlib_dir/lib/libz.a" -o \
- -f "$mysql_zlib_dir/lib/libz.so" -o \
- -f "$mysql_zlib_dir/lib/libz.sl" -o \
- -f "$mysql_zlib_dir/lib/libz.dylib" \) \
- -a -f "$mysql_zlib_dir/include/zlib.h"; then
- ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
- ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
- MYSQL_CHECK_ZLIB_DIR
- fi
- if test "x$mysql_cv_compress" != "xyes"; then
- AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,lib}])
- fi
- ;;
- esac
- if test "$mysql_cv_compress" = "yes"; then
- if test "x$ZLIB_DEPS" = "x"; then
- ZLIB_DEPS="$ZLIB_LIBS"
- fi
- AC_SUBST([ZLIB_LIBS])
- AC_SUBST([ZLIB_DEPS])
- AC_SUBST([ZLIB_INCLUDES])
- AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
- fi
- ;;
-esac
-])
-
-dnl ------------------------------------------------------------------------
diff --git a/configure.cmake b/configure.cmake
index 91c39fc5b09..cba9e79ff23 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -299,7 +299,8 @@ CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN)
CHECK_FUNCTION_EXISTS (fchmod HAVE_FCHMOD)
CHECK_FUNCTION_EXISTS (fcntl HAVE_FCNTL)
CHECK_FUNCTION_EXISTS (fconvert HAVE_FCONVERT)
-CHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_FDATASYNC)
+CHECK_FUNCTION_EXISTS (fdatasync HAVE_FDATASYNC)
+CHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_DECL_FDATASYNC)
CHECK_FUNCTION_EXISTS (fesetround HAVE_FESETROUND)
CHECK_FUNCTION_EXISTS (fpsetmask HAVE_FPSETMASK)
CHECK_FUNCTION_EXISTS (fseeko HAVE_FSEEKO)
diff --git a/configure.in b/configure.in
deleted file mode 100644
index c272efe9214..00000000000
--- a/configure.in
+++ /dev/null
@@ -1,3003 +0,0 @@
-dnl -*- ksh -*-
-dnl Process this file with autoconf to produce a configure script.
-
-# 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
-# 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
-
-# Minimum Autoconf version required.
-AC_PREREQ(2.59)
-
-dnl Various people throughout the community may parse configure.in to
-dnl get the MySQL version from the source branch. If the formatting
-dnl of this line is going to be changed, please announce the change to
-dnl internals@lists.mysql.com in advance of pushing the change.
-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.7-rc], [], [mysql])
-
-AC_CONFIG_SRCDIR([sql/mysqld.cc])
-AC_CANONICAL_SYSTEM
-# USTAR format gives us the possibility to store longer path names in
-# TAR files, the path name is split into two parts, a 155 chacater
-# first part and a 100 character second part.
-AM_INIT_AUTOMAKE([1.9 tar-ustar])
-AC_PROG_LIBTOOL
-
-AM_CONFIG_HEADER([include/config.h])
-
-# Request support for automake silent-rules if available.
-# Default to verbose output. One can use the configure-time
-# option --enable-silent-rules or make V=0 to activate
-# silent rules.
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
-
-PROTOCOL_VERSION=10
-DOT_FRM_VERSION=6
-# See the libtool docs for information on how to do shared lib versions.
-SHARED_LIB_MAJOR_VERSION=16
-SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
-NDB_SHARED_LIB_MAJOR_VERSION=3
-NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
-
-# Set all version vars based on $VERSION. How do we do this more elegant ?
-# Remember that regexps needs to quote [ and ] since this is run through m4
-# We take some made up examples
-#
-# VERSION 5.1.40sp1-alpha 5.0.34a 5.5.1-m2
-# MYSQL_U_SCORE_VERSION 5.1.40sp1_alpha 5.0.34a 5.5.1_m2
-# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a 5.5.1
-# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 5.5.1
-# MYSQL_BASE_VERSION 5.1 5.0 5.5
-# MYSQL_VERSION_ID 50140 50034 50501
-#
-MYSQL_U_SCORE_VERSION=`echo $VERSION | sed -e "s|-|_|"`
-MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
-MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
-MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
-MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
- awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
-MYSQL_COPYRIGHT_YEAR=`date '+%Y'`
-
-# Add previous major version for debian package upgrade path
-MYSQL_PREVIOUS_BASE_VERSION=5.0
-
-# The port should be constant for a LONG time
-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)
-sinclude(config/ac-macros/compiler_flag.m4)
-sinclude(config/ac-macros/plugins.m4)
-sinclude(config/ac-macros/dtrace.m4)
-sinclude(config/ac-macros/large_file.m4)
-sinclude(config/ac-macros/misc.m4)
-sinclude(config/ac-macros/readline.m4)
-sinclude(config/ac-macros/ssl.m4)
-sinclude(config/ac-macros/zlib.m4)
-
-# Remember to add a directory sql/share/LANGUAGE
-AVAILABLE_LANGUAGES="\
-czech danish dutch english estonian french german greek hungarian \
-italian japanese korean norwegian norwegian-ny polish portuguese \
-romanian russian serbian slovak spanish swedish ukrainian"
-
-#####
-#####
-
-AC_SUBST(MYSQL_U_SCORE_VERSION)
-AC_SUBST(MYSQL_NO_DASH_VERSION)
-AC_SUBST(MYSQL_BASE_VERSION)
-AC_SUBST(MYSQL_VERSION_ID)
-AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
-AC_SUBST(MYSQL_COPYRIGHT_YEAR)
-AC_SUBST(PROTOCOL_VERSION)
-AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
- [mysql client protocol version])
-AC_SUBST(DOT_FRM_VERSION)
-AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
- [Version of .frm files])
-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.
-
-# Check whether --with-system-type or --without-system-type was given.
-AC_ARG_WITH(system-type,
- [ --with-system-type Set the system type, like "sun-solaris10"],
- [SYSTEM_TYPE="$withval"],
- [SYSTEM_TYPE="$host_vendor-$host_os"])
-AC_ARG_WITH(machine-type,
- [ --with-machine-type Set the machine type, like "powerpc"],
- [MACHINE_TYPE="$withval"],
- [MACHINE_TYPE="$host_cpu"])
-AC_SUBST(SYSTEM_TYPE)
-AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
- [Name of system, eg sun-solaris])
-AC_SUBST(MACHINE_TYPE)
-AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
- [Machine type name, eg sparc])
-
-# Detect intel x86 like processor
-BASE_MACHINE_TYPE=$MACHINE_TYPE
-case $MACHINE_TYPE in
- i?86) BASE_MACHINE_TYPE=i386 ;;
-esac
-
-# Save some variables and the command line options for mysqlbug
-SAVE_CC="$CC"
-SAVE_CXX="$CXX"
-SAVE_ASFLAGS="$ASFLAGS"
-SAVE_CFLAGS="$CFLAGS"
-SAVE_CXXFLAGS="$CXXFLAGS"
-SAVE_LDFLAGS="$LDFLAGS"
-SAVE_CXXLDFLAGS="$CXXLDFLAGS"
-CONF_COMMAND="$0 $ac_configure_args"
-AC_SUBST(CONF_COMMAND)
-AC_SUBST(SAVE_CC)
-AC_SUBST(SAVE_CXX)
-AC_SUBST(SAVE_ASFLAGS)
-AC_SUBST(SAVE_CFLAGS)
-AC_SUBST(SAVE_CXXFLAGS)
-AC_SUBST(SAVE_LDFLAGS)
-AC_SUBST(SAVE_CXXLDFLAGS)
-AC_SUBST(CXXLDFLAGS)
-
-#AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE
-
-AM_SANITY_CHECK
-# This is needed is SUBDIRS is set
-AC_PROG_MAKE_SET
-
-##############################################################################
-# The below section needs to be done before AC_PROG_CC
-##############################################################################
-
-# Hack for OS X/Darwin and Metrowerks CodeWarrior
-AC_ARG_WITH(darwin-mwcc,
-[ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin],[
- if [ "with_darwin_mwcc" = yes ] ; then
- builddir=`pwd`
- ccwrapper="$builddir/support-files/MacOSX/mwcc-wrapper"
- arwrapper="$builddir/support-files/MacOSX/mwar-wrapper"
- CC="$ccwrapper"
- CXX="$ccwrapper"
- LD="$ccwrapper"
- AR="$arwrapper"
- RANLIB=:
- export CC CXX LD AR RANLIB
- AC_SUBST(AR)
- AC_SUBST(RANLIB)
- fi
-])
-
-AM_CONDITIONAL(DARWIN_MWCC, test x$with_darwin_mwcc = xyes)
-
-if test "x${CFLAGS-}" = x ; then
- cflags_is_set=no
-else
- cflags_is_set=yes
-fi
-
-if test "x${CPPFLAGS-}" = x ; then
- cppflags_is_set=no
-else
- cppflags_is_set=yes
-fi
-
-if test "x${LDFLAGS-}" = x ; then
- ldflags_is_set=no
-else
- ldflags_is_set=yes
-fi
-
-################ End of section to be done before AC_PROG_CC #################
-
-# The following hack should ensure that configure doesn't add optimizing
-# or debugging flags to CFLAGS or CXXFLAGS
-# C_EXTRA_FLAGS are flags that are automaticly added to both
-# CFLAGS and CXXFLAGS
-CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
-CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
-
-dnl Checks for programs.
-AC_PROG_AWK
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_CPP
-
-# Print version of CC and CXX compiler (if they support --version)
-CC_VERSION=`$CC --version | sed 1q`
-if test $? -eq "0"
-then
- AC_MSG_CHECKING("C Compiler version")
- AC_MSG_RESULT("$CC $CC_VERSION")
-else
-CC_VERSION=""
-fi
-AC_SUBST(CC_VERSION)
-MYSQL_CHECK_CXX_VERSION
-
-# Fix for sgi gcc / sgiCC which tries to emulate gcc
-if test "$CC" = "sgicc"
-then
- ac_cv_prog_gcc="no"
-fi
-if test "$CXX" = "sgi++"
-then
- GXX="no"
-fi
-
-if test "$ac_cv_prog_gcc" = "yes"
-then
- AS="$CC -c"
- AC_SUBST(AS)
-else
- AC_PATH_PROG(AS, as, as)
-fi
-
-# Still need ranlib for readline; local static use only so no libtool.
-AC_PROG_RANLIB
-# We use libtool
-#AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
-
-# Ensure that we have --preserve-dup-deps defines, otherwise we get link
-# problems of 'mysql' with CXX=g++
-LIBTOOL="$LIBTOOL --preserve-dup-deps"
-AC_SUBST(LIBTOOL)dnl
-
-AC_SUBST(NM)dnl
-
-# NM= "$NM -X64"
-#archive_expsym_cmds= `echo "$archive_expsym_cmds" | sed -e '/"$(CC)"//'`
-#archive_expsym_cmds= "$CC -q64 $archive_expsym_cmds"
-# CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
-
-#AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC
-
-# AC_PROG_INSTALL
-AC_PROG_INSTALL
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-# Not critical since the generated file is distributed
-AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
-AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
-AC_CHECK_PROG(DVIS, tex, manual.dvi)
-
-AC_PATH_PROG(uname_prog, uname, no)
-
-# We should go through this and put all the explictly system dependent
-# stuff in one place
-AC_MSG_CHECKING(operating system)
-AC_CACHE_VAL(mysql_cv_sys_os,
-[
-if test "$uname_prog" != "no"; then
- mysql_cv_sys_os="`uname`"
-else
- mysql_cv_sys_os="Not Solaris"
-fi
-])
-AC_MSG_RESULT($mysql_cv_sys_os)
-
-# This should be rewritten to use $target_os
-case "$target_os" in
- sco3.2v5*)
- CFLAGS="$CFLAGS -DSCO"
- CXXFLAGS="$CXXFLAGS -DSCO"
- LD='$(CC) $(CFLAGS)'
- case "$CFLAGS" in
- *-belf*)
- AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
- case "$LDFLAGS" in
- *-belf*) ;;
- *) AC_MSG_WARN([Adding -belf option to ldflags.])
- LDFLAGS="$LDFLAGS -belf"
- ;;
- esac
- ])
- ;;
- *)
- AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
- case "$LDFLAGS" in
- *-belf*) ;;
- *)
- AC_MSG_WARN([Adding -belf option to ldflags.])
- LDFLAGS="$LDFLAGS -belf"
- ;;
- esac
- ])
- ;;
- esac
- ;;
- sysv5UnixWare* | sysv5OpenUNIX8*)
- if test "$GCC" != "yes"; then
- # Use the built-in alloca()
- CFLAGS="$CFLAGS -Kalloca"
- fi
- CXXFLAGS="$CXXFLAGS -DNO_CPLUSPLUS_ALLOCA"
- ;;
- sysv5SCO_SV6.0.0*)
- if test "$GCC" != "yes"; then
- # Use the built-in alloca()
- CFLAGS="$CFLAGS -Kalloca"
- CXXFLAGS="$CFLAGS -Kalloca"
- # Use no_implicit for templates
- CXXFLAGS="$CXXFLAGS -Tno_implicit"
- AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
- [1], [Defined by configure. Use explicit template instantiation.])
- fi
- ;;
-esac
-
-# The following is required for portable results of floating point calculations
-# on PowerPC. The same must also be done for IA-64, but this options is missing
-# in the IA-64 gcc backend.
-
-if test "$GCC" = "yes"
-then
- case "$host_cpu" in
- *ppc* | *powerpc*)
- CFLAGS="$CFLAGS -mno-fused-madd"
- CXXFLAGS="$CXXFLAGS -mno-fused-madd"
- ;;
- esac
-fi
-
-AC_SUBST(CC)
-AC_SUBST(CFLAGS)
-AC_SUBST(CXX)
-AC_SUBST(CXXFLAGS)
-AC_SUBST(ASFLAGS)
-AC_SUBST(LD)
-AC_SUBST(INSTALL_SCRIPT)
-
-export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
-
-if test "$GCC" = "yes"
-then
- # mysqld requires -fno-implicit-templates.
- # Disable exceptions as they seams to create problems with gcc and threads.
- # mysqld doesn't use run-time-type-checking, so we disable it.
- # We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
- # regarding offset() usage in C++ which are done in a safe manner in the
- # server
- CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
- AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
- [1], [Defined by configure. Use explicit template instantiation.])
-fi
-
-MYSQL_PROG_AR
-
-# libmysqlclient versioning when linked with GNU ld.
-if $LD --version 2>/dev/null| grep GNU >/dev/null 2>&1; then
- LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
- AC_CONFIG_FILES(libmysql/libmysql.ver)
-fi
-AC_SUBST(LD_VERSION_SCRIPT)
-
-
-# Avoid bug in fcntl on some versions of linux
-AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
-# Any variation of Linux
-if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
-then
- MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
- TARGET_LINUX="true"
- AC_MSG_RESULT([yes])
- AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
-else
- MYSQLD_DEFAULT_SWITCHES=""
- TARGET_LINUX="false"
- AC_MSG_RESULT([no])
-fi
-AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
-AC_SUBST(TARGET_LINUX)
-
-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)
-# 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)
-AC_PATH_PROG(CP, cp, cp)
-AC_PATH_PROG(SED, sed, sed)
-AC_PATH_PROG(CMP, cmp, cmp)
-AC_PATH_PROG(CHMOD, chmod, chmod)
-AC_PATH_PROG(HOSTNAME, hostname, hostname)
-AC_PATH_PROG(DIFF, diff, diff)
-# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
-# fall back to 'tar' otherwise and hope that it's a GNU tar as well
-AC_CHECK_PROGS(TAR, gnutar gtar tar)
-
-dnl We use a path for perl so the script startup works
-dnl We make sure to use perl, not perl5, in hopes that the RPMs will
-dnl not depend on the perl5 binary being installed (probably a bug in RPM)
-AC_PATH_PROG(PERL, perl, no)
-if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
-then
- PERL5=$PERL
-else
- AC_PATH_PROG(PERL5, perl5, no)
- if test "$PERL5" != no
- then
- PERL=$PERL5
- ac_cv_path_PERL=$ac_cv_path_PERL5
- fi
-fi
-
-AC_SUBST(HOSTNAME)
-AC_SUBST(PERL)
-AC_SUBST(PERL5)
-
-# Enable the abi_check rule only if gcc is available
-
-if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
-then
- ABI_CHECK=""
-else
- ABI_CHECK="abi_check"
-fi
-
-AC_SUBST(ABI_CHECK)
-
-# Look for PS usage. We use double dollar-signs in FIND_PROC because this
-# value is written to a makefile, which interprets away one level of
-# dollar-signs. So, interpretation stages are m4 and then shell in autoconf,
-# then Make, then shell. The autoconf substitution uses single quotes, so
-# no unprotected single quotes should appear in the expression.
-AC_PATH_PROG(PS, ps, ps)
-AC_MSG_CHECKING("how to check if pid exists")
-PS=$ac_cv_path_PS
-# Linux style
-if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null
-then
- FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
-# Solaris
-elif $PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null
-then
- FIND_PROC="$PS -p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
-# BSD style
-elif $PS -uaxww 2> /dev/null | grep -- $0 > /dev/null
-then
- FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
-# SysV style
-elif $PS -ef 2> /dev/null | grep -- $0 > /dev/null
-then
- FIND_PROC="$PS -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
-# Do anybody use this?
-elif $PS $$ 2> /dev/null | grep -- $0 > /dev/null
-then
- FIND_PROC="$PS \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
-else
- case $SYSTEM_TYPE in
- *freebsd*|*dragonfly*)
- FIND_PROC="$PS p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
- ;;
- *darwin*)
- FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
- ;;
- *cygwin*)
- FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
- ;;
- *)
- 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
-fi
-AC_SUBST(FIND_PROC)
-AC_MSG_RESULT("$FIND_PROC")
-
-# Check if a pid is valid
-AC_PATH_PROG(KILL, kill, kill)
-AC_MSG_CHECKING("for kill switches")
-if $ac_cv_path_KILL -0 $$
-then
- CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
-elif kill -s 0 $$
-then
- CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
-else
- AC_MSG_WARN([kill -0 to check for pid seems to fail])
- CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
-fi
-AC_SUBST(CHECK_PID)
-AC_MSG_RESULT("$CHECK_PID")
-
-# We need an ANSI C compiler
-AM_PROG_CC_STDC
-
-# We need an assembler, too
-AM_PROG_AS
-CCASFLAGS="$CCASFLAGS $ASFLAGS"
-
-# Check if we need noexec stack for assembler
-AC_CHECK_NOEXECSTACK
-
-if test "$am_cv_prog_cc_stdc" = "no"
-then
- AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
-fi
-
-NOINST_LDFLAGS="-static"
-
-static_nss=""
-STATIC_NSS_FLAGS=""
-OTHER_LIBC_LIB=""
-AC_ARG_WITH(other-libc,
- [ --with-other-libc=DIR Link against libc and other standard libraries
- installed in the specified non-standard location
- overriding default. Originally added to be able to
- link against glibc 2.2 without making the user
- upgrade the standard libc installation.],
- [
- other_libc_include="$withval/include"
- other_libc_lib="$withval/lib"
- with_other_libc="yes"
- enable_shared="no"
- all_is_static="yes"
- CFLAGS="$CFLAGS -I$other_libc_include"
- # There seems to be a feature in gcc that treats system and libc headers
- # silently when they violatate ANSI C++ standard, but it is strict otherwise
- # since gcc cannot now recognize that our headers are libc, we work around
- # by telling it to be permissive. Note that this option only works with
- # new versions of gcc (2.95.x and above)
- CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
- if test -f "$other_libc_lib/libnss_files.a"
- then
- # libc has been compiled with --enable-static-nss
- # we need special flags, but we will have to add those later
- STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
- STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
- OTHER_LIBC_LIB="-static -L$other_libc_lib"
- static_nss=1
- else
- # this is a dirty hack. We if we detect static nss glibc in the special
- # location, we do not re-direct the linker to get libraries from there
- # during check. The reason is that if we did, we would have to find a
- # way to append the special static nss flags to LIBS every time we do
- # any check - this is definitely feasible, but not worthwhile the risk
- # of breaking other things. So for our purposes it would be sufficient
- # to assume that whoever is using static NSS knows what he is doing and
- # has sensible libraries in the regular location
- LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
- fi
-
- # When linking against custom libc installed separately, we want to force
- # all binary builds to be static, including the build done by configure
- # itself to test for system features.
- with_mysqld_ldflags="-all-static"
- with_client_ldflags="-all-static"
- NOINST_LDFLAGS="-all-static"
- ],
- [
- other_libc_include=
- other_libc_lib=
- with_other_libc="no"
- ]
-)
-AC_SUBST(NOINST_LDFLAGS)
-
-#
-# Check if we are using Linux and a glibc compiled with static nss
-# (this is true on the MySQL build machines to avoid NSS problems)
-#
-AC_CHECK_TOOL([NM], [nm])
-
-if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
-then
- tmp=`$NM ${other_libc_lib:-/usr/lib*}/libc.a | grep _nss_files_getaliasent_r1`
- if test -n "$tmp"
- then
- STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
- STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
- static_nss=1
- fi
-fi
-
-AC_ARG_WITH(server-suffix,
- [ --with-server-suffix Append value to the version string.],
- [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
- [ MYSQL_SERVER_SUFFIX= ]
- )
-AC_SUBST(MYSQL_SERVER_SUFFIX)
-
-# Set flags if we want to force to use pthreads
-AC_ARG_WITH(pthread,
- [ --with-pthread Force use of pthread library.],
- [ with_pthread=$withval ],
- [ with_pthread=no ]
- )
-
-# Force use of thread libs LIBS
-AC_ARG_WITH(named-thread-libs,
- [ --with-named-thread-libs=ARG
- Use specified thread libraries instead of
- those automatically found by configure.],
- [ with_named_thread=$withval ],
- [ with_named_thread=no ]
- )
-
-# Force use of a curses libs
-AC_ARG_WITH(named-curses-libs,
- [ --with-named-curses-libs=ARG
- Use specified curses libraries instead of
- those automatically found by configure.],
- [ with_named_curses=$withval ],
- [ with_named_curses=no ]
- )
-
-# Make thread safe client
-AC_ARG_ENABLE(thread-safe-client,
- [ --disable-thread-safe-client
- Compile the client without threads.],
- [ THREAD_SAFE_CLIENT=$enableval ],
- [ THREAD_SAFE_CLIENT=yes ]
- )
-
-# compile with strings functions in assembler
-AC_ARG_ENABLE(assembler,
- [ --enable-assembler Use assembler versions of some string
- functions if available.],
- [ ENABLE_ASSEMBLER=$enableval ],
- [ ENABLE_ASSEMBLER=no ]
- )
-
-AC_MSG_CHECKING(if we should use assembler functions)
-# For now we only support assembler on i386 and sparc systems
-AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
-AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
-AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "")
-
-if test "$ASSEMBLER_TRUE" = ""
-then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-# Add query profiler
-AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
-AC_ARG_ENABLE(profiling,
- AS_HELP_STRING([--enable-profiling], [Enable profiling of query lifetime.]),
- [ ENABLED_PROFILING=$enableval ],
- [ ENABLED_PROFILING=no ])
-
-AC_DEFINE([ENABLED_PROFILING], [1], [If SHOW PROFILE should be enabled])
-if test "$ENABLED_PROFILING" = "yes"
-then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-# Use this to set the place used for unix socket used to local communication.
-AC_ARG_WITH(unix-socket-path,
- [ --with-unix-socket-path=SOCKET
- Where to put the unix-domain socket. SOCKET must be
- an absolute file name.],
- [ MYSQL_UNIX_ADDR=$withval ],
- [ MYSQL_UNIX_ADDR=$MYSQL_UNIX_ADDR_DEFAULT ]
- )
-AC_SUBST(MYSQL_UNIX_ADDR)
-
-AC_ARG_WITH(tcp-port,
- [ --with-tcp-port=port-number
- Which port to use for MySQL services (default 3306)],
- [ MYSQL_TCP_PORT=$withval ],
- [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
- # if we actually defaulted (as opposed to the pathological case of
- # --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
- # happen if whole batch of servers was built from a script), set
- # the default to zero to indicate that; we don't lose information
- # that way, because 0 obviously indicates that we can get the
- # default value from MYSQL_TCP_PORT. this seems really evil, but
- # testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
- # a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
- # intend it to mean "use the default, in fact, look up a good default
- # from /etc/services if you can", but really, really meant 3306 when
- # they passed in 3306. When they pass in a specific value, let them
- # have it; don't second guess user and think we know better, this will
- # just make people cross. this makes the the logic work like this
- # (which is complicated enough):
- #
- # - if a port was set during build, use that as a default.
- #
- # - otherwise, try to look up a port in /etc/services; if that fails,
- # use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
- #
- # - allow the MYSQL_TCP_PORT environment variable to override that.
- #
- # - allow command-line parameters to override all of the above.
- #
- # the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
- # so don't mess with that.
- MYSQL_TCP_PORT_DEFAULT=0 ]
- )
-AC_SUBST(MYSQL_TCP_PORT)
-# We might want to document the assigned port in the manual.
-AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
-
-# Use this to set the place used for unix socket used to local communication.
-AC_ARG_WITH(mysqld-user,
- [ --with-mysqld-user=username
- What user the mysqld daemon shall be run as.],
- [ MYSQLD_USER=$withval ],
- [ MYSQLD_USER=mysql ]
- )
-AC_SUBST(MYSQLD_USER)
-
-# If we should allow LOAD DATA LOCAL
-AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
-AC_ARG_ENABLE(local-infile,
- [ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)],
- [ ENABLED_LOCAL_INFILE=$enableval ],
- [ ENABLED_LOCAL_INFILE=no ]
- )
-if test "$ENABLED_LOCAL_INFILE" = "yes"
-then
- AC_MSG_RESULT([yes])
- AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
- [If LOAD DATA LOCAL INFILE should be enabled by default])
-else
- AC_MSG_RESULT([no])
-fi
-
-# If we should allow init-file, skip-grant-table and bootstrap options
-AC_MSG_CHECKING(If we should should enable init-file, skip-grant-table options and bootstrap)
-AC_ARG_ENABLE(grant-options,
- [ --disable-grant-options Disables the use of --init-file, --skip-grant-tables and --bootstrap options],
- [ mysql_grant_options_enabled=$enableval ],
- [ mysql_grant_options_enabled=yes ]
- )
-if test "$mysql_grant_options_enabled" = "yes"
-then
- AC_MSG_RESULT([yes])
-else
- AC_DEFINE([DISABLE_GRANT_OPTIONS], [1],
- [Disables the use of --init-file, --skip-grant-tables and --bootstrap options])
- AC_MSG_RESULT([no])
-fi
-
-MYSQL_SYS_LARGEFILE
-
-# Types that must be checked AFTER large file support is checked
-AC_TYPE_SIZE_T
-
-#--------------------------------------------------------------------
-# Check for system header files
-#--------------------------------------------------------------------
-
-AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
- ieeefp.h limits.h memory.h pwd.h select.h poll.h \
- stdlib.h stddef.h \
- strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
- sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
- unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
- sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
- sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h \
- execinfo.h)
-
-AC_CHECK_HEADERS([xfs/xfs.h])
-
-#--------------------------------------------------------------------
-# Check for system libraries. Adds the library to $LIBS
-# and defines HAVE_LIBM etc
-#--------------------------------------------------------------------
-
-AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
-
-AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
- AC_CHECK_LIB(nsl, gethostbyname_r))
-AC_CHECK_FUNC(gethostbyname_r)
-
-AC_SEARCH_LIBS(setsockopt, socket)
-# This may get things to compile even if bind-8 is installed
-AC_SEARCH_LIBS(bind, bind)
-# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
-AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
-# See if we need a library for address lookup.
-AC_SEARCH_LIBS(inet_aton, [socket nsl resolv])
-
-# For the sched_yield() function on Solaris
-AC_SEARCH_LIBS(sched_yield, posix4,
- AC_DEFINE(HAVE_SCHED_YIELD, 1, [sched_yield]))
-
-MYSQL_CHECK_ZLIB_WITH_COMPRESS
-
-# For large pages support
-if test "$TARGET_LINUX" = "true"
-then
- # For SHM_HUGETLB on Linux
- AC_CHECK_DECLS(SHM_HUGETLB,
- AC_DEFINE([HAVE_LARGE_PAGES], [1],
- [Define if you have large pages support])
- AC_DEFINE([HAVE_LARGE_PAGE_OPTION], [1],
- [Define if you have large page option])
- AC_DEFINE([HUGETLB_USE_PROC_MEMINFO], [1],
- [Define if /proc/meminfo shows the huge page size (Linux only)])
- , ,
- [
-#include <sys/shm.h>
- ]
- )
-else
-# For large pages support on Solaris
-AC_CHECK_DECLS(MHA_MAPSIZE_VA,
- AC_DEFINE([HAVE_SOLARIS_LARGE_PAGES], [1],
- [Define to 1 if you have large pages support])
- AC_DEFINE([HAVE_LARGE_PAGE_OPTION], [1],
- [Define if you have large page option])
- , ,
- [
-#include <sys/mman.h>
- ]
-)
-fi
-
-dnl Use of ALARMs to wakeup on timeout on sockets
-dnl
-dnl This feature makes use of a mutex and is a scalability hog we
-dnl try to avoid using. However we need support for SO_SNDTIMEO and
-dnl SO_RCVTIMEO socket options for this to work. So we will check
-dnl if this feature is supported by a simple AC_RUN_IFELSE macro. However
-dnl on some OS's there is support for setting those variables but
-dnl they are silently ignored. For those OS's we will not attempt
-dnl o use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
-dnl See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
-dnl To use alarm is simple, simply avoid setting anything.
-
-
-AC_CACHE_CHECK([whether SO_SNDTIMEO and SO_RCVTIMEO work],
- [mysql_cv_socket_timeout],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/time.h>
- ]],[[
- int fd = socket(AF_INET, SOCK_STREAM, 0);
- struct timeval tv;
- int ret= 0;
- tv.tv_sec= 2;
- tv.tv_usec= 0;
- ret|= setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
- ret|= setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- return !!ret;
- ]])],
- [mysql_cv_socket_timeout=yes],
- [mysql_cv_socket_timeout=no],
- [mysql_cv_socket_timeout=no
- AC_MSG_WARN([Socket timeout options disabled due to cross-compiling])])
- ])
-
-use_alarm=yes
-
-if test "$mysql_cv_socket_timeout" = yes; then
- case $SYSTEM_TYPE in
- dnl We trust the result from the following systems
- *solaris*) use_alarm=no ;;
- *freebsd*) use_alarm=no ;;
- *darwin*) use_alarm=no ;;
- *)
- dnl We trust the result from Linux also
- if test "$TARGET_LINUX" = "true"; then
- use_alarm=no
- fi
- dnl We trust no one else for the moment
- dnl (Windows is hardcoded to not use alarms)
- ;;
- esac
-fi
-
-AC_ARG_WITH(alarm,
- AS_HELP_STRING([--with-alarm], [Use alarm to implement socket timeout.]),
- [use_alarm=$withval], [])
-
-AC_MSG_CHECKING(whether to use alarms to implement socket timeout)
-if test "$use_alarm" = no ; then
- AC_DEFINE([NO_ALARM], [1], [No need to use alarm for socket timeout])
- AC_DEFINE([SIGNAL_WITH_VIO_CLOSE], [1], [Need to use vio close for kill connection])
-fi
-AC_MSG_RESULT($use_alarm)
-
-#--------------------------------------------------------------------
-# Check for IPv6 support
-#--------------------------------------------------------------------
-
-AC_CHECK_HEADERS(netinet/in6.h)
-
-AC_CHECK_TYPES([struct sockaddr_in6, struct in6_addr],
- [have_in6_types=yes],
- [have_in6_types=no],
- [[
- #ifdef WIN32
- #include <winsock2.h>
- #else
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <sys/socket.h>
- #endif
-
- #ifdef HAVE_NETINET_IN6_H
- #include <netinet/in6.h>
- #endif
- ]])
-
-AC_MSG_CHECKING([for IPv6 support])
-
-AC_ARG_ENABLE(ipv6,
- AS_HELP_STRING([--disable-ipv6], [Disable support for IPv6 networking]),
- [disable_ipv6=yes], [disable_ipv6=no])
-
-if test x"$disable_ipv6" = xyes -o x"$have_in6_types" = xno; then
- AC_MSG_RESULT([no])
-else
- AC_DEFINE([HAVE_IPV6], [1], [Define if IPv6 networking support is present])
- AC_MSG_RESULT([yes])
-fi
-
-#--------------------------------------------------------------------------
-# Check if struct sockaddr_in::sin_len is available
-#--------------------------------------------------------------------------
-
-AC_CACHE_CHECK(
- [if sockaddr_in::sin_len is available],
- mysql_cv_have_sockaddr_in_sin_len,
- AC_TRY_COMPILE(
- [
- #ifdef WIN32
- #include <winsock2.h>
- #else
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <sys/socket.h>
- #endif
- ],
- [unsigned int i = sizeof(((struct sockaddr_in *) 0)->sin_len)],
- mysql_cv_have_sockaddr_in_sin_len=yes,
- mysql_cv_have_sockaddr_in_sin_len=no))
-
-if test "$mysql_cv_have_sockaddr_in_sin_len" = "yes"; then
- AC_DEFINE(
- [HAVE_SOCKADDR_IN_SIN_LEN],
- [1],
- [If sockaddr_in::sin_len is available])
-fi
-
-#--------------------------------------------------------------------------
-# Check if struct sockaddr_in6::sin6_len is available
-#--------------------------------------------------------------------------
-
-AC_CACHE_CHECK(
- [if sockaddr_in6::sin6_len is available],
- mysql_cv_have_sockaddr_in6_sin6_len,
- AC_TRY_COMPILE(
- [
- #ifdef WIN32
- #include <winsock2.h>
- #else
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <sys/socket.h>
- #endif
-
- #ifdef HAVE_NETINET_IN6_H
- #include <netinet/in6.h>
- #endif
- ],
- [unsigned int i = sizeof(((struct sockaddr_in6 *) 0)->sin6_len)],
- mysql_cv_have_sockaddr_in6_sin6_len=yes,
- mysql_cv_have_sockaddr_in6_sin6_len=no))
-
-if test "$mysql_cv_have_sockaddr_in_sin6_len" = "yes"; then
- AC_DEFINE(
- [HAVE_SOCKADDR_IN6_SIN6_LEN],
- [1],
- [If sockaddr_in6::sin6_len is available])
-fi
-
-#--------------------------------------------------------------------
-# Check for TCP wrapper support
-#--------------------------------------------------------------------
-
-AC_ARG_WITH(libwrap,
-[ --with-libwrap[=DIR] Compile in libwrap (tcp_wrappers) support],[
- case "$with_libwrap" in
- no) : ;;
- yes|*)
- _cppflags=${CPPFLAGS}
- _ldflags=${LDFLAGS}
-
- if test "$with_libwrap" != "yes"; then
- CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
- LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
- fi
-
- _libs=${LIBS}
- AC_CHECK_HEADER(tcpd.h,
- LIBS="-lwrap $LIBS"
- AC_MSG_CHECKING(for TCP wrappers library -lwrap)
- AC_TRY_LINK([#include <tcpd.h>
-int allow_severity = 0;
-int deny_severity = 0;
-
-struct request_info *req;
-],[hosts_access (req)],
- AC_MSG_RESULT(yes)
- AC_DEFINE([LIBWRAP], [1], [Define if you have -lwrap])
- AC_DEFINE([HAVE_LIBWRAP], [1], [Define if have -lwrap])
- if test "$with_libwrap" != "yes"; then
- WRAPLIBS="-L${with_libwrap}/lib"
- fi
- WRAPLIBS="${WRAPLIBS} -lwrap",
- AC_MSG_RESULT(no)
- CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
- CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
- LDFLAGS=${_ldflags} LIBS=${_libs}
- ;;
- esac
-])
-AC_SUBST(WRAPLIBS)
-
-# Check for gtty if termio.h doesn't exists
-if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
-then
- AC_SEARCH_LIBS(gtty, compat)
-fi
-
-# We make a special variable for non-threaded version of LIBS to avoid
-# including thread libs into non-threaded version of MySQL client library.
-# Later in this script LIBS will be augmented with a threads library.
-NON_THREADED_LIBS="$LIBS"
-
-AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
- uchar, uint, ulong],[],[], [
-#include <sys/types.h>
-])
-AC_CHECK_TYPES([fp_except], [], [], [
-#include <sys/types.h>
-#include <ieeefp.h>
-])
-
-#
-# Some system specific hacks
-#
-
-MAX_C_OPTIMIZE="-O3"
-MAX_CXX_OPTIMIZE="-O3"
-
-case $SYSTEM_TYPE in
- *solaris2.7*)
- # Solaris 2.7 has a broken /usr/include/widec.h
- # Make a fixed copy in ./include
- AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
- echo " - Creating local copy of widec.h"
- if test ! -d include
- then
- mkdir ./include
- fi
- builddir=`pwd`
- sed -e "s|^#if[ ]*!defined(lint) && !defined(__lint)|#if !defined\(lint\) \&\& !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
- CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
- CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
- ;;
- *solaris2.8*)
- # Solaris 2.8 has a broken /usr/include/widec.h
- # Make a fixed copy in ./include
- AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
- echo " - Creating local copy of widec.h"
- if test ! -d include
- then
- mkdir ./include
- fi
- builddir=`pwd`
- sed -e "s|^#if[ ]*!defined(__lint)|#if !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
- CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
- CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
- ;;
- *solaris2.5.1*)
- AC_MSG_WARN([Enabling getpass() workaround for Solaris 2.5.1])
- CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS -DHAVE_RWLOCK_T";
- CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T -DSOLARIS"
- ;;
- *solaris*)
- CFLAGS="$CFLAGS -DHAVE_RWLOCK_T"
- CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T"
- ;;
- *SunOS*)
- AC_MSG_WARN([Enabling getpass() workaround for SunOS])
- CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS";
- ;;
- *hpux10.20*)
- AC_MSG_WARN([Enabling workarounds for hpux 10.20])
- CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
- CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
- if test "$with_named_thread" = "no"
- then
- AC_MSG_WARN([Using --with-named-thread=-lpthread])
- with_named_thread="-lcma"
- fi
- ;;
- *hpux11.*)
- AC_MSG_WARN([Enabling workarounds for hpux 11])
- CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
- CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
- if test "$with_named_thread" = "no"
- then
- AC_MSG_WARN([Using --with-named-thread=-lpthread])
- with_named_thread="-lpthread"
- fi
- # Fixes for HPUX 11.0 compiler
- if test "$ac_cv_prog_gcc" = "no"
- then
-# set working flags first in line, letting override it (i. e. for debug):
- CXXFLAGS="+O2 $CXXFLAGS"
- MAX_C_OPTIMIZE=""
- MAX_CXX_OPTIMIZE=""
- ndb_cxxflags_fix="$ndb_cxxflags_fix -Aa"
- fi
- ;;
- *rhapsody*)
- if test "$ac_cv_prog_gcc" = "yes"
- then
- CPPFLAGS="$CPPFLAGS -traditional-cpp "
- CFLAGS="-DHAVE_CTHREADS_WRAPPER -DDO_NOT_REMOVE_THREAD_WRAPPERS"
- CXXFLAGS="-DHAVE_CTHREADS_WRAPPER"
- if test $with_named_curses = "no"
- then
- with_named_curses=""
- fi
- fi
- ;;
- *darwin5*)
- if test "$ac_cv_prog_gcc" = "yes"
- then
- FLAGS="-traditional-cpp -DHAVE_DARWIN5_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
- CFLAGS="$CFLAGS $FLAGS"
- CXXFLAGS="$CXXFLAGS $FLAGS"
- MAX_C_OPTIMIZE="-O"
- with_named_curses=""
- fi
- ;;
- *darwin6*)
- if test "$ac_cv_prog_gcc" = "yes"
- then
- FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
- CFLAGS="$CFLAGS $FLAGS"
- CXXFLAGS="$CXXFLAGS $FLAGS"
- MAX_C_OPTIMIZE="-O"
- fi
- ;;
- *darwin*)
- if test "$ac_cv_prog_gcc" = "yes"
- then
- FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL"
- CFLAGS="$CFLAGS $FLAGS"
- CXXFLAGS="$CXXFLAGS $FLAGS"
- MAX_C_OPTIMIZE="-O"
- fi
- ;;
- *freebsd*|*dragonfly*)
- dnl These dependencies have not really been checked for some time
- OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
- if test "$OSVERSION" -gt "600000"
- then
- # Post user-level threads, MYSQLD_NET_RETRY_COUNT is not needed any more
- :
- elif test "$OSVERSION" -gt "480100" && \
- test "$OSVERSION" -lt "500000" || \
- test "$OSVERSION" -gt "500109"
- then
- AC_MSG_WARN([Adding fix for interrupted reads])
- CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
- else
- AC_MSG_WARN([Adding fix for interrupted reads and broken realpath])
- CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
- CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
- fi
- ;;
- *netbsd*)
- AC_MSG_WARN([Adding flag -Dunix])
- CFLAGS="$CFLAGS -Dunix"
- CXXFLAGS="$CXXFLAGS -Dunix"
- OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
- ;;
- *bsdi*)
- AC_MSG_WARN([Adding fix for BSDI])
- CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
- AC_DEFINE_UNQUOTED([SOCKOPT_OPTLEN_TYPE], [size_t],
- [Last argument to get/setsockopt])
- ;;
- *sgi-irix6*)
- if test "$with_named_thread" = "no"
- then
- AC_MSG_WARN([Using --with-named-thread=-lpthread])
- with_named_thread="-lpthread"
- fi
- CXXFLAGS="$CXXFLAGS -D_BOOL"
- ;;
- *aix4.3*)
- AC_MSG_WARN([Adding defines for AIX])
- CFLAGS="$CFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
- CXXFLAGS="$CXXFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
- ;;
-dnl Is this the right match for DEC OSF on alpha?
- *dec-osf*)
- if test "$ac_cv_prog_gcc" = "yes" && test "$host_cpu" = "alpha"
- then
- AC_MSG_WARN([Adding defines for DEC OSF on alpha])
- CFLAGS="$CFLAGS -mieee"
- CXXFLAGS="$CXXFLAGS -mieee"
- fi
- AC_MSG_WARN([Adding defines for OSF1])
- # gethostbyname_r is deprecated and doesn't work ok on OSF1
- CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
- CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
- # 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"
- ;;
-esac
-
-
-#---START: Used in for client configure
-# Check if we threads are in libc or if we should use
-# -lpthread, -lpthreads or mit-pthreads
-# We have to check libc last because else it fails on Solaris 2.6
-
-with_posix_threads="no"
-# Search thread lib on Linux
-if test "$with_named_thread" = "no"
-then
- AC_MSG_CHECKING("Linux threads")
- if test "$TARGET_LINUX" = "true"
- then
- AC_MSG_RESULT("starting")
- # use getconf to check glibc contents
- AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
- case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
- NPTL* )
- AC_MSG_RESULT("NPTL")
- AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
- with_named_thread="-lpthread"
- ;;
- LINUXTHREADS* )
- AC_MSG_RESULT("Linuxthreads")
- AC_DEFINE([HAVE_LINUXTHREADS], [1],
- [Whether we are using Xavier Leroy's LinuxThreads])
- with_named_thread="-lpthread"
- ;;
- * )
- AC_MSG_RESULT("unknown")
- ;;
- esac
- if test "$with_named_thread" = "no"
- then
- # old method, check headers
- # Look for LinuxThreads.
- AC_MSG_CHECKING("LinuxThreads in header file comment")
- res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
- if test "$res" -gt 0
- then
- AC_MSG_RESULT("Found")
- AC_DEFINE([HAVE_LINUXTHREADS], [1],
- [Whether we are using Xavier Leroy's LinuxThreads])
- # Linux 2.0 sanity check
- AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
- AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
- # RedHat 5.0 does not work with dynamic linking of this. -static also
- # gives a speed increase in linux so it does not hurt on other systems.
- with_named_thread="-lpthread"
- else
- AC_MSG_RESULT("Not found")
- # If this is a linux machine we should barf
- AC_MSG_ERROR([This is a Linux system without a working getconf,
-and Linuxthreads was not found. Please install it (or a new glibc) and try again.
-See the Installation chapter in the Reference Manual for more information.])
- fi
- else
- AC_MSG_RESULT("no need to check headers")
- fi
-
- AC_MSG_CHECKING("for pthread_create in -lpthread")
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS -lpthread"
- AC_TRY_LINK( [#include <pthread.h>],
- [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
- AC_MSG_RESULT("yes"),
- [ AC_MSG_RESULT("no")
- AC_MSG_ERROR([
-This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
-Please install one of these (or a new glibc) and try again.
-See the Installation chapter in the Reference Manual for more information.]) ]
- )
- LIBS="$ac_save_LIBS"
- else
- AC_MSG_RESULT("no")
- fi # "$TARGET_LINUX"
-fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
-
-
-# Hack for DEC-UNIX (OSF1 -> Tru64)
-if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
-then
- AC_MSG_CHECKING("DEC threads post OSF/1 3.2")
- if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
- then
- with_named_thread="-lpthread -lmach -lexc"
- CFLAGS="$CFLAGS -D_REENTRANT"
- CXXFLAGS="$CXXFLAGS -D_REENTRANT"
- AC_DEFINE(HAVE_DEC_THREADS, [1], [Whether we are using DEC threads])
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- fi # DEC threads
-fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
-
-
-dnl This is needed because -lsocket has to come after the thread
-dnl library on SCO.
-AC_DEFUN([MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK], [
- LIBS=`echo " $LIBS " | sed -e 's/ -lsocket / /g'`
-])
-# Hack for SCO UNIX
-if test "$with_named_thread" = "no"
-then
- AC_MSG_CHECKING("SCO threads")
- if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
- then
- if test -f /usr/lib/libgthreads.a -o -f /usr/lib/libgthreads.so
- then
- MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- with_named_thread="-lgthreads -lsocket -lgthreads"
- # sched.h conflicts with fsu-threads
- touch ./include/sched.h
- touch ./include/semaphore.h
-
- # We must have gcc
- if expr "$CC" : ".*gcc.*"
- then
- AC_MSG_RESULT("yes")
- else
- AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.])
- fi
- AC_MSG_RESULT("yes")
- elif test -f /usr/local/lib/libpthread.a -o -f /usr/local/lib/libpthread.so
- then
- MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- with_named_thread="-lpthread -lsocket"
- # sched.h conflicts with fsu-threads
- # touch ./include/sched.h
-
- AC_MSG_CHECKING("for gcc")
- # We must have gcc
- if expr "$CC" : ".*gcc.*"
- then
- AC_MSG_RESULT("yes")
- else
- AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.])
- fi
- AC_MSG_RESULT("yes")
- # Hack for SCO UnixWare 7.1.x
- #
- elif test "$with_named_thread" = "no"
- then
- AC_MSG_RESULT("no")
- AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads")
- if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
- then
- if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
- then
- MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- if expr "$CC" : ".*gcc.*"
- then
- with_named_thread="-pthread -lsocket -lnsl"
- else
- with_named_thread="-Kthread -lsocket -lnsl"
- fi
- if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
- then
- AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1])
- fi
- AC_MSG_RESULT("yes")
- # We must have cc
- AC_MSG_CHECKING("for gcc")
- if expr "$CC" : ".*gcc.*"
- then
- CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
- CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
- else
- CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
- CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
- fi
- else
- AC_MSG_ERROR([configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual.])
- fi
- else
- AC_MSG_RESULT("no")
- fi
- else
- AC_MSG_ERROR([On SCO UNIX MySQL requires that the FSUThreads package is installed. See the Installation chapter in the Reference Manual.])
- fi
- else
- AC_MSG_RESULT("no")
- fi
-fi
-
-#
-# Check for SCO threading libraries
-#
-if test "$with_named_thread" = "no"
-then
- AC_MSG_CHECKING([SCO OpenServer 6, UnixWare 7 or OpenUNIX 8 native threads])
- if expr "$SYSTEM_TYPE" : ".*UnixWare.*" > /dev/null || \
- expr "$SYSTEM_TYPE" : ".*SCO_SV6.*" > /dev/null || \
- expr "$SYSTEM_TYPE" : ".*OpenUNIX.*" > /dev/null
- then
- if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
- then
- MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- if expr "$CC" : ".*gcc.*" > /dev/null
- then
- with_named_thread="-pthread -lsocket -lnsl"
- CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- else
- with_named_thread="-Kthread -lsocket -lnsl"
- CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- fi
- if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
- then
- AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1], [Have UnixWare 7 (or similar) almost-POSIX threading library])
- fi
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR([configure: error: Can't find thread library on SCO/Caldera system. See the Installation chapter in the Reference Manual.])
- fi
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-# Hack for Siemens UNIX
-if test "$with_named_thread" = "no"
-then
- AC_MSG_CHECKING("Siemens threads")
- if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
- then
- LIBS="-lxnet $LIBS"
- NON_THREADED_LIBS="-lxnet $NON_THREADED_LIBS"
- with_named_thread="-Kthread $LDFLAGS -lxnet"
- LD_FLAGS=""
- CFLAGS="-Kthread $CFLAGS"
- CXXFLAGS="-Kthread $CXXFLAGS"
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- fi
-fi
-
-# Use library named -lpthread
-if test "$with_named_thread" = "no" -a "$with_pthread" = "yes"
-then
- with_named_thread="-lpthread"
-fi
-
-#---END:
-
-# Hack for Solaris >= 2.5
-# We want both the new and the old interface
-
-if test "$with_named_thread" = "no"
-then
- AC_MSG_CHECKING("Solaris threads")
- if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
- then
- with_named_thread="-lpthread -lthread"
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- fi
-fi
-
-# Should we use named pthread library ?
-AC_MSG_CHECKING("named thread libs:")
-if test "$with_named_thread" != "no"
-then
- LIBS="$with_named_thread $LIBS $with_named_thread"
- CLIENT_THREAD_LIBS="$with_named_thread"
- with_posix_threads="yes"
- AC_MSG_RESULT("$with_named_thread")
-else
- AC_MSG_RESULT("no")
- # pthread_create is in standard libraries (As in BSDI 3.0)
- AC_MSG_CHECKING("for pthread_create in -libc");
- AC_TRY_LINK(
- [#include <pthread.h>],
- [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
- with_posix_threads=yes, with_posix_threads=no)
- AC_MSG_RESULT("$with_posix_threads")
- if test "$with_posix_threads" = "no"
- then
- AC_MSG_CHECKING("for pthread_create in -lpthread")
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS -lpthread"
- CLIENT_THREAD_LIBS="-lpthread"
- AC_TRY_LINK(
- [#include <pthread.h>],
- [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
- with_posix_threads=yes, with_posix_threads=no)
- AC_MSG_RESULT("$with_posix_threads")
- if test "$with_posix_threads" = "no"
- then
- LIBS=" $ac_save_LIBS -lpthreads"
- CLIENT_THREAD_LIBS="-lpthreads"
- AC_MSG_CHECKING("for pthread_create in -lpthreads")
- AC_TRY_LINK(
- [#include <pthread.h>],
- [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
- with_posix_threads=yes, with_posix_threads=no)
- AC_MSG_RESULT("$with_posix_threads")
- if test "$with_posix_threads" = "no"
- then
- # This is for FreeBSD
- LIBS="$ac_save_LIBS -pthread"
- CLIENT_THREAD_LIBS="-pthread"
- AC_MSG_CHECKING("for pthread_create in -pthread")
- AC_TRY_LINK(
- [#include <pthread.h>],
- [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
- with_posix_threads=yes, with_posix_threads=no)
- AC_MSG_RESULT("$with_posix_threads")
- fi
- fi
- fi
-fi
-
-#---START: Used in for client configure
-# Must be checked after, because strtok_r may be in -lpthread
-# On AIX strtok_r is in libc_r
-
-my_save_LIBS="$LIBS"
-AC_CHECK_LIB(pthread,strtok_r)
-LIBS="$my_save_LIBS"
-if test "$ac_cv_lib_pthread_strtok_r" = "no"
-then
- AC_CHECK_LIB(c_r,strtok_r)
- case "$with_osf32_threads---$target_os" in
- # Don't keep -lc_r in LIBS; -pthread handles it magically
- yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;;
-
- esac
- AC_CHECK_FUNCS(strtok_r pthread_init)
-else
- AC_CHECK_FUNCS(strtok_r)
-fi
-#---END:
-
-# dlopen, dlerror
-case "$with_mysqld_ldflags " in
-
- *"-all-static "*)
- # No need to check for dlopen when mysqld is linked with
- # -all-static as it won't be able to load any functions.
- # NOTE! It would be better if it was possible to test if dlopen
- # can be used, but a good way to test it couldn't be found
-
- ;;
-
- *)
- # Check for dlopen, needed for user definable functions and plugins
- # This must be checked after threads on AIX
-
- my_save_LIBS="$LIBS"
- LIBS=""
- AC_CHECK_LIB(dl,dlopen)
- LIBDL=$LIBS
- LIBS="$my_save_LIBS"
- AC_SUBST(LIBDL)
-
- my_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBDL"
- AC_CHECK_FUNCS(dlopen dlerror)
- LIBS="$my_save_LIBS"
-
- ;;
-esac
-
-
-# System characteristics
-AC_SYS_RESTARTABLE_SYSCALLS
-
-# Build optimized or debug version ?
-# First check for gcc and g++
-if test "$GCC" = "yes"
-then
- DEBUG_CFLAGS="-g"
- DEBUG_OPTIMIZE_CC="-O"
- OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
-else
- DEBUG_CFLAGS="-g"
- DEBUG_OPTIMIZE_CC=""
- case $SYSTEM_TYPE in
- *solaris*)
- OPTIMIZE_CFLAGS="-O1"
- ;;
- *)
- OPTIMIZE_CFLAGS="-O"
- ;;
- esac
-fi
-if test "$GXX" = "yes"
-then
- DEBUG_CXXFLAGS="-g"
- DEBUG_OPTIMIZE_CXX="-O"
- OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
-else
- DEBUG_OPTIMIZE_CXX=""
- case $SYSTEM_TYPE in
- *solaris*)
- DEBUG_CXXFLAGS="-g0"
- OPTIMIZE_CXXFLAGS="-O1"
- ;;
- *)
- DEBUG_CXXFLAGS="-g"
- OPTIMIZE_CXXFLAGS="-O"
- ;;
- esac
-fi
-
-# If the user specified CFLAGS, we won't add any optimizations
-if test -n "$SAVE_CFLAGS"
-then
- OPTIMIZE_CFLAGS=""
- DEBUG_OPTIMIZE_CC=""
-fi
-# Ditto for CXXFLAGS
-if test -n "$SAVE_CXXFLAGS"
-then
- OPTIMIZE_CXXFLAGS=""
- DEBUG_OPTIMIZE_CXX=""
-fi
-
-AC_ARG_WITH(debug,
- [AS_HELP_STRING([--with-debug], [Add debug code @<:@default=no@:>@])],
- [with_debug=$withval],
- [with_debug=no])
-if test "$with_debug" = "yes"
-then
- AC_DEFINE([DBUG_ON], [1], [Use libdbug])
- CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
-else
- # Optimized version. No debug
- AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
- CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
- CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
-fi
-
-AC_ARG_WITH([valgrind],
- [AS_HELP_STRING([--with-valgrind],
- [Valgrind instrumentation @<:@default=no@:>@])],
- [], [with_valgrind=no])
-
-if test "$with_valgrind" != "no"
-then
- AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
- [AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
-fi
-
-# Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
-AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
-AC_ARG_ENABLE(debug_sync,
- AS_HELP_STRING([--enable-debug-sync],
- [Build a version with Debug Sync Facility]),
- [ enable_debug_sync=$enableval ],
- [ enable_debug_sync=$with_debug ])
-
-if test "$enable_debug_sync" != "no"
-then
- AC_DEFINE([ENABLED_DEBUG_SYNC], [1],
- [If Debug Sync Facility should be enabled])
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-AC_ARG_WITH([fast-mutexes],
- AC_HELP_STRING([--with-fast-mutexes],
- [Compile with fast mutexes (default is disabled)]),
- [with_fast_mutexes=$withval], [with_fast_mutexes=no])
-
-if test "$with_fast_mutexes" != "no"
-then
- if test "$with_debug" != "no"
- then
- AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
- else
- AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1],
- [Define to 1 if you want to use fast mutexes])
- fi
-fi
-
-AC_ARG_WITH([atomic-ops],
- AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
- [Implement atomic operations using pthread rwlocks or atomic CPU
- instructions for multi-processor or uniprocessor
- configuration. By default gcc built-in sync functions are used,
- if available and 'smp' configuration otherwise.]))
-case "$with_atomic_ops" in
- "up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
- [Assume single-CPU mode, no concurrency]) ;;
- "rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
- [Use pthread rwlocks for atomic ops]) ;;
- "smp") ;;
- "")
- ;;
- *) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
-esac
-
-AC_CACHE_CHECK([whether the compiler provides atomic builtins],
- [mysql_cv_gcc_atomic_builtins],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [
- ],
- [[
- int foo= -10; int bar= 10;
- long long int foo64= -10; long long int bar64= 10;
- if (!__sync_fetch_and_add(&foo, bar) || foo)
- return -1;
- bar= __sync_lock_test_and_set(&foo, bar);
- if (bar || foo != 10)
- return -1;
- bar= __sync_val_compare_and_swap(&bar, foo, 15);
- if (bar)
- return -1;
- if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
- return -1;
- bar64= __sync_lock_test_and_set(&foo64, bar64);
- if (bar64 || foo64 != 10)
- return -1;
- bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
- if (bar64)
- return -1;
- return 0;
- ]]
- )],
- [mysql_cv_gcc_atomic_builtins=yes],
- [mysql_cv_gcc_atomic_builtins=no],
- [mysql_cv_gcc_atomic_builtins=no]
-)])
-if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
- AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
- [Define to 1 if compiler provides atomic builtins.])
-fi
-
-AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
- [mysql_cv_solaris_atomic],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <atomic.h>
- ]],
- [[
- int foo = -10; int bar = 10;
- int64_t foo64 = -10; int64_t bar64 = 10;
- if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
- return -1;
- bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
- if (bar || foo != 10)
- return -1;
- bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
- if (bar)
- return -1;
- if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
- return -1;
- bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
- if (bar64 || foo64 != 10)
- return -1;
- bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
- if (bar64)
- return -1;
- atomic_or_64((volatile uint64_t *)&bar64, 0);
- return 0;
- ]]
- )],
- [mysql_cv_solaris_atomic=yes],
- [mysql_cv_solaris_atomic=no],
- [mysql_cv_solaris_atomic=no]
-)])
-if test "x$mysql_cv_solaris_atomic" = xyes; then
- AC_DEFINE(HAVE_SOLARIS_ATOMIC, 1,
- [Define to 1 if OS provides atomic_* functions like Solaris.])
-fi
-
-# Force static compilation to avoid linking problems/get more speed
-AC_ARG_WITH(mysqld-ldflags,
- [ --with-mysqld-ldflags Extra linking arguments for mysqld],
- [MYSQLD_EXTRA_LDFLAGS=$withval],
- [MYSQLD_EXTRA_LDFLAGS=])
-AC_SUBST(MYSQLD_EXTRA_LDFLAGS)
-
-AC_ARG_WITH(client-ldflags,
- [ --with-client-ldflags Extra linking arguments for clients],
- [CLIENT_EXTRA_LDFLAGS=$withval],
- [CLIENT_EXTRA_LDFLAGS=])
-AC_SUBST(CLIENT_EXTRA_LDFLAGS)
-
-AC_ARG_WITH(mysqld-libs,
- [ --with-mysqld-libs Extra libraries to link with for mysqld],
- [MYSQLD_EXTRA_LIBS=$withval],
- [MYSQLD_EXTRA_LIBS=])
-AC_SUBST(MYSQLD_EXTRA_LIBS)
-
-AC_ARG_WITH(lib-ccflags,
- [ --with-lib-ccflags Extra CC options for libraries],
- [LIB_EXTRA_CCFLAGS=$withval],
- [LIB_EXTRA_CCFLAGS=])
-AC_SUBST(LIB_EXTRA_CCFLAGS)
-
-# Avoid stupid bug on some OS
-AC_ARG_WITH(low-memory,
- [ --with-low-memory Try to use less memory to compile to avoid
- memory limitations.],
- [with_lowmem=$withval],
- [with_lowmem=no])
-if test "$with_lowmem" = "yes"
-then
- if test "$ac_cv_prog_gcc" = "yes"
- then
- LM_CFLAGS="-fno-inline"
- else
- LM_CFLAGS="-O0"
- fi
-else
- LM_CFLAGS=""
-fi
-AC_SUBST(LM_CFLAGS)
-
-AC_ARG_WITH(comment,
- [ --with-comment Comment about compilation environment.],
- [with_comment=$withval],
- [with_comment=no])
-if test "$with_comment" != "no"
-then
- COMPILATION_COMMENT=$with_comment
-else
- COMPILATION_COMMENT="Source distribution"
-fi
-AC_SUBST(COMPILATION_COMMENT)
-
-AC_MSG_CHECKING("need of special linking flags")
-if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
-then
- LDFLAGS="$LDFLAGS -rdynamic"
- AC_MSG_RESULT("-rdynamic")
-else
- case "$SYSTEM_TYPE$with_mysqld_ldflags " in
- *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
- AC_MSG_RESULT("none")
- ;;
- *freebsd*|*dragonfly*)
- MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
- AC_MSG_RESULT("-export-dynamic")
- ;;
- *)
- AC_MSG_RESULT("none")
- ;;
- esac
-fi
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AS_IF([test "x$ac_cv_c_inline" = "xno"],
- [AC_MSG_WARN([The C compiler does not support inline. Beware that unused
- functions might not be eliminated the object files.])])
-AC_TYPE_OFF_T
-AC_STRUCT_ST_RDEV
-AC_HEADER_TIME
-AC_STRUCT_TM
-MYSQL_NEEDS_MYSYS_NEW
-# AC_CHECK_SIZEOF return 0 when it does not find the size of a
-# type. We want a error instead.
-AC_CHECK_SIZEOF(char, 1)
-if test "$ac_cv_sizeof_char" -eq 0
-then
- AC_MSG_ERROR([No size for char type.
-A likely cause for this could be that there isn't any
-static libraries installed. You can verify this by checking if you have libm.a
-in /lib, /usr/lib or some other standard place. If this is the problem,
-install the static libraries and try again. If this isn't the problem,
-examine config.log for possible errors. If you want to report this, use
-'scripts/mysqlbug' and include at least the last 20 rows from config.log!])
-fi
-AC_CHECK_SIZEOF(char*, 4)
-AC_CHECK_SIZEOF(short, 2)
-AC_CHECK_SIZEOF(int, 4)
-if test "$ac_cv_sizeof_int" -eq 0
-then
- AC_MSG_ERROR("No size for int type.")
-fi
-AC_CHECK_SIZEOF(long, 4)
-if test "$ac_cv_sizeof_long" -eq 0
-then
- AC_MSG_ERROR("No size for long type.")
-fi
-AC_CHECK_SIZEOF(long long, 8)
-if test "$ac_cv_sizeof_long_long" -eq 0
-then
- AC_MSG_ERROR("MySQL needs a long long type.")
-fi
-# off_t is not a builtin type
-AC_CHECK_SIZEOF(off_t, 4)
-if test "$ac_cv_sizeof_off_t" -eq 0
-then
- AC_MSG_ERROR("MySQL needs a off_t type.")
-fi
-
-dnl
-dnl check if time_t is unsigned
-dnl
-
-MYSQL_CHECK_TIME_T
-
-
-# do we need #pragma interface/#pragma implementation ?
-# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
-AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
-# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
-# follow any standard), we'll use well-defined preprocessor macros:
-AC_TRY_CPP([
-#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
-#error USE_PRAGMA_IMPLEMENTATION
-#endif
-],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
-
-# This always gives a warning. Ignore it unless you are cross compiling
-AC_C_BIGENDIAN
-#---START: Used in for client configure
-# Check base type of last arg to accept
-MYSQL_TYPE_ACCEPT
-#---END:
-# Figure out what type of struct rlimit to use with setrlimit
-MYSQL_TYPE_STRUCT_RLIMIT
-# Find where the stack goes
-MYSQL_STACK_DIRECTION
-# We want to skip alloca on irix unconditionally. It may work on some version..
-MYSQL_FUNC_ALLOCA
-# Do struct timespec have members tv_sec or ts_sec
-MYSQL_TIMESPEC_TS
-# Do we have the tzname variable
-MYSQL_TZNAME
-# Do the c++ compiler have a bool type
-MYSQL_CXX_BOOL
-# Check some common bugs with gcc 2.8.# on sparc
-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])
-
-MYSQL_PTHREAD_YIELD
-
-######################################################################
-# For readline/libedit (We simply move the mimimum amount of stuff from
-# the readline/libedit configure.in here)
-
-dnl Checks for header files.
-AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
-
-dnl Checks for library functions.
-AC_FUNC_ALLOCA
-AC_PROG_GCC_TRADITIONAL
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(re_comp regcomp strdup)
-
-dnl Sun compilers have their own vis.h that is about something
-dnl totally different. So, not to change the libedit source, we
-dnl do some additional checks before we define HAVE_VIS_H.
-AC_CHECK_HEADER(vis.h,
- [AC_CHECK_FUNC(strvis,
- [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
-
-AC_CHECK_FUNCS(strlcat strlcpy)
-AC_CHECK_FUNCS(issetugid)
-AC_CHECK_FUNCS(fgetln)
-AC_CHECK_FUNCS(getline flockfile)
-
-# from old readline settting:
-
-MAKE_SHELL=/bin/sh
-AC_SUBST(MAKE_SHELL)
-
-# Already-done: stdlib.h string.h unistd.h termios.h
-AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
- sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
- sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
-paths.h semaphore.h langinfo.h)
-
-# Already-done: strcasecmp
-AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
-AC_CHECK_FUNCS(nl_langinfo)
-
-AC_STAT_MACROS_BROKEN
-MYSQL_SIGNAL_CHECK
-MYSQL_CHECK_GETPW_FUNCS
-MYSQL_HAVE_TIOCGWINSZ
-MYSQL_HAVE_FIONREAD
-MYSQL_HAVE_TIOCSTAT
-MYSQL_STRUCT_DIRENT_D_INO
-MYSQL_STRUCT_DIRENT_D_NAMLEN
-MYSQL_TYPE_SIGHANDLER
-MYSQL_CHECK_MULTIBYTE
-if test "$with_named_curses" = "no"
-then
- MYSQL_CHECK_LIB_TERMCAP
-else
- TERMCAP_LIB="$with_named_curses"
-fi
-AC_SUBST(TERMCAP_LIB)
-
-# Check if the termcap function 'tgoto' is already declared in
-# system header files or if it need to be declared locally
-AC_CHECK_DECLS(tgoto,,,[
-#ifdef HAVE_CURSES_H
-# include <curses.h>
-#elif HAVE_NCURSES_H
-# include <ncurses.h>
-#endif
-#ifdef HAVE_TERM_H
-# include <term.h>
-#endif
-])
-
-LIBEDIT_LOBJECTS=""
-AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
-AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
-AC_CHECK_FUNC(strlcpy, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
-AC_CHECK_FUNC(strlcat, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
-AC_CHECK_FUNC(fgetln, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
-AC_SUBST(LIBEDIT_LOBJECTS)
-enable_readline="yes"
-
-# End of readline/libedit stuff
-#########################################################################
-
-dnl Checks for library functions.
-
-#
-# The following code disables intrinsic function support while we test for
-# library functions. This is to avoid configure problems with Intel ecc
-# compiler
-
-ORG_CFLAGS="$CFLAGS"
-if test "$GCC" != "yes"; then
- AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
-fi
-
-#AC_FUNC_MMAP
-AC_TYPE_SIGNAL
-MYSQL_TYPE_QSORT
-AC_FUNC_UTIME_NULL
-AC_FUNC_VPRINTF
-
-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 \
- getpwuid getrlimit getrusage getwd index initgroups isnan \
- localtime_r gethrtime gmtime_r \
- locking longjmp lrand48 madvise mallinfo memcpy memmove \
- mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
- pthread_attr_getstacksize pthread_attr_setstacksize pthread_condattr_create \
- pthread_getsequence_np pthread_key_delete pthread_rwlock_rdlock \
- pthread_sigmask \
- readlink realpath rename rint rwlock_init setupterm \
- shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
- sighold sigset sigthreadmask port_create sleep thr_yield \
- snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
- strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
- posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack)
-
-#
-#
-#
-case "$target" in
- *-*-aix4* | *-*-sco*)
- # (grr) aix 4.3 has a stub for clock_gettime, (returning ENOSYS)
- # and using AC_TRY_RUN is hard when cross-compiling
- # We also disable for SCO for the time being, the headers for the
- # thread library we use conflicts with other headers.
- ;;
- *) AC_CHECK_FUNCS(clock_gettime)
- ;;
-esac
-
-case "$mysql_cv_sys_os" in
- OS400) # i5/OS (OS/400) emits a SIGILL (Function not implemented) when
- # unsupported priority values are passed to pthread_setschedprio.
- # Since the only supported value is 1, treat it as inexistent.
- ;;
- SunOS) # Bug#42599 error: `pthread_setschedprio' was not declared in this scope
- # In some installations, the pthread.h header used by GCC does not
- # declare the pthread_setscheprio prototype, but the function is
- # implemented. Since the function is used in C++ code, ensure that
- # the function prototype is present.
- AC_MSG_CHECKING([whether pthread_setschedprio is declared])
- AC_LANG_PUSH([C++])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([#include <pthread.h>],
- [(void)(pthread_setschedprio);])],
- [ac_cv_func_pthread_setschedprio=yes],
- [ac_cv_func_pthread_setschedprio=no])
- AC_LANG_POP([C++])
- AC_MSG_RESULT([$ac_cv_func_pthread_setschedprio])
- if test "$ac_cv_func_pthread_setschedprio" = yes; then
- AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1,
- [Define to 1 if you have the `pthread_setschedprio' function.])
- fi
- ;;
- *) AC_CHECK_FUNCS(pthread_setschedprio)
- ;;
-esac
-
-# Check that isinf() is available in math.h and can be used in both C and C++
-# code
-AC_MSG_CHECKING(for isinf in <math.h>)
-AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
- AC_MSG_RESULT(yes)
- AC_MSG_CHECKING(whether isinf() is safe to use in C code)
- AC_TRY_RUN([
-#include <math.h>
-int main()
-{
- double a= 10.0;
- double b= 1e308;
-
- return !isinf(a * b);
-}
-],
- [AC_MSG_RESULT(yes)],
- [AC_MSG_RESULT(no)
- AC_DEFINE([HAVE_BROKEN_ISINF], [1],
- [Define to 1 if isinf() uses 80-bit register for intermediate values])
- ],
- [
-# Let's be optimistic when cross-compiling, since the only compiler known
-# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
- AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
- ])
- AC_MSG_CHECKING(whether isinf() can be used in C++ code)
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
- AC_MSG_RESULT(no))
- AC_LANG_RESTORE,
- AC_MSG_RESULT(no))
-
-CFLAGS="$ORG_CFLAGS"
-
-# Sanity check: We chould not have any fseeko symbol unless
-# large_file_support=yes
-AC_CHECK_FUNC(fseeko,
-[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
-then
- AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
-fi]
-)
-
-# Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-
-# Test whether madvise() is declared in C++ code -- it is not on some
-# systems, such as Solaris
-AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
-#include <sys/types.h>
-#include <sys/mman.h>
-#endif])
-
-# Do not treat warnings as errors if we are linking against other libc
-# this is to work around gcc not being permissive on non-system includes
-# with respect to ANSI C++
-# We also remove the -fbranch-probabilities option as this will give warnings
-# about not profiled code, which confuses configure
-# We also must remove -W and -Wcheck which on icc produces warnings that
-# we don't want to catch with -Werror
-
-if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
-then
- CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
-fi
-
-AC_TRY_COMPILE(
-[#undef inline
-#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
- struct hostent *foo = gethostbyaddr_r((const char *) 0,
- 0, 0, (struct hostent *) 0, (char *) NULL, 0, &skr); return (foo == 0);],
-mysql_cv_gethost_style=solaris, mysql_cv_gethost_style=other))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethost_style" = "solaris"
-then
- AC_DEFINE([HAVE_SOLARIS_STYLE_GETHOST], [1],
- [Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines this with 8 arguments])
-fi
-
-#---START: Used in for client configure
-
-# Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([style of gethostbyname_r routines], mysql_cv_gethostbyname_style,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
-then
- CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
-fi
-AC_TRY_COMPILE(
-[#undef inline
-#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0,
- (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
-mysql_cv_gethostbyname_style=glibc2, mysql_cv_gethostbyname_style=other))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostbyname_style" = "glibc2"
-then
- AC_DEFINE([HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE], [1],
- [Solaris define gethostbyname_r with 5 arguments. glibc2 defines this with 6 arguments])
-fi
-
-# Check 3rd argument of getthostbyname_r
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([3 argument to gethostbyname_r routines], mysql_cv_gethostbyname_arg,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
-then
- CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
-fi
-AC_TRY_COMPILE(
-[#undef inline
-#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);],
-mysql_cv_gethostbyname_arg=hostent_data, mysql_cv_gethostbyname_arg=char))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostbyname_arg" = "hostent_data"
-then
- AC_DEFINE([HAVE_GETHOSTBYNAME_R_RETURN_INT], [1],
- [In OSF 4.0f the 3'd argument to gethostbyname_r is hostent_data *])
-fi
-
-
-# Check definition of pthread_getspecific
-AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
-AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[ void *pthread_getspecific(pthread_key_t key);
-pthread_getspecific((pthread_key_t) NULL); ],
-mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
- if test "$mysql_cv_getspecific_args" = "other"
- then
- AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
- [For some non posix threads])
- fi
-
- # Check definition of pthread_mutex_init
- AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
- AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[
- pthread_mutexattr_t attr;
- pthread_mutex_t mp;
- pthread_mutex_init(&mp,&attr); ],
-mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
- if test "$mysql_cv_mutex_init_args" = "other"
- then
- AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
- [For some non posix threads])
- fi
-#---END:
-
-#---START: Used in for client configure
-# Check definition of readdir_r
-AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
-AC_TRY_LINK(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <dirent.h>],
-[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
-readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
-mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
-if test "$mysql_cv_readdir_r" = "POSIX"
-then
- AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
-fi
-
-# Check definition of posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[#ifndef _AIX
-sigset_t set;
-int sig;
-sigwait(&set,&sig);
-#endif],
-mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "POSIX"
-then
- AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
-fi
-
-if test "$mysql_cv_sigwait" != "POSIX"
-then
-unset mysql_cv_sigwait
-# Check definition of posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[sigset_t set;
-int sig;
-sigwait(&set);],
-mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "NONPOSIX"
-then
- AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
-fi
-fi
-#---END:
-
-#Check for x86 PAUSE instruction
-AC_MSG_CHECKING("for x86 PAUSE instruction")
-# We have to actually try running the test program, because of a bug
-# in Solaris on x86_64, where it wrongly reports that PAUSE is not
-# supported when trying to run an application. See
-# http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
-AC_TRY_RUN([
- int main() {
- __asm__ __volatile__ ("pause");
- return 0;
- }
- ],
- [x86_pause_exists=yes],
- [x86_pause_exists=no],
- [x86_pause_exists=no] # Cross-compile, assume no PAUSE instruction
-)
-AC_TRY_RUN([
- int main() {
- __asm__ __volatile__ ("rep; nop");
- return 0;
- }
- ],
- [x86_fake_pause_exists=yes],
- [x86_fake_pause_exists=no],
- [x86_fake_pause_exists=no] # Cross-compile, assume no x86 NOP instruction
-)
-if test "$x86_pause_exists" = "yes"
-then
- AC_DEFINE([HAVE_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
-else
- if test "$x86_fake_pause_exists" = "yes"
- then
- AC_DEFINE([HAVE_FAKE_PAUSE_INSTRUCTION], [1], [Does x86 NOP instruction exist])
- fi
-fi
-
-# Check if pthread_attr_setscope() exists
-AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
-AC_TRY_LINK(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>],
-[pthread_attr_t thr_attr;
-pthread_attr_setscope(&thr_attr,0);],
-mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
-if test "$mysql_cv_pthread_attr_setscope" = "yes"
-then
- AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
-fi
-
-# Check for bad includes
-AC_MSG_CHECKING("can netinet files be included")
-AC_TRY_COMPILE(
-[#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in_systm.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/tcp.h>],
-[ printf("1\n"); ],
-netinet_inc=yes, netinet_inc=no)
-if test "$netinet_inc" = "no"
-then
- AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
-fi
-AC_MSG_RESULT("$netinet_inc")
-
-AC_CACHE_CHECK([support for weak symbols], mysql_cv_weak_symbol,
-[AC_TRY_LINK([],[
- extern void __attribute__((weak)) foo(void);
-], [mysql_cv_weak_symbol=yes], [mysql_cv_weak_symbol=no])])
-
-if test "x$mysql_cv_weak_symbol" = xyes; then
- AC_DEFINE(HAVE_WEAK_SYMBOL, 1,
- [Define to 1 if compiler supports weak symbol attribute.])
-fi
-
-AC_CACHE_CHECK([whether __bss_start is defined], mysql_cv_bss_start,
-[AC_TRY_LINK([],[
- extern char *__bss_start;
- return __bss_start ? 1 : 0;
-], [mysql_cv_bss_start=yes], [mysql_cv_bss_start=no])])
-
-if test "x$mysql_cv_bss_start" = xyes; then
- AC_DEFINE(HAVE_BSS_START, 1,
- [Define to 1 if compiler defines __bss_start.])
-fi
-
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-AC_CHECK_HEADERS(cxxabi.h)
-AC_CACHE_CHECK([for abi::__cxa_demangle], mysql_cv_cxa_demangle,
-[AC_TRY_LINK([#include <cxxabi.h>], [
- char *foo= 0; int bar= 0;
- foo= abi::__cxa_demangle(foo, foo, 0, &bar);
-], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
-AC_LANG_RESTORE
-
-if test "x$mysql_cv_cxa_demangle" = xyes; then
- AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
- [Define to 1 if you have the `abi::__cxa_demangle' function.])
-fi
-
-#--------------------------------------------------------------------
-# Check for requested features
-#--------------------------------------------------------------------
-
-MYSQL_CHECK_BIG_TABLES
-MYSQL_CHECK_MAX_INDEXES
-MYSQL_CHECK_VIO
-MYSQL_CHECK_SSL
-
-#--------------------------------------------------------------------
-# Declare our plugin modules
-# Has to be done late, as the plugin may need to check for existence of
-# functions tested above
-#--------------------------------------------------------------------
-
-MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support],
- [MySQL Partitioning Support], [max,max-no-ndb])
-
-dnl -- ndbcluster requires partition to be enabled
-
-MYSQL_CONFIGURE_PLUGINS([default])
-
-# Only build client code?
-AC_ARG_WITH(server,
- [ --without-server Only build the client.],
- [with_server=$withval],
- [with_server=yes]
-)
-
-AC_ARG_WITH(embedded-server,
- [ --with-embedded-server Build the embedded server (libmysqld).],
- [with_embedded_server=$withval],
- [with_embedded_server=no]
-)
-
-AC_ARG_WITH(query_cache,
- [ --without-query-cache Do not build query cache.],
- [with_query_cache=$withval],
- [with_query_cache=yes]
-)
-
-if test "$with_query_cache" = "yes"
-then
- AC_DEFINE([HAVE_QUERY_CACHE], [1], [If we want to have query cache])
-fi
-
-AC_ARG_WITH(geometry,
- [ --without-geometry Do not build geometry-related parts.],
- [with_geometry=$withval],
- [with_geometry=yes]
-)
-
-if test "$with_geometry" = "yes"
-then
- AC_DEFINE([HAVE_SPATIAL], [1], [Spatial extentions])
- AC_DEFINE([HAVE_RTREE_KEYS], [1], [RTree keys])
-fi
-
-AC_ARG_WITH(embedded_privilege_control,
- [ --with-embedded-privilege-control
- Build parts to check user's privileges.
- Only affects embedded library.],
- [with_embedded_privilege_control=$withval],
- [with_embedded_privilege_control=no]
-)
-
-if test "$with_embedded_privilege_control" = "yes"
-then
- AC_DEFINE([HAVE_EMBEDDED_PRIVILEGE_CONTROL], [1],
- [Access checks in embedded library])
-fi
-
-#MYSQL_CHECK_CPU
-
-libmysqld_dirs=
-if test "$with_embedded_server" = "yes"
-then
- libmysqld_dirs=libmysqld
-
- # We can't build embedded library without building the server, because
- # we depend on libmysys, libmystrings, libmyisam, etc.
- with_server=yes
-fi
-# XXX: We need to add @libmysqld_extra_libs@ (or whatever) so that
-# mysql_config --libmysqld-libs will print out something like
-# -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ...
-AC_SUBST([libmysqld_dirs])
-
-# Shall we build the docs?
-AC_ARG_WITH(docs,
- [ --without-docs Skip building of the documentation.],
- [with_docs=$withval],
- [with_docs=yes]
-)
-
-if test "$with_docs" = "yes"
-then
- docs_dirs="Docs"
- if test -f "$srcdir/Docs/manual.chm" ; then
- extra_docs="manual.chm"
- fi
-else
- docs_dirs=""
- extra_docs=""
-fi
-AC_SUBST(docs_dirs)
-AC_SUBST(extra_docs)
-
-# Shall we build the man pages?
-AC_ARG_WITH(man,
- [ --without-man Skip building of the man pages.],
- [with_man=$withval],
- [with_man=yes]
-)
-
-# Don't build readline, i have it already
-AC_ARG_WITH(readline,
- [ --without-readline Use system readline instead of bundled copy.],
- [ with_readline=$withval ],
- [ with_readline=undefined ]
- )
-
-AC_ARG_WITH(libedit,
- [ --without-libedit Use system libedit instead of bundled copy.],
- [ with_libedit=$withval ],
- [ with_libedit=undefined ]
- )
-
-if test "$with_readline/$with_libedit" = "undefined/undefined" -a ! -e "$srcdir/cmd-line-utils"
-then
- with_readline=no
- with_libedit=no
-fi
-
-#
-# We support next variants of compilation:
-# --with-readline
-# | yes | no | undefined
-# --with-libedit | | |
-# ---------------+----------------+------+----------------------------------
-# yes | ERROR! | use libedit from mysql sources
-# ---------------+----------------+------+----------------------------------
-# no | use readline | use system readline or external libedit
-# | from mysql | according to results of m4 tests
-# ---------------+ sources (if it + +----------------------------------
-# undefined | is presented) | | use libedit from mysql sources
-
-
-compile_readline="no"
-compile_libedit="no"
-
-if [test "$with_libedit" = "yes"] && [test "$with_readline" = "yes"]
-then
- AC_MSG_ERROR([You can not use --with-readline and --with-libedit at the same time, please choose one of it])
-fi
-
-readline_topdir=""
-readline_basedir=""
-readline_dir=""
-readline_h_ln_cmd=""
-readline_link=""
-want_to_use_readline="no"
-
-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
- # 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
-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
-
-AC_SUBST(readline_dir)
-AC_SUBST(readline_topdir)
-AC_SUBST(readline_basedir)
-AC_SUBST(readline_link)
-AC_SUBST(readline_h_ln_cmd)
-
-
-
-# Include man pages, if desired, adapted to the configured parts.
-if test X"$with_man" = Xyes
-then
- # First, create the list of all man pages present.
- MANLISTFIL=manlist.$$
- TMPLISTFIL=`echo $MANLISTFIL | sed -e 's/manlist/tmplist/'`
- if test -f $MANLISTFIL -o -f $TMPLISTFIL
- then
- echo "Temp file '$MANLISTFIL' or '$TMPLISTFIL' already exists in '`pwd`' - aborting"
- exit 1
- fi
- touch $MANLISTFIL $TMPLISTFIL
-
- ls $srcdir/man/*.[[18]] > $MANLISTFIL
-
- # Then, remove all those pages from the list which are specific to parts
- # (table handlers, features, ...) which are not configured in this run.
- AC_MSG_CHECKING("for man pages to remove")
- MAN_DROP="dropping"
- if test X"$with_plugin_ndbcluster" != Xyes
- then
- MAN_DROP="$MAN_DROP ndbcluster"
- grep -v '/ndb' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
- fi
- if test X"$with_embedded_server" != Xyes
- then
- MAN_DROP="$MAN_DROP embedded"
- grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
- fi
- if test X"$with_plugin_innobase" != Xyes
- then
- MAN_DROP="$MAN_DROP innodb"
- grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
- fi
- AC_MSG_RESULT([$MAN_DROP])
-
- # Finally, split the man pages into sections 1 and 8.
- # Get rid of line breaks.
- man1_files=`sed -n -e '/\.1$/s/^.*man\///p' <$MANLISTFIL`
- man8_files=`sed -n -e '/\.8$/s/^.*man\///p' <$MANLISTFIL`
-
- man_dirs="man"
- man1_files=`echo $man1_files`
- man8_files=`echo $man8_files`
- rm -f $MANLISTFIL $TMPLISTFIL
-else
- man_dirs=""
- man1_files=""
- man8_files=""
-fi
-AC_SUBST(man_dirs)
-AC_SUBST(man1_files)
-AC_SUBST(man8_files)
-
-# If we have threads generate some library functions and test programs
-sql_server_dirs=
-sql_server=
-server_scripts=
-
-dnl This probably should be cleaned up more - for now the threaded
-dnl client is just using plain-old libs.
-sql_client_dirs="strings mysys dbug extra regex libmysql"
-
-AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
-
-if test "$THREAD_SAFE_CLIENT" != "no"
-then
- sql_client_dirs="$sql_client_dirs libmysql_r"
- AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe])
-fi
-sql_client_dirs="$sql_client_dirs client"
-
-CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
-
-AC_SUBST(CLIENT_LIBS)
-AC_SUBST(CLIENT_THREAD_LIBS)
-AC_SUBST(NON_THREADED_LIBS)
-AC_SUBST(STATIC_NSS_FLAGS)
-AC_SUBST(sql_client_dirs)
-
-if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
-then
- AC_DEFINE([THREAD], [1],
- [Define if you want to have threaded code. This may be undef on client code])
- # Avoid _PROGRAMS names
- THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o"
- AC_SUBST(THREAD_LOBJECTS)
-fi
-AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no")
-
-if test "$with_server" != "no"
-then
- server_scripts="mysqld_safe mysql_install_db"
- sql_server_dirs="strings mysys dbug extra regex storage plugin"
-
- sql_server="vio sql"
-fi
-
-# "innochecksum" is not in the "innobase/" subdirectory, but should be switched
-AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innobase" = Xyes])
-
-# IMPORTANT - do not modify LIBS past this line - this hack is the only way
-# I know to add the static NSS magic if we have static NSS libraries with
-# glibc - Sasha
-
-LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
-LIBS="$LIBS $STATIC_NSS_FLAGS"
-
-AC_SUBST(sql_server_dirs)
-AC_SUBST(sql_server)
-AC_SUBST(server_scripts)
-
-AC_SUBST(mysql_plugin_dirs)
-AC_SUBST(mysql_plugin_libs)
-AC_SUBST(mysql_optional_plugins)
-AC_SUBST(mysql_mandatory_plugins)
-
-# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
-# We support client-only builds by "--without-server", but not vice versa,
-# so we start with the client list, then add each server item not yet present.
-sql_union_dirs=" $sql_client_dirs "
-for DIR in $sql_server_dirs
-do
- if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
- then
- : # already present, skip
- else
- sql_union_dirs="$sql_union_dirs $DIR "
- fi
-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
-AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
-
-#--------------------------------------------------------------------
-# Support for WL#2373 (Use cycle counter for timing)
-#--------------------------------------------------------------------
-
-AC_CHECK_HEADERS(time.h)
-AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(sys/times.h)
-AC_CHECK_HEADERS(asm/msr.h)
-#msr.h has rdtscll()
-
-AC_CHECK_HEADERS(ia64intrin.h)
-
-AC_CHECK_FUNCS(times)
-AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_FUNCS(read_real_time)
-# This should work on AIX.
-
-AC_CHECK_FUNCS(ftime)
-# This is still a normal call for milliseconds.
-
-AC_CHECK_FUNCS(time)
-# We can use time() on Macintosh if there is no ftime().
-
-AC_CHECK_FUNCS(rdtscll)
-# I doubt that we'll ever reach the check for this.
-
-# When compiling with Sun Studio C / C++ we need to include
-# my_timer_cycles.il, an "inline templates" separate file,
-# on the command line. It has assembly code, "rd %tick" for
-# SPARC or "rdtsc" for x86.
-RDTSC_SPARC_ASSEMBLY=""
-case $CC_VERSION in
- *Sun*C*)
- RDTSC_SPARC_ASSEMBLY="my_timer_cycles.il"
- ;;
-esac
-case $CXX_VERSION in
- *Sun*C++*)
- RDTSC_SPARC_ASSEMBLY="my_timer_cycles.il"
- ;;
-esac
-
-AC_SUBST([RDTSC_SPARC_ASSEMBLY])
-
-
-#--------------------------------------------------------------------
-# Output results
-#--------------------------------------------------------------------
-
-if test -d "$srcdir/cmd-line-utils/readline" ; then
- AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
-fi
-
-AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
- unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
- unittest/mysys/Makefile unittest/strings/Makefile dnl
- unittest/examples/Makefile dnl
- strings/Makefile regex/Makefile storage/Makefile dnl
- man/Makefile BUILD/Makefile vio/Makefile dnl
- libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
- sql/Makefile sql/share/Makefile dnl
- sql/sql_builtin.cc sql-common/Makefile libservices/Makefile dnl
- dbug/Makefile scripts/Makefile include/Makefile dnl
- tests/Makefile Docs/Makefile support-files/Makefile dnl
- support-files/MacOSX/Makefile support-files/RHEL4-SElinux/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
- sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl
- cmake/Makefile packaging/Makefile
- )
-
-AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
-
-# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
-AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
-
-AC_OUTPUT
-
-# The first line "Thank you ..." is checked in ./Do-compile to verify that configure
-# ended sucessfully - don't remove it.
-echo
-echo "Thank you for choosing MySQL!"
-echo
-echo "Remember to check the platform specific part of the reference manual"
-echo "for hints about installing MySQL on your platform."
-echo "Also have a look at the files in the Docs directory."
-echo
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
deleted file mode 100644
index 3581b3597ee..00000000000
--- a/dbug/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright (C) 2000, 2002, 2004-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-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
-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 \
- CMakeLists.txt tests.c tests-t.pl
-NROFF_INC = example1.r example2.r example3.r main.r \
- factorial.r output1.r output2.r output3.r \
- output4.r output5.r
-CLEANFILES = $(NROFF_INC) user.t user.ps tests-t
-
-
-# Must be linked with libs that are not compiled yet
-noinst_PROGRAMS = factorial dbug_analyze tests
-factorial_SOURCES = my_main.c factorial.c
-tests_SOURCES = tests.c
-dbug_analyze_SOURCES = dbug_analyze.c
-
-all: user.t user.ps tests-t
-
-user.t: user.r $(NROFF_INC)
- -nroff -mm user.r > $@
-
-user.ps: user.r $(NROFF_INC)
- -groff -mm user.r > $@
-
-output1.r: factorial
- ./factorial 1 2 3 4 5 | cat > $@
-
-output2.r: factorial
- ./factorial -\#t:o 2 3 | cat >$@
-
-output3.r: factorial
- ./factorial -\#d:t:o 3 | cat >$@
-
-output4.r: factorial
- ./factorial -\#d,result:o 4 | cat >$@
-
-output5.r: factorial
- ./factorial -\#d:f,factorial:F:L:o 3 | cat >$@
-.c.r:
- @RM@ -f $@
- @SED@ -e 's!\\!\\\\!g' $< > $@
-
-# a hack to have executable in builddir, not in srcdir
-tests-t: tests-t.pl
- cp -f $(srcdir)/tests-t.pl ./tests-t
-
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 040ee9356c1..df26e2ee8ef 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -905,6 +905,7 @@ void _db_set_init_(const char *control)
CODE_STATE tmp_cs;
bzero((uchar*) &tmp_cs, sizeof(tmp_cs));
tmp_cs.stack= &init_settings;
+ tmp_cs.process= db_process ? db_process : "dbug";
DbugParse(&tmp_cs, control);
}
@@ -2370,7 +2371,7 @@ static void DbugFlush(CODE_STATE *cs)
void _db_flush_()
{
- CODE_STATE *cs;
+ CODE_STATE *cs= NULL;
get_code_state_or_return;
(void) fflush(cs->stack->out_file);
}
diff --git a/extra/Makefile.am b/extra/Makefile.am
deleted file mode 100644
index ff62749ac4c..00000000000
--- a/extra/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/sql
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
- ../dbug/libdbug.a ../strings/libmystrings.a \
- $(ZLIB_LIBS)
-BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \
- $(top_builddir)/include/sql_state.h \
- $(top_builddir)/include/mysqld_ername.h
-pkginclude_HEADERS= $(BUILT_SOURCES)
-DISTCLEANFILES = $(BUILT_SOURCES)
-SUBDIRS = @yassl_dir@
-DIST_SUBDIRS = yassl
-
-# This will build mysqld_error.h, mysqld_ername.h and sql_state.h
-# NOTE Built files should depend on their sources to avoid
-# the built files being rebuilt in source dist
-$(top_builddir)/include/mysqld_error.h: comp_err.c \
- $(top_srcdir)/sql/share/errmsg-utf8.txt
- $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT)
- $(top_builddir)/extra/comp_err$(EXEEXT) \
- --charset=$(top_srcdir)/sql/share/charsets \
- --out-dir=$(top_builddir)/sql/share/ \
- --header_file=$(top_builddir)/include/mysqld_error.h \
- --name_file=$(top_builddir)/include/mysqld_ername.h \
- --state_file=$(top_builddir)/include/sql_state.h \
- --in_file=$(top_srcdir)/sql/share/errmsg-utf8.txt
-$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
-$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
-
-bin_PROGRAMS = replace perror resolveip my_print_defaults \
- resolve_stack_dump mysql_waitpid
-# "innochecksum" should be switched
-if BUILD_INNODB_TOOLS
-bin_PROGRAMS += innochecksum
-endif
-
-noinst_PROGRAMS = charset2html
-EXTRA_PROGRAMS = comp_err
-EXTRA_DIST = CMakeLists.txt
-
-perror.o: perror.c
- $(COMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
diff --git a/extra/yassl/Makefile.am b/extra/yassl/Makefile.am
deleted file mode 100644
index 43cae0514f9..00000000000
--- a/extra/yassl/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = taocrypt src testsuite
-EXTRA_DIST = CMakeLists.txt
diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am
deleted file mode 100644
index 300cdcd096f..00000000000
--- a/extra/yassl/src/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL
-
-noinst_LTLIBRARIES = libyassl.la
-libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
- handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
- template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
-EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)
-AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@
diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am
deleted file mode 100644
index deab5227f7f..00000000000
--- a/extra/yassl/taocrypt/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = src test benchmark
-EXTRA_DIST = CMakeLists.txt $(wildcard mySTL/*.hpp)
diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am
deleted file mode 100644
index 0171c7366bb..00000000000
--- a/extra/yassl/taocrypt/benchmark/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
-noinst_PROGRAMS = benchmark
-benchmark_SOURCES = benchmark.cpp
-benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-benchmark_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
-EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am
deleted file mode 100644
index a8d08b6e9d5..00000000000
--- a/extra/yassl/taocrypt/src/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
-
-noinst_LTLIBRARIES = libtaocrypt.la
-
-libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
- asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \
- dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md4.cpp md5.cpp misc.cpp \
- random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
- tftables.cpp twofish.cpp
-
-libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \
- @yassl_thread_cxxflags@
-
-EXTRA_DIST = $(wildcard ../include/*.hpp)
diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am
deleted file mode 100644
index 38f04f1387f..00000000000
--- a/extra/yassl/taocrypt/test/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
-noinst_PROGRAMS = test
-test_SOURCES = test.cpp
-test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-test_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
-EXTRA_DIST = make.bat
diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am
deleted file mode 100644
index d74c972a084..00000000000
--- a/extra/yassl/testsuite/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL
-noinst_PROGRAMS = testsuite
-testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \
- ../examples/client/client.cpp ../examples/server/server.cpp \
- ../examples/echoclient/echoclient.cpp \
- ../examples/echoserver/echoserver.cpp
-testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER @yassl_thread_cxxflags@
-testsuite_LDADD = $(top_builddir)/extra/yassl/src/libyassl.la \
- $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat
diff --git a/include/Makefile.am b/include/Makefile.am
deleted file mode 100644
index 415e2ef8c8c..00000000000
--- a/include/Makefile.am
+++ /dev/null
@@ -1,107 +0,0 @@
-# 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
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# 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
-HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
- my_list.h my_alloc.h typelib.h mysql/plugin.h \
- mysql/plugin_audit.h mysql/plugin_ftparser.h
-pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
- my_xml.h mysql_embed.h mysql/plugin_auth.h \
- mysql/client_plugin.h mysql/plugin_auth_common.h \
- mysql/services.h \
- mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
- mysql/service_thread_scheduler.h \
- mysql/service_thd_wait.h \
- my_pthread.h my_no_pthread.h \
- decimal.h errmsg.h my_global.h my_net.h \
- my_getopt.h sslopt-longopts.h my_dir.h \
- sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
- m_ctype.h my_attribute.h my_compiler.h \
- $(HEADERS_GEN_CONFIGURE) $(HEADERS_GEN_MAKE) \
- probes_mysql.h probes_mysql_nodtrace.h
-
-noinst_HEADERS = lf.h my_bit.h \
- heap.h my_bitmap.h my_uctype.h password.h \
- myisam.h myisampack.h myisammrg.h ft_global.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 hash.h thr_alarm.h \
- thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
- my_handler.h my_time.h service_versions.h \
- my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.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
-
-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 \
- mysql/psi/psi_abi_v1.h.pp \
- mysql/psi/psi_abi_v2.h.pp \
- mysql/plugin_auth.h.pp mysql/client_plugin.h.pp
-
-# Remove built files and the symlinked directories
-CLEANFILES = $(BUILT_SOURCES) readline openssl probes_mysql.d probes_mysql_nodtrace.h
-
-
-# Some include files that may be moved and patched by configure
-DISTCLEANFILES = sched.h $(CLEANFILES) $(HEADERS_GEN_CONFIGURE)
-
-link_sources:
- -$(RM) -f readline openssl
- @readline_h_ln_cmd@
- @yassl_h_ln_cmd@
- echo timestamp > link_sources
-
-# We want both "my_config.h" and "config.h" that are identical, as
-# MySQL sources assumes the name "my_config.h", and 3rd party sources
-# assumes the name "config.h".
-my_config.h: config.h
- $(CP) config.h my_config.h
-
-# These files should not be included in distributions since they are
-# generated by configure from the .h.in files
-dist-hook:
- $(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h
-
-probes_mysql.d:
- if ! test -f probes_mysql.d ; then \
- $(CP) -f $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d; \
- fi
-
-DTRACEPROVIDER = probes_mysql.d
-if HAVE_DTRACE
-BUILT_SOURCES += probes_mysql_dtrace.h
-CLEANFILES += $(DTRACEPROVIDER)
-
-# Fake for creating the probes file. If we are building a separate directory
-# then we copy the probes from the source location and use that
-# If we are building in the same directory as the source, we do not copy
-
-probes_mysql_dtrace.h: $(DTRACEPROVIDER)
- $(DTRACE) $(DTRACEFLAGS) -h -s $(DTRACEPROVIDER) -o $@
-endif
-
-probes_mysql_nodtrace.h: $(DTRACEPROVIDER)
- @PERL@ $(top_srcdir)/scripts/dheadgen.pl -f $(DTRACEPROVIDER) > $@
diff --git a/include/m_string.h b/include/m_string.h
index 2ec4eb64c8e..d2194858589 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -52,8 +52,6 @@
# define memmove(d, s, n) bmove ((d), (s), (n))
#elif defined(HAVE_MEMMOVE)
# define bmove(d, s, n) memmove((d), (s), (n))
-#else
-# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
#endif
/* Unixware 7 */
@@ -76,7 +74,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY)
+#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
+#define strmov(A,B) __builtin_stpcpy((A),(B))
+#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
@@ -94,14 +94,6 @@ extern char _dig_vec_lower[];
/* Prototypes for string functions */
-#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(uchar *dst,size_t len,pchar fill);
-#endif
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(uuchar *dst, const uchar *src,size_t len);
-#endif
-
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
extern void bchange(uchar *dst,size_t old_len,const uchar *src,
size_t new_len,size_t tot_len);
@@ -126,11 +118,6 @@ extern char *strxnmov(char *dst, size_t len, const char *src, ...);
extern size_t strnlen(const char *s, size_t n);
#endif
-#if !defined(__cplusplus)
-#ifndef HAVE_STRSTR
-extern char *strstr(const char *, const char *);
-#endif
-#endif
extern int is_prefix(const char *, const char *);
/* Conversion routines */
diff --git a/include/my_compiler.h b/include/my_compiler.h
index 1cd46ff4260..5f898621159 100644
--- a/include/my_compiler.h
+++ b/include/my_compiler.h
@@ -32,8 +32,15 @@
/* GNU C/C++ */
#if defined __GNUC__
+/* Convenience macro to test the minimum required GCC version. */
+# define MY_GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
/* Any after 2.95... */
# define MY_ALIGN_EXT
+/* Comunicate to the compiler the unreachability of the code. */
+# if MY_GNUC_PREREQ(4,5)
+# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
+# endif
/* Microsoft Visual C++ */
#elif defined _MSC_VER
@@ -67,8 +74,13 @@
#endif
/**
- Generic compiler-dependent features.
+ Generic (compiler-independent) features.
*/
+
+#ifndef MY_GNUC_PREREQ
+# define MY_GNUC_PREREQ(maj, min) (0)
+#endif
+
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
@@ -79,6 +91,10 @@
# endif
#endif
+#ifndef MY_ASSERT_UNREACHABLE
+# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
+#endif
+
/**
C++ Type Traits
*/
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 19570ac2a67..e1cb3252601 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* 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
@@ -13,8 +13,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef _dbug_h
-#define _dbug_h
+#ifndef MY_DBUG_INCLUDED
+#define MY_DBUG_INCLUDED
+
+#ifndef __WIN__
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#endif /* not __WIN__ */
#ifdef __cplusplus
extern "C" {
@@ -111,6 +121,20 @@ extern const char* _db_get_func_(void);
#define DBUG_CRASH_VOID_RETURN \
DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return")
+/*
+ Make the program fail, without creating a core file.
+ abort() will send SIGABRT which (most likely) generates core.
+ Use SIGKILL instead, which cannot be caught.
+ We also pause the current thread, until the signal is actually delivered.
+ An alternative would be to use _exit(EXIT_FAILURE),
+ but then valgrind would report lots of memory leaks.
+ */
+#ifdef __WIN__
+#define DBUG_SUICIDE() DBUG_ABORT()
+#else
+#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL), pause())
+#endif
+
#else /* No debugger */
#define DBUG_ENTER(a1)
@@ -139,10 +163,11 @@ extern const char* _db_get_func_(void);
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define DEBUGGER_OFF do { } while(0)
#define DEBUGGER_ON do { } while(0)
-#define DBUG_ABORT() abort()
+#define DBUG_ABORT() do { } while(0)
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
+#define DBUG_SUICIDE() do { } while(0)
#endif
@@ -164,4 +189,5 @@ void debug_sync_point(const char* lock_name, uint lock_timeout);
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* MY_DBUG_INCLUDED */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 5eb0004e9c3..47feb21d85e 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -39,6 +39,13 @@ C_MODE_START
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
+/**
+ Enumeration of the my_option::arg_type attributes.
+ It should be noted that for historical reasons variables with the combination
+ arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts
+ arguments. This is someone counter intuitive and care should be taken
+ if the code is refactored.
+*/
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
struct st_typelib;
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d3053b4861a..bec88a716fe 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -501,7 +501,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime, const char *file, uint line);
+ const struct timespec *abstime,
+ const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
diff --git a/include/my_sys.h b/include/my_sys.h
index 23c9b2da55f..7b437e2a745 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -256,7 +256,7 @@ extern my_bool my_disable_locking, my_disable_async_io,
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
/* from default.c */
-extern char *my_defaults_extra_file;
+extern const char *my_defaults_extra_file;
extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
diff --git a/include/mysql.h b/include/mysql.h
index b52235b484e..d3b24f0198a 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -17,11 +17,10 @@
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
- The ABI should never be changed in a released product of MySQL
+ The ABI should never be changed in a released product of MySQL,
thus you need to take great care when changing the file. In case
- the file is changed so the ABI is broken, you must also
- update the SHAREDLIB_MAJOR_VERSION in configure.in .
-
+ the file is changed so the ABI is broken, you must also update
+ the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
*/
#ifndef _mysql_h
diff --git a/include/mysql/client_plugin.h b/include/mysql/client_plugin.h
index ddd3b64ca56..cc3f468040f 100644
--- a/include/mysql/client_plugin.h
+++ b/include/mysql/client_plugin.h
@@ -23,8 +23,10 @@
*/
#define MYSQL_CLIENT_PLUGIN_INCLUDED
+#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
+#endif
/* known plugin types */
#define MYSQL_CLIENT_reserved1 0
@@ -77,8 +79,7 @@ struct st_mysql_client_plugin_AUTHENTICATION
/**
loads a plugin and initializes it
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
@@ -98,8 +99,7 @@ mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
@@ -116,8 +116,7 @@ mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
/**
finds an already loaded plugin by name, or loads it, if necessary
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded
diff --git a/include/mysql/client_plugin.h.pp b/include/mysql/client_plugin.h.pp
index 58627e06f09..e508f821aad 100644
--- a/include/mysql/client_plugin.h.pp
+++ b/include/mysql/client_plugin.h.pp
@@ -1,5 +1,3 @@
-#include <stdarg.h>
-#include <stdlib.h>
struct st_mysql_client_plugin
{
int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index 5622e9cdebe..420eb3bb80f 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -90,8 +90,8 @@ typedef struct st_mysql_server_auth_info
int password_used;
/**
- Set to the name of the connected client if it can be resolved, or to
- the address otherwise
+ Set to the name of the connected client host, if it can be resolved,
+ or to its IP address otherwise.
*/
const char *host_or_ip;
@@ -107,7 +107,7 @@ typedef struct st_mysql_server_auth_info
*/
struct st_mysql_auth
{
- int interface_version; /**< version plugin uses */
+ int interface_version; /** version plugin uses */
/**
A plugin that a client must use for authentication with this server
plugin. Can be NULL to mean "any plugin".
diff --git a/include/mysql_com.h b/include/mysql_com.h
index d4223211710..bc9296a6d02 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -255,7 +255,11 @@ enum enum_server_command
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
SERVER_QUERY_NO_INDEX_USED|\
SERVER_MORE_RESULTS_EXISTS|\
- SERVER_STATUS_METADATA_CHANGED)
+ SERVER_STATUS_METADATA_CHANGED |\
+ SERVER_QUERY_WAS_SLOW |\
+ SERVER_STATUS_DB_DROPPED |\
+ SERVER_STATUS_CURSOR_EXISTS|\
+ SERVER_STATUS_LAST_ROW_SENT)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 7441423743e..d7426c465d8 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -172,7 +172,7 @@ IF(UNIX)
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
ENDIF()
ENDMACRO()
- INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+ INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
ENDIF()
IF(NOT DISABLE_SHARED)
@@ -210,7 +210,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
""
linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+ INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} 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})
@@ -219,7 +219,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${ver}"
linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+ INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
ENDFOREACH()
ENDIF()
ENDIF()
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
deleted file mode 100644
index 07f66c28ddb..00000000000
--- a/libmysql/Makefile.am
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (C) 2000-2004 MySQL AB, 2008-2009 Sun Microsystems, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 GNU General Public License as
-# published by the Free Software Foundation.
-#
-# There are special exceptions to the terms and conditions of the GPL as it
-# is applied to this software. View the full text of the exception in file
-# EXCEPTIONS-CLIENT in the directory of this software distribution.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-#
-# This file is public domain and comes with NO WARRANTY of any kind
-
-target = libmysqlclient.la
-target_defs = -DMYSQL_CLIENT_NO_THREADS -DDISABLE_MYSQL_THREAD_H \
- @LIB_EXTRA_CCFLAGS@
-
-LIBS = @CLIENT_LIBS@
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes) @ZLIB_INCLUDES@
-
-include $(srcdir)/Makefile.shared
-
-libmysqlclient_la_SOURCES = $(target_sources)
-libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_las)
-libmysqlclient_la_LDFLAGS = $(target_ldflags)
-EXTRA_DIST = Makefile.shared libmysql.def CMakeLists.txt
-noinst_HEADERS = client_settings.h
-
-link_sources:
- set -x; \
- ss=`echo $(mystringsobjects) | sed "s;\.lo;.c;g"`; \
- ds=`echo $(dbugobjects) | sed "s;\.lo;.c;g"`; \
- ms=`echo $(mysysobjects) | sed "s;\.lo;.c;g"`; \
- vs=`echo $(vio_objects) | sed "s;\.lo;.c;g"`; \
- scs=`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"`; \
- for f in $$ss; do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
- done; \
- for f in $$vs $(vioheaders); do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/vio/$$f $$f; \
- done; \
- for f in $$scs; do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/sql-common/$$f $$f; \
- done; \
- for f in $(mystringsextra); do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
- done; \
- for f in $$ds; do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/dbug/$$f $$f; \
- done; \
- for f in $$ms $(mysysheaders); do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/mysys/$$f $$f; \
- done; \
- rm -f net.c; \
- @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc net.c ; \
- rm -f password.c; \
- @LN_CP_F@ $(top_srcdir)/sql/password.c password.c
- echo timestamp > link_sources
-
-# This part requires GNUmake
-#
-# This makes a distribution file with only the files needed to compile
-# a minimal MySQL client library
-#
-# For a really minimal distribution (without debugging code) we could
-# keep only the stubs for debug.c
-#
-# A list of needed headers collected from the deps information 000213
-nh = my_global.h dbug.h errmsg.h \
- m_ctype.h m_string.h password.h \
- my_alarm.h my_config.h my_dir.h my_list.h my_net.h my_sys.h \
- mysql.h mysql_com.h mysql_version.h mysqld_error.h \
- mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h \
- sql_common.h ../libmysql/client_settings.h
-# Get a list of the needed objects
-lobjs = $(mysysobjects1) $(dbugobjects) $(mystringsobjects) $(sqlobjects)
-
-do-lib-dist:
- dir=libmysql-$(MYSQL_NO_DASH_VERSION); \
- srcs1=`echo $(lobjs) | sed "s;\.lo;.c;g"`; \
- srcs2=$(target_sources); \
- srcs="$$srcs1 $$srcs2"; \
- objs1=`echo $(lobjs) | sed "s;\.lo;.o;g"`; \
- objs2=`echo $(target_sources) | sed "s;\.c;.o;g"`; \
- objs="$$objs1 $$objs2"; \
- rm -rf $$dir; \
- mkdir $$dir; \
- $(INSTALL_DATA) $$srcs $(mysysheaders) $$dir; \
- for i in $(nh); do $(INSTALL_DATA) ../include/$$i $$dir; done; \
- echo "# A very minimal Makefile to compile" > $$dir/Makefile; \
- echo "# the minimized libmysql library" >> $$dir/Makefile; \
- echo "# This file is autogenerated from Makefile.am" >> $$dir/Makefile; \
- echo 'CFLAGS= -I. -DMYSQL_CLIENT_NO_THREADS' >>$$dir/Makefile; \
- echo "obj=$$objs" >>$$dir/Makefile; \
- echo 'all: libmysql.a' >>$$dir/Makefile; \
- echo 'libmysql.a: $$(obj)' >>$$dir/Makefile; \
- echo ' $$(AR) r $$@ $$?' >>$$dir/Makefile; \
- gtar cvzf $$dir.tar.gz $$dir; \
- cd $$dir; gmake
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
deleted file mode 100644
index 5a7236f1e6d..00000000000
--- a/libmysql/Makefile.shared
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright (C) 2000-2004 MySQL AB, 2008-2009 Sun Microsystems, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 GNU General Public License as
-# published by the Free Software Foundation.
-#
-# There are special exceptions to the terms and conditions of the GPL as it
-# is applied to this software. View the full text of the exception in file
-# EXCEPTIONS-CLIENT in the directory of this software distribution.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-#
-# This file is public domain and comes with NO WARRANTY of any kind
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-pkgplugindir = $(pkglibdir)/plugin
-## We'll use CLIENT_EXTRA_LDFLAGS for threaded and non-threaded
-## until someone complains that they need separate options.
-LDADD = @CLIENT_EXTRA_LDFLAGS@ $(target)
-pkglib_LTLIBRARIES = $(target)
-
-noinst_PROGRAMS = conf_to_src
-
-
-target_sources = libmysql.c password.c \
- get_password.c errmsg.c
-
-mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
- strmake.lo strend.lo \
- strnlen.lo strfill.lo is_prefix.lo \
- int2str.lo str2int.lo strcont.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 \
- ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjpms.lo ctype-euc_kr.lo \
- ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
- ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
- ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
- ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
-
-mystringsextra= strto.c
-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_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 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 \
- thr_mutex.lo mulalloc.lo string.lo default.lo \
- my_compress.lo array.lo my_once.lo list.lo \
- charset.lo charset-def.lo hash.lo mf_iocache.lo \
- mf_iocache2.lo my_seek.lo my_sleep.lo \
- my_pread.lo mf_cache.lo md5.lo sha1.lo \
- my_getopt.lo my_gethostbyname.lo my_port.lo \
- my_rename.lo my_chsize.lo my_sync.lo \
- my_getsystime.lo my_symlink2.lo mf_same.lo
-sqlobjects = net.lo
-sql_cmn_objects = pack.lo client.lo my_time.lo client_plugin.lo
-
-# Not needed in the minimum library
-mysysobjects2 = my_lib.lo mf_qsort.lo
-mysysobjects = $(mysysobjects1) $(mysysobjects2)
-target_libadd = $(mysysobjects) $(mystringsobjects) $(dbugobjects) \
- $(sql_cmn_objects) $(vio_objects) $(sqlobjects)
-target_ldflags = -version-info @SHARED_LIB_VERSION@ @LD_VERSION_SCRIPT@ @LIBDL@
-vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo
-
-BUILT_SOURCES = link_sources
-
-CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
- $(target) $(BUILT_SOURCES)
-DEFS = -DDEFAULT_CHARSET_HOME='"$(MYSQLBASEdir)"' \
- -DMYSQL_DATADIR='"$(MYSQLDATAdir)"' \
- -DDEFAULT_HOME_ENV=MYSQL_HOME \
- -DPLUGINDIR='"$(pkgplugindir)"' \
- -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
- -DDEFAULT_SYSCONFDIR='"$(sysconfdir)"' \
- -DSHAREDIR='"$(MYSQLSHAREdir)"' -DDISABLE_DTRACE \
- $(target_defs)
-
-if HAVE_YASSL
-yassl_las = $(top_builddir)/extra/yassl/src/libyassl.la \
- $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-endif
-
-# The automatic dependencies miss this
-#bmove_upp.lo: $(LTCHARSET_OBJS)
-
-clean-local:
- rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \
- `echo $(dbugobjects) | sed "s;\.lo;.c;g"` \
- `echo $(mysysobjects) | sed "s;\.lo;.c;g"` \
- `echo $(vio_objects) | sed "s;\.lo;.c;g"` \
- `echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"` \
- $(CHARSET_SRCS) $(CHARSET_OBJS) \
- $(mystringsextra) $(mysysheaders) $(vioheaders) \
- net.c
-
-conf_to_src_SOURCES = conf_to_src.c
-conf_to_src_LDADD=
-#force static linking of conf_to_src - essential when linking against
-#custom installation of libc
-conf_to_src_LDFLAGS=@NOINST_LDFLAGS@
diff --git a/libmysql/acinclude.m4 b/libmysql/acinclude.m4
deleted file mode 100644
index c0211f3759f..00000000000
--- a/libmysql/acinclude.m4
+++ /dev/null
@@ -1,91 +0,0 @@
-# Local macros for automake & autoconf
-
-AC_DEFUN(MYSQL_TYPE_ACCEPT,
-[ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-mysql_cv_btype_last_arg_accept=none
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0);],
-mysql_cv_btype_last_arg_accept=socklen_t)]
-if test $mysql_cv_btype_last_arg_accept = none; then
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
-mysql_cv_btype_last_arg_accept=size_t)]
-fi
-if test $mysql_cv_btype_last_arg_accept = none; then
-mysql_cv_btype_last_arg_accept=int
-fi)
-AC_LANG_RESTORE
-AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $mysql_cv_btype_last_arg_accept)
-CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-
-#---START: Used in for client configure
-AC_DEFUN(MYSQL_CHECK_ULONG,
-[AC_MSG_CHECKING(for type ulong)
-AC_CACHE_VAL(ac_cv_ulong,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- ulong foo;
- foo++;
- exit(0);
-}], ac_cv_ulong=yes, ac_cv_ulong=no, ac_cv_ulong=no)])
-AC_MSG_RESULT($ac_cv_ulong)
-if test "$ac_cv_ulong" = "yes"
-then
- AC_DEFINE(HAVE_ULONG)
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UCHAR,
-[AC_MSG_CHECKING(for type uchar)
-AC_CACHE_VAL(ac_cv_uchar,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uchar foo;
- foo++;
- exit(0);
-}], ac_cv_uchar=yes, ac_cv_uchar=no, ac_cv_uchar=no)])
-AC_MSG_RESULT($ac_cv_uchar)
-if test "$ac_cv_uchar" = "yes"
-then
- AC_DEFINE(HAVE_UCHAR)
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UINT,
-[AC_MSG_CHECKING(for type uint)
-AC_CACHE_VAL(ac_cv_uint,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uint foo;
- foo++;
- exit(0);
-}], ac_cv_uint=yes, ac_cv_uint=no, ac_cv_uint=no)])
-AC_MSG_RESULT($ac_cv_uint)
-if test "$ac_cv_uint" = "yes"
-then
- AC_DEFINE(HAVE_UINT)
-fi
-])
-
-#---END:
diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c
index 785e3cad4c1..f39a2e1856f 100644
--- a/libmysql/conf_to_src.c
+++ b/libmysql/conf_to_src.c
@@ -5,8 +5,7 @@
the Free Software Foundation.
There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software. View the full text of the exception in file
- EXCEPTIONS-CLIENT in the directory of this software distribution.
+ is applied to this software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index 823f83026c9..b99b3f2de30 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -5,8 +5,7 @@
the Free Software Foundation.
There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software. View the full text of the exception in file
- EXCEPTIONS-CLIENT in the directory of this software distribution.
+ is applied to this software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index 56514a8d864..455b4b3c8f1 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -5,8 +5,7 @@
the Free Software Foundation.
There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software. View the full text of the exception in file
- EXCEPTIONS-CLIENT in the directory of this software distribution.
+ is applied to this software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index e9327d770fb..c498ed0f089 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -5,8 +5,7 @@
the Free Software Foundation.
There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software. View the full text of the exception in file
- EXCEPTIONS-CLIENT in the directory of this software distribution.
+ is applied to this software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am
deleted file mode 100644
index 30aa2467dab..00000000000
--- a/libmysql_r/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2000-2004 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 GNU General Public License as
-# published by the Free Software Foundation.
-#
-# There are special exceptions to the terms and conditions of the GPL as it
-# is applied to this software. View the full text of the exception in file
-# EXCEPTIONS-CLIENT in the directory of this software distribution.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-#
-# This file is public domain and comes with NO WARRANTY of any kind
-
-target = libmysqlclient_r.la
-target_defs = -DDISABLE_MYSQL_PRLOCK_H -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
-
-LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes) @ZLIB_INCLUDES@
-## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
-include $(top_srcdir)/libmysql/Makefile.shared
-
-nodist_libmysqlclient_r_la_SOURCES = $(target_sources)
-libmysqlclient_r_la_LIBADD = $(target_libadd) $(yassl_las)
-libmysqlclient_r_la_LDFLAGS = $(target_ldflags)
-
-link_sources:
- set -x; \
- for d in $(top_srcdir)/libmysql $(top_builddir)/libmysql; do \
- for f in `cd $$d && echo *.[ch]`; do \
- rm -f $$f; \
- @LN_CP_F@ $$d/$$f $$f; \
- done; \
- done
- echo timestamp > link_sources
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
deleted file mode 100644
index 279f1007243..00000000000
--- a/libmysqld/Makefile.am
+++ /dev/null
@@ -1,229 +0,0 @@
-# Copyright (c) 2001, 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
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(libdir)
-pkgplugindir = $(pkglibdir)/plugin
-
-EXTRA_DIST = libmysqld.def CMakeLists.txt
-DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
- -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
- -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
- -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
- -DPLUGINDIR="\"$(pkgplugindir)\"" \
- -DDISABLE_DTRACE \
- @DEFS@
-INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_builddir)/sql -I$(top_srcdir)/sql \
- -I$(top_srcdir)/sql/examples \
- -I$(top_srcdir)/regex \
- $(openssl_includes) @ZLIB_INCLUDES@ \
- @condition_dependent_plugin_includes@
-
-noinst_LIBRARIES = libmysqld_int.a
-pkglib_LIBRARIES = libmysqld.a
-SUBDIRS = . examples
-libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc
-libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
- my_time.c client_plugin.c
-
-noinst_HEADERS = embedded_priv.h emb_qcache.h
-
-sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
- ha_ndbcluster.cc ha_ndbcluster_cond.cc \
- ha_ndbcluster_binlog.cc ha_partition.cc \
- handler.cc sql_handler.cc \
- hostname.cc init.cc password.c \
- item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
- item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
- item_geofunc.cc item_subselect.cc item_row.cc\
- item_xmlfunc.cc \
- sha2.cc des_key_file.cc \
- key.cc lock.cc log.cc sql_state.c \
- log_event.cc rpl_record.cc rpl_utility.cc \
- log_event_old.cc rpl_record_old.cc \
- protocol.cc net_serv.cc opt_range.cc \
- opt_sum.cc procedure.cc records.cc sql_acl.cc \
- sql_load.cc discover.cc sql_locale.cc \
- sql_profile.cc sql_admin.cc sql_truncate.cc datadict.cc \
- sql_reload.cc \
- sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
- sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
- sql_lex.cc sql_list.cc sql_manager.cc \
- scheduler.cc sql_connect.cc sql_parse.cc \
- sql_prepare.cc sql_derived.cc sql_rename.cc \
- sql_select.cc sql_do.cc sql_show.cc set_var.cc sys_vars.cc \
- sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
- sql_update.cc sql_yacc.cc table.cc thr_malloc.cc sql_time.cc \
- unireg.cc uniques.cc sql_union.cc hash_filo.cc \
- spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
- sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
- parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
- rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
- debug_sync.cc sql_tablespace.cc transaction.cc \
- rpl_injector.cc my_user.c partition_info.cc sql_alter.cc \
- sql_servers.cc event_parse_data.cc sql_signal.cc \
- rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc \
- sql_partition_admin.cc
-
-libmysqld_int_a_SOURCES= $(libmysqld_sources)
-nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
-libmysqld_a_SOURCES=
-
-sqlstoragesources = $(EXTRA_libmysqld_a_SOURCES)
-storagesources = @condition_dependent_plugin_modules@
-storageobjects = @condition_dependent_plugin_objects@
-storagesourceslinks = @condition_dependent_plugin_links@
-
-# automake misses these
-sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
-
-# The following libraries should be included in libmysqld.a
-INC_LIB= $(top_builddir)/regex/libregex.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/vio/libvio.a \
- @NDB_SCI_LIBS@ \
- @mysql_plugin_libs@ \
- $(yassl_inc_libs)
-
-if HAVE_YASSL
-yassl_inc_libs= $(top_builddir)/extra/yassl/src/.libs/libyassl.a \
- $(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a
-endif
-
-# Storage engine specific compilation options
-ha_ndbcluster.o:ha_ndbcluster.cc
- $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc
- $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-ha_ndbcluster_binlog.o: ha_ndbcluster_binlog.cc
- $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-# Until we can remove dependency on ha_ndbcluster.h
-handler.o: handler.cc
- $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-# We need rules to compile these as no good way
-# found to append fileslists that collected by configure
-# to the sources list
-
-ha_federated.o:ha_federated.cc
- $(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_heap.o:ha_heap.cc
- $(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_innodb.o:ha_innodb.cc
- $(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_myisam.o:ha_myisam.cc
- $(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_myisammrg.o:ha_myisammrg.cc
- $(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-#
-# To make it easy for the end user to use the embedded library we
-# generate a total libmysqld.a from all library files,
-
-# note - InnoDB libraries have circular dependencies, so in INC_LIB
-# few libraries are present two times. Metrowerks linker doesn't like
-# it at all. Traditional ar has no problems with it, but still there's no
-# need to add the same file twice to the library, so 'sort -u' save us
-# some time and spares unnecessary work.
-
-libmysqld.a: libmysqld_int.a $(INC_LIB) $(libmysqld_a_DEPENDENCIES) $(storageobjects)
-if DARWIN_MWCC
- mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects)
-else
- -rm -f libmysqld.a
- 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
-## the version info for libmysqld; however, it's possible for the
-## libmysqld interface to change without affecting the standard
-## libmysqlclient interface. Should we make a separate version
-## string for the two?
-#libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@
-#CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la
-
-BUILT_SOURCES = link_sources
-
-CLEANFILES = $(BUILT_SOURCES)
-
-link_sources:
- for f in $(sqlsources); do \
- rm -f $$f; \
- if test -e $(top_srcdir)/sql/$$f ; \
- then \
- @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
- else \
- @LN_CP_F@ $(top_builddir)/sql/$$f $$f; \
- fi ; \
- done; \
- for f in $(libmysqlsources); do \
- rm -f $$f; \
- if test -e $(top_srcdir)/libmysql/$$f ; \
- then \
- @LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
- else \
- @LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \
- fi ; \
- done; \
- if test -n "$(sqlstoragesources)" ; \
- then \
- for f in "$(sqlstoragesources)"; do \
- rm -f "$$f"; \
- @LN_CP_F@ `find $(srcdir)/../sql -name "$$f"` "$$f"; \
- done; \
- fi; \
- if test -n "$(storagesources)" ; \
- then \
- rm -f $(storagesources); \
- for f in $(storagesourceslinks); do \
- @LN_CP_F@ $(top_srcdir)/$$f . ; \
- done; \
- fi; \
- rm -f client_settings.h; \
- @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h \
- client_settings.h; \
- echo timestamp > link_sources
-
-
-clean-local:
- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \
- rm -f client_settings.h
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
deleted file mode 100644
index 66c40d88e29..00000000000
--- a/libmysqld/examples/Makefile.am
+++ /dev/null
@@ -1,53 +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
-
-noinst_PROGRAMS = mysql
-bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
-client_sources = $(nodist_mysqltest_embedded_SOURCES) $(nodist_mysql_SOURCES)
-tests_sources = $(nodist_mysql_client_test_embedded_SOURCES)
-BUILT_SOURCES = link_sources
-CLEANFILES = $(client_sources) $(tests_sources) $(BUILT_SOURCES)
-EXTRA_DIST = CMakeLists.txt
-
-link_sources:
- for f in $(client_sources); do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/client/$$f $$f; \
- done; \
- for f in $(tests_sources); do \
- rm -f $$f; \
- @LN_CP_F@ $(top_srcdir)/tests/$$f $$f; \
- done
- echo timestamp > link_sources
-
-DEFS = -DEMBEDDED_LIBRARY @DEFS@
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
- -I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
- $(openssl_includes)
-LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
- @NDB_SCI_LIBS@
-
-mysqltest_embedded_LINK = $(CXXLINK)
-nodist_mysqltest_embedded_SOURCES = mysqltest.cc
-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
-mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
-
-mysql_client_test_embedded_LINK = $(CXXLINK)
-nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 1c9b773de15..b07ae1de96b 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -506,7 +506,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
orig_argc= *argcp;
orig_argv= *argvp;
- load_defaults("my", (const char **)groups, argcp, argvp);
+ if (load_defaults("my", (const char **)groups, argcp, argvp))
+ return 1;
defaults_argc= *argcp;
defaults_argv= *argvp;
remaining_argc= argc;
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 396430fba12..300e0ce32a3 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -22,4 +22,4 @@ SET(MYSQLSERVICES_SOURCES
my_thread_scheduler_service.c)
ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
-INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR})
+INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
diff --git a/libservices/Makefile.am b/libservices/Makefile.am
deleted file mode 100644
index d25c5c9680c..00000000000
--- a/libservices/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 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
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-pkglib_LIBRARIES = libmysqlservices.a
-libmysqlservices_a_SOURCES = my_snprintf_service.c thd_alloc_service.c \
- thd_wait_service.c \
- my_thread_scheduler_service.c
-EXTRA_DIST = CMakeLists.txt
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 7c96deada08..135d66634e4 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -21,8 +21,10 @@ IF(MAN1_FILES)
IF(MAN1_EXCLUDE)
LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE})
ENDIF()
- INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1)
+ INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1
+ COMPONENT ManPages)
ENDIF()
IF(MAN8_FILES)
- INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8)
+ INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8
+ COMPONENT ManPages)
ENDIF()
diff --git a/man/Makefile.am b/man/Makefile.am
deleted file mode 100644
index 027edccc249..00000000000
--- a/man/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2000-2001, 2003-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-man1_MANS = @man1_files@
-man8_MANS = @man8_files@
-EXTRA_DIST = $(man1_MANS) $(man8_MANS) CMakeLists.txt
-
-# "make_win_*" are not needed in Unix binary packages,
-install-data-hook:
- rm -f $(DESTDIR)$(mandir)/man1/make_win_*
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index 3c38e5772d0..f18b2ae341c 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -53,7 +53,8 @@ IF(UNIX)
IF(INSTALL_MYSQLTESTDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
- DESTINATION ${INSTALL_MYSQLTESTDIR})
+ DESTINATION ${INSTALL_MYSQLTESTDIR}
+ COMPONENT Test)
ENDIF()
ENDIF()
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
deleted file mode 100644
index 030a4823b36..00000000000
--- a/mysql-test/Makefile.am
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-testroot = $(prefix)
-testdir = $(testroot)/mysql-test
-
-test_SCRIPTS = mtr \
- mysql-test-run \
- mysql-test-run.pl \
- mysql-stress-test.pl
-
-nobase_test_DATA = \
- valgrind.supp \
- lib/v1/mysql-test-run.pl \
- lib/v1/mtr_cases.pl \
- lib/v1/mtr_io.pl \
- lib/v1/mtr_report.pl \
- lib/v1/My/Config.pm \
- lib/v1/mtr_gcov.pl \
- lib/v1/mtr_match.pl \
- lib/v1/mtr_stress.pl \
- lib/v1/ndb_config_1_node.ini \
- lib/v1/ndb_config_2_node.ini \
- lib/v1/mtr_gprof.pl \
- lib/v1/mtr_misc.pl \
- lib/v1/mtr_timer.pl \
- lib/v1/mtr_im.pl \
- lib/v1/mtr_process.pl \
- lib/v1/mtr_unique.pl \
- lib/mtr_cases.pm \
- lib/mtr_gcov.pl \
- lib/mtr_gprof.pl \
- lib/mtr_io.pl \
- lib/mtr_match.pm \
- lib/mtr_misc.pl \
- lib/mtr_process.pl \
- lib/mtr_report.pm \
- lib/mtr_stress.pl \
- lib/mtr_unique.pm \
- lib/My/ConfigFactory.pm \
- lib/My/Config.pm \
- lib/My/Find.pm \
- lib/My/Handles.pm \
- lib/My/Options.pm \
- lib/My/Test.pm \
- lib/My/Platform.pm \
- lib/My/SafeProcess.pm \
- lib/My/File/Path.pm \
- lib/My/SysInfo.pm \
- lib/My/CoreDump.pm \
- lib/My/SafeProcess/Base.pm \
- lib/My/SafeProcess/safe_process.pl
-
-SUBDIRS = lib/My/SafeProcess
-
-EXTRA_DIST = README \
- $(test_SCRIPTS) \
- $(nobase_test_DATA) \
- CMakeLists.txt \
- mtr.out-of-source
-
-
-# List of directories containing test + result files and the
-# related test data files that should be copied
-# If you want to add a new suite, please check DEFAULT_SUITES in
-# mysql-test-run.pl.
-TEST_DIRS = t r include std_data std_data/parts collections \
- std_data/ndb_backup50 std_data/ndb_backup51 \
- std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \
- std_data/funcs_1 \
- extra/binlog_tests/ extra/rpl_tests \
- suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \
- suite/bugs suite/bugs/data suite/bugs/t suite/bugs/r \
- suite/federated \
- suite/funcs_1 suite/funcs_1/bitdata \
- suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \
- suite/funcs_1/t suite/funcs_1/views suite/funcs_1/cursors \
- suite/funcs_1/datadict suite/funcs_1/storedproc suite/funcs_1/triggers \
- suite/funcs_2 suite/funcs_2/charset suite/funcs_2/data \
- suite/funcs_2/include suite/funcs_2/lib suite/funcs_2/r \
- suite/funcs_2/t \
- suite/jp suite/jp/t suite/jp/r suite/jp/std_data suite/jp/include \
- suite/manual/t suite/manual/r \
- suite/ndb_team suite/ndb_team/t suite/ndb_team/r \
- suite/rpl suite/rpl/include suite/rpl/r \
- suite/rpl/t \
- suite/stress/include suite/stress/t suite/stress/r \
- suite/ndb suite/ndb/t suite/ndb/r \
- suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
- suite/parts suite/parts/t suite/parts/r suite/parts/inc \
- suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
- suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
- suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
- suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
- suite/engines/rr_trx/t \
- suite/sys_vars suite/sys_vars/t suite/sys_vars/inc suite/sys_vars/r \
- suite/perfschema suite/perfschema/t suite/perfschema/r \
- suite/perfschema/include
-
-# Used by dist-hook and install-data-local to copy all
-# test files into either dist or install directory
-install_test_files:
- @if test -z "$(INSTALL_TO_DIR)"; then \
- echo "Set INSTALL_TO_DIR!" && exit 1; \
- fi
- @for dir in $(TEST_DIRS); do \
- from_dir="$(srcdir)/$$dir"; \
- to_dir="$(INSTALL_TO_DIR)/$$dir"; \
- $(mkinstalldirs) "$$to_dir"; \
- for f in `(cd $$from_dir && ls)`; do \
- if test -f "$$from_dir/$$f"; then \
- $(INSTALL_DATA) "$$from_dir/$$f" "$$to_dir/$$f" ; \
- fi; \
- done \
- done
-
-dist-hook:
- $(MAKE) INSTALL_TO_DIR="$(distdir)" install_test_files
-
-install-data-local:
- $(MAKE) INSTALL_TO_DIR="$(DESTDIR)$(testdir)" install_test_files
-
-uninstall-local:
- @RM@ -f -r $(DESTDIR)$(testdir)
-
-# mtr - a shortcut for executing mysql-test-run.pl
-mtr:
- $(RM) -f mtr
- $(LN_S) mysql-test-run.pl mtr
-
-# mysql-test-run - a shortcut for executing mysql-test-run.pl
-mysql-test-run:
- $(RM) -f mysql-test-run
- $(LN_S) mysql-test-run.pl mysql-test-run
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 29046e9b8bc..818691e2e73 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -9,6 +9,7 @@ funcs_1.myisam_views @solaris # Bug#50595 2010-03-05 alik funcs_1.myi
innodb.innodb_information_schema # Bug#48883 2010-05-11 alik Test "innodb_information_schema" takes fewer locks than expected
main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2
+main.gis # Bug#52208 2010-11-24 alik gis fails on some platforms (Solaris, HP-UX, Linux)
main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
@@ -16,6 +17,7 @@ main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_m
main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically
main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again)
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
+main.show_check # Bug#58414 2010-11-24 alik Race condition in show_check.test
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
@@ -24,10 +26,9 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou
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
-rpl.rpl_killed_ddl @windows # Bug#47638 2010-01-20 alik The rpl_killed_ddl test fails on Windows
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.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure
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
diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly
index d874c2f4519..33d13d8edfd 100644
--- a/mysql-test/collections/default.weekly
+++ b/mysql-test/collections/default.weekly
@@ -1,2 +1,2 @@
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
-perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb main.variables-big rpl_ndb.rpl_truncate_7ndb_2
+perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 large_tests.alter_table main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb rpl_ndb.rpl_truncate_7ndb_2
diff --git a/mysql-test/collections/mysql-5.5-bugteam.daily b/mysql-test/collections/mysql-5.5-bugteam.daily
new file mode 100644
index 00000000000..81dffff91ce
--- /dev/null
+++ b/mysql-test/collections/mysql-5.5-bugteam.daily
@@ -0,0 +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
+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
+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 --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/mysql-5.5-bugteam.push b/mysql-test/collections/mysql-5.5-bugteam.push
new file mode 100644
index 00000000000..06118ed9e1e
--- /dev/null
+++ b/mysql-test/collections/mysql-5.5-bugteam.push
@@ -0,0 +1,4 @@
+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=main_ps_row --vardir=var-main-ps_row --suite=main --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=main_embedded --vardir=var-main_emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
+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/extra/binlog_tests/binlog_truncate.test b/mysql-test/extra/binlog_tests/binlog_truncate.test
index 24cf363f780..d434f792db0 100644
--- a/mysql-test/extra/binlog_tests/binlog_truncate.test
+++ b/mysql-test/extra/binlog_tests/binlog_truncate.test
@@ -12,13 +12,13 @@ eval CREATE TABLE t1 (a INT) ENGINE=$engine;
eval CREATE TABLE t2 (a INT) ENGINE=$engine;
INSERT INTO t2 VALUES (1),(2),(3);
let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1);
-if (`select length('$before_truncate') > 0`) {
+if ($before_truncate) {
eval $before_truncate;
}
--echo **** Truncate of empty table shall be logged
TRUNCATE TABLE t1;
-if (`select length('$before_truncate') > 0`) {
+if ($before_truncate) {
eval $before_truncate;
}
TRUNCATE TABLE t2;
@@ -35,7 +35,7 @@ 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`) {
+if ($before_truncate) {
eval $before_truncate;
}
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index c694c34622f..90146d41471 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -173,7 +173,7 @@ insert into t1 values(2);
rollback;
let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
-if (`SELECT $master_log_pos_2 <> $master_log_pos_1`)
+if ($master_log_pos_2 != $master_log_pos_1)
{
echo $master_log_pos_1 $master_log_pos_2;
die Rollbacked transaction has been binlogged;
diff --git a/mysql-test/extra/binlog_tests/implicit.test b/mysql-test/extra/binlog_tests/implicit.test
index 84d80288d36..de906fc0605 100644
--- a/mysql-test/extra/binlog_tests/implicit.test
+++ b/mysql-test/extra/binlog_tests/implicit.test
@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES (1);
source include/show_binlog_events.inc;
eval $statement;
source include/show_binlog_events.inc;
-if (`select '$cleanup' != ''`) {
+if ($cleanup) {
eval $cleanup;
}
@@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (3);
source include/show_binlog_events.inc;
COMMIT;
source include/show_binlog_events.inc;
-if (`select '$cleanup' != ''`) {
+if ($cleanup) {
eval $cleanup;
}
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 6bf9a27afaf..040da1959dc 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -319,7 +319,7 @@ 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'`) {
+ if ($binlog_query != ROLLBACK) {
--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
diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
index ac10ab8ddb2..6e130a8154f 100644
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
@@ -167,7 +167,9 @@
--let $CRC_create=
######## func_retval ########
-if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) {
+# if inside if in lieu of AND operand
+if ($CRC_ARG_type == 0) {
+ if ($CRC_ARG_value) {
# It will be safe to call this function and discard the return
# value, but it will be unsafe to use return value (e.g., in
# INSERT...SELECT).
@@ -180,10 +182,11 @@ if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) {
--let $CRC_RET_drop= DROP FUNCTION $CRC_name
--let $CRC_RET_is_toplevel= 0
--let $CRC_RET_desc= function $CRC_name returning value from $CRC_ARG_desc
+ }
}
######## func_sidef ########
-if (`SELECT $CRC_ARG_type = 1`) {
+if ($CRC_ARG_type == 1) {
# It will be unsafe to call func even if you discard return value.
--let $CRC_name= func_sidef_$CRC_ARG_level
--let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; RETURN 0; END
@@ -197,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) {
}
######## proc ########
-if (`SELECT $CRC_ARG_type = 2`) {
+if ($CRC_ARG_type == 2) {
# It will be unsafe to call this procedure.
--let $CRC_name= proc_$CRC_ARG_level
--let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END
@@ -211,7 +214,7 @@ if (`SELECT $CRC_ARG_type = 2`) {
}
######## trig ########
-if (`SELECT $CRC_ARG_type = 3`) {
+if ($CRC_ARG_type == 3) {
# It will be unsafe to invoke this trigger.
--let $CRC_name= trig_$CRC_ARG_level
--let $CRC_create= CREATE TRIGGER $CRC_name BEFORE INSERT ON trigger_table_$CRC_ARG_level FOR EACH ROW BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
@@ -225,7 +228,8 @@ if (`SELECT $CRC_ARG_type = 3`) {
}
######## view_retval ########
-if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_retval' != ''`) {
+if ($CRC_ARG_type == 4) {
+ if ($CRC_ARG_sel_retval) {
# It will be safe to select from this view if you discard the result
# set, but unsafe to use result set (e.g., in INSERT..SELECT).
--let $CRC_name= view_retval_$CRC_ARG_level
@@ -237,10 +241,12 @@ if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_retval' != ''`) {
--let $CRC_RET_drop= DROP VIEW $CRC_name
--let $CRC_RET_is_toplevel= 0
--let $CRC_RET_desc= view $CRC_name returning value from $CRC_ARG_desc
+ }
}
######## view_sidef ########
-if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_sidef' != ''`) {
+if ($CRC_ARG_type == 5) {
+ if ($CRC_ARG_sel_sidef) {
# It will be unsafe to select from this view, even if you discard
# the return value.
--let $CRC_name= view_sidef_$CRC_ARG_level
@@ -252,10 +258,11 @@ if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_sidef' != ''`) {
--let $CRC_RET_drop= DROP VIEW $CRC_name
--let $CRC_RET_is_toplevel= 0
--let $CRC_RET_desc= view $CRC_name invoking $CRC_ARG_desc
+ }
}
######## prep ########
-if (`SELECT $CRC_ARG_type = 6`) {
+if ($CRC_ARG_type == 6) {
# It will be unsafe to execute this prepared statement
--let $CRC_name= prep_$CRC_ARG_level
--let $CRC_create= PREPARE $CRC_name FROM "$CRC_ARG_stmt_sidef"
@@ -269,7 +276,7 @@ if (`SELECT $CRC_ARG_type = 6`) {
}
######## no recursive construct: just return the given statement ########
-if (`SELECT $CRC_ARG_type = 7`) {
+if ($CRC_ARG_type == 7) {
# CRC_ARG_type=7 is a special case. We just set $CRC_RET_x =
# $CRC_ARG_x. This way, the $CRC_ARG_stmt gets executed directly
# (below). In binlog_unsafe.test, it is used to invoke the unsafe
@@ -285,17 +292,17 @@ if (`SELECT $CRC_ARG_type = 7`) {
}
######## execute! ########
-if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
+if ($CRC_RET_stmt_sidef) {
--echo
--echo Invoking $CRC_RET_desc.
- if (`SELECT '$CRC_create' != ''`) {
+ if ($CRC_create) {
--eval $CRC_create
}
--echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings.
--eval $CRC_RET_stmt_sidef
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- if (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_warnings'`) {
+ if ($n_warnings != $CRC_ARG_expected_number_of_warnings) {
--echo ******** Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. ********
SHOW WARNINGS;
SHOW BINLOG EVENTS;
@@ -312,14 +319,14 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
RESET MASTER;
--eval $CRC_RET_stmt_sidef
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- if (`SELECT '$n_warnings' != '0'`) {
+ if ($n_warnings) {
--echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
SHOW WARNINGS;
SHOW BINLOG EVENTS;
--die Wrong number of warnings.
}
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
- if (`SELECT '$binlog_event' != 'No such row'`) {
+ if ($binlog_event != No such row) {
--enable_query_log
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
SHOW BINLOG EVENTS;
@@ -332,7 +339,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
RESET MASTER;
--eval $CRC_RET_stmt_sidef
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- if (`SELECT '$n_warnings' != '0'`) {
+ if ($n_warnings) {
--echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
SHOW WARNINGS;
SHOW BINLOG EVENTS;
@@ -365,7 +372,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
# Invoke created object, discarding the return value. This should not
# give any warning.
-if (`SELECT '$CRC_RET_sel_retval' != ''`) {
+if ($CRC_RET_sel_retval) {
--echo * Invoke statement so that return value is dicarded: expect no warning.
--disable_result_log
--eval $CRC_RET_sel_retval
@@ -375,7 +382,7 @@ if (`SELECT '$CRC_RET_sel_retval' != ''`) {
# fail. When the bug is fixed, we should execute the following.
#--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- #if (`SELECT '$n_warnings' != '0'`) {
+ #if ($n_warnings) {
# --enable_query_log
# --echo Failure! Expected 0 warnings, got $n_warnings warnings.
# SHOW WARNINGS;
diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
index 8e89cde004d..094e84537db 100644
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
@@ -35,7 +35,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
--eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
@@ -62,7 +62,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
--eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
@@ -89,7 +89,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
@@ -116,7 +116,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
@@ -163,14 +163,14 @@ if (`SELECT HEX(@commands) = HEX('clean')`)
DROP TABLE IF EXISTS nt_xx_1;
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--dec $n
}
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--dec $n
@@ -634,11 +634,11 @@ while (`SELECT HEX(@commands) != HEX('')`)
{
--let $dropped_temp= $table
}
- if (`SELECT $n = 1`)
+ if ($n == 1)
{
--let $table_1= $table
}
- if (`SELECT $n = 2`)
+ if ($n == 2)
{
--let $table_2= $table
}
@@ -886,7 +886,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_n_temp=
--let $dropped_n_temp=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
--eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
@@ -905,7 +905,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_t_temp=
--let $dropped_t_temp=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
--eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
@@ -924,7 +924,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_t=
--let $dropped_t=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
@@ -943,7 +943,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_n=
--let $dropped_n=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
index 568cf802763..77b7e9a57ea 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -406,7 +406,7 @@ sync_slave_with_master;
# Error reaction is up to sql_mode of the slave sql (bug#38173)
#--echo *** Create t9 on slave ***
# Please, check BUG#47741 to see why you are not testing NDB.
-if (`SELECT $engine_type != 'NDB'`)
+if ($engine_type != NDB)
{
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
index 66bd61a8ea9..40e155bc314 100644
--- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
+++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
@@ -34,7 +34,7 @@
#
connection slave;
-if (`SELECT $debug_sync_action = ''`)
+if (!$debug_sync_action)
{
--die Cannot continue. Please set value for debug_sync_action.
}
diff --git a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
index 14368ba4321..bbd4969ef40 100644
--- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
+++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
@@ -33,7 +33,7 @@ INSERT INTO tt_2(ddl_case) VALUES(0);
--echo #########################################################################
SET AUTOCOMMIT= 0;
let $ddl_cases= 41;
-while (`SELECT $ddl_cases >= 1`)
+while ($ddl_cases >= 1)
{
--echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
let $in_temporary= "no";
@@ -76,7 +76,7 @@ while (`SELECT $ddl_cases >= 1`)
# 6: ROW EVENT
# 7: COMMIT
#
- if (`select '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 7;
}
@@ -84,10 +84,10 @@ while (`SELECT $ddl_cases >= 1`)
let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1);
--enable_query_log
eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases);
- if (`SELECT $ddl_cases = 41`)
+ if ($ddl_cases == 41)
{
let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES;
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
# This seems to be related to epochs.
# We need to check this against an updated version or avoid it.
@@ -95,7 +95,7 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 40`)
+ if ($ddl_cases == 40)
{
let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES;
#
@@ -109,16 +109,16 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 39`)
+ if ($ddl_cases == 39)
{
let $cmd= ANALYZE TABLE nt_1;
}
- if (`SELECT $ddl_cases = 38`)
+ if ($ddl_cases == 38)
{
let $cmd= CHECK TABLE nt_1;
#
@@ -132,20 +132,20 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 37`)
+ if ($ddl_cases == 37)
{
let $cmd= OPTIMIZE TABLE nt_1;
}
- if (`SELECT $ddl_cases = 36`)
+ if ($ddl_cases == 36)
{
let $cmd= REPAIR TABLE nt_1;
}
- if (`SELECT $ddl_cases = 35`)
+ if ($ddl_cases == 35)
{
let $cmd= LOCK TABLES tt_1 WRITE;
#
@@ -159,12 +159,12 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 34`)
+ if ($ddl_cases == 34)
{
let $cmd= UNLOCK TABLES;
#
@@ -178,20 +178,20 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 33`)
+ if ($ddl_cases == 33)
{
let $cmd= CREATE USER 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 32`)
+ if ($ddl_cases == 32)
{
let $cmd= GRANT ALL ON *.* TO 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 31`)
+ if ($ddl_cases == 31)
{
let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass');
#
@@ -231,35 +231,35 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 7;
}
}
- if (`SELECT $ddl_cases = 30`)
+ if ($ddl_cases == 30)
{
let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 29`)
+ if ($ddl_cases == 29)
{
let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost';
}
- if (`SELECT $ddl_cases = 28`)
+ if ($ddl_cases == 28)
{
let $cmd= DROP USER 'user_new'@'localhost';
}
- if (`SELECT $ddl_cases = 27`)
+ if ($ddl_cases == 27)
{
let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 26`)
+ if ($ddl_cases == 26)
{
let $cmd= ALTER EVENT evt COMMENT 'evt';
}
- if (`SELECT $ddl_cases = 25`)
+ if ($ddl_cases == 25)
{
let $cmd= DROP EVENT evt;
}
- if (`SELECT $ddl_cases = 24`)
+ if ($ddl_cases == 24)
{
let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
}
- if (`SELECT $ddl_cases = 23`)
+ if ($ddl_cases == 23)
{
let $cmd= DROP TRIGGER tr;
#
@@ -277,43 +277,43 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 5;
}
}
- if (`SELECT $ddl_cases = 22`)
+ if ($ddl_cases == 22)
{
let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
}
- if (`SELECT $ddl_cases = 21`)
+ if ($ddl_cases == 21)
{
let $cmd= ALTER FUNCTION fc COMMENT 'fc';
}
- if (`SELECT $ddl_cases = 20`)
+ if ($ddl_cases == 20)
{
let $cmd= DROP FUNCTION fc;
}
- if (`SELECT $ddl_cases = 19`)
+ if ($ddl_cases == 19)
{
let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
}
- if (`SELECT $ddl_cases = 18`)
+ if ($ddl_cases == 18)
{
let $cmd= ALTER PROCEDURE pc COMMENT 'pc';
}
- if (`SELECT $ddl_cases = 17`)
+ if ($ddl_cases == 17)
{
let $cmd= DROP PROCEDURE pc;
}
- if (`SELECT $ddl_cases = 16`)
+ if ($ddl_cases == 16)
{
let $cmd= CREATE VIEW v AS SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 15`)
+ if ($ddl_cases == 15)
{
let $cmd= ALTER VIEW v AS SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 14`)
+ if ($ddl_cases == 14)
{
let $cmd= DROP VIEW v;
}
- if (`SELECT $ddl_cases = 13`)
+ if ($ddl_cases == 13)
{
let $cmd= CREATE INDEX ix ON tt_1(ddl_case);
#
@@ -328,12 +328,12 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 12`)
+ if ($ddl_cases == 12)
{
let $cmd= DROP INDEX ix ON tt_1;
#
@@ -348,12 +348,12 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 11`)
+ if ($ddl_cases == 11)
{
let $cmd= CREATE TEMPORARY TABLE tt_xx (a int);
let $in_temporary= "yes";
@@ -411,7 +411,7 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 9;
}
}
- if (`SELECT $ddl_cases = 10`)
+ if ($ddl_cases == 10)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
#
@@ -438,12 +438,12 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 9`)
+ if ($ddl_cases == 9)
{
let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx;
#
@@ -470,12 +470,12 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 8`)
+ if ($ddl_cases == 8)
{
let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
let $in_temporary= "yes";
@@ -528,7 +528,7 @@ while (`SELECT $ddl_cases >= 1`)
# 8: ROW EVENT
# 9: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 9;
}
@@ -551,27 +551,27 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 9;
}
}
- if (`SELECT $ddl_cases = 7`)
+ if ($ddl_cases == 7)
{
let $cmd= CREATE TABLE tt_xx (a int);
}
- if (`SELECT $ddl_cases = 6`)
+ if ($ddl_cases == 6)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
}
- if (`SELECT $ddl_cases = 5`)
+ if ($ddl_cases == 5)
{
let $cmd= RENAME TABLE tt_xx TO new_tt_xx;
}
- if (`SELECT $ddl_cases = 4`)
+ if ($ddl_cases == 4)
{
let $cmd= TRUNCATE TABLE new_tt_xx;
}
- if (`SELECT $ddl_cases = 3`)
+ if ($ddl_cases == 3)
{
let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx;
}
- if (`SELECT $ddl_cases = 2`)
+ if ($ddl_cases == 2)
{
let $cmd= CREATE DATABASE db;
#
@@ -586,12 +586,12 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 1`)
+ if ($ddl_cases == 1)
{
let $cmd= DROP DATABASE IF EXISTS db;
#
@@ -606,7 +606,7 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
@@ -618,14 +618,14 @@ while (`SELECT $ddl_cases >= 1`)
# commit. The flag in_temporary is used to avoid aborting the test in such
# cases. Thus we force the commit.
#
- if (`SELECT $in_temporary = "yes"`)
+ if ($in_temporary == "yes")
{
--eval COMMIT
}
let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number);
if (`SELECT SUBSTRING("$event_commit",1,6) != "COMMIT"`)
{
- if (`SELECT $ok = "yes"`)
+ if ($ok == "yes")
{
--echo it *does not* commit the current transaction.
--echo $cmd
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index 7fd3451184a..d158b6595ba 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -121,7 +121,7 @@ if (`SELECT @@global.binlog_format = 'STATEMENT'`)
# The second INSERT DELAYED statement is the 5 item if two INSERT DELAYED are
# handled separately
- if (`SELECT '$stmt' = 'COMMIT'`)
+ if ($stmt == COMMIT)
{
--let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 5)
}
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
index 844f93d0906..4a20fc48ac4 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
@@ -85,4 +85,5 @@ INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master;
connection master;
drop table t1;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index ed89bd66531..ea2cc7b10ad 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -25,7 +25,7 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state
# MTR is not case-sensitive.
let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA;
-if (`SELECT '$lock_option' <> ''`)
+if ($lock_option)
{
#if $lock_option is null, an extra blank is added into the statement,
#this will change the result of rpl_loaddata test case. so $lock_option
diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test
index 58dbd9ce29f..290a0a0173f 100644
--- a/mysql-test/extra/rpl_tests/rpl_not_null.test
+++ b/mysql-test/extra/rpl_tests/rpl_not_null.test
@@ -177,7 +177,7 @@ sync_slave_with_master;
#--source include/wait_for_slave_to_start.inc
#
#let $y=0;
-#while (`select $y < 6`)
+#while ($y < 6)
#{
# connection master;
#
@@ -202,21 +202,21 @@ sync_slave_with_master;
# `c` INT DEFAULT 500,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
#
-# if (`select $y=0`)
+# if ($y==0)
# {
# --echo ************* EXECUTION WITH INSERTS *************
# connection master;
# INSERT INTO t1(a) VALUES (1);
# }
#
-# if (`select $y=1`)
+# if ($y==1)
# {
# --echo ************* EXECUTION WITH INSERTS *************
# connection master;
# INSERT INTO t1(a, b) VALUES (1, NULL);
# }
#
-# if (`select $y=2`)
+# if ($y==2)
# {
# --echo ************* EXECUTION WITH UPDATES *************
# connection master;
@@ -225,14 +225,14 @@ sync_slave_with_master;
# UPDATE t3 SET b = NULL where a= 1;
# }
#
-# if (`select $y=3`)
+# if ($y==3)
# {
# --echo ************* EXECUTION WITH INSERTS/REPLACES *************
# connection master;
# REPLACE INTO t3(a, b) VALUES (1, null);
# }
#
-# if (`select $y=4`)
+# if ($y==4)
# {
# --echo ************* EXECUTION WITH UPDATES/REPLACES *************
# connection master;
@@ -240,7 +240,7 @@ sync_slave_with_master;
# REPLACE INTO t3(a, b) VALUES (1, null);
# }
#
-# if (`select $y=5`)
+# if ($y==5)
# {
# --echo ************* EXECUTION WITH MULTI-ROW INSERTS *************
# connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
index 7bc326a3791..d2c2ea0caf3 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
@@ -35,10 +35,23 @@ connection master1;
send CALL test.p1();
connection master;
-# To make sure tha the call on master1 arrived at the get_lock
-sleep 1;
+# Make sure that the call on master1 arrived at the get_lock.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = 'User lock' and
+ info = 'SELECT get_lock("test", 100)';
+--source include/wait_condition.inc
CALL test.p2();
SELECT release_lock("test");
+
+connection master1;
+# Reap CALL test.p1() to ensure that it has fully completed
+# before doing any selects on test.t1.
+--reap
+# Release lock acquired by it.
+SELECT release_lock("test");
+
+connection master;
SELECT * FROM test.t1;
#show binlog events;
--source include/wait_for_ndb_to_binlog.inc
@@ -51,6 +64,7 @@ DROP TABLE IF EXISTS test.t1;
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
CALL test.p2();
CALL test.p1();
+SELECT release_lock("test");
SELECT * FROM test.t1;
sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
index 05836737717..5c99fa1bc74 100644
--- a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
@@ -122,4 +122,60 @@ drop table t1i, t2m;
sync_slave_with_master;
+--echo #
+--echo # Bug#56096 STOP SLAVE hangs if executed in parallel with user sleep
+--echo #
+
+--connection master
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT );
+
+sync_slave_with_master;
+
+--connection slave1
+--echo # Slave1: lock table for synchronization
+LOCK TABLES t1 WRITE;
+
+--connection master
+--echo # Master: insert into the table
+INSERT INTO t1 SELECT SLEEP(4);
+
+--connection slave
+--echo # Slave: wait for the insert
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE STATE = "Waiting for table metadata lock"
+ AND INFO = "INSERT INTO t1 SELECT SLEEP(4)";
+--source include/wait_condition.inc
+
+--echo # Slave: send slave stop
+--send STOP SLAVE
+
+--connection slave1
+--echo # Slave1: wait for stop slave
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE INFO = "STOP SLAVE";
+--source include/wait_condition.inc
+
+--echo # Slave1: unlock the table
+UNLOCK TABLES;
+
+--connection slave
+--echo # Slave: wait for the slave to stop
+--reap
+--source include/wait_for_slave_to_stop.inc
+
+--echo # Start slave again
+--source include/start_slave.inc
+
+--echo # Clean up
+--connection master
+DROP TABLE t1;
+sync_slave_with_master;
+
# End of tests
diff --git a/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_stop_slave.test
new file mode 100644
index 00000000000..7c88afe3532
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test
@@ -0,0 +1,61 @@
+#
+# Auxiliary file which is used to test BUG#56118
+#
+# Slave should apply all statements in the transaction before stop if any
+# temporary table is created or dropped.
+#
+# USEAGE:
+# --let $tmp_table_stm= a SQL statement
+# --source extra/rpl_tests/rpl_stop_slave.test
+#
+
+if (`SELECT "$tmp_table_stm" = ''`)
+{
+ --echo \$tmp_table_stm is NULL
+ --die $tmp_table_stm is NULL
+}
+
+--echo
+--echo [ On Master ]
+connection master;
+BEGIN;
+DELETE FROM t1;
+eval $tmp_table_stm;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+--echo
+--echo [ On Slave ]
+connection slave;
+
+# To check if slave SQL thread is applying INSERT statement
+let $show_statement= SHOW PROCESSLIST;
+let $field= Info;
+let $condition= LIKE 'INSERT%';
+source include/wait_show_condition.inc;
+
+send STOP SLAVE SQL_THREAD;
+
+--echo
+--echo [ On Slave1 ]
+connection slave1;
+--echo # To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+--echo
+--echo [ On Slave ]
+connection slave;
+reap;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo # Slave should stop after the transaction has committed.
+--echo # So t1 on master is same to t1 on slave.
+let diff_table_1=master:test.t1;
+let diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+connection slave;
+START SLAVE SQL_THREAD;
+source include/wait_for_slave_sql_to_start.inc;
diff --git a/mysql-test/include/check_concurrent_insert.inc b/mysql-test/include/check_concurrent_insert.inc
index f4bec3c9cdb..62de485d8f1 100644
--- a/mysql-test/include/check_concurrent_insert.inc
+++ b/mysql-test/include/check_concurrent_insert.inc
@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
{
--eval create temporary table t_backup select * from $restore_table;
}
@@ -82,7 +82,7 @@ connection default;
--eval delete from $table where i = 0;
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
diff --git a/mysql-test/include/check_ftwrl_compatible.inc b/mysql-test/include/check_ftwrl_compatible.inc
new file mode 100644
index 00000000000..76c1915957c
--- /dev/null
+++ b/mysql-test/include/check_ftwrl_compatible.inc
@@ -0,0 +1,158 @@
+#
+# SUMMARY
+# Check that a statement is compatible with FLUSH TABLES WITH READ LOCK.
+#
+# PARAMETERS
+# $con_aux1 Name of the 1st aux connection to be used by this script.
+# $con_aux2 Name of the 2nd aux connection to be used by this script.
+# $statement The statement to be checked.
+# $cleanup_stmt The statement to be run in order to revert effects of
+# the statement to be checked.
+# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
+# stage is to check that metadata locks taken by this
+# statement are compatible with metadata locks taken
+# by FTWRL.
+#
+# EXAMPLE
+# flush_read_lock.test
+#
+--disable_result_log
+--disable_query_log
+
+# Reset DEBUG_SYNC facility for safety.
+set debug_sync= "RESET";
+
+#
+# First, check that the statement can be run under FTWRL.
+#
+flush tables with read lock;
+--disable_abort_on_error
+--eval $statement
+--enable_abort_on_error
+let $err= $mysql_errno;
+if (!$err)
+{
+--echo Success: Was able to run '$statement' under FTWRL.
+unlock tables;
+if (`SELECT "$cleanup_stmt" <> ""`)
+{
+--eval $cleanup_stmt;
+}
+}
+if ($err)
+{
+--echo Error: Wasn't able to run '$statement' under FTWRL!
+unlock tables;
+}
+
+#
+# Then check that this statement won't be blocked by FTWRL
+# that is active in another connection.
+#
+connection $con_aux1;
+flush tables with read lock;
+
+connection default;
+--send_eval $statement;
+
+connection $con_aux1;
+
+--enable_result_log
+--enable_query_log
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where info = "$statement";
+--source include/wait_condition.inc
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+--echo Success: Was able to run '$statement' with FTWRL active in another connection.
+
+connection default;
+# Apparently statement was successfully executed and so
+# was not blocked by FTWRL.
+# To be safe against wait_condition.inc succeeding due to
+# races let us first reap the statement being checked to
+# ensure that it has been successfully executed.
+--reap
+
+connection $con_aux1;
+unlock tables;
+
+connection default;
+}
+if (!$success)
+{
+--echo Error: Wasn't able to run '$statement' with FTWRL active in another connection!
+unlock tables;
+connection default;
+--reap
+}
+
+if (`SELECT "$cleanup_stmt" <> ""`)
+{
+--eval $cleanup_stmt;
+}
+
+if (`SELECT "$skip_3rd_check" = ""`)
+{
+#
+# Finally, let us check that FTWRL will succeed if this statement
+# is active but has already closed its tables.
+#
+connection default;
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send_eval $statement;
+
+connection $con_aux1;
+set debug_sync="now WAIT_FOR parked";
+--send flush tables with read lock
+
+connection $con_aux2;
+--enable_result_log
+--enable_query_log
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where info = "flush tables with read lock";
+--source include/wait_condition.inc
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+--echo Success: Was able to run FTWRL while '$statement' was active in another connection.
+connection $con_aux1;
+# Apparently FTWRL was successfully executed and so was not blocked by
+# the statement being checked. To be safe against wait_condition.inc
+# succeeding due to races let us first reap the FTWRL to ensure that it
+# has been successfully executed.
+--reap
+unlock tables;
+set debug_sync="now SIGNAL go";
+connection default;
+--reap
+}
+if (!$success)
+{
+--echo Error: Wasn't able to run FTWRL while '$statement' was active in another connection!
+set debug_sync="now SIGNAL go";
+connection default;
+--reap
+connection $con_aux1;
+--reap
+unlock tables;
+connection default;
+}
+
+set debug_sync= "RESET";
+if (`SELECT "$cleanup_stmt" <> ""`)
+{
+--eval $cleanup_stmt;
+}
+
+}
+
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/include/check_ftwrl_incompatible.inc b/mysql-test/include/check_ftwrl_incompatible.inc
new file mode 100644
index 00000000000..56deef8e92f
--- /dev/null
+++ b/mysql-test/include/check_ftwrl_incompatible.inc
@@ -0,0 +1,155 @@
+#
+# SUMMARY
+# Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK.
+#
+# PARAMETERS
+# $con_aux1 Name of the 1st aux connection to be used by this script.
+# $con_aux2 Name of the 2nd aux connection to be used by this script.
+# $statement The statement to be checked.
+# $cleanup_stmt1 The 1st statement to be run in order to revert effects
+# of statement to be checked.
+# $cleanup_stmt2 The 2nd statement to be run in order to revert effects
+# of statement to be checked.
+# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
+# stage is to check that metadata locks taken by this
+# statement are incompatible with metadata locks taken
+# by FTWRL.
+#
+# EXAMPLE
+# flush_read_lock.test
+#
+--disable_result_log
+--disable_query_log
+
+# Reset DEBUG_SYNC facility for safety.
+set debug_sync= "RESET";
+
+#
+# First, check that the statement cannot be run under FTWRL.
+#
+flush tables with read lock;
+--disable_abort_on_error
+--eval $statement
+--enable_abort_on_error
+let $err= $mysql_errno;
+if ($err)
+{
+--echo Success: Was not able to run '$statement' under FTWRL.
+unlock tables;
+}
+if (!$err)
+{
+--echo Error: Was able to run '$statement' under FTWRL!
+unlock tables;
+if (`SELECT "$cleanup_stmt1" <> ""`)
+{
+--eval $cleanup_stmt1;
+}
+if (`SELECT "$cleanup_stmt2" <> ""`)
+{
+--eval $cleanup_stmt2;
+}
+}
+
+
+#
+# Then check that this statement is blocked by FTWRL
+# that is active in another connection.
+#
+connection $con_aux1;
+flush tables with read lock;
+
+connection default;
+--send_eval $statement;
+
+connection $con_aux1;
+
+--enable_result_log
+--enable_query_log
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where (state = "Waiting for global read lock" or
+ state = "Waiting for commit lock") and
+ info = "$statement";
+--source include/wait_condition.inc
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+--echo Success: '$statement' is blocked by FTWRL active in another connection.
+}
+if (!$success)
+{
+--echo Error: '$statement' wasn't blocked by FTWRL active in another connection!
+}
+unlock tables;
+
+connection default;
+--reap
+
+if (`SELECT "$cleanup_stmt1" <> ""`)
+{
+--eval $cleanup_stmt1;
+}
+if (`SELECT "$cleanup_stmt2" <> ""`)
+{
+--eval $cleanup_stmt2;
+}
+
+if (`SELECT "$skip_3rd_check" = ""`)
+{
+#
+# Finally, let us check that FTWRL will not succeed if this
+# statement is active but has already closed its tables.
+#
+connection default;
+--eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send_eval $statement;
+
+connection $con_aux1;
+set debug_sync="now WAIT_FOR parked";
+--send flush tables with read lock
+
+connection $con_aux2;
+--enable_result_log
+--enable_query_log
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where (state = "Waiting for global read lock" or
+ state = "Waiting for commit lock") and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+--echo Success: FTWRL is blocked when '$statement' is active in another connection.
+}
+if (!$success)
+{
+--echo Error: FTWRL isn't blocked when '$statement' is active in another connection!
+}
+set debug_sync="now SIGNAL go";
+connection default;
+--reap
+connection $con_aux1;
+--reap
+unlock tables;
+connection default;
+
+set debug_sync= "RESET";
+
+if (`SELECT "$cleanup_stmt1" <> ""`)
+{
+--eval $cleanup_stmt1;
+}
+if (`SELECT "$cleanup_stmt2" <> ""`)
+{
+--eval $cleanup_stmt2;
+}
+}
+
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc
index c615ebd02cd..ea3187d9b41 100644
--- a/mysql-test/include/check_no_concurrent_insert.inc
+++ b/mysql-test/include/check_no_concurrent_insert.inc
@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
{
--eval create temporary table t_backup select * from $restore_table;
}
@@ -68,7 +68,7 @@ if (!$success)
--eval delete from $table where i = 0;
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc
index 5fbbe0d684c..51c418e6c64 100644
--- a/mysql-test/include/check_slave_is_running.inc
+++ b/mysql-test/include/check_slave_is_running.inc
@@ -8,10 +8,18 @@
--echo Checking that both slave threads are running.
+--let $running= 1
--let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
--let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
-if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) {
+if ($slave_sql_running != Yes) {
+ --let $running= 0
+}
+if ($slave_io_running != Yes) {
+ --let $running= 0
+}
+
+if (!$running) {
--echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running
--source include/show_rpl_debug_info.inc
--die Expected slave to be running, but it was not running.
diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc
index d82c26851ea..b27825eee6c 100644
--- a/mysql-test/include/check_slave_param.inc
+++ b/mysql-test/include/check_slave_param.inc
@@ -9,7 +9,7 @@
# --source include/check_slave_param.inc
--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
-if (`SELECT '$_param_value' != '$slave_param_value'`) {
+if ($_param_value != $slave_param_value) {
--echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
--source include/show_rpl_debug_info.inc
--die Wrong value for slave parameter
diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc
index c4a39879947..83d69cfa40d 100644
--- a/mysql-test/include/ctype_numconv.inc
+++ b/mysql-test/include/ctype_numconv.inc
@@ -1723,6 +1723,21 @@ DROP TABLE t1;
--echo #
+--echo # Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+--echo #
+SELECT @@collation_connection;
+CREATE TABLE t1 (
+ id INT(11) DEFAULT NULL,
+ date_column DATE DEFAULT NULL,
+ KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+DROP TABLE t1;
+
+
+--echo #
--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
--echo #
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc
index d6216f3fe1e..bdd929f39a4 100644
--- a/mysql-test/include/diff_tables.inc
+++ b/mysql-test/include/diff_tables.inc
@@ -69,7 +69,7 @@ while ($_diff_i) {
# 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'`) {
+ if ($_diff_conn) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`;
connection $_diff_conn;
}
diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc
index 7ce36fd3c50..61ee07fc655 100644
--- a/mysql-test/include/get_relay_log_pos.inc
+++ b/mysql-test/include/get_relay_log_pos.inc
@@ -10,12 +10,12 @@
# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
# # in $relay_log_file: $relay_log_pos.
-if (`SELECT '$relay_log_file' = ''`)
+if (!$relay_log_file)
{
--die 'variable $relay_log_file is null'
}
-if (`SELECT '$master_log_pos' = ''`)
+if (!$master_log_pos)
{
--die 'variable $master_log_pos is null'
}
diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc
index b86d5d9287f..57d368960bf 100644
--- a/mysql-test/include/handler.inc
+++ b/mysql-test/include/handler.inc
@@ -1545,8 +1545,6 @@ lock table not_exists_write read;
--echo # We still have the read lock.
--error ER_CANT_UPDATE_WITH_READLOCK
drop table t1;
-handler t1 read next;
-handler t1 close;
handler t1 open;
select a from t2;
handler t1 read next;
diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc
index 3a667d2e21a..8920399555d 100644
--- a/mysql-test/include/have_example_plugin.inc
+++ b/mysql-test/include/have_example_plugin.inc
@@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'YES'`) {
#
# Check if the variable EXAMPLE_PLUGIN is set
#
-if (`SELECT LENGTH('$EXAMPLE_PLUGIN') = 0`) {
+if (!$EXAMPLE_PLUGIN) {
--skip Example plugin requires the environment variable \$EXAMPLE_PLUGIN to be set (normally done by mtr)
}
diff --git a/mysql-test/include/have_plugin_interface.inc b/mysql-test/include/have_plugin_interface.inc
new file mode 100644
index 00000000000..afe8ffad40d
--- /dev/null
+++ b/mysql-test/include/have_plugin_interface.inc
@@ -0,0 +1,5 @@
+--disable_query_log
+--require r/true.require
+select (PLUGIN_LIBRARY LIKE 'qa_auth_interface%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_NAME='qa_auth_interface';
+--enable_query_log
diff --git a/mysql-test/include/have_plugin_server.inc b/mysql-test/include/have_plugin_server.inc
new file mode 100644
index 00000000000..aad1f026b44
--- /dev/null
+++ b/mysql-test/include/have_plugin_server.inc
@@ -0,0 +1,5 @@
+--disable_query_log
+--require r/true.require
+select (PLUGIN_LIBRARY LIKE 'qa_auth_server%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_NAME='qa_auth_server';
+--enable_query_log
diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc
index d3b42dbf5fb..95899f559aa 100644
--- a/mysql-test/include/have_semisync_plugin.inc
+++ b/mysql-test/include/have_semisync_plugin.inc
@@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'YES'`) {
#
# Check if the variable SEMISYNC_MASTER_PLUGIN is set
#
-if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`)
+if (!$SEMISYNC_MASTER_PLUGIN)
{
skip Need semisync plugins;
}
diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc
index 745f68603fe..d077916c5e7 100644
--- a/mysql-test/include/have_simple_parser.inc
+++ b/mysql-test/include/have_simple_parser.inc
@@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'YES'`) {
#
# Check if the variable SIMPLE_PARSER is set
#
-if (`SELECT LENGTH('$SIMPLE_PARSER') = 0`) {
+if (!$SIMPLE_PARSER) {
--skip simple parser requires the environment variable \$SIMPLE_PARSER to be set (normally done by mtr)
}
diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc
index d9ca1450043..5c404b03729 100644
--- a/mysql-test/include/have_udf.inc
+++ b/mysql-test/include/have_udf.inc
@@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'YES'`) {
#
# Check if the variable UDF_EXAMPLE_LIB is set
#
-if (`SELECT LENGTH('$UDF_EXAMPLE_LIB') = 0`) {
+if (!$UDF_EXAMPLE_LIB) {
--skip UDF requires the environment variable \$UDF_EXAMPLE_LIB to be set (normally done by mtr)
}
diff --git a/mysql-test/include/kill_query.inc b/mysql-test/include/kill_query.inc
index b303ed0ec39..1c949d3cbad 100644
--- a/mysql-test/include/kill_query.inc
+++ b/mysql-test/include/kill_query.inc
@@ -44,7 +44,7 @@ connection master;
# kill the query that is waiting
eval kill query $connection_id;
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
{
# release the lock to allow binlog continue
eval SELECT RELEASE_LOCK($debug_lock);
@@ -57,7 +57,7 @@ reap;
connection master;
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
{
# get lock again to make the next query wait
eval SELECT GET_LOCK($debug_lock, 10);
diff --git a/mysql-test/include/kill_query_and_diff_master_slave.inc b/mysql-test/include/kill_query_and_diff_master_slave.inc
index 611d6929c99..b3846d12df1 100644
--- a/mysql-test/include/kill_query_and_diff_master_slave.inc
+++ b/mysql-test/include/kill_query_and_diff_master_slave.inc
@@ -25,7 +25,7 @@ source include/kill_query.inc;
connection master;
disable_query_log;
disable_result_log;
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
{
eval SELECT RELEASE_LOCK($debug_lock);
}
@@ -36,8 +36,8 @@ source include/diff_master_slave.inc;
# Acquire the debug lock again if used
connection master;
-disable_query_log; disable_result_log; if (`SELECT '$debug_lock' !=
-''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log;
-enable_query_log;
+disable_query_log; disable_result_log;
+if ($debug_lock) { eval SELECT GET_LOCK($debug_lock, 10); }
+enable_result_log; enable_query_log;
connection $connection_name;
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index bf0a58788d6..f793ff54e86 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -16,6 +16,12 @@ CREATE TABLE test_suppressions (
-- no invalid patterns can be inserted
-- into test_suppressions
--
+SET @character_set_client_saved = @@character_set_client||
+SET @character_set_results_saved = @@character_set_results||
+SET @collation_connection_saved = @@collation_connection||
+SET @@character_set_client = latin1||
+SET @@character_set_results = latin1||
+SET @@collation_connection = latin1_swedish_ci||
/*!50002
CREATE DEFINER=root@localhost TRIGGER ts_insert
BEFORE INSERT ON test_suppressions
@@ -24,6 +30,9 @@ FOR EACH ROW BEGIN
SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
+SET @@character_set_client = @character_set_client_saved||
+SET @@character_set_results = @character_set_results_saved||
+SET @@collation_connection = @collation_connection_saved||
--
@@ -38,6 +47,12 @@ CREATE TABLE global_suppressions (
-- no invalid patterns can be inserted
-- into global_suppressions
--
+SET @character_set_client_saved = @@character_set_client||
+SET @character_set_results_saved = @@character_set_results||
+SET @collation_connection_saved = @@collation_connection||
+SET @@character_set_client = latin1||
+SET @@character_set_results = latin1||
+SET @@collation_connection = latin1_swedish_ci||
/*!50002
CREATE DEFINER=root@localhost TRIGGER gs_insert
BEFORE INSERT ON global_suppressions
@@ -46,6 +61,9 @@ FOR EACH ROW BEGIN
SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
+SET @@character_set_client = @character_set_client_saved||
+SET @@character_set_results = @character_set_results_saved||
+SET @@collation_connection = @collation_connection_saved||
diff --git a/mysql-test/include/mysql_upgrade_preparation.inc b/mysql-test/include/mysql_upgrade_preparation.inc
index 5de8a79d6e0..a3c81c4c1e7 100644
--- a/mysql-test/include/mysql_upgrade_preparation.inc
+++ b/mysql-test/include/mysql_upgrade_preparation.inc
@@ -17,7 +17,7 @@ select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
# Therefore, truncate the log table in advance and issue a statement
# that should be logged.
#
-if (`SELECT $VALGRIND_TEST`)
+if ($VALGRIND_TEST)
{
--disable_query_log
--disable_result_log
diff --git a/mysql-test/include/no_valgrind_without_big.inc b/mysql-test/include/no_valgrind_without_big.inc
index 743e974daec..ea1f2ac91ab 100644
--- a/mysql-test/include/no_valgrind_without_big.inc
+++ b/mysql-test/include/no_valgrind_without_big.inc
@@ -5,8 +5,9 @@
# Therefore we require that the option "--big-test" is also set.
#
-if (`SELECT $VALGRIND_TEST <> 0 AND '$BIG_TEST' = ''`)
-{
- --skip Need "--big-test" when running with Valgrind
+if ($VALGRIND_TEST) {
+ if (!$BIG_TEST)
+ {
+ --skip Need "--big-test" when running with Valgrind
+ }
}
-
diff --git a/mysql-test/include/not_parallel.inc b/mysql-test/include/not_parallel.inc
index 39432c59813..615bdf68453 100644
--- a/mysql-test/include/not_parallel.inc
+++ b/mysql-test/include/not_parallel.inc
@@ -1,3 +1,3 @@
-if (`SELECT '$MTR_PARALLEL' > 1`) {
+if ($MTR_PARALLEL > 1) {
--skip test requires --parallel=1
}
diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc
index c3a45578a79..a82e094a209 100644
--- a/mysql-test/include/rpl_diff_tables.inc
+++ b/mysql-test/include/rpl_diff_tables.inc
@@ -8,13 +8,13 @@
# --source include/rpl_diff_tables.inc
# #############################################################################
-if (`SELECT "XX$diff_table" = "XX"`)
+if (!$diff_table)
{
--die diff_table is null.
}
--let $_servers= master, slave
-if (`SELECT "XX$diff_server_list" <> "XX"`)
+if ($diff_server_list)
{
--let $_servers= $diff_server_list
}
@@ -22,7 +22,7 @@ if (`SELECT "XX$diff_server_list" <> "XX"`)
--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
connection $_master;
-while (`SELECT "XX$_servers" <> "XX"`)
+while ($_servers)
{
--let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`
diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc
index 86a5da328af..1b517862235 100644
--- a/mysql-test/include/setup_fake_relay_log.inc
+++ b/mysql-test/include/setup_fake_relay_log.inc
@@ -40,9 +40,16 @@ let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_
--echo Setting up fake replication from $_fake_relay_log_printable
# Sanity check.
+let $running= 0;
let $_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
let $_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
-if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) {
+if ($_sql_running == Yes) {
+ let $running= 1;
+}
+if ($_io_running == Yes) {
+ let $running= 1;
+}
+if ($running) {
--echo Error: Slave was running when test case sourced
--echo include/setup_fake_replication.inc
--echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running
@@ -56,7 +63,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) {
# Read server variables.
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1);
-if (`SELECT '$_fake_filename' = ''`) {
+if (!$_fake_filename) {
--echo Badly written test case: relay_log variable is empty. Please use the
--echo server option --relay-log=FILE.
}
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
index 2fd0bc6dbd8..ff5a7105c24 100644
--- a/mysql-test/include/show_events.inc
+++ b/mysql-test/include/show_events.inc
@@ -18,13 +18,15 @@ if ($is_relay_log)
--let $_statement=show relaylog events
}
-if (`SELECT '$binlog_file' <> ''`)
+if ($binlog_file)
{
--let $_statement= $_statement in '$binlog_file'
}
--let $_statement= $_statement from $binlog_start
+# Cannot use if($binlog_limit) since the variable may begin with a 0
+
if (`SELECT '$binlog_limit' <> ''`)
{
--let $_statement= $_statement limit $binlog_limit
diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc
index 148d11f3b02..dedf689cd19 100644
--- a/mysql-test/include/show_rpl_debug_info.inc
+++ b/mysql-test/include/show_rpl_debug_info.inc
@@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name';
let $_master_con= $master_connection;
-if (`SELECT '$_master_con' = ''`)
+if (!$_master_con)
{
- if (`SELECT '$_con' = 'slave'`)
+ if ($_con == slave)
{
let $_master_con= master;
}
- if (`SELECT '$_master_con' = ''`)
+ if (!$_master_con)
{
--echo Unable to determine master connection. No debug info printed for master.
--echo Please fix the test case by setting $master_connection before sourcing
@@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`)
}
}
-if (`SELECT '$_master_con' != ''`)
+if ($_master_con)
{
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
@@ -80,7 +80,7 @@ if (`SELECT '$_master_con' != ''`)
--echo
--echo **** SHOW BINLOG EVENTS on $_master_con ****
eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql';
- if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`)
+ if ($master_binlog_name_io != $master_binlog_name_sql)
{
eval SHOW BINLOG EVENTS IN '$master_binlog_name_io';
}
diff --git a/mysql-test/include/truncate_file.inc b/mysql-test/include/truncate_file.inc
index c82108681bd..2326d6c0b94 100644
--- a/mysql-test/include/truncate_file.inc
+++ b/mysql-test/include/truncate_file.inc
@@ -1,6 +1,6 @@
# truncate a giving file, all contents of the file are be cleared
-if (`SELECT 'x$file' = 'x'`)
+if (!$file)
{
--echo Please assign a file name to $file!!
exit;
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index 34cbf20a73b..ffdcf752873 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -31,7 +31,7 @@
# $master_connection
# See wait_for_slave_param.inc for description.
-if (`SELECT '$slave_io_errno' = ''`) {
+if (!$slave_io_errno) {
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
}
diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc
index f61b0db1ed7..512bb6b7243 100644
--- a/mysql-test/include/wait_for_slave_io_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_io_to_stop.inc
@@ -14,7 +14,7 @@
# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
# STATUS will return an empty set.
let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
-if (`SELECT '$_slave_io_running' != 'No such row'`)
+if ($_slave_io_running != No such row)
{
let $slave_param= Slave_IO_Running;
let $slave_param_value= No;
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
index b0989c3264e..db07692672f 100644
--- a/mysql-test/include/wait_for_slave_param.inc
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -53,7 +53,7 @@ if (!$_slave_timeout_counter)
let $slave_tcnt= $_slave_timeout_counter;
let $_slave_param_comparison= $slave_param_comparison;
-if (`SELECT '$_slave_param_comparison' = ''`)
+if (!$_slave_param_comparison)
{
let $_slave_param_comparison= =;
}
@@ -73,7 +73,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_
if (!$_slave_timeout_counter)
{
--echo **** ERROR: timeout after $slave_tcnt deci-seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
- if (`SELECT '$slave_error_message' != ''`)
+ if ($slave_error_message)
{
--echo Message: $slave_error_message
}
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
index aab04036eea..3ae34b1fb9e 100644
--- a/mysql-test/include/wait_for_slave_sql_error.inc
+++ b/mysql-test/include/wait_for_slave_sql_error.inc
@@ -24,7 +24,7 @@
# $master_connection
# See wait_for_slave_param.inc for description.
-if (`SELECT '$slave_sql_errno' = ''`) {
+if (!$slave_sql_errno) {
--die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
}
@@ -34,7 +34,7 @@ let $slave_error_message= Failed while waiting for slave to stop the SQL thread
source include/wait_for_slave_param.inc;
let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-if (`SELECT '$_error' != '$slave_sql_errno'`) {
+if ($_error != $slave_sql_errno) {
--echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
source include/show_rpl_debug_info.inc;
--echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc
index 6992613b646..50bf53e421d 100644
--- a/mysql-test/include/wait_for_slave_sql_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc
@@ -14,7 +14,7 @@
# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
# STATUS will return an empty set.
let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
-if (`SELECT '$_slave_io_running' != 'No such row'`)
+if ($_slave_io_running != No such row)
{
let $slave_param= Slave_SQL_Running;
let $slave_param_value= No;
diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc
index 56d0e7b0c91..618c5397cb7 100644
--- a/mysql-test/include/wait_for_slave_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_to_stop.inc
@@ -14,7 +14,7 @@
# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
# STATUS will return an empty set.
let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
-if (`SELECT '$_slave_io_running' != 'No such row'`)
+if ($_slave_io_running != No such row)
{
let $slave_error_message= Failed while waiting for slave to stop;
diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc
index 8b644c2c3c5..9f4962aeaed 100644
--- a/mysql-test/include/wait_for_status_var.inc
+++ b/mysql-test/include/wait_for_status_var.inc
@@ -45,7 +45,7 @@ if (!$_status_timeout_counter)
}
let $_status_var_comparsion= $status_var_comparsion;
-if (`SELECT '$_status_var_comparsion' = ''`)
+if (!$_status_var_comparsion)
{
let $_status_var_comparsion= =;
}
diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc
index f683ca7b47b..68e05ce4644 100644
--- a/mysql-test/include/wait_show_condition.inc
+++ b/mysql-test/include/wait_show_condition.inc
@@ -50,7 +50,7 @@ inc $max_run_time;
let $found= 0;
let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
-if (`SELECT '$wait_for_all' != '1'`)
+if ($wait_for_all != 1)
{
while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
{
@@ -58,24 +58,27 @@ if (`SELECT '$wait_for_all' != '1'`)
real_sleep 0.2;
let $rowno= 1;
let $process_result= 1;
- while (`SELECT $process_result = 1 AND $found = 0`)
+ let $do_loop= 1;
+ while ($do_loop)
{
let $field_value= query_get_value($show_statement, $field, $rowno);
if (`SELECT '$field_value' $condition`)
{
let $found= 1;
+ let $do_loop= 0;
}
- if (`SELECT '$field_value' = 'No such row'`)
+ if ($field_value == No such row)
{
# We are behind the last row of the result set.
let $process_result= 0;
+ let $do_loop= 0;
}
inc $rowno;
}
}
}
-if (`SELECT '$wait_for_all' = '1'`)
+if ($wait_for_all == 1)
{
while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
{
@@ -83,16 +86,19 @@ if (`SELECT '$wait_for_all' = '1'`)
real_sleep 0.2;
let $rowno= 1;
let $process_result= 1;
- while (`SELECT $process_result = 1 AND $found = 0`)
+ let $do_loop= 1;
+ while ($do_loop)
{
let $field_value= query_get_value($show_statement, $field, $rowno);
- if (`SELECT '$field_value' = 'No such row'`)
+ if ($field_value == No such row)
{
let $found= 1;
+ let $do_loop= 0;
}
if (`SELECT $found = 0 AND NOT '$field_value' $condition`)
{
let process_result= 0;
+ let $do_loop= 0;
}
inc $rowno;
}
@@ -101,7 +107,7 @@ if (`SELECT '$wait_for_all' = '1'`)
if (!$found)
{
- echo # Timeout in include/wait_show_condition.inc for $wait_condition;
+ echo # Timeout in include/wait_show_condition.inc for $condition;
echo # show_statement : $show_statement;
echo # field : $field;
echo # condition : $condition;
diff --git a/mysql-test/lib/My/SafeProcess/Makefile.am b/mysql-test/lib/My/SafeProcess/Makefile.am
deleted file mode 100644
index 33cab066611..00000000000
--- a/mysql-test/lib/My/SafeProcess/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-testroot = $(prefix)
-safedir = $(testroot)/mysql-test/lib/My/SafeProcess
-#nobase_bin_PROGRAMS = ...
-safe_PROGRAMS = my_safe_process
-
-my_safe_process_SOURCES = safe_process.cc
-
-EXTRA_DIST = safe_kill_win.cc \
- safe_process_win.cc \
- CMakeLists.txt
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 87f96496c73..a7d7a8aefa4 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -177,8 +177,6 @@ sub collect_test_cases ($$$$) {
if ( $opt_reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
- my %sort_criteria;
-
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, etc.
@@ -190,24 +188,31 @@ sub collect_test_cases ($$$$) {
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
+ push(@criteria, $tinfo->{template_path});
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
+ # Add slave opts if any
+ if ($tinfo->{'slave_opt'})
+ {
+ push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}}));
+ }
+ # This sorts tests with force-restart *before* identical tests
+ push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart");
- $sort_criteria{$tinfo->{name}} = join(" ", @criteria);
+ $tinfo->{criteria}= join(" ", @criteria);
}
- @$cases = sort {
- $sort_criteria{$a->{'name'}} . $a->{'name'} cmp
- $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
+ @$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
- # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
+ # my $tname= $tinfo->{name} . ' ' . $tinfo->{combination};
+ # my $crit= $tinfo->{criteria};
+ # print("$tname\n\t$crit\n");
# }
-
}
if (defined $print_testcases){
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 32960d866ce..dc9928d37c5 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -33,6 +33,13 @@ sub mtr_exe_maybe_exists(@);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
+sub init_timers();
+sub mark_time_used($);
+sub add_total_times($);
+sub print_times_used($$);
+sub print_total_times($);
+
+our $opt_report_times;
##############################################################################
#
@@ -205,4 +212,81 @@ sub start_timer ($) { return time + $_[0]; }
sub has_expired ($) { return $_[0] && time gt $_[0]; }
+# Below code is for time usage reporting
+
+use Time::HiRes qw(gettimeofday);
+
+my %time_used= (
+ 'collect' => 0,
+ 'restart' => 0,
+ 'check' => 0,
+ 'ch-warn' => 0,
+ 'test' => 0,
+ 'init' => 0,
+);
+
+my %time_text= (
+ 'collect' => "Collecting test cases",
+ 'restart' => "Server stop/start",
+ 'check' => "Check-testcase",
+ 'ch-warn' => "Check for warnings",
+ 'test' => "Test execution",
+ 'init' => "Initialization etc.",
+);
+
+# Counts number of reports from workers
+
+my $time_totals= 0;
+
+my $last_timer_set;
+
+sub init_timers() {
+ $last_timer_set= gettimeofday();
+}
+
+sub mark_time_used($) {
+ my ($name)= @_;
+ return unless $opt_report_times;
+ die "Unknown timer $name" unless exists $time_used{$name};
+
+ my $curr_time= gettimeofday();
+ $time_used{$name}+= int (($curr_time - $last_timer_set) * 1000 + .5);
+ $last_timer_set= $curr_time;
+}
+
+sub add_total_times($) {
+ my ($dummy, $num, @line)= split (" ", $_[0]);
+
+ $time_totals++;
+ foreach my $elem (@line) {
+ my ($name, $spent)= split (":", $elem);
+ $time_used{$name}+= $spent;
+ }
+}
+
+sub print_times_used($$) {
+ my ($server, $num)= @_;
+ return unless $opt_report_times;
+
+ my $output= "SPENT $num";
+ foreach my $name (keys %time_used) {
+ my $spent= $time_used{$name};
+ $output.= " $name:$spent";
+ }
+ print $server $output . "\n";
+}
+
+sub print_total_times($) {
+ # Don't print if we haven't received all worker data
+ return if $time_totals != $_[0];
+
+ foreach my $name (keys %time_used)
+ {
+ my $spent= $time_used{$name}/1000;
+ my $text= $time_text{$name};
+ print ("Spent $spent seconds on $text\n");
+ }
+}
+
+
1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index a42627c93cd..26a95fa13ab 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -116,18 +116,20 @@ sub sleep_until_file_created ($$$) {
return 1;
}
+ my $seconds= ($loop * $sleeptime) / 1000;
+
# Check if it died after the fork() was successful
if ( defined $proc and ! $proc->wait_one(0) )
{
- mtr_warning("Process $proc died");
+ mtr_warning("Process $proc died after mysql-test-run waited $seconds " .
+ "seconds for $pidfile to be created.");
return 0;
}
mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
# Print extra message every 60 seconds
- my $seconds= ($loop * $sleeptime) / 1000;
- if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
+ if ( $seconds > 1 && int($seconds * 10) % 600 == 0 && $seconds < $timeout )
{
my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
@@ -138,6 +140,8 @@ sub sleep_until_file_created ($$$) {
}
+ mtr_warning("Timeout after mysql-test-run waited $timeout seconds " .
+ "for the process $proc to create a pid file.");
return 0;
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 88719ff5bb2..89e2ed5d441 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -131,6 +131,9 @@ my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
+my $auth_interface_fn; # the name of qa_auth_interface plugin
+my $auth_server_fn; # the name of qa_auth_server plugin
+my $auth_client_fn; # the name of qa_auth_client plugin
my $auth_filename; # the name of the authentication test plugin
my $auth_plugin; # the path to the authentication test plugin
@@ -198,6 +201,7 @@ sub using_extern { return (keys %opts_extern > 0);};
our $opt_fast= 0;
our $opt_force;
our $opt_mem= $ENV{'MTR_MEM'};
+our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
our $opt_gcov;
our $opt_gcov_exe= "gcov";
@@ -238,6 +242,7 @@ my $opt_skip_core;
our $opt_check_testcases= 1;
my $opt_mark_progress;
my $opt_max_connections;
+our $opt_report_times= 0;
my $opt_sleep;
@@ -351,8 +356,11 @@ sub main {
}
}
+ init_timers();
+
mtr_report("Collecting tests...");
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
+ mark_time_used('collect');
if ( $opt_report_features ) {
# Put "report features" as the first test to run
@@ -421,6 +429,7 @@ sub main {
$opt_tmpdir= "$opt_tmpdir/$child_num";
}
+ init_timers();
run_worker($server_port, $child_num);
exit(1);
}
@@ -433,6 +442,8 @@ sub main {
mtr_print_thick_line();
mtr_print_header();
+ mark_time_used('init');
+
my $completed= run_test_server($server, $tests, $opt_parallel);
exit(0) if $opt_start_exit;
@@ -478,8 +489,12 @@ sub main {
$opt_gcov_msg, $opt_gcov_err);
}
+ print_total_times($opt_parallel) if $opt_report_times;
+
mtr_report_stats("Completed", $completed);
+ remove_vardir_subs() if $opt_clean_vardir;
+
exit(0);
}
@@ -610,13 +625,15 @@ sub run_test_server ($$$) {
if ($test_has_failed and $retries <= $opt_retry){
# Test should be run one more time unless it has failed
# too many times already
+ my $tname= $result->{name};
my $failures= $result->{failures};
if ($opt_retry > 1 and $failures >= $opt_retry_failure){
- mtr_report("\nTest has failed $failures times,",
+ mtr_report("\nTest $tname has failed $failures times,",
"no more retries!\n");
}
else {
- mtr_report("\nRetrying test, attempt($retries/$opt_retry)...\n");
+ mtr_report("\nRetrying test $tname, ".
+ "attempt($retries/$opt_retry)...\n");
delete($result->{result});
$result->{retries}= $retries+1;
$result->write_test($sock, 'TESTCASE');
@@ -652,6 +669,9 @@ sub run_test_server ($$$) {
elsif ($line eq 'START'){
; # Send first test
}
+ elsif ($line =~ /^SPENT/) {
+ add_total_times($line);
+ }
else {
mtr_error("Unknown response: '$line' from client");
}
@@ -684,22 +704,40 @@ sub run_test_server ($$$) {
next;
}
- # Prefer same configuration, or just use next if --noreorder
- if (!$opt_reorder or (defined $result and
- $result->{template_path} eq $t->{template_path}))
- {
- #mtr_report("Test uses same config => good match");
- # Test uses same config => good match
- $next= splice(@$tests, $i, 1);
- last;
- }
-
# Second best choice is the first that does not fulfill
# any of the above conditions
if (!defined $second_best){
#mtr_report("Setting second_best to $i");
$second_best= $i;
}
+
+ # Smart allocation of next test within this thread.
+
+ if ($opt_reorder and $opt_parallel > 1 and defined $result)
+ {
+ my $wid= $result->{worker};
+ # Reserved for other thread, try next
+ next if (defined $t->{reserved} and $t->{reserved} != $wid);
+ if (! defined $t->{reserved})
+ {
+ # Force-restart not relevant when comparing *next* test
+ $t->{criteria} =~ s/force-restart$/no-restart/;
+ my $criteria= $t->{criteria};
+ # Reserve similar tests for this worker, but not too many
+ my $maxres= (@$tests - $i) / $opt_parallel + 1;
+ for (my $j= $i+1; $j <= $i + $maxres; $j++)
+ {
+ my $tt= $tests->[$j];
+ last unless defined $tt;
+ last if $tt->{criteria} ne $criteria;
+ $tt->{reserved}= $wid;
+ }
+ }
+ }
+
+ # At this point we have found next suitable test
+ $next= splice(@$tests, $i, 1);
+ last;
}
# Use second best choice if no other test has been found
@@ -708,10 +746,12 @@ sub run_test_server ($$$) {
mtr_error("Internal error, second best too large($second_best)")
if $second_best > $#$tests;
$next= splice(@$tests, $second_best, 1);
+ delete $next->{reserved};
}
if ($next) {
- #$next->print_test();
+ # We don't need this any more
+ delete $next->{criteria};
$next->write_test($sock, 'TESTCASE');
$running{$next->key()}= $next;
$num_ndb_tests++ if ($next->{ndb_test});
@@ -783,7 +823,9 @@ sub run_worker ($) {
# Ask server for first test
print $server "START\n";
- while(my $line= <$server>){
+ mark_time_used('init');
+
+ while (my $line= <$server>){
chomp($line);
if ($line eq 'TESTCASE'){
my $test= My::Test::read_test($server);
@@ -794,6 +836,11 @@ sub run_worker ($) {
delete($test->{'comment'});
delete($test->{'logfile'});
+ # A sanity check. Should this happen often we need to look at it.
+ if (defined $test->{reserved} && $test->{reserved} != $thread_num) {
+ my $tres= $test->{reserved};
+ mtr_warning("Test reserved for w$tres picked up by w$thread_num");
+ }
$test->{worker} = $thread_num if $opt_parallel > 1;
run_testcase($test);
@@ -801,16 +848,20 @@ sub run_worker ($) {
# Send it back, now with results set
#$test->print_test();
$test->write_test($server, 'TESTRESULT');
+ mark_time_used('restart');
}
elsif ($line eq 'BYE'){
mtr_report("Server said BYE");
stop_all_servers($opt_shutdown_timeout);
+ mark_time_used('restart');
if ($opt_valgrind_mysqld) {
valgrind_exit_reports();
}
if ( $opt_gprof ) {
gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
}
+ mark_time_used('init');
+ print_times_used($server, $thread_num);
exit(0);
}
else {
@@ -868,7 +919,7 @@ sub command_line_setup {
'ssl|with-openssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress,
- 'vs-config' => \$opt_vs_config,
+ 'vs-config=s' => \$opt_vs_config,
# Max number of parallel threads to use
'parallel=s' => \$opt_parallel,
@@ -951,6 +1002,7 @@ sub command_line_setup {
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
'mem' => \$opt_mem,
+ 'clean-vardir' => \$opt_clean_vardir,
'client-bindir=s' => \$path_client_bindir,
'client-libdir=s' => \$path_client_libdir,
@@ -983,6 +1035,7 @@ sub command_line_setup {
'timediff' => \&report_option,
'max-connections=i' => \$opt_max_connections,
'default-myisam!' => \&collect_option,
+ 'report-times' => \$opt_report_times,
'help|h' => \$opt_usage,
'list-options' => \$opt_list_options,
@@ -1062,14 +1115,20 @@ sub command_line_setup {
"$basedir/sql/share/charsets",
"$basedir/share/charsets");
- # Look for client test plugin
+ # Look for auth test plugins
if (IS_WINDOWS)
{
$auth_filename = "auth_test_plugin.dll";
+ $auth_interface_fn = "qa_auth_interface.dll";
+ $auth_server_fn = "qa_auth_server.dll";
+ $auth_client_fn = "qa_auth_client.dll";
}
else
{
$auth_filename = "auth_test_plugin.so";
+ $auth_interface_fn = "qa_auth_interface.so";
+ $auth_server_fn = "qa_auth_server.so";
+ $auth_client_fn = "qa_auth_client.so";
}
$auth_plugin=
mtr_file_exists(vs_config_dirs('plugin/auth/',$auth_filename),
@@ -1316,7 +1375,7 @@ sub command_line_setup {
# Add the location for libmysqld.dll to the path.
my $separator= ";";
my $lib_mysqld=
- mtr_path_exists(vs_config_dirs('libmysqld',''));
+ mtr_path_exists("$bindir/lib", vs_config_dirs('libmysqld',''));
if ( IS_CYGWIN )
{
$lib_mysqld= posix_path($lib_mysqld);
@@ -1752,17 +1811,17 @@ sub executable_setup () {
if ( ! $opt_skip_ndbcluster )
{
$exe_ndbd=
- my_find_bin($basedir,
+ my_find_bin($bindir,
["storage/ndb/src/kernel", "libexec", "sbin", "bin"],
"ndbd");
$exe_ndb_mgmd=
- my_find_bin($basedir,
+ my_find_bin($bindir,
["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"],
"ndb_mgmd");
$exe_ndb_waiter=
- my_find_bin($basedir,
+ my_find_bin($bindir,
["storage/ndb/tools/", "bin"],
"ndb_waiter");
@@ -1973,12 +2032,18 @@ sub environment_setup {
$ENV{'PLUGIN_AUTH_OPT'}= "--plugin-dir=".dirname($auth_plugin);
$ENV{'PLUGIN_AUTH_LOAD'}="--plugin_load=test_plugin_server=".$auth_filename;
+ $ENV{'PLUGIN_AUTH_INTERFACE'}="--plugin_load=qa_auth_interface=".$auth_interface_fn;
+ $ENV{'PLUGIN_AUTH_SERVER'}="--plugin_load=qa_auth_server=".$auth_server_fn;
+ $ENV{'PLUGIN_AUTH_CLIENT'}="--plugin_load=qa_auth_client=".$auth_client_fn;
}
else
{
$ENV{'PLUGIN_AUTH'}= "";
$ENV{'PLUGIN_AUTH_OPT'}="--plugin-dir=";
$ENV{'PLUGIN_AUTH_LOAD'}="";
+ $ENV{'PLUGIN_AUTH_INTERFACE'}="";
+ $ENV{'PLUGIN_AUTH_SERVER'}="";
+ $ENV{'PLUGIN_AUTH_CLIENT'}="";
}
@@ -2128,12 +2193,12 @@ sub environment_setup {
if ( ! $opt_skip_ndbcluster )
{
$ENV{'NDB_MGM'}=
- my_find_bin($basedir,
+ my_find_bin($bindir,
["storage/ndb/src/mgmclient", "bin"],
"ndb_mgm");
$ENV{'NDB_TOOLS_DIR'}=
- my_find_dir($basedir,
+ my_find_dir($bindir,
["storage/ndb/tools", "bin"]);
$ENV{'NDB_EXAMPLES_DIR'}=
@@ -2141,7 +2206,7 @@ sub environment_setup {
["storage/ndb/ndbapi-examples", "bin"]);
$ENV{'NDB_EXAMPLES_BINARY'}=
- my_find_bin($basedir,
+ my_find_bin($bindir,
["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"],
"ndbapi_simple", NOT_REQUIRED);
@@ -2241,6 +2306,12 @@ sub environment_setup {
}
+sub remove_vardir_subs() {
+ foreach my $sdir ( glob("$opt_vardir/*") ) {
+ mtr_verbose("Removing subdir $sdir");
+ rmtree($sdir);
+ }
+}
#
# Remove var and any directories in var/ created by previous
@@ -2285,11 +2356,7 @@ sub remove_stale_vardir () {
mtr_error("The destination for symlink $opt_vardir does not exist")
if ! -d readlink($opt_vardir);
- foreach my $bin ( glob("$opt_vardir/*") )
- {
- mtr_verbose("Removing bin $bin");
- rmtree($bin);
- }
+ remove_vardir_subs();
}
}
else
@@ -3207,6 +3274,7 @@ sub check_testcase($$)
if ( keys(%started) == 0){
# All checks completed
+ mark_time_used('check');
return 0;
}
# Wait for next process to exit
@@ -3222,7 +3290,8 @@ sub check_testcase($$)
"\nMTR's internal check of the test case '$tname' failed.
This means that the test case does not preserve the state that existed
before the test case was executed. Most likely the test case did not
-do a proper clean-up.
+do a proper clean-up. It could also be caused by the previous test run
+by this thread, if the server wasn't restarted.
This is the diff of the states of the servers before and after the
test case was executed:\n";
$tinfo->{check}.= $report;
@@ -3264,6 +3333,11 @@ test case was executed:\n";
# Kill any check processes still running
map($_->kill(), values(%started));
+ mtr_warning("Check-testcase failed, this could also be caused by the" .
+ " previous test run by this worker thread")
+ if $result > 1 && $mode eq "before";
+ mark_time_used('check');
+
return $result;
}
@@ -3573,6 +3647,7 @@ sub run_testcase ($) {
return 1;
}
}
+ mark_time_used('restart');
# --------------------------------------------------------------------
# If --start or --start-dirty given, stop here to let user manually
@@ -3625,6 +3700,8 @@ sub run_testcase ($) {
do_before_run_mysqltest($tinfo);
+ mark_time_used('init');
+
if ( $opt_check_testcases and check_testcase($tinfo, "before") ){
# Failed to record state of server or server crashed
report_failure_and_restart($tinfo);
@@ -3671,6 +3748,7 @@ sub run_testcase ($) {
}
mtr_verbose("Got $proc");
+ mark_time_used('test');
# ----------------------------------------------------
# Was it the test program that exited
# ----------------------------------------------------
@@ -3768,7 +3846,6 @@ sub run_testcase ($) {
# ----------------------------------------------------
# Check if it was an expected crash
# ----------------------------------------------------
- SRVDIED:
my $check_crash = check_expected_crash_and_restart($proc);
if ($check_crash)
{
@@ -3778,6 +3855,7 @@ sub run_testcase ($) {
next;
}
+ SRVDIED:
# ----------------------------------------------------
# Stop the test case timer
# ----------------------------------------------------
@@ -3897,7 +3975,9 @@ sub get_log_from_proc ($$) {
foreach my $mysqld (mysqlds()) {
if ($mysqld->{proc} eq $proc) {
my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
- $srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
+ $srv_log= "\nServer log from this test:\n" .
+ "----------SERVER LOG START-----------\n". join ("", @srv_lines) .
+ "----------SERVER LOG END-------------\n";
last;
}
}
@@ -4074,6 +4154,7 @@ sub check_warnings ($) {
if ( keys(%started) == 0){
# All checks completed
+ mark_time_used('ch-warn');
return $result;
}
# Wait for next process to exit
@@ -4106,6 +4187,7 @@ sub check_warnings ($) {
# Kill any check processes still running
map($_->kill(), values(%started));
+ mark_time_used('ch-warn');
return $result;
}
@@ -4406,7 +4488,13 @@ sub mysqld_arguments ($$$) {
my $mysqld= shift;
my $extra_opts= shift;
- mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ my @defaults = grep(/^--defaults-file=/, @$extra_opts);
+ if (@defaults > 0) {
+ mtr_add_arg($args, pop(@defaults))
+ }
+ else {
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ }
# When mysqld is run by a root user(euid is 0), it will fail
# to start unless we specify what user to run as, see BUG#30630
@@ -4442,6 +4530,9 @@ sub mysqld_arguments ($$$) {
my $found_skip_core= 0;
foreach my $arg ( @$extra_opts )
{
+ # Skip --defaults-file option since it's handled above.
+ next if $arg =~ /^--defaults-file/;
+
# Allow --skip-core-file to be set in <testname>-[master|slave].opt file
if ($arg eq "--skip-core-file")
{
@@ -4675,17 +4766,6 @@ sub server_need_restart {
}
}
- # Temporary re-enable the "always restart slave" hack
- # this should be removed asap, but will require that each rpl
- # testcase cleanup better after itself - ie. stop and reset
- # replication
- # Use the "#!use-slave-opt" marker to detect that this is a "slave"
- # server
- if ( $server->option("#!use-slave-opt") ){
- mtr_verbose_restart($server, "Always restart slave(s)");
- return 1;
- }
-
my $is_mysqld= grep ($server eq $_, mysqlds());
if ($is_mysqld)
{
@@ -5069,6 +5149,8 @@ sub start_mysqltest ($) {
my $exe= $exe_mysqltest;
my $args;
+ mark_time_used('init');
+
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
@@ -5258,8 +5340,7 @@ sub gdb_arguments {
"break mysql_parse\n" .
"commands 1\n" .
"disable 1\n" .
- "end\n" .
- "run");
+ "end\n");
}
if ( $opt_manual_gdb )
@@ -5550,6 +5631,8 @@ Options to control directories to use
for tmpfs (/dev/shm)
The option can also be set using environment
variable MTR_MEM=[DIR]
+ clean-vardir Clean vardir if tests were successful and if
+ running in "memory". Otherwise this option is ignored
client-bindir=PATH Path to the directory where client binaries are located
client-libdir=PATH Path to the directory where client libraries are located
@@ -5709,6 +5792,8 @@ Misc options
default-myisam Set default storage engine to MyISAM for non-innodb
tests. This is needed after switching default storage
engine to InnoDB.
+ report-times Report how much time has been spent on different
+ phases of test execution.
HERE
exit(1);
diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result
index e8562662bfd..792d9eaf2f1 100644
--- a/mysql-test/r/1st.result
+++ b/mysql-test/r/1st.result
@@ -21,7 +21,7 @@ ndb_binlog_index
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
diff --git a/mysql-test/r/bug58669.result b/mysql-test/r/bug58669.result
new file mode 100644
index 00000000000..5504c5908be
--- /dev/null
+++ b/mysql-test/r/bug58669.result
@@ -0,0 +1,17 @@
+#
+# Bug#58669: read_only not enforced on 5.5.x
+#
+CREATE USER user1@localhost;
+CREATE DATABASE db1;
+GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
+CREATE TABLE db1.t1(a INT);
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SHOW VARIABLES LIKE "%read_only%";
+Variable_name Value
+read_only ON
+INSERT INTO db1.t1 VALUES (1);
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+DROP DATABASE db1;
+DROP USER user1@localhost;
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index bbd0273c1c6..b21956252d2 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -15,7 +15,7 @@ ndb_binlog_index
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -49,7 +49,7 @@ ndb_binlog_index
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -91,7 +91,7 @@ ndb_binlog_index
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 0e8fe328589..4d526a86ade 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL DEFAULT ''
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -2748,6 +2748,25 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index b1e9ff38d26..d5ee7214cde 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -2830,6 +2830,25 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 6216819d172..ac84b169ec3 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -410,6 +410,15 @@ hex(cast(_ascii 0x7f as char(1) character set latin1))
7F
End of 5.0 tests
#
+# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
+#
+SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '');
+'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '')
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+End of 5.1 tests
+#
# Start of 5.5 tests
#
#
@@ -1835,7 +1844,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL DEFAULT ''
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -3158,6 +3167,25 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index c2fb90ecfa6..11d5117bbe1 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -2667,7 +2667,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -3990,6 +3990,25 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+DROP TABLE t1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 946aa1c780e..b801a7f45a4 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2374,6 +2374,16 @@ hex(convert(_latin1 0xA4A2 using ujis)) hex(c2)
DROP PROCEDURE sp1;
DROP TABLE t1;
DROP TABLE t2;
+#
+# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+#
+SET NAMES utf8;
+SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis);
+CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis)
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
set names default;
set character_set_database=default;
set character_set_server=default;
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 7cee15aecef..beafbf80e1e 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -625,16 +625,16 @@ INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
HEX(a) HEX(CONVERT(a USING utf8mb4))
0385 CE85
+FF9D EFBE9D
D800DF84 F0908E84
DBC0DC00 F4808080
-FF9D EFBE9D
ALTER TABLE t1 ADD KEY(a);
SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
HEX(a) HEX(CONVERT(a USING utf8mb4))
0385 CE85
+FF9D EFBE9D
D800DF84 F0908E84
DBC0DC00 F4808080
-FF9D EFBE9D
DROP TABLE IF EXISTS t1;
select @@collation_connection;
@@collation_connection
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index e14b54b59a3..5763885d5f3 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1898,6 +1898,37 @@ CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
DROP TABLE t1;
End of 5.0 tests
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'ÑÑÑŽÑ'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'ÑÑÑŽÑ'))
+122587
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуÑ'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуÑ'))
+122587
+SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
+HEX(RPAD(0x20, 2, _utf8 0xD18F))
+20D1
+SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
+HEX(RPAD(0x20, 4, _utf8 0xD18F))
+20D18FD1
+SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
+HEX(LPAD(0x20, 2, _utf8 0xD18F))
+D120
+SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
+HEX(LPAD(0x20, 4, _utf8 0xD18F))
+D18FD120
+SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
+HEX(RPAD(_utf8 0xD18F, 3, 0x20))
+D18F20
+SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
+HEX(LPAD(_utf8 0xD18F, 3, 0x20))
+20D18F
+SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20))
+D120
+SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
+D120D18E
+End of 5.1 tests
Start of 5.4 tests
SET NAMES utf8mb3;
SHOW VARIABLES LIKE 'character_set_results%';
@@ -2040,6 +2071,20 @@ predicted_order hex(utf8_encoding)
100 E0B78AE2808DE0B6BA
101 E0B78AE2808DE0B6BB
DROP TABLE t1;
+SET NAMES utf8 COLLATE utf8_sinhala_ci;
+CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci);
+INSERT INTO t1 VALUES ('a'),('ae'),('af');
+SELECT s1,hex(s1) FROM t1 ORDER BY s1;
+s1 hex(s1)
+a 61
+ae 6165
+af 6166
+SELECT * FROM t1 ORDER BY s1;
+s1
+a
+ae
+af
+DROP TABLE t1;
End of 5.4 tests
#
# Start of 5.5 tests
@@ -3511,7 +3556,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -4834,6 +4879,25 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
@@ -4854,5 +4918,16 @@ maketime(`a`,`a`,`a`)
DROP TABLE t1;
SET sql_mode=default;
#
+# Bug#57687 crash when reporting duplicate group_key error and utf8
+# Make sure to modify this when Bug#58081 is fixed.
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
+SELECT COUNT(*) FROM t1, t1 t2
+GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
+ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 432b9b14a85..b6081d34f37 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -544,3 +544,17 @@ SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
valid_date
Thursday 01 January 2009
"End of 5.0 tests"
+#
+# Start of 5.1 tests
+#
+#
+# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
+#
+SET NAMES utf8;
+SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
+LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)))
+%
+SET NAMES latin1;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 77aa0d49407..d9082914d05 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -418,6 +418,18 @@ COMMIT;
UNLOCK TABLES;
# Connection con1
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
+# Connection default
+# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
+# This test has triggered some asserts in metadata locking
+# subsystem at some point in time..
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (7);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 0;
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (8);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 1;
# Connection con2
# Connection con1
# Connection default
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 3d247a242a3..e6a1b492b39 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -134,3 +134,15 @@ INSERT INTO t1 VALUES ('abc\0\0');
INSERT INTO t1 VALUES ('abc\0\0');
ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY'
DROP TABLE t1;
+#
+# Bug#57882: Item_func_conv_charset::val_str(String*):
+# Assertion `fixed == 1' failed
+#
+SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
+ERROR 22003: DOUBLE value is out of range in 'cot('v')'
+SET NAMES utf8 COLLATE utf8_latvian_ci ;
+SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
+ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))'
+#
+# End Bug#57882
+#
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result
index 530d8559f11..66ec00d7357 100644
--- a/mysql-test/r/events_2.result
+++ b/mysql-test/r/events_2.result
@@ -133,15 +133,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write;
show create event e1;
@@ -151,15 +151,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event read;
show create event e1;
@@ -169,15 +169,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write, mysql.event read;
show create event e1;
@@ -187,15 +187,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
@@ -209,11 +209,17 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e3;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
+drop event e1;
Make sure we have left no events
select event_name from information_schema.events;
event_name
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index b8dbb54e5fb..b9ae362f6cd 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -271,4 +271,50 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c2,c2_2 c2 10 const,const 3 Using where
DROP TABLE t1;
+#
+# Bug#56814 Explain + subselect + fulltext crashes server
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
+FULLTEXT KEY(f1),UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests.
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index ced8306c3ab..b1e2e48eca8 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -423,3 +423,31 @@ i
4
unlock tables;
drop tables tm, t1, t2;
+#
+# Test for bug #57006 "Deadlock between HANDLER and
+# FLUSH TABLES WITH READ LOCK".
+#
+drop table if exists t1, t2;
+create table t1 (i int);
+create table t2 (i int);
+handler t1 open;
+# Switching to connection 'con1'.
+# Sending:
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL starts waiting for 't1' to be closed.
+# Switching to connection 'default'.
+# The below statement should not cause deadlock.
+# Sending:
+insert into t2 values (1);
+# Switching to connection 'con2'.
+# Wait until INSERT starts to wait for FTWRL to go away.
+# Switching to connection 'con1'.
+# FTWRL should be able to continue now.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+# Reap INSERT.
+handler t1 close;
+# Cleanup.
+drop tables t1, t2;
diff --git a/mysql-test/r/flush_read_lock.result b/mysql-test/r/flush_read_lock.result
new file mode 100644
index 00000000000..2b1071a92b2
--- /dev/null
+++ b/mysql-test/r/flush_read_lock.result
@@ -0,0 +1,1683 @@
+# FTWRL takes two global metadata locks -- a global shared
+# metadata lock and the commit blocker lock.
+# The first lock prevents DDL from taking place.
+# Let's say that all DDL statements that take metadata
+# locks form class #1 -- incompatible with FTWRL because
+# take incompatible MDL table locks.
+# The first global lock doesn't, however, prevent standalone
+# COMMITs (or implicit COMMITs) from taking place, since a
+# COMMIT doesn't take table locks. It doesn't prevent
+# DDL on temporary tables either, since they don't
+# take any table locks either.
+# Most DDL statements do not perform an implicit commit
+# if operate on a temporary table. Examples are CREATE
+# TEMPORARY TABLE and DROP TEMPORARY TABLE.
+# Thus, these DDL statements can go through in presence
+# of FTWRL. This is class #2 -- compatible because
+# do not take incompatible MDL locks and do not issue
+# implicit commit..
+# (Although these operations do not commit, their effects
+# cannot be rolled back either.)
+# ALTER TABLE, ANALYZE, OPTIMIZE and some others always
+# issue an implicit commit, even if its argument is a
+# temporary table.
+# *Howewer* an implicit commit is a no-op if all engines
+# used since the start of transactiona are non-
+# transactional. Thus, for non-transactional engines,
+# these operations are not blocked by FTWRL.
+# This is class #3 -- compatible because do not take
+# MDL table locks and are non-transactional.
+# On the contrary, for transactional engines, there
+# is always a commit, regardless of whether a table
+# is temporary or not. Thus, for example, ALTER TABLE
+# for a transactional engine will wait for FTWRL,
+# even if the subject table is temporary.
+# Thus ALTER TABLE <temporary> is incompatible
+# with FTWRL. This is class #4 -- incompatible
+# becuase issue implicit COMMIT which is not a no-op.
+# Finally, there are administrative statements (such as
+# RESET SLAVE) that do not take any locks and do not
+# issue COMMIT.
+# This is class #5.
+# The goal of this coverage is to test statements
+# of all classes.
+# @todo: documents the effects of @@autocommit,
+# DML and temporary transactional tables.
+# Use MyISAM engine for the most of the tables
+# used in this test in order to be able to
+# check that DDL statements on temporary tables
+# are compatible with FTRWL.
+drop tables if exists t1_base, t2_base, t3_trans;
+drop tables if exists tm_base, tm_base_temp;
+drop database if exists mysqltest1;
+# We're going to test ALTER DATABASE UPGRADE
+drop database if exists `#mysql50#mysqltest-2`;
+drop procedure if exists p1;
+drop function if exists f1;
+drop view if exists v1;
+drop procedure if exists p2;
+drop function if exists f2_base;
+drop function if exists f2_temp;
+drop event if exists e1;
+drop event if exists e2;
+create table t1_base(i int) engine=myisam;
+create table t2_base(j int) engine=myisam;
+create table t3_trans(i int) engine=innodb;
+create temporary table t1_temp(i int) engine=myisam;
+create temporary table t2_temp(j int) engine=myisam;
+create temporary table t3_temp_trans(i int) engine=innodb;
+create database mysqltest1;
+create database `#mysql50#mysqltest-2`;
+create procedure p1() begin end;
+create function f1() returns int return 0;
+create view v1 as select 1 as i;
+create procedure p2(i int) begin end;
+create function f2_base() returns int
+begin
+insert into t1_base values (1);
+return 0;
+end|
+create function f2_temp() returns int
+begin
+insert into t1_temp values (1);
+return 0;
+end|
+create event e1 on schedule every 1 minute do begin end;
+#
+# Test compatibility of FLUSH TABLES WITH READ LOCK
+# with various statements.
+#
+# These tests don't cover some classes of statements:
+# - Replication-related - CHANGE MASTER TO, START/STOP SLAVE and etc
+# (all compatible with FTWRL).
+# - Plugin-related - INSTALL/UNINSTALL (incompatible with FTWRL,
+# require plugin support).
+#
+# 1) ALTER variants.
+#
+# 1.1) ALTER TABLE
+#
+# 1.1.a) For base table should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter table t1_base add column c1 int' under FTWRL.
+Success: 'alter table t1_base add column c1 int' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table t1_base add column c1 int' is active in another connection.
+#
+# 1.1.b) For a temporary table should be compatible with FTWRL.
+#
+Success: Was able to run 'alter table t1_temp add column c1 int' under FTWRL.
+Success: Was able to run 'alter table t1_temp add column c1 int' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'alter table t1_temp add column c1 int' was active in another connection.
+#
+# 1.2) ALTER DATABASE should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter database mysqltest1 default character set utf8' under FTWRL.
+Success: 'alter database mysqltest1 default character set utf8' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter database mysqltest1 default character set utf8' is active in another connection.
+#
+# 1.3) ALTER DATABASE UPGRADE DATA DIRECTORY NAME should be
+# incompatible with FTWRL.
+#
+Success: Was not able to run 'alter database `#mysql50#mysqltest-2` upgrade data directory name' under FTWRL.
+Success: 'alter database `#mysql50#mysqltest-2` upgrade data directory name' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter database `#mysql50#mysqltest-2` upgrade data directory name' is active in another connection.
+#
+# 1.4) ALTER PROCEDURE should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter procedure p1 comment 'a'' under FTWRL.
+Success: 'alter procedure p1 comment 'a'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter procedure p1 comment 'a'' is active in another connection.
+#
+# 1.5) ALTER FUNCTION should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter function f1 comment 'a'' under FTWRL.
+Success: 'alter function f1 comment 'a'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter function f1 comment 'a'' is active in another connection.
+#
+# 1.6) ALTER VIEW should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter view v1 as select 2 as j' under FTWRL.
+Success: 'alter view v1 as select 2 as j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter view v1 as select 2 as j' is active in another connection.
+#
+# 1.7) ALTER EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter event e1 comment 'test'' under FTWRL.
+Success: 'alter event e1 comment 'test'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter event e1 comment 'test'' is active in another connection.
+#
+# 1.x) The rest of ALTER statements (ALTER TABLESPACE,
+# ALTER LOGFILE GROUP and ALTER SERVER) are too
+# special to be tested here.
+#
+#
+# 2) ANALYZE TABLE statement is compatible with FTWRL.
+# See Bug#43336 ANALYZE and OPTIMIZE do not honour
+# --read-only for a discussion why.
+#
+Success: Was able to run 'analyze table t1_base' under FTWRL.
+Success: Was able to run 'analyze table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'analyze table t1_base' was active in another connection.
+#
+# 3) BEGIN, ROLLBACK and COMMIT statements.
+# BEGIN and ROLLBACK are compatible with FTWRL.
+# COMMIT is not.
+#
+# We need a special test for these statements as
+# FTWRL commits a transaction and because COMMIT
+# is handled in a special way.
+flush tables with read lock;
+begin;
+# ROLLBACK is allowed under FTWRL although there
+# no much sense in it. FTWRL commits any previous
+# changes and doesn't allows any DML after it.
+# So such a ROLLBACK is always a no-op.
+rollback;
+# Although COMMIT is incompatible with FTWRL in
+# other senses it is still allowed under FTWRL.
+# This fact relied upon by some versions of
+# innobackup tool.
+# Similarly to ROLLBACK it is a no-op in this situation.
+commit;
+unlock tables;
+# Check that BEGIN/ROLLBACK are not blocked and
+# COMMIT is blocked by active FTWRL in another
+# connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+begin;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some work so ROLLBACK is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+rollback;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+begin;
+# Do some work so COMMIT is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Send:
+commit;
+# Switching to connection 'con1'.
+# Wait until COMMIT is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap COMMIT.
+delete from t3_trans;
+#
+# Check that COMMIT blocks FTWRL in another connection.
+begin;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+commit;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap COMMIT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+# We don't run similar test for BEGIN and ROLLBACK as
+# they release metadata locks in non-standard place.
+#
+# 4) BINLOG statement should be incompatible with FTWRL.
+#
+#
+# Provide format description BINLOG statement first.
+BINLOG '
+MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
+';
+# Now test compatibility for BINLOG statement which is
+# equivalent to INSERT INTO t1_base VALUES (1).
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was not able to run 'BINLOG '
+MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
+MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
+'' under FTWRL.
+Success: 'BINLOG '
+MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
+MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
+'' is blocked by FTWRL active in another connection.
+#
+# 5) CALL statement. This statement uses resources in two
+# ways: through expressions used as parameters and through
+# sub-statements. This test covers only usage through
+# parameters as sub-statements do locking individually.
+#
+# 5.a) In simple cases a parameter expression should be
+# compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'call p2((select count(*) from t1_base))' under FTWRL.
+Success: Was able to run 'call p2((select count(*) from t1_base))' with FTWRL active in another connection.
+#
+# 5.b) In case when an expression uses function which updates
+# base tables CALL should be incompatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was not able to run 'call p2(f2_base())' under FTWRL.
+Success: 'call p2(f2_base())' is blocked by FTWRL active in another connection.
+#
+# 5.c) If function used as argument updates temporary tables
+# CALL statement should be compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'call p2(f2_temp())' under FTWRL.
+Success: Was able to run 'call p2(f2_temp())' with FTWRL active in another connection.
+#
+# 6) CHECK TABLE statement is compatible with FTWRL.
+#
+Success: Was able to run 'check table t1_base' under FTWRL.
+Success: Was able to run 'check table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'check table t1_base' was active in another connection.
+#
+# 7) CHECKSUM TABLE statement is compatible with FTWRL.
+#
+Success: Was able to run 'checksum table t1_base' under FTWRL.
+Success: Was able to run 'checksum table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'checksum table t1_base' was active in another connection.
+#
+# 8) CREATE variants.
+#
+# 8.1) CREATE TABLE statement.
+#
+# 8.1.a) CREATE TABLE is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base(i int)' under FTWRL.
+Success: 'create table t3_base(i int)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base(i int)' is active in another connection.
+# 8.1.b) CREATE TABLE is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp(i int)' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp(i int)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp(i int)' was active in another connection.
+# 8.1.c) CREATE TABLE LIKE is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base like t1_temp' under FTWRL.
+Success: 'create table t3_base like t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base like t1_temp' is active in another connection.
+# 8.1.d) CREATE TABLE LIKE is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp like t1_base' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp like t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp like t1_base' was active in another connection.
+# 8.1.e) CREATE TABLE SELECT is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base select 1 as i' under FTWRL.
+Success: 'create table t3_base select 1 as i' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base select 1 as i' is active in another connection.
+# 8.1.f) CREATE TABLE SELECT is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp select 1 as i' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp select 1 as i' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp select 1 as i' was active in another connection.
+# 8.2) CREATE INDEX statement.
+#
+# 8.2.a) CREATE INDEX is incompatible with FTWRL when
+# applied to base table.
+Success: Was not able to run 'create index i on t1_base (i)' under FTWRL.
+Success: 'create index i on t1_base (i)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create index i on t1_base (i)' is active in another connection.
+# 8.2.b) CREATE INDEX is compatible with FTWRL when
+# applied to temporary table.
+Success: Was able to run 'create index i on t1_temp (i)' under FTWRL.
+Success: Was able to run 'create index i on t1_temp (i)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create index i on t1_temp (i)' was active in another connection.
+#
+# 8.3) CREATE DATABASE is incompatible with FTWRL.
+#
+Success: Was not able to run 'create database mysqltest2' under FTWRL.
+Success: 'create database mysqltest2' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create database mysqltest2' is active in another connection.
+#
+# 8.4) CREATE VIEW is incompatible with FTWRL.
+#
+Success: Was not able to run 'create view v2 as select 1 as j' under FTWRL.
+Success: 'create view v2 as select 1 as j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create view v2 as select 1 as j' is active in another connection.
+#
+# 8.5) CREATE TRIGGER is incompatible with FTWRL.
+#
+Success: Was not able to run 'create trigger t1_bi before insert on t1_base for each row begin end' under FTWRL.
+Success: 'create trigger t1_bi before insert on t1_base for each row begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create trigger t1_bi before insert on t1_base for each row begin end' is active in another connection.
+#
+# 8.6) CREATE FUNCTION is incompatible with FTWRL.
+#
+Success: Was not able to run 'create function f2() returns int return 0' under FTWRL.
+Success: 'create function f2() returns int return 0' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create function f2() returns int return 0' is active in another connection.
+#
+# 8.7) CREATE PROCEDURE is incompatible with FTWRL.
+#
+Success: Was not able to run 'create procedure p3() begin end' under FTWRL.
+Success: 'create procedure p3() begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create procedure p3() begin end' is active in another connection.
+#
+# 8.8) CREATE EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'create event e2 on schedule every 1 minute do begin end' under FTWRL.
+Success: 'create event e2 on schedule every 1 minute do begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create event e2 on schedule every 1 minute do begin end' is active in another connection.
+#
+# 8.9) CREATE USER should be incompatible with FTWRL.
+#
+Success: Was not able to run 'create user mysqltest_u1' under FTWRL.
+Success: 'create user mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create user mysqltest_u1' is active in another connection.
+#
+# 8.x) The rest of CREATE variants (CREATE LOGFILE GROUP,
+# CREATE TABLESPACE and CREATE SERVER) are too special
+# to test here.
+#
+#
+# 9) PREPARE, EXECUTE and DEALLOCATE PREPARE statements.
+#
+# 9.1) PREPARE statement is compatible with FTWRL as it
+# doesn't change any data.
+#
+# 9.1.a) Prepare of simple INSERT statement.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'insert into t1_base values (1)'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'insert into t1_base values (1)'' with FTWRL active in another connection.
+#
+# 9.1.b) Prepare of multi-UPDATE. At some point such statements
+# tried to acquire thr_lock.c locks during prepare phase.
+# This no longer happens and thus it is compatible with
+# FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j'' with FTWRL active in another connection.
+#
+# 9.1.c) Prepare of multi-DELETE. Again PREPARE of such
+# statement should be compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j'' with FTWRL active in another connection.
+#
+# 9.2) Compatibility of EXECUTE statement depends on statement
+# to be executed.
+#
+# 9.2.a) EXECUTE for statement which is itself compatible with
+# FTWRL should be compatible.
+prepare stmt1 from 'select * from t1_base';
+Success: Was able to run 'execute stmt1' under FTWRL.
+Success: Was able to run 'execute stmt1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'execute stmt1' was active in another connection.
+deallocate prepare stmt1;
+#
+# 9.2.b) EXECUTE for statement which is incompatible with FTWRL
+# should be also incompatible.
+#
+# Check that EXECUTE is not allowed under FTWRL.
+prepare stmt1 from 'insert into t1_base values (1)';
+flush tables with read lock;
+execute stmt1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+# Check that active FTWRL in another connection
+# blocks EXECUTE which changes data.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+execute stmt1 ;
+# Switching to connection 'con1'.
+# Check that EXECUTE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap EXECUTE.
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+execute stmt1; ;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap EXECUTE.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+set debug_sync= "RESET";
+delete from t1_base;
+deallocate prepare stmt1;
+#
+# 9.3) DEALLOCATE PREPARE is compatible with FTWRL.
+#
+prepare stmt1 from 'insert into t1_base values (1)';
+Success: Was able to run 'deallocate prepare stmt1' under FTWRL.
+Success: Was able to run 'deallocate prepare stmt1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'deallocate prepare stmt1' was active in another connection.
+deallocate prepare stmt1;
+#
+# 10) DELETE variations.
+#
+# 10.1) Simple DELETE.
+#
+# 10.1.a) Simple DELETE on base table is incompatible with FTWRL.
+Success: Was not able to run 'delete from t1_base' under FTWRL.
+Success: 'delete from t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'delete from t1_base' is active in another connection.
+#
+# 10.1.b) Simple DELETE on temporary table is compatible with FTWRL.
+Success: Was able to run 'delete from t1_temp' under FTWRL.
+Success: Was able to run 'delete from t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t1_temp' was active in another connection.
+#
+# 10.2) Multi DELETE.
+#
+# 10.2.a) Multi DELETE on base tables is incompatible with FTWRL.
+Success: Was not able to run 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' under FTWRL.
+Success: 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' is active in another connection.
+#
+# 10.2.b) Multi DELETE on temporary tables is compatible with FTWRL.
+Success: Was able to run 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' was active in another connection.
+#
+# 11) DESCRIBE should be compatible with FTWRL.
+#
+Success: Was able to run 'describe t1_base' under FTWRL.
+Success: Was able to run 'describe t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'describe t1_base' was active in another connection.
+#
+# 12) Compatibility of DO statement with FTWRL depends on its
+# expression.
+#
+# 12.a) DO with expression which does not change base table
+# should be compatible with FTWRL.
+Success: Was able to run 'do (select count(*) from t1_base)' under FTWRL.
+Success: Was able to run 'do (select count(*) from t1_base)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'do (select count(*) from t1_base)' was active in another connection.
+#
+# 12.b) DO which calls SF updating base table should be
+# incompatible with FTWRL.
+Success: Was not able to run 'do f2_base()' under FTWRL.
+Success: 'do f2_base()' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'do f2_base()' is active in another connection.
+#
+# 12.c) DO which calls SF updating temporary table should be
+# compatible with FTWRL.
+Success: Was able to run 'do f2_temp()' under FTWRL.
+Success: Was able to run 'do f2_temp()' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'do f2_temp()' was active in another connection.
+#
+# 13) DROP variants.
+#
+# 13.1) DROP TABLES.
+#
+# 13.1.a) DROP TABLES which affects base tables is incompatible
+# with FTWRL.
+Success: Was not able to run 'drop table t2_base' under FTWRL.
+Success: 'drop table t2_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop table t2_base' is active in another connection.
+# 13.1.b) DROP TABLES which affects only temporary tables
+# in theory can be compatible with FTWRL.
+# In practice it is not yet.
+Success: Was not able to run 'drop table t2_temp' under FTWRL.
+Success: 'drop table t2_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop table t2_temp' is active in another connection.
+#
+# 13.1.c) DROP TEMPORARY TABLES should be compatible with FTWRL.
+Success: Was able to run 'drop temporary table t2_temp' under FTWRL.
+Success: Was able to run 'drop temporary table t2_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary table t2_temp' was active in another connection.
+#
+# 13.2) DROP INDEX.
+#
+# 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
+create index i on t1_base (i);
+Success: Was not able to run 'drop index i on t1_base' under FTWRL.
+Success: 'drop index i on t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop index i on t1_base' is active in another connection.
+drop index i on t1_base;
+#
+# 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
+create index i on t1_temp (i);
+Success: Was able to run 'drop index i on t1_temp' under FTWRL.
+Success: Was able to run 'drop index i on t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop index i on t1_temp' was active in another connection.
+drop index i on t1_temp;
+#
+# 13.3) DROP DATABASE is incompatible with FTWRL
+#
+Success: Was not able to run 'drop database mysqltest1' under FTWRL.
+Success: 'drop database mysqltest1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop database mysqltest1' is active in another connection.
+#
+# 13.4) DROP FUNCTION is incompatible with FTWRL.
+#
+Success: Was not able to run 'drop function f1' under FTWRL.
+Success: 'drop function f1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop function f1' is active in another connection.
+#
+# 13.5) DROP PROCEDURE is incompatible with FTWRL.
+#
+Success: Was not able to run 'drop procedure p1' under FTWRL.
+Success: 'drop procedure p1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop procedure p1' is active in another connection.
+#
+# 13.6) DROP USER should be incompatible with FTWRL.
+#
+create user mysqltest_u1;
+Success: Was not able to run 'drop user mysqltest_u1' under FTWRL.
+Success: 'drop user mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop user mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 13.7) DROP VIEW should be incompatible with FTWRL.
+#
+Success: Was not able to run 'drop view v1' under FTWRL.
+Success: 'drop view v1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop view v1' is active in another connection.
+#
+# 13.8) DROP EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'drop event e1' under FTWRL.
+Success: 'drop event e1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop event e1' is active in another connection.
+#
+# 13.9) DROP TRIGGER is incompatible with FTWRL.
+#
+create trigger t1_bi before insert on t1_base for each row begin end;
+Success: Was not able to run 'drop trigger t1_bi' under FTWRL.
+Success: 'drop trigger t1_bi' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop trigger t1_bi' is active in another connection.
+drop trigger t1_bi;
+#
+# 13.x) The rest of DROP variants (DROP TABLESPACE, DROP LOGFILE
+# GROUP and DROP SERVER) are too special to test here.
+#
+#
+# 14) FLUSH variants.
+#
+# Test compatibility of _some_ important FLUSH variants with FTWRL.
+#
+# 14.1) FLUSH TABLES WITH READ LOCK is compatible with itself.
+#
+# Check that FTWRL statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# The second FTWRL in a row is allowed at the moment.
+# It does not make much sense as it does only flush.
+flush tables with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+flush tables with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
+# active FTWRL. But since the latter keeps tables open
+# FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
+flush tables with read lock;
+# FT <list> WRL is allowed under FTWRL at the moment.
+# It does not make much sense though.
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+flush tables t1_base, t2_base with read lock;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+# Switching to connection 'default'.
+unlock tables;
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 14.3) FLUSH TABLES is compatible with FTWRL.
+Success: Was able to run 'flush tables' under FTWRL.
+Success: Was able to run 'flush tables' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush tables' was active in another connection.
+#
+# 14.4) FLUSH TABLES <list> is compatible with FTWRL.
+Success: Was able to run 'flush table t1_base, t2_base' under FTWRL.
+Success: Was able to run 'flush table t1_base, t2_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush table t1_base, t2_base' was active in another connection.
+#
+# 14.5) FLUSH PRIVILEGES is compatible with FTWRL.
+Success: Was able to run 'flush privileges' under FTWRL.
+Success: Was able to run 'flush privileges' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush privileges' was active in another connection.
+#
+# 15) GRANT statement should be incompatible with FTWRL.
+#
+Success: Was not able to run 'grant all privileges on t1_base to mysqltest_u1' under FTWRL.
+Success: 'grant all privileges on t1_base to mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'grant all privileges on t1_base to mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 16) All HANDLER variants are half-compatible with FTWRL.
+# I.e. they are not blocked by active FTWRL. But since open
+# HANDLER means open table instance FTWRL is blocked while
+# HANDLER is not closed.
+#
+# Check that HANDLER statements succeed under FTWRL.
+flush tables with read lock;
+handler t1_base open;
+handler t1_base read first;
+i
+handler t1_base close;
+unlock tables;
+# Check that HANDLER statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+handler t1_base open;
+handler t1_base read first;
+i
+handler t1_base close;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 17) HELP statement is compatible with FTWRL.
+#
+Success: Was able to run 'help no_such_topic' under FTWRL.
+Success: Was able to run 'help no_such_topic' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'help no_such_topic' was active in another connection.
+#
+# 18) INSERT statement.
+#
+# 18.a) Ordinary INSERT into base table is incompatible with FTWRL.
+Success: Was not able to run 'insert into t1_base values (1)' under FTWRL.
+Success: 'insert into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into t1_base values (1)' is active in another connection.
+#
+# 18.b) Ordinary INSERT into temp table is compatible with FTWRL.
+Success: Was able to run 'insert into t1_temp values (1)' under FTWRL.
+Success: Was able to run 'insert into t1_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t1_temp values (1)' was active in another connection.
+#
+# 18.c) INSERT DELAYED is incompatible with FTWRL.
+Success: Was not able to run 'insert delayed into t1_base values (1)' under FTWRL.
+Success: 'insert delayed into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert delayed into t1_base values (1)' is active in another connection.
+delete from t1_base;
+#
+# 18.d) INSERT SELECT into base table is incompatible with FTWRL.
+Success: Was not able to run 'insert into t1_base select * from t1_temp' under FTWRL.
+Success: 'insert into t1_base select * from t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into t1_base select * from t1_temp' is active in another connection.
+#
+# 18.e) INSERT SELECT into temp table is compatible with FTWRL.
+Success: Was able to run 'insert into t1_temp select * from t1_base' under FTWRL.
+Success: Was able to run 'insert into t1_temp select * from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t1_temp select * from t1_base' was active in another connection.
+#
+# 19) KILL statement is compatible with FTWRL.
+#
+# Check that KILL can be run under FTWRL.
+flush tables with read lock;
+set @id:= connection_id();
+kill query @id;
+ERROR 70100: Query execution was interrupted
+unlock tables;
+# Check that KILL statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+kill query @id;
+ERROR 70100: Query execution was interrupted
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Finally check that KILL doesn't block FTWRL
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+kill query @id;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap KILL.
+ERROR 70100: Query execution was interrupted
+set debug_sync='RESET';
+#
+# 20) LOAD DATA statement.
+#
+# 20.a) LOAD DATA into base table is incompatible with FTWRL.
+Success: Was not able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' under FTWRL.
+Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' is active in another connection.
+#
+# 20.b) LOAD DATA into temporary table is compatible with FTWRL.
+Success: Was able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' under FTWRL.
+Success: Was able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' was active in another connection.
+#
+# 21) LOCK/UNLOCK TABLES statements.
+#
+# LOCK TABLES statement always (almost) blocks FTWRL as it
+# keeps tables open until UNLOCK TABLES.
+# Active FTWRL on the other hand blocks only those
+# LOCK TABLES which allow updating of base tables.
+#
+# 21.a) LOCK TABLES READ is allowed under FTWRL and
+# is not blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_base read;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_base read;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 21.b) LOCK TABLES WRITE on a base table is disallowed
+# under FTWRL and should be blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_base write;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_base write ;
+# Switching to connection 'con1'.
+# Check that LOCK TABLES WRITE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap LOCK TABLES WRITE
+unlock tables;
+#
+# 21.c) LOCK TABLES WRITE on temporary table doesn't
+# make much sense but is allowed under FTWRL
+# and should not be blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_temp write;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_temp write;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 22) OPTIMIZE TABLE statement.
+#
+# 22.a) OPTIMIZE TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+# OPTIMIZE statement returns errors as part of result-set.
+optimize table t1_base;
+Table Op Msg_type Msg_text
+test.t1_base optimize Error Can't execute the query because you have a conflicting read lock
+test.t1_base optimize error Corrupt
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+optimize table t1_base;
+# Switching to connection 'con1'.
+# Check that OPTIMIZE TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap OPTIMIZE TABLE
+Table Op Msg_type Msg_text
+test.t1_base optimize status OK
+# We don't check that active OPTIMIZE TABLE blocks
+# FTWRL as this one of statements releasing metadata
+# locks in non-standard place.
+#
+# 22.b) OPTIMIZE TABLE of temporary table is compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'optimize table t1_temp' under FTWRL.
+Success: Was able to run 'optimize table t1_temp' with FTWRL active in another connection.
+#
+# 23) CACHE statement is compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'cache index t1_base in default' under FTWRL.
+Success: Was able to run 'cache index t1_base in default' with FTWRL active in another connection.
+#
+# 24) LOAD INDEX statement is compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'load index into cache t1_base' under FTWRL.
+Success: Was able to run 'load index into cache t1_base' with FTWRL active in another connection.
+#
+# 25) SAVEPOINT/RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT are
+# compatible with FTWRL.
+#
+# Since manipulations on savepoint have to be done
+# inside transaction and FTWRL commits transaction we
+# need a special test for these statements.
+flush tables with read lock;
+begin;
+savepoint sv1;
+rollback to savepoint sv1;
+release savepoint sv1;
+unlock tables;
+commit;
+# Check that these statements are not blocked by
+# active FTWRL in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+begin;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some changes to avoid SAVEPOINT and friends
+# being almost no-ops.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+savepoint sv1;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+insert into t3_trans values (2);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+rollback to savepoint sv1;
+release savepoint sv1;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+rollback;
+# Check that these statements don't block FTWRL in
+# another connection.
+begin;
+# Do some changes to avoid SAVEPOINT and friends
+# being almost no-ops.
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap SAVEPOINT
+insert into t3_trans values (2);
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+rollback to savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap ROLLBACK TO SAVEPOINT
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+release savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap RELEASE SAVEPOINT
+rollback;
+set debug_sync= "RESET";
+#
+# 26) RENAME variants.
+#
+# 26.1) RENAME TABLES is incompatible with FTWRL.
+Success: Was not able to run 'rename table t1_base to t3_base' under FTWRL.
+Success: 'rename table t1_base to t3_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'rename table t1_base to t3_base' is active in another connection.
+#
+# 26.2) RENAME USER is incompatible with FTWRL.
+create user mysqltest_u1;
+Success: Was not able to run 'rename user mysqltest_u1 to mysqltest_u2' under FTWRL.
+Success: 'rename user mysqltest_u1 to mysqltest_u2' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'rename user mysqltest_u1 to mysqltest_u2' is active in another connection.
+drop user mysqltest_u1;
+#
+# 27) REPAIR TABLE statement.
+#
+# 27.a) REPAIR TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+# REPAIR statement returns errors as part of result-set.
+repair table t1_base;
+Table Op Msg_type Msg_text
+test.t1_base repair Error Can't execute the query because you have a conflicting read lock
+test.t1_base repair error Corrupt
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+repair table t1_base;
+# Switching to connection 'con1'.
+# Check that REPAIR TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap REPAIR TABLE
+Table Op Msg_type Msg_text
+test.t1_base repair status OK
+# We don't check that active REPAIR TABLE blocks
+# FTWRL as this one of statements releasing metadata
+# locks in non-standard place.
+#
+# 27.b) REPAIR TABLE of temporary table is compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'repair table t1_temp' under FTWRL.
+Success: Was able to run 'repair table t1_temp' with FTWRL active in another connection.
+#
+# 28) REPLACE statement.
+#
+# 28.a) Ordinary REPLACE into base table is incompatible with FTWRL.
+Success: Was not able to run 'replace into t1_base values (1)' under FTWRL.
+Success: 'replace into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'replace into t1_base values (1)' is active in another connection.
+#
+# 28.b) Ordinary REPLACE into temp table is compatible with FTWRL.
+Success: Was able to run 'replace into t1_temp values (1)' under FTWRL.
+Success: Was able to run 'replace into t1_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'replace into t1_temp values (1)' was active in another connection.
+#
+# 28.c) REPLACE SELECT into base table is incompatible with FTWRL.
+Success: Was not able to run 'replace into t1_base select * from t1_temp' under FTWRL.
+Success: 'replace into t1_base select * from t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'replace into t1_base select * from t1_temp' is active in another connection.
+#
+# 28.d) REPLACE SELECT into temp table is compatible with FTWRL.
+Success: Was able to run 'replace into t1_temp select * from t1_base' under FTWRL.
+Success: Was able to run 'replace into t1_temp select * from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'replace into t1_temp select * from t1_base' was active in another connection.
+#
+# 29) REVOKE variants.
+#
+# 29.1) REVOKE privileges is incompatible with FTWRL.
+grant all privileges on t1_base to mysqltest_u1;
+Success: Was not able to run 'revoke all privileges on t1_base from mysqltest_u1' under FTWRL.
+Success: 'revoke all privileges on t1_base from mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'revoke all privileges on t1_base from mysqltest_u1' is active in another connection.
+#
+# 29.2) REVOKE ALL PRIVILEGES, GRANT OPTION is incompatible with FTWRL.
+Success: Was not able to run 'revoke all privileges, grant option from mysqltest_u1' under FTWRL.
+Success: 'revoke all privileges, grant option from mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'revoke all privileges, grant option from mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 30) Compatibility of SELECT statement with FTWRL depends on
+# locking mode used and on functions being invoked by it.
+#
+# 30.a) Simple SELECT which does not change tables should be
+# compatible with FTWRL.
+Success: Was able to run 'select count(*) from t1_base' under FTWRL.
+Success: Was able to run 'select count(*) from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select count(*) from t1_base' was active in another connection.
+# 30.b) SELECT ... FOR UPDATE is incompatible with FTWRL.
+Success: Was not able to run 'select count(*) from t1_base for update' under FTWRL.
+Success: 'select count(*) from t1_base for update' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'select count(*) from t1_base for update' is active in another connection.
+# 30.c) SELECT ... LOCK IN SHARE MODE is compatible with FTWRL.
+Success: Was able to run 'select count(*) from t1_base lock in share mode' under FTWRL.
+Success: Was able to run 'select count(*) from t1_base lock in share mode' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select count(*) from t1_base lock in share mode' was active in another connection.
+#
+# 30.d) SELECT which calls SF updating base table should be
+# incompatible with FTWRL.
+Success: Was not able to run 'select f2_base()' under FTWRL.
+Success: 'select f2_base()' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'select f2_base()' is active in another connection.
+#
+# 30.e) SELECT which calls SF updating temporary table should be
+# compatible with FTWRL.
+Success: Was able to run 'select f2_temp()' under FTWRL.
+Success: Was able to run 'select f2_temp()' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select f2_temp()' was active in another connection.
+#
+# 31) Compatibility of SET statement with FTWRL depends on its
+# expression and on whether it is a special SET statement.
+#
+# 31.a) Ordinary SET with expression which does not
+# changes base table should be compatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set @a:= (select count(*) from t1_base)' under FTWRL.
+Success: Was able to run 'set @a:= (select count(*) from t1_base)' with FTWRL active in another connection.
+#
+# 31.b) Ordinary SET which calls SF updating base table should
+# be incompatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was not able to run 'set @a:= f2_base()' under FTWRL.
+Success: 'set @a:= f2_base()' is blocked by FTWRL active in another connection.
+#
+# 31.c) Ordinary SET which calls SF updating temporary table
+# should be compatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set @a:= f2_temp()' under FTWRL.
+Success: Was able to run 'set @a:= f2_temp()' with FTWRL active in another connection.
+#
+# 31.d) Special SET variants have different compatibility with FTWRL.
+#
+# 31.d.I) SET PASSWORD is incompatible with FTWRL as it changes data.
+create user mysqltest_u1;
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was not able to run 'set password for 'mysqltest_u1' = password('')' under FTWRL.
+Success: 'set password for 'mysqltest_u1' = password('')' is blocked by FTWRL active in another connection.
+drop user mysqltest_u1;
+#
+# 31.d.II) SET READ_ONLY is compatible with FTWRL (but has no
+# effect when executed under it).
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set global read_only= 1' under FTWRL.
+Success: Was able to run 'set global read_only= 1' with FTWRL active in another connection.
+#
+# 31.d.III) Situation with SET AUTOCOMMIT is complex.
+# Turning auto-commit off is always compatible with FTWRL.
+# Turning auto-commit on causes implicit commit and so
+# is incompatible with FTWRL if there are changes to be
+# committed.
+flush tables with read lock;
+set autocommit= 0;
+# Turning auto-commit on causes implicit commit so can
+# be incompatible with FTWRL if there is something to
+# commit. But since even in this case we allow commits
+# under active FTWRL such statement should always succeed.
+insert into t3_temp_trans values (1);
+set autocommit= 1;
+unlock tables;
+delete from t3_temp_trans;
+# Check that SET AUTOCOMMIT=0 is not blocked and
+# SET AUTOCOMMIT=1 is blocked by active FTWRL in
+# another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+set autocommit= 0;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some work so implicit commit in SET AUTOCOMMIT=1
+# is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Send:
+set autocommit= 1;
+# Switching to connection 'con1'.
+# Wait until SET AUTOCOMMIT=1 is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap SET AUTOCOMMIT=1.
+delete from t3_trans;
+#
+# Check that SET AUTOCOMMIT=1 blocks FTWRL in another connection.
+set autocommit= 0;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+set autocommit= 1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap SET AUTOCOMMIT=1.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+#
+# 32) SHOW statements are compatible with FTWRL.
+# Let us test _some_ of them.
+#
+# 32.1) SHOW TABLES.
+Success: Was able to run 'show tables from test' under FTWRL.
+Success: Was able to run 'show tables from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show tables from test' was active in another connection.
+#
+# 32.1) SHOW TABLES.
+Success: Was able to run 'show tables from test' under FTWRL.
+Success: Was able to run 'show tables from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show tables from test' was active in another connection.
+#
+# 32.2) SHOW EVENTS.
+Success: Was able to run 'show events from test' under FTWRL.
+Success: Was able to run 'show events from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show events from test' was active in another connection.
+#
+# 32.3) SHOW GRANTS.
+create user mysqltest_u1;
+Success: Was able to run 'show grants for mysqltest_u1' under FTWRL.
+Success: Was able to run 'show grants for mysqltest_u1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show grants for mysqltest_u1' was active in another connection.
+drop user mysqltest_u1;
+#
+# 32.4) SHOW CREATE TABLE.
+Success: Was able to run 'show create table t1_base' under FTWRL.
+Success: Was able to run 'show create table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show create table t1_base' was active in another connection.
+#
+# 32.5) SHOW CREATE FUNCTION.
+Success: Was able to run 'show create function f1' under FTWRL.
+Success: Was able to run 'show create function f1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show create function f1' was active in another connection.
+#
+# 33) SIGNAL statement is compatible with FTWRL.
+#
+# Note that we don't cover RESIGNAL as it requires
+# active handler context.
+Success: Was able to run 'signal sqlstate '01000'' under FTWRL.
+Success: Was able to run 'signal sqlstate '01000'' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'signal sqlstate '01000'' was active in another connection.
+#
+# 34) TRUNCATE TABLE statement.
+#
+# 34.a) TRUNCATE of base table is incompatible with FTWRL.
+Success: Was not able to run 'truncate table t1_base' under FTWRL.
+Success: 'truncate table t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'truncate table t1_base' is active in another connection.
+#
+# 34.b) TRUNCATE of temporary table is compatible with FTWRL.
+Success: Was able to run 'truncate table t1_temp' under FTWRL.
+Success: Was able to run 'truncate table t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'truncate table t1_temp' was active in another connection.
+#
+# 35) UPDATE variants.
+#
+# 35.1) Simple UPDATE.
+#
+# 35.1.a) Simple UPDATE on base table is incompatible with FTWRL.
+Success: Was not able to run 'update t1_base set i= 1 where i = 0' under FTWRL.
+Success: 'update t1_base set i= 1 where i = 0' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'update t1_base set i= 1 where i = 0' is active in another connection.
+#
+# 35.1.b) Simple UPDATE on temporary table is compatible with FTWRL.
+Success: Was able to run 'update t1_temp set i= 1 where i = 0' under FTWRL.
+Success: Was able to run 'update t1_temp set i= 1 where i = 0' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t1_temp set i= 1 where i = 0' was active in another connection.
+#
+# 35.2) Multi UPDATE.
+#
+# 35.2.a) Multi UPDATE on base tables is incompatible with FTWRL.
+Success: Was not able to run 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' under FTWRL.
+Success: 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' is active in another connection.
+#
+# 35.2.b) Multi UPDATE on temporary tables is compatible with FTWRL.
+Success: Was able to run 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' was active in another connection.
+#
+# 36) USE statement is compatible with FTWRL.
+#
+Success: Was able to run 'use mysqltest1' under FTWRL.
+Success: Was able to run 'use mysqltest1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'use mysqltest1' was active in another connection.
+#
+# 37) XA statements.
+#
+# XA statements are similar to BEGIN/COMMIT/ROLLBACK.
+#
+# XA BEGIN, END, PREPARE, ROLLBACK and RECOVER are compatible
+# with FTWRL. XA COMMIT is not.
+flush tables with read lock;
+# Although all below statements are allowed under FTWRL they
+# are almost no-ops as FTWRL does commit and does not allows
+# any non-temporary DML under it.
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa commit 'test1';
+xa recover;
+unlock tables;
+# Check that XA non-COMMIT statements are not and COMMIT is
+# blocked by active FTWRL in another connection
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa start 'test1';
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+xa start 'test1';
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa end 'test1';
+xa prepare 'test1';
+# Send:
+xa commit 'test1';;
+# Switching to connection 'con1'.
+# Wait until XA COMMIT is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap XA COMMIT.
+delete from t3_trans;
+#
+# Check that XA COMMIT blocks FTWRL in another connection.
+xa start 'test1';
+insert into t3_trans values (1);
+xa end 'test1';
+xa prepare 'test1';
+set debug_sync='RESET';
+set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+xa commit 'test1';
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap XA COMMIT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+#
+# 38) Test effect of auto-commit mode for DML on transactional
+# temporary tables.
+#
+# 38.1) When auto-commit is on each such a statement ends with commit
+# of changes to temporary tables. But since transactions doing
+# such changes are considered read only [sic!/QQ] this commit
+# is compatible with FTWRL.
+#
+# Let us demostrate this fact for some common DML statements.
+Success: Was able to run 'delete from t3_temp_trans' under FTWRL.
+Success: Was able to run 'delete from t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t3_temp_trans' was active in another connection.
+Success: Was able to run 'insert into t3_temp_trans values (1)' under FTWRL.
+Success: Was able to run 'insert into t3_temp_trans values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t3_temp_trans values (1)' was active in another connection.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' was active in another connection.
+#
+# 38.2) When auto-commit is off DML on transaction temporary tables
+# is compatible with FTWRL.
+#
+set autocommit= 0;
+Success: Was able to run 'delete from t3_temp_trans' under FTWRL.
+Success: Was able to run 'delete from t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t3_temp_trans' was active in another connection.
+Success: Was able to run 'insert into t3_temp_trans values (1)' under FTWRL.
+Success: Was able to run 'insert into t3_temp_trans values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t3_temp_trans values (1)' was active in another connection.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' was active in another connection.
+set autocommit= 1;
+#
+# 39) Test effect of DDL on transactional tables.
+#
+# 39.1) Due to implicit commit at the end of statement some of DDL
+# statements which are compatible with FTWRL in non-transactional
+# case are not compatible in case of transactional tables.
+#
+# 39.1.a) ANALYZE TABLE for transactional table is incompatible with
+# FTWRL.
+flush tables with read lock;
+# Implicit commits are allowed under FTWRL.
+analyze table t3_trans;
+Table Op Msg_type Msg_text
+test.t3_trans analyze status OK
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+analyze table t3_trans;
+# Switching to connection 'con1'.
+# Check that ANALYZE TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ANALYZE TABLE
+Table Op Msg_type Msg_text
+test.t3_trans analyze status OK
+#
+# 39.1.b) CHECK TABLE for transactional table is compatible with FTWRL.
+# Although it does implicit commit at the end of statement it
+# is considered to be read-only operation.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'check table t3_trans' under FTWRL.
+Success: Was able to run 'check table t3_trans' with FTWRL active in another connection.
+#
+# 39.2) Situation with DDL on temporary transactional tables is
+# complex.
+#
+# 39.2.a) Some statements compatible with FTWRL since they don't
+# do implicit commit.
+#
+# For example, CREATE TEMPORARY TABLE:
+Success: Was able to run 'create temporary table t4_temp_trans(i int) engine=innodb' under FTWRL.
+Success: Was able to run 'create temporary table t4_temp_trans(i int) engine=innodb' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t4_temp_trans(i int) engine=innodb' was active in another connection.
+#
+# Or DROP TEMPORARY TABLE:
+Success: Was able to run 'drop temporary tables t3_temp_trans' under FTWRL.
+Success: Was able to run 'drop temporary tables t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary tables t3_temp_trans' was active in another connection.
+#
+# 39.2.b) Some statements do implicit commit but are considered
+# read-only and so are compatible with FTWRL.
+#
+# For example, REPAIR TABLE:
+Success: Was able to run 'repair table t3_temp_trans' under FTWRL.
+Success: Was able to run 'repair table t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'repair table t3_temp_trans' was active in another connection.
+#
+# And ANALYZE TABLE:
+Success: Was able to run 'analyze table t3_temp_trans' under FTWRL.
+Success: Was able to run 'analyze table t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'analyze table t3_temp_trans' was active in another connection.
+#
+# 39.2.c) Some statements do implicit commit and not
+# considered read-only. As result they are
+# not compatible with FTWRL.
+#
+flush tables with read lock;
+# Implicit commits are allowed under FTWRL.
+alter table t3_temp_trans add column c1 int;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+alter table t3_temp_trans drop column c1;
+# Switching to connection 'con1'.
+# Check that ALTER TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ALTER TABLE
+#
+# 40) Test effect of implicit commit for DDL which is otherwise
+# compatible with FTWRL. Implicit commit at the start of DDL
+# statement can make it incompatible with FTWRL if there are
+# some changes to be commited even in case when DDL statement
+# itself is compatible with FTWRL.
+#
+# For example CHECK TABLE for base non-transactional tables and
+# ALTER TABLE for temporary non-transactional tables are affected.
+begin;
+insert into t3_trans values (1);
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+check table t1_base;
+# Switching to connection 'con1'.
+# Check that CHECK TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap CHECK TABLE
+Table Op Msg_type Msg_text
+test.t1_base check status OK
+begin;
+delete from t3_trans;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+alter table t1_temp add column c1 int;
+# Switching to connection 'con1'.
+# Check that ALTER TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ALTER TABLE
+alter table t1_temp drop column c1;
+#
+# Check that FLUSH TABLES WITH READ LOCK is blocked by individual
+# statements and is not blocked in the presence of transaction which
+# has done some changes earlier but is idle now (or does only reads).
+# This allows to use this statement even on systems which has long
+# running transactions.
+#
+begin;
+insert into t1_base values (1);
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+# The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Transaction still is able to read even with FTWRL active in another
+# connection.
+select * from t1_base;
+i
+1
+select * from t2_base;
+j
+select * from t3_trans;
+i
+1
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+commit;
+delete from t1_base;
+delete from t3_trans;
+#
+# Check that impending FTWRL blocks new DML statements and
+# so can't be starved by a constant flow of DML.
+# (a.k.a. test for bug #54673 "It takes too long to get
+# readlock for 'FLUSH TABLES WITH READ LOCK'").
+#
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+insert into t1_base values (1);
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+# Try to run another INSERT and see that it is blocked.
+insert into t2_base values (1);;
+# Switching to connection 'con3'.
+# Wait until new INSERT is blocked.
+# Unblock INSERT in the first connection.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap first INSERT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'con2'.
+# Reap second INSERT.
+# Switching to connection 'default'.
+set debug_sync= "RESET";
+delete from t1_base;
+delete from t2_base;
+
+# Check that COMMIT thas is issued after
+# FLUSH TABLES WITH READ LOCK is not blocked by
+# FLUSH TABLES WITH READ LOCK from another connection.
+# This scenario is used in innobackup.pl. The COMMIT goes
+# through because the transaction started by FTWRL does
+# not modify any tables, and the commit blocker lock is
+# only taken when there were such modifications.
+
+flush tables with read lock;
+# Switching to connection 'con1'.
+# The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+# Switching to connection 'default'.
+select * from t1_base;
+i
+select * from t3_trans;
+i
+commit;
+# Switching to connection 'con1'.
+select * from t1_base;
+i
+select * from t3_trans;
+i
+commit;
+unlock tables;
+# Switching to connection 'default'.
+unlock tables;
+#
+# Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
+# As usual there are tricky cases related to this type of tables.
+#
+#
+# 1) Most typical case - base MERGE table with base underlying tables.
+#
+# 1.a) DML statements which change data should be incompatible with FTWRL.
+create table tm_base (i int) engine=merge union=(t1_base) insert_method=last;
+Success: Was not able to run 'insert into tm_base values (1)' under FTWRL.
+Success: 'insert into tm_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into tm_base values (1)' is active in another connection.
+#
+# 1.b) DDL statement on such table should be incompatible with FTWRL as well.
+Success: Was not able to run 'alter table tm_base insert_method=first' under FTWRL.
+Success: 'alter table tm_base insert_method=first' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table tm_base insert_method=first' is active in another connection.
+drop table tm_base;
+#
+# 2) Temporary MERGE table with base underlying tables.
+#
+# 2.a) DML statements which change data should be incompatible with FTWRL
+# as they affect base tables.
+create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
+Success: Was not able to run 'insert into tm_temp_base values (1)' under FTWRL.
+Success: 'insert into tm_temp_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into tm_temp_base values (1)' is active in another connection.
+#
+# 2.b) Some of DDL statements on such table can be compatible with FTWRL
+# as they don't affect base tables.
+Success: Was able to run 'drop temporary tables tm_temp_base' under FTWRL.
+Success: Was able to run 'drop temporary tables tm_temp_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary tables tm_temp_base' was active in another connection.
+#
+# 2.c) ALTER statement is incompatible with FTWRL. Even though it does
+# not change data in base table it still acquires strong metadata
+# locks on them.
+Success: Was not able to run 'alter table tm_temp_base insert_method=first' under FTWRL.
+Success: 'alter table tm_temp_base insert_method=first' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table tm_temp_base insert_method=first' is active in another connection.
+drop table tm_temp_base;
+#
+# 3) Temporary MERGE table with temporary underlying tables.
+#
+# 3.a) DML statements should be compatible with FTWRL as
+# no base table is going to be affected.
+create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+Success: Was able to run 'insert into tm_temp_temp values (1)' under FTWRL.
+Success: Was able to run 'insert into tm_temp_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into tm_temp_temp values (1)' was active in another connection.
+#
+# 3.b) DDL statements should be compatible with FTWRL as well
+# as no base table is going to be affected too.
+Success: Was able to run 'alter table tm_temp_temp union=(t1_temp) insert_method=first' under FTWRL.
+Success: Was able to run 'alter table tm_temp_temp union=(t1_temp) insert_method=first' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'alter table tm_temp_temp union=(t1_temp) insert_method=first' was active in another connection.
+drop table tm_temp_temp;
+#
+# 4) For the sake of completeness let us check that base MERGE tables
+# with temporary underlying tables are not functional.
+create table tm_base_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+select * from tm_base_temp;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+drop table tm_base_temp;
+#
+# Clean-up.
+#
+drop event e1;
+drop function f2_temp;
+drop function f2_base;
+drop procedure p2;
+drop view v1;
+drop function f1;
+drop procedure p1;
+drop database `#mysql50#mysqltest-2`;
+drop database mysqltest1;
+drop temporary tables t1_temp, t2_temp;
+drop tables t1_base, t2_base, t3_trans;
diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result
index b16a8b114b3..8453d26cbea 100644
--- a/mysql-test/r/flush_read_lock_kill.result
+++ b/mysql-test/r/flush_read_lock_kill.result
@@ -1,12 +1,38 @@
-SET @old_concurrent_insert= @@global.concurrent_insert;
-SET @@global.concurrent_insert= 0;
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (kill_id INT);
+SET DEBUG_SYNC= 'RESET';
+CREATE TABLE t1 (kill_id INT) engine = InnoDB;
INSERT INTO t1 VALUES(connection_id());
+# Switching to connection 'default'.
+# Start transaction.
+BEGIN;
+INSERT INTO t1 VALUES(connection_id());
+# Ensure that COMMIT will pause once it acquires protection
+# against its global read lock.
+SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
+# Sending:
+COMMIT;
+# Switching to 'con1'.
+# Wait till COMMIT acquires protection against global read
+# lock and pauses.
+SET DEBUG_SYNC='now WAIT_FOR acquired';
+# Sending:
FLUSH TABLES WITH READ LOCK;
-SELECT ((@id := kill_id) - kill_id) FROM t1;
+# Switching to 'con2'.
+SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
((@id := kill_id) - kill_id)
0
+# Wait till FLUSH TABLES WITH READ LOCK blocks due
+# to active COMMIT
+# Kill connection 'con1'.
KILL CONNECTION @id;
+# Switching to 'con1'.
+# Try to reap FLUSH TABLES WITH READ LOCK,
+# it fail due to killed statement and connection.
+Got one of the listed errors
+# Switching to 'con2'.
+# Resume COMMIT.
+SET DEBUG_SYNC='now SIGNAL go';
+# Switching to 'default'.
+# Reaping COMMIT.
DROP TABLE t1;
-SET @@global.concurrent_insert= @old_concurrent_insert;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index a75f502c735..7788a32ac90 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -652,4 +652,40 @@ Table Op Msg_type Msg_text
test.t1 repair status OK
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
+#
+# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+SELECT 1 FROM t1 WHERE 1 >
+ALL((SELECT 1 FROM t1 JOIN t1 a
+ON (MATCH(t1.f1) against (""))
+WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+1
+1
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 302de9de9f7..69be0107b8f 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1038,6 +1038,14 @@ GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1,2,2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+#
+# Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
+#
+CREATE TABLE t1(f1 int);
+INSERT INTO t1 values (0),(0);
+SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
+ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing
+DROP TABLE t1;
End of 5.1 tests
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(6), b INT);
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index bfb3af0afff..ac9a22a0b82 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -481,6 +481,18 @@ RAND(i)
0.15522042769493574
DROP TABLE t1;
#
+# Bug#57477 SIGFPE when dividing a huge number a negative number
+#
+SELECT -9999999999999999991 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9999999999999999991) DIV -(1))'
+SELECT -9223372036854775808 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
+SELECT -9223372036854775808 MOD -1;
+-9223372036854775808 MOD -1
+0
+SELECT -9223372036854775808999 MOD -1;
+-9223372036854775808999 MOD -1
+0
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)'
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
@@ -607,3 +619,12 @@ SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
as foo;
foo
2
+#
+# Bug #58137 char(0) column cause:
+# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
+#
+CREATE TABLE t1(a char(0));
+INSERT INTO t1 (SELECT -pi());
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 85448a258e4..068ab343c89 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -375,4 +375,25 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
3
1
DROP TABLE t1;
-End of 5.1 tests
+SELECT INET_NTOA(0);
+INET_NTOA(0)
+0.0.0.0
+SELECT '1' IN ('1', INET_NTOA(0));
+'1' IN ('1', INET_NTOA(0))
+1
+#
+# End of 5.1 tests
+#
+#
+# Bug #58199: name_const in the having clause crashes
+#
+CREATE TABLE t1 (a INT);
+SELECT 1 from t1 HAVING NAME_CONST('', a);
+ERROR HY000: Incorrect arguments to NAME_CONST
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
+#
+# End of tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index f1b2196ebfa..34987530b5a 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
1
1
DROP TABLE t1;
+#
+# Bug #52160: crash and inconsistent results when grouping
+# by a function and column
+#
+CREATE TABLE t1(a CHAR(10) NOT NULL);
+INSERT INTO t1 VALUES (''),('');
+SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect time value: ''
+Warning 1292 Truncated incorrect time value: ''
+Warning 1292 Truncated incorrect time value: ''
+DROP TABLE t1;
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.
@@ -1327,3 +1341,12 @@ SELECT * FROM t1 WHERE date_date <= addtime(date_add("2000-1-1", INTERVAL "1:1:1
date_date
DROP TABLE t1;
#
+# Bug#57512 str_to_date crash...
+#
+SELECT WEEK(STR_TO_DATE(NULL,0));
+WEEK(STR_TO_DATE(NULL,0))
+NULL
+SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
+SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR)
+NULL
+#
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 84cac386b57..60053b29125 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1448,8 +1448,6 @@ CREATE USER 'userbug33464'@'localhost';
GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
userbug33464@localhost dbbug33464
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
@@ -1577,6 +1575,17 @@ DROP USER 'testbug'@localhost;
DROP TABLE db2.t1;
DROP DATABASE db1;
DROP DATABASE db2;
+#
+# Bug #36742
+#
+grant usage on Foo.* to myuser@Localhost identified by 'foo';
+grant select on Foo.* to myuser@localhost;
+select host,user from mysql.user where User='myuser';
+host user
+localhost myuser
+revoke select on Foo.* from myuser@localhost;
+delete from mysql.user where User='myuser';
+flush privileges;
#########################################################################
#
# Bug#38347: ALTER ROUTINE privilege allows SHOW CREATE TABLE.
diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result
index 59c64ee84ae..fd51a83d4b2 100644
--- a/mysql-test/r/grant3.result
+++ b/mysql-test/r/grant3.result
@@ -21,123 +21,108 @@ grant select on test.* to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
-CUser LOCALHOST test Y
CUser localhost test Y
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
-CUser localhost test Y
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
create table t1 (a int);
grant select on test.t1 to CUser@localhost;
grant select on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser LOCALHOST test t1 Select
CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
grant select(a) on test.t1 to CUser@localhost;
grant select(a) on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser LOCALHOST test t1 Select
CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
drop table t1;
grant select on test.* to CUser2@localhost;
grant select on test.* to CUser2@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
-CUser2 LOCALHOST test Y
CUser2 localhost test Y
REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
-CUser2 localhost test Y
REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
+ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost'
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
DROP USER CUser2@localhost;
DROP USER CUser2@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser2'@'localhost'
CREATE DATABASE mysqltest_1;
CREATE TABLE mysqltest_1.t1 (a INT);
CREATE USER 'mysqltest1'@'%';
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 2621f69da06..188485d366f 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1846,6 +1846,16 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300
DROP TABLE t1;
+#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1(f1 INT NOT NULL);
+INSERT INTO t1 VALUES (16777214),(0);
+SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
+ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
+COUNT(*)
+2
+DROP TABLE t1;
# End of 5.1 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/r/handler_innodb.result
index 66914285733..dd4cac669c8 100644
--- a/mysql-test/r/handler_innodb.result
+++ b/mysql-test/r/handler_innodb.result
@@ -1485,10 +1485,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
-handler t1 read next;
-a b
-1 1
-handler t1 close;
handler t1 open;
select a from t2;
a
diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result
index d5d43ca0717..69d791b8263 100644
--- a/mysql-test/r/handler_myisam.result
+++ b/mysql-test/r/handler_myisam.result
@@ -1481,10 +1481,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
-handler t1 read next;
-a b
-1 1
-handler t1 close;
handler t1 open;
select a from t2;
a
diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result
index 248b8d606dc..92408c439a5 100644
--- a/mysql-test/r/information_schema-big.result
+++ b/mysql-test/r/information_schema-big.result
@@ -30,6 +30,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -42,6 +43,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
@@ -74,6 +76,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -86,6 +89,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index aa47b8c437e..1418af5b813 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -88,7 +88,7 @@ host
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -1807,3 +1807,47 @@ USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+#
+# A test case for Bug#56540 "Exception (crash) in sql_show.cc
+# during rqg_info_schema test on Windows"
+# Ensure that we never access memory of a closed table,
+# in particular, never access table->field[] array.
+# Before the fix, the below test case, produced
+# valgrind errors.
+#
+drop table if exists t1;
+drop view if exists v1;
+create table t1 (a int, b int);
+create view v1 as select t1.a, t1.b from t1;
+alter table t1 change b c int;
+lock table t1 read;
+# --> connection con1
+flush tables;
+# --> connection default
+select * from information_schema.views;
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME v1
+VIEW_DEFINITION select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
+CHECK_OPTION NONE
+IS_UPDATABLE
+DEFINER root@localhost
+SECURITY_TYPE DEFINER
+CHARACTER_SET_CLIENT latin1
+COLLATION_CONNECTION latin1_swedish_ci
+Warnings:
+Level Warning
+Code 1356
+Message View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+unlock tables;
+#
+# Cleanup.
+#
+# --> connection con1
+# Reaping 'flush tables'
+# --> connection default
+drop table t1;
+drop view v1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ipv4_as_ipv6.result b/mysql-test/r/ipv4_as_ipv6.result
index 8523dc82f02..82bca393d71 100644
--- a/mysql-test/r/ipv4_as_ipv6.result
+++ b/mysql-test/r/ipv4_as_ipv6.result
@@ -32,9 +32,9 @@ mysqld is alive
CREATE USER testuser@'0:0:0:0:0:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0:0:0:0:0:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0:0:0:0:0:FFFF:127.0.0.1';
-Grants for testuser@0:0:0:0:0:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1'
+Grants for testuser@0:0:0:0:0:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:ffff:127.0.0.1'
SET @nip= inet_aton('0:0:0:0:0:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -61,9 +61,9 @@ mysqld is alive
CREATE USER testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
-Grants for testuser@0000:0000:0000:0000:0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'
+Grants for testuser@0000:0000:0000:0000:0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:ffff:127.0.0.1'
SET @nip= inet_aton('0000:0000:0000:0000:0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -90,9 +90,9 @@ mysqld is alive
CREATE USER testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1';
-Grants for testuser@0:0000:0000:0:0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1'
+Grants for testuser@0:0000:0000:0:0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0:0000:0000:0:0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0000:0000:0:0000:ffff:127.0.0.1'
SET @nip= inet_aton('0:0000:0000:0:0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -119,9 +119,9 @@ mysqld is alive
CREATE USER testuser@'0::0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0::0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0::0000:FFFF:127.0.0.1';
-Grants for testuser@0::0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0::0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0::0000:FFFF:127.0.0.1'
+Grants for testuser@0::0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0::0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0::0000:ffff:127.0.0.1'
SET @nip= inet_aton('0::0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -149,9 +149,9 @@ mysqld is alive
CREATE USER testuser@'::FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'::FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'::FFFF:127.0.0.1';
-Grants for testuser@::FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'::FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::FFFF:127.0.0.1'
+Grants for testuser@::ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'::ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::ffff:127.0.0.1'
SET @nip= inet_aton('::FFFF:127.0.0.1');
SELECT @nip;
@nip
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 0af32d8f749..99ca9f05535 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1402,4 +1402,34 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
DROP TABLE t1;
+#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
+INSERT INTO t1 VALUES (4);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (7, 7);
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+f1 f1 f2
+4 NULL NULL
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+f1 f1 f2
+DROP TABLE t1,t2;
End of 5.1 tests
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 5f338ad6a62..58cb7430563 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -45,3 +45,227 @@ p1
max=1
drop procedure p1;
drop table t1;
+CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO slow(slow, general) VALUES (1,2), (5,6);
+INSERT INTO slow(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM slow ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM slow ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE slow;
+CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO general(slow, general) VALUES (1,2), (5,6);
+INSERT INTO general(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM general ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM general ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE general;
+CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6);
+INSERT INTO master_heartbeat_period(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM master_heartbeat_period ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE master_heartbeat_period;
+CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6);
+INSERT INTO ignore_server_ids(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM ignore_server_ids ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE ignore_server_ids;
+CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT);
+INSERT INTO t1 VALUES (1,2,3,4);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE slow INT;
+DECLARE general INT;
+DECLARE ignore_server_ids INT;
+DECLARE master_heartbeat_period INT;
+SELECT max(t1.slow) INTO slow FROM t1;
+SELECT max(t1.general) INTO general FROM t1;
+SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1;
+SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1;
+SELECT slow, general, ignore_server_ids, master_heartbeat_period;
+END|
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE n INT DEFAULT 2;
+general: WHILE n > 0 DO
+SET n = n -1;
+END WHILE general;
+SET n = 2;
+slow: WHILE n > 0 DO
+SET n = n -1;
+END WHILE slow;
+SET n = 2;
+ignore_server_ids: WHILE n > 0 DO
+SET n = n -1;
+END WHILE ignore_server_ids;
+SET n = 2;
+master_heartbeat_period: WHILE n > 0 DO
+SET n = n -1;
+END WHILE master_heartbeat_period;
+END|
+CALL p1();
+slow general ignore_server_ids master_heartbeat_period
+1 2 3 4
+call p2();
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP TABLE t1;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 1f4f4bb32eb..964f2947f6a 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -1,143 +1,178 @@
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
-drop table if exists t1, t2, t3;
-create table t1 (kill_id int);
-insert into t1 values(connection_id());
-select ((@id := kill_id) - kill_id) from t1;
-((@id := kill_id) - kill_id)
-0
-kill @id;
-select ((@id := kill_id) - kill_id) from t1;
-((@id := kill_id) - kill_id)
-0
-select @id != connection_id();
-@id != connection_id()
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP FUNCTION IF EXISTS MY_KILL;
+CREATE FUNCTION MY_KILL(tid INT) RETURNS INT
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+KILL tid;
+RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
+END|
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
+SET DEBUG_SYNC='now WAIT_FOR con1_read';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
+SELECT 1;
+Got one of the listed errors
+SELECT 1;
+1
1
-select 4;
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SELECT 4;
4
4
-drop table t1;
-kill (select count(*) from mysql.user);
+KILL (SELECT COUNT(*) FROM mysql.user);
ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
-create table t1 (id int primary key);
-create table t2 (id int unsigned not null);
-insert into t2 select id from t1;
-create table t3 (kill_id int);
-insert into t3 values(connection_id());
-select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
-select ((@id := kill_id) - kill_id) from t3;
-((@id := kill_id) - kill_id)
-0
-kill @id;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
+SELECT 1;
Got one of the listed errors
-drop table t1, t2, t3;
-select get_lock("a", 10);
-get_lock("a", 10)
-1
-select get_lock("a", 10);
-get_lock("a", 10)
-NULL
-select 1;
-1
-1
-select RELEASE_LOCK("a");
-RELEASE_LOCK("a")
-1
-create table t1(f1 int);
-create function bug27563() returns int(11)
-deterministic
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-set @a= get_lock("lock27563", 10);
-return 1;
-end|
-select get_lock("lock27563",10);
-get_lock("lock27563",10)
-1
-insert into t1 values (bug27563());
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT 1;
+1
+1
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SELECT 4;
+4
+4
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
+INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
+INSERT INTO t2 SELECT id FROM t1;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
+SELECT id FROM t1 WHERE id IN
+(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
+GROUP BY ACOS(1/a.id), b.id, c.id, d.id
+HAVING a.id BETWEEN 10 AND 20);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL @id;
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+Got one of the listed errors
+SELECT 1;
+1
+1
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
+SELECT ACOS(0);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ACOS(0)
+1.5707963267948966
+SELECT 1;
+1
+1
+SELECT @id = CONNECTION_ID();
+@id = CONNECTION_ID()
+1
+SET DEBUG_SYNC = 'RESET';
+CREATE TABLE t1 (f1 INT);
+CREATE FUNCTION bug27563() RETURNS INT(11)
+DETERMINISTIC
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+RETURN 1;
+END|
+INSERT INTO t1 VALUES (bug27563());
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
f1
-insert into t1 values(0);
-update t1 set f1= bug27563();
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 VALUES(0);
+UPDATE t1 SET f1= bug27563();
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT * FROM t1;
f1
0
-insert into t1 values(1);
-delete from t1 where bug27563() is null;
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 VALUES(1);
+DELETE FROM t1 WHERE bug27563() IS NULL;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT * FROM t1;
f1
0
1
-select * from t1 where f1= bug27563();
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-create procedure proc27563()
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-select get_lock("lock27563",10);
-select "shouldn't be selected";
-end|
-call proc27563();
-get_lock("lock27563",10)
-NULL
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-create table t2 (f2 int);
-create trigger trg27563 before insert on t1 for each row
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-set @a:= get_lock("lock27563",10);
-insert into t2 values(1);
-end|
-insert into t1 values(2),(3);
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SET DEBUG_SYNC = 'RESET';
+SELECT * FROM t1 WHERE f1= bug27563();
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
f1
0
1
-select * from t2;
-f2
-select release_lock("lock27563");
-release_lock("lock27563")
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION bug27563;
+CREATE TABLE t2 (f2 INT);
+CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 VALUES(0);
+SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+INSERT INTO t2 VALUES(1);
+END|
+INSERT INTO t1 VALUES(2),(3);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
+f1
+0
1
-drop table t1, t2;
-drop function bug27563;
-drop procedure proc27563;
+SELECT * FROM t2;
+f2
+0
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 ';
EXECUTE stmt;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC = 'RESET';
#
# Bug#19723: kill of active connection yields different error code
# depending on platform.
#
-# Connection: con2.
-KILL CONNECTION_ID();
-# CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing
-# of close of the connection socket
+# Connection: con1.
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+KILL @id;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
+# depending on the timing of close of the connection socket
SELECT 1;
Got one of the listed errors
+SELECT 1;
+1
+1
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SET DEBUG_SYNC = 'RESET';
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
# Check that DDL and DML statements waiting for metadata locks can
@@ -208,13 +243,11 @@ ERROR 70100: Query execution was interrupted
# Test for DML waiting for meta-data lock
# Switching to connection 'blocker'
unlock tables;
-drop table t2;
-create table t2 (k int);
lock tables t1 read;
# Switching to connection 'ddl'
-rename tables t1 to t3, t2 to t1;
+truncate table t1;
# Switching to connection 'dml'
-insert into t2 values (1);
+insert into t1 values (1);
# Switching to connection 'default'
kill query ID2;
# Switching to connection 'dml'
@@ -239,6 +272,7 @@ unlock tables;
# Switching to connection 'ddl'
# Cleanup.
# Switching to connection 'default'
-drop table t3;
drop table t1;
-set @@global.concurrent_insert= @old_concurrent_insert;
+drop table t2;
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION MY_KILL;
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
index 3682f0df26a..8fe94679e70 100644
--- a/mysql-test/r/lock_sync.result
+++ b/mysql-test/r/lock_sync.result
@@ -704,3 +704,72 @@ SET DEBUG_SYNC="now SIGNAL query";
# Connection default
DROP EVENT e2;
SET DEBUG_SYNC="RESET";
+#
+# Bug#55930 Assertion `thd->transaction.stmt.is_empty() ||
+# thd->in_sub_stmt || (thd->state..
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) engine=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+# Connection con1
+SET SESSION lock_wait_timeout= 1;
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
+SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
+# Sending:
+INSERT INTO t1 VALUES (3);
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
+SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
+# Connection con1
+# Reaping: 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 Lock wait timeout exceeded; try restarting transaction
+test.t1 optimize status Operation failed
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
+# Connection con2
+# Reaping: INSERT INTO t1 VALUES (3)
+# Connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1(a INT);
+CREATE FUNCTION f1() RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1;
+DROP FUNCTION f1;
+# Connection con1
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
+# Sending:
+SHOW CREATE VIEW v1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+# Sending:
+FLUSH TABLES;
+# Connection default
+# Waiting for FLUSH TABLES to be blocked.
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+# Connection con1
+# Reaping: SHOW CREATE VIEW v1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+# Connection con2
+# Reaping: FLUSH TABLES
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 1666d5e0297..f64894c9f10 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -896,6 +896,16 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
+use mysql;
+drop table if exists renamed_general_log;
+drop table if exists renamed_slow_log;
+RENAME TABLE general_log TO renamed_general_log;
+ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
+RENAME TABLE slow_log TO renamed_slow_log;
+ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log'
+use test;
+flush tables with read lock;
+unlock tables;
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result
index 13b08c2e771..7d15005e143 100644
--- a/mysql-test/r/log_tables_upgrade.result
+++ b/mysql-test/r/log_tables_upgrade.result
@@ -27,7 +27,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.renamed_general_log OK
mysql.servers OK
mysql.slow_log OK
diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result
new file mode 100755
index 00000000000..e3f861f8884
--- /dev/null
+++ b/mysql-test/r/lowercase_table4.result
@@ -0,0 +1,7 @@
+#
+# Bug#46941 crash with lower_case_table_names=2 and
+# foreign data dictionary confusion
+#
+CREATE DATABASE XY;
+USE XY;
+DROP DATABASE XY;
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index d2a32c25201..594cf433692 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2471,7 +2471,7 @@ CREATE PROCEDURE p1() SELECT 1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let CREATE PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
# Connection 2
@@ -2486,10 +2486,17 @@ DROP PROCEDURE p1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
+# Once FLUSH TABLES WITH READ LOCK starts waiting
+# DROP PROCEDURE will be waked up and will drop
+# procedure. Global read lock will be granted after
+# this statement ends.
+#
+# Reaping DROP PROCEDURE.
# Connection 2
+# Reaping FTWRL.
UNLOCK TABLES;
# Connection 1
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index f705db3e509..e36b4781ddf 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -15,7 +15,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
@@ -44,7 +44,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
@@ -73,7 +73,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
@@ -104,7 +104,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
@@ -139,7 +139,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
@@ -177,7 +177,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
index 694eb1e7d88..4cc8b6ab44b 100644
--- a/mysql-test/r/mysql_upgrade_ssl.result
+++ b/mysql-test/r/mysql_upgrade_ssl.result
@@ -17,7 +17,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 51fad679909..ce83fe5b79b 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -879,3 +879,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
End of 5.0 tests
End of 5.1 tests
+# Expect deprecation warning.
+WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
+# Expect deprecation warning again.
+WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 241c92f0aa6..ef46eba5ccb 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -18,7 +18,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support analyze
@@ -46,7 +46,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support optimize
@@ -72,7 +72,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
-mysql.proxy_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support analyze
@@ -98,7 +98,7 @@ mysql.ndb_binlog_index Table is already up to date
mysql.plugin Table is already up to date
mysql.proc Table is already up to date
mysql.procs_priv Table is already up to date
-mysql.proxy_priv Table is already up to date
+mysql.proxies_priv Table is already up to date
mysql.servers Table is already up to date
mysql.slow_log
note : The storage engine for the table doesn't support optimize
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 63e17e1c188..fc269e1dd82 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
+ --autocommit Set default value for autocommit (0 or 1)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index c5996981e92..c5d7bb458c3 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
+ --autocommit Set default value for autocommit (0 or 1)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index cff845a2819..e24a6f07171 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -308,6 +308,10 @@ var3 two columns with same name
var4 from query that returns NULL
var5 from query that returns no row
failing query in let
+create table t1 (a varchar(100));
+insert into t1 values ('`select 42`');
+`select 42`
+drop table t1;
mysqltest: At line 1: Error running query 'failing query': 1064 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 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
@@ -399,10 +403,40 @@ true-inner
true-inner again
true-outer
Counter is greater than 0, (counter=10)
+Counter should still be 10, is 10
Counter is not 0, (counter=0)
+Not space var works
Counter is true, (counter=alpha)
-Beta is true
while with string, only once
+5<7
+5<7 again
+5<7 still
+5<6
+5>=5
+5>=5 again
+5>3
+5==5
+5!=8
+5!=five
+5==3+2
+5 == 5
+hello == hello
+hello == hello
+hello != goodbye
+two words
+two words are two words
+right answer
+anything goes
+0 != string
+mysqltest: At line 2: Only == and != are supported for string values
+mysqltest: At line 2: Found junk '~= 6' after $variable in condition
+mysqltest: At line 2: Expression in if/while must beging with $, ` or a number
+counter is 2
+counter is 3
+counter is 4
+counter is 5
+counter is 6
+counter is 7
1
Testing while with not
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
@@ -799,7 +833,7 @@ drop table t1;
mysqltest: At line 1: change user failed: Unknown database 'inexistent'
mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
-file1.txt
+REPLACED_FILE1.txt
file1.txt
file2.txt
file11.txt
@@ -807,8 +841,6 @@ dir-list.txt
SELECT 'c:\\a.txt' AS col;
col
z
-hej
-mysqltest: At line 1: Found junk ' != 143' after $variable in expression
select 1;
1
1
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index fac38624695..ce229bf3e2e 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -14,3 +14,32 @@ flush privileges;
ERROR HY000: Table 'host' was not locked with LOCK TABLES
unlock tables;
drop table t1;
+#
+# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
+#
+CREATE USER nopriv_user@localhost;
+connection: default
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP FUNCTION IF EXISTS f;
+CREATE TABLE t1 (key1 INT PRIMARY KEY);
+CREATE TABLE t2 (key2 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
+FLUSH PRIVILEGES;
+connection: con1
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+connection: default
+DROP TABLE t1,t2;
+DROP FUNCTION f;
+DROP USER nopriv_user@localhost;
+#
+# End Bug#54812
+#
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 80676c0d324..a639f9e6b3b 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,5 +1,38 @@
drop table if exists t1, t2;
#
+# Bug#57778: failed primary key add to partitioned innodb table
+# inconsistent and crashes
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (0,1), (0,2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a b
+0 1
+0 2
+UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SELECT * FROM t1;
+a b
+1 1
+0 1
+ALTER TABLE t1 DROP PRIMARY KEY;
+SELECT * FROM t1;
+a b
+1 1
+0 1
+DROP TABLE t1;
+#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result
index 0e3241cf88e..6b8c8e48acc 100644
--- a/mysql-test/r/partition_debug_sync.result
+++ b/mysql-test/r/partition_debug_sync.result
@@ -25,7 +25,7 @@ ALTER TABLE t1 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
# Con 1
SET SESSION debug= "-d,sleep_before_create_table_no_lock";
@@ -51,12 +51,12 @@ SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
-SET SESSION debug= "+d,sleep_before_part2_delete_table";
+SET SESSION debug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
-SET SESSION debug= "-d,sleep_before_part2_delete_table";
+SET SESSION debug= "-d,sleep_before_no_locks_delete_table";
# Con 1
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 148504bcc8b..6515d2a4e0c 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,5 +1,31 @@
drop table if exists t1, t2;
#
+# Bug#56287: crash when using Partition datetime in sub in query
+#
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(40) not null default '',
+c3 datetime not NULL,
+PRIMARY KEY (c1,c3),
+KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+PARTITION p201912 VALUES LESS THAN MAXVALUE);
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+PARTITION_NAME TABLE_ROWS
+p200912 0
+p201103 1
+p201912 0
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+count(*)
+0
+DROP TABLE t1;
+#
# Bug#54747: Deadlock between REORGANIZE PARTITION and
# SELECT is not detected
#
@@ -489,3 +515,31 @@ 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;
+#
+# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
+# table unusable".
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
+ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 values (0,1), (1,2);
+# The below ALTER should fail. It should leave the
+# table in its original, non-corrupted, usable state.
+ALTER TABLE t1 ADD UNIQUE KEY (b);
+ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
+# The below statements should succeed, as ALTER should
+# have left table intact.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a b
+1 2
+0 1
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index dd91eee316a..aa0944e96b5 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -1,3 +1,76 @@
+call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal");
+#
+# Bug#55091: Server crashes on ADD PARTITION after a failed attempt
+#
+SET @old_innodb_file_format_max = @@global.innodb_file_format_max;
+SET @old_innodb_file_format = @@global.innodb_file_format;
+SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
+SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
+SET @@global.innodb_file_format = Barracuda,
+@@global.innodb_file_per_table = ON,
+@@global.innodb_strict_mode = ON;
+# Connection con1
+CREATE TABLE t1 (id INT NOT NULL
+PRIMARY KEY,
+user_num CHAR(10)
+) ENGINE = InnoDB
+KEY_BLOCK_SIZE=4
+PARTITION BY HASH(id) PARTITIONS 1;
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `user_num` char(10) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+/*!50100 PARTITION BY HASH (id)
+PARTITIONS 1 */
+SET GLOBAL innodb_file_per_table = OFF;
+# Connection con2
+LOCK TABLE t1 WRITE;
+# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
+# are incompatible with innodb_file_per_table = OFF;
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ERROR HY000: Got error 1478 from storage engine
+t1#P#p0.ibd
+t1.frm
+t1.par
+# This SET is not needed to reproduce the bug,
+# it is here just to make the test case more realistic
+SET innodb_strict_mode = OFF;
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+t1.frm
+t1.par
+ALTER TABLE t1 REBUILD PARTITION p0;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `user_num` char(10) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+/*!50100 PARTITION BY HASH (id)
+PARTITIONS 3 */
+DROP TABLE t1;
+# Connection default
+SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
+SET @@global.innodb_file_format = @old_innodb_file_format;
+SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
+SET @@global.innodb_file_format_max = @old_innodb_file_format_max;
SET NAMES utf8;
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
ENGINE=InnoDB
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index 54467b78f19..8a649f63598 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -11,6 +11,26 @@ test_plugin_server plug_dest
## test plugin auth
ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
GRANT PROXY ON plug_dest TO plug;
+test proxies_priv columns
+SELECT * FROM mysql.proxies_priv;
+Host User Proxied_host Proxied_user With_grant Grantor Timestamp
+xx root 1 xx
+xx root 1 xx
+xx plug % plug_dest 0 root@localhost xx
+test mysql.proxies_priv;
+SHOW CREATE TABLE mysql.proxies_priv;
+Table Create Table
+proxies_priv CREATE TABLE `proxies_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `With_grant` tinyint(1) NOT NULL DEFAULT '0',
+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
+ KEY `Grantor` (`Grantor`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug@localhost plug_dest@%
@@ -146,8 +166,8 @@ Grants for test_drop@localhost
GRANT USAGE ON *.* TO 'test_drop'@'localhost'
GRANT PROXY ON 'future_user'@'%' TO 'test_drop'@'localhost'
DROP USER test_drop@localhost;
-SELECT * FROM mysql.proxy_priv WHERE Host = 'test_drop' AND User = 'localhost';
-Host User Proxied_Host Proxied_User With_Grant
+SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost';
+Host User Proxied_host Proxied_user With_grant Grantor Timestamp
DROP USER proxy_admin;
DROP USER grant_plug,grant_plug_dest,grant_plug_dest2;
## END GRANT PROXY tests
@@ -235,3 +255,67 @@ GRANT PROXY ON standard_user TO ''@'';
DROP USER ''@'';
DROP USER standard_user;
DROP DATABASE shared;
+#
+# Bug #57551 : Live upgrade fails between 5.1.52 -> 5.5.7-rc
+#
+CALL mtr.add_suppression("Missing system table mysql.proxies_priv.");
+DROP TABLE mysql.proxies_priv;
+# Must come back with mysql.proxies_priv absent.
+SELECT * FROM mysql.proxies_priv;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+CREATE USER u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+CREATE USER u2@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u2@localhost;
+# access denied because of no privileges to root
+GRANT PROXY ON u2@localhost TO u1@localhost;
+ERROR 28000: Access denied for user 'root'@'localhost'
+# access denied because of no privileges to root
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+ERROR 28000: Access denied for user 'root'@'localhost'
+# go try graning proxy on itself, so that it will need the table
+GRANT PROXY ON u2@localhost TO u1@localhost;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+# test if REVOKE works without the proxies_priv table
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost, u2@localhost;
+# test if DROP USER work without the proxies_priv table
+DROP USER u1@localhost,u2@localhost;
+# test if FLUSH PRIVILEGES works without the proxies_priv table
+FLUSH PRIVILEGES;
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log 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 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
+SELECT Host,User,Proxied_host,Proxied_user,With_grant FROM mysql.proxies_priv;
+Host localhost
+User root
+Proxied_host
+Proxied_user
+With_grant 1
+FLUSH PRIVILEGES;
+End of 5.5 tests
diff --git a/mysql-test/r/plugin_auth_qa.result b/mysql-test/r/plugin_auth_qa.result
new file mode 100644
index 00000000000..d1ecf6a6470
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa.result
@@ -0,0 +1,327 @@
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+========== test 1.1 ======================================================
+CREATE USER plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+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 'plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+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 'plug_dest' at line 1
+========== test 1.1 syntax errors ========================================
+CREATE USER plug IDENTIFIED WITH AS plug_dest;
+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 'AS plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
+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 'AS plug_dest' at line 1
+CREATE USER plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED AS '';
+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 'AS ''' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
+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 'AS ''' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+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 'IDENTIFIED WITH 'test_plugin_server'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug
+IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+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 'IDENTIFIED WITH 'test_plugin_server'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
+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 'AS 'plug_dest'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
+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 'AS '' AS 'plug_dest'' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ''
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+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 'IDENTIFIED WITH test_plugin_server AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+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 'IDENTIFIED WITH test_plugin_server AS 'plug_dest'' at line 2
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+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 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
+ IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+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 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+IDENTIFIED by 'plug_dest_pwd';
+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 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ IDENTIFIED by 'plug_dest_pwd';
+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 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+========== test 1.1 combinations ==========================
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+========== test 1.1.1.6/1.1.2.5 ============================
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest
+DROP USER plug, plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest *939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+plug_dest test_plugin_server plug_dest
+DROP USER plug,plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+plug_dest test_plugin_server plug_dest
+DROP USER plug,plug_dest;
+========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest
+DROP USER plüg_dest;
+SET NAMES ascii;
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+pl??g test_plugin_server pl??g_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+pl??g_dest
+DROP USER 'plüg_dest';
+SET NAMES latin1;
+========== test 1.1.1.5 ====================================
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plüg_dest
+DROP USER 'plug';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest
+DROP USER 'plüg_dest';
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest
+DROP USER 'plüg_dest';
+CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest
+DROP USER plüg_dest;
+========== test 1.1.1.2/1.1.2.2=============================
+SET @auth_name= 'test_plugin_server';
+CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
+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 '@auth_name AS 'plug_dest'' at line 1
+SET @auth_string= 'plug_dest';
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
+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 '@auth_string' at line 1
+========== test 1.1.1.3/1.1.2.3=============================
+CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
+ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server hh's_plug_dest
+DROP USER plug;
+CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+hh's_plug_dest
+DROP USER 'hh''s_plug_dest';
+========== test 1.1.1.4 ====================================
+CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
+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 '''s_test_plugin_server AS 'plug_dest'' at line 1
+========== test 1.1.3.1 ====================================
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+plug_dest
+DROP USER grant_user,plug_dest;
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+ERROR 42000: Can't find any matching row in the user table
+DROP USER grant_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+grant_user test_plugin_server plug_dest
+plug_dest *939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+grant_user test_plugin_server plug_dest
+plug_dest *560881EB651416CEF77314D07D55EDCD5FC1BD6D
+DROP USER grant_user,plug_dest;
+set @@sql_mode= @save_sql_mode;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_1.result b/mysql-test/r/plugin_auth_qa_1.result
new file mode 100644
index 00000000000..00ee47b56b3
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_1.result
@@ -0,0 +1,335 @@
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user,plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+plug_user test_plugin_server plug_dest
+1)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+3)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user,plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+1)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+DROP USER plug_user,plug_dest;
+========== test 1.2 ========================================
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest
+plug_user test_plugin_server plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest
+plug_user test_plugin_server plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug_user@localhost plug_dest@%
+connection default;
+disconnect plug_user;
+RENAME USER plug_user TO new_user;
+connect(plug_user,localhost,new_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_user@localhost plug_dest@%
+connection default;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server plug_dest
+plug_dest
+disconnect plug_user;
+UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+plug_user test_plugin_server plug_dest
+DROP USER plug_dest,plug_user;
+========== test 1.3 ========================================
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug_user@localhost plug_dest@%
+connection default;
+disconnect plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest
+plug_user test_plugin_server plug_dest
+UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server plug_dest
+plug_dest
+UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server new_dest
+plug_dest
+UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user new_plugin_server new_dest
+plug_dest
+connect(plug_user,localhost,new_user,new_dest);
+ERROR HY000: Plugin 'new_plugin_server' is not loaded
+UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
+UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
+FLUSH PRIVILEGES;
+GRANT PROXY ON new_dest TO new_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest
+new_user test_plugin_server new_dest
+connect(plug_user,localhost,new_user,new_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_user@localhost new_dest@%
+connection default;
+disconnect plug_user;
+UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
+FLUSH PRIVILEGES;
+CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest
+new_user test_plugin_server new_dest
+plug_dest
+GRANT ALL PRIVILEGES ON test.* TO new_user;
+connect(plug_user,localhost,new_dest,new_dest_passwd);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_dest@localhost new_dest@%
+connection default;
+disconnect plug_user;
+DROP USER new_user,new_dest,plug_dest;
+========== test 2, 2.1, 2.2 ================================
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxy_user@localhost proxied_user@%
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@''
+IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxy_user@localhost proxied_user@%
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
+CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
+CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
+CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
+CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
+GRANT PROXY ON proxied_user_1 TO ''@'';
+GRANT PROXY ON proxied_user_2 TO ''@'';
+GRANT PROXY ON proxied_user_3 TO ''@'';
+GRANT PROXY ON proxied_user_4 TO ''@'';
+GRANT PROXY ON proxied_user_5 TO ''@'';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user_1
+proxied_user_2
+proxied_user_3
+proxied_user_4
+proxied_user_5
+connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+connection proxy_con_1;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_1@localhost proxied_user_1@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_2;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_2@localhost proxied_user_2@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_3;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_3@localhost proxied_user_3@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_4;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_4@localhost proxied_user_4@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_5;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_5@localhost proxied_user_5@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con_1;
+disconnect proxy_con_2;
+disconnect proxy_con_3;
+disconnect proxy_con_4;
+disconnect proxy_con_5;
+DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
+========== test 3 ==========================================
+GRANT ALL PRIVILEGES ON *.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+FLUSH PRIVILEGES;
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_2.result b/mysql-test/r/plugin_auth_qa_2.result
new file mode 100644
index 00000000000..99fe9c6f5a9
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_2.result
@@ -0,0 +1,150 @@
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+=== check contens of components of info ====================
+CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
+CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+qa_test_1_dest
+qa_test_1_user qa_auth_interface qa_test_1_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_1_user@% qa_test_1_user@localhost NULL NULL
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+qa_test_1_dest
+qa_test_1_user qa_auth_interface qa_test_1_dest
+DROP USER qa_test_1_user;
+DROP USER qa_test_1_dest;
+=== Assign values to components of info ====================
+CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
+CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
+GRANT PROXY ON authenticated_as TO qa_test_2_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+authenticated_as
+qa_test_2_dest
+qa_test_2_user qa_auth_interface qa_test_2_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%'
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+authenticated_as
+qa_test_2_dest
+qa_test_2_user qa_auth_interface qa_test_2_dest
+DROP USER qa_test_2_user;
+DROP USER qa_test_2_dest;
+DROP USER authenticated_as;
+=== Assign too high values for *length, which should have no effect ====
+CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
+CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%'
+DROP USER qa_test_3_user;
+DROP USER qa_test_3_dest;
+=== Assign too low values for *length, which should have no effect ====
+CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
+CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%'
+DROP USER qa_test_4_user;
+DROP USER qa_test_4_dest;
+=== Assign empty string especially to authenticated_as (in plugin) ====
+CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
+CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
+GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
+GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+ *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_user qa_auth_interface qa_test_5_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
+DROP USER qa_test_5_user;
+DROP USER qa_test_5_dest;
+DROP USER ''@'localhost';
+=== Assign 'root' especially to authenticated_as (in plugin) ====
+CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES)
+GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+root qa_auth_interface qa_test_6_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+REVOKE PROXY ON qa_test_6_dest FROM root;
+SELECT user,plugin,authentication_string FROM mysql.user;
+user plugin authentication_string
+qa_test_6_dest
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+root qa_auth_interface qa_test_6_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+DROP USER qa_test_6_user;
+DROP USER qa_test_6_dest;
+DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+root
+root
+root
+root
+=== Test of the --default_auth option for clients ====
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
+CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_11_user'@'localhost' (using password: YES)
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_3.result b/mysql-test/r/plugin_auth_qa_3.result
new file mode 100644
index 00000000000..d94d8879e7d
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_3.result
@@ -0,0 +1,11 @@
+CREATE DATABASE test_user_db;
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%'
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO)
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 33282823931..17f639cdca3 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3202,6 +3202,510 @@ test1
DROP PROCEDURE p1;
DROP PROCEDURE p2;
+TINYINT
+
+CREATE PROCEDURE p1(OUT v TINYINT)
+SET v = 127;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 127;
+@a @a = 127
+127 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+SMALLINT
+
+CREATE PROCEDURE p1(OUT v SMALLINT)
+SET v = 32767;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 32767;
+@a @a = 32767
+32767 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMINT
+
+CREATE PROCEDURE p1(OUT v MEDIUMINT)
+SET v = 8388607;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 8388607;
+@a @a = 8388607
+8388607 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+INT
+
+CREATE PROCEDURE p1(OUT v INT)
+SET v = 2147483647;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 2147483647;
+@a @a = 2147483647
+2147483647 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BIGINT
+
+CREATE PROCEDURE p1(OUT v BIGINT)
+SET v = 9223372036854775807;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 9223372036854775807;
+@a @a = 9223372036854775807
+9223372036854775807 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BIT(11)
+
+CREATE PROCEDURE p1(OUT v BIT(11))
+SET v = b'10100100101';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = b'10100100101';
+@a @a = b'10100100101'
+1317 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TIMESTAMP
+
+CREATE PROCEDURE p1(OUT v TIMESTAMP)
+SET v = '2007-11-18 15:01:02';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '2007-11-18 15:01:02';
+@a @a = '2007-11-18 15:01:02'
+2007-11-18 15:01:02 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DATETIME
+
+CREATE PROCEDURE p1(OUT v DATETIME)
+SET v = '1234-11-12 12:34:59';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '1234-11-12 12:34:59';
+@a @a = '1234-11-12 12:34:59'
+1234-11-12 12:34:59 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TIME
+
+CREATE PROCEDURE p1(OUT v TIME)
+SET v = '123:45:01';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '123:45:01';
+@a @a = '123:45:01'
+123:45:01 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DATE
+
+CREATE PROCEDURE p1(OUT v DATE)
+SET v = '1234-11-12';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '1234-11-12';
+@a @a = '1234-11-12'
+1234-11-12 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+YEAR
+
+CREATE PROCEDURE p1(OUT v YEAR)
+SET v = 2010;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 2010;
+@a @a = 2010
+2010 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+FLOAT(7, 4)
+
+CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
+SET v = 123.4567;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a - 123.4567 < 0.00001;
+@a @a - 123.4567 < 0.00001
+123.45670318603516 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DOUBLE(8, 5)
+
+CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
+SET v = 123.45678;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a - 123.45678 < 0.000001;
+@a @a - 123.45678 < 0.000001
+123.45678 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DECIMAL(9, 6)
+
+CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
+SET v = 123.456789;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 123.456789;
+@a @a = 123.456789
+123.456789 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+CHAR(32)
+
+CREATE PROCEDURE p1(OUT v CHAR(32))
+SET v = REPEAT('a', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('a', 16);
+@a @a = REPEAT('a', 16)
+aaaaaaaaaaaaaaaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+VARCHAR(32)
+
+CREATE PROCEDURE p1(OUT v VARCHAR(32))
+SET v = REPEAT('b', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('b', 16);
+@a @a = REPEAT('b', 16)
+bbbbbbbbbbbbbbbb 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TINYTEXT
+
+CREATE PROCEDURE p1(OUT v TINYTEXT)
+SET v = REPEAT('c', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('c', 16);
+@a @a = REPEAT('c', 16)
+cccccccccccccccc 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TEXT
+
+CREATE PROCEDURE p1(OUT v TEXT)
+SET v = REPEAT('d', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('d', 16);
+@a @a = REPEAT('d', 16)
+dddddddddddddddd 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMTEXT
+
+CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
+SET v = REPEAT('e', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('e', 16);
+@a @a = REPEAT('e', 16)
+eeeeeeeeeeeeeeee 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+LONGTEXT
+
+CREATE PROCEDURE p1(OUT v LONGTEXT)
+SET v = REPEAT('f', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('f', 16);
+@a @a = REPEAT('f', 16)
+ffffffffffffffff 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BINARY(32)
+
+CREATE PROCEDURE p1(OUT v BINARY(32))
+SET v = REPEAT('g', 32);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('g', 32);
+@a @a = REPEAT('g', 32)
+gggggggggggggggggggggggggggggggg 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+VARBINARY(32)
+
+CREATE PROCEDURE p1(OUT v VARBINARY(32))
+SET v = REPEAT('h', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('h', 16);
+@a @a = REPEAT('h', 16)
+hhhhhhhhhhhhhhhh 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TINYBLOB
+
+CREATE PROCEDURE p1(OUT v TINYBLOB)
+SET v = REPEAT('i', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('i', 16);
+@a @a = REPEAT('i', 16)
+iiiiiiiiiiiiiiii 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BLOB
+
+CREATE PROCEDURE p1(OUT v BLOB)
+SET v = REPEAT('j', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('j', 16);
+@a @a = REPEAT('j', 16)
+jjjjjjjjjjjjjjjj 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMBLOB
+
+CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
+SET v = REPEAT('k', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('k', 16);
+@a @a = REPEAT('k', 16)
+kkkkkkkkkkkkkkkk 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+LONGBLOB
+
+CREATE PROCEDURE p1(OUT v LONGBLOB)
+SET v = REPEAT('l', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('l', 16);
+@a @a = REPEAT('l', 16)
+llllllllllllllll 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+SET('aaa', 'bbb')
+
+CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
+SET v = 'aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 'aaa';
+@a @a = 'aaa'
+aaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+ENUM('aaa', 'bbb')
+
+CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
+SET v = 'aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 'aaa';
+@a @a = 'aaa'
+aaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
# End of WL#4435.
#
# WL#4284: Transactional DDL locking
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 96979d257f1..a345a2ae6aa 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4887,3 +4887,22 @@ col_int_key
DROP VIEW view_t1;
DROP TABLE t1;
# End of test BUG#54515
+#
+# Bug #57203 Assertion `field_length <= 255' failed.
+#
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+UNION ALL
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+AS foo
+;
+coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+0.0000
+0.0000
+CREATE table t1(a text);
+INSERT INTO t1 VALUES (''), ('');
+SELECT avg(distinct(t1.a)) FROM t1, t1 t2
+GROUP BY t2.a ORDER BY t1.a;
+avg(distinct(t1.a))
+0
+DROP TABLE t1;
+# End of test BUG#57203
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index c1a75281e0e..5e41e6b29c6 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1514,3 +1514,27 @@ ALTER TABLE t1 CHARACTER SET = utf8;
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;
+#
+# Bug#57306 SHOW PROCESSLIST does not display string literals well.
+#
+SET NAMES latin1;
+SELECT GET_LOCK('t', 1000);
+GET_LOCK('t', 1000)
+1
+SET NAMES latin1;
+SELECT GET_LOCK('t',1000) AS 'óóóó';;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root ### test Query ### ### SHOW PROCESSLIST
+### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SET NAMES utf8;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root ### test Query ### ### SHOW PROCESSLIST
+### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SELECT RELEASE_LOCK('t');
+RELEASE_LOCK('t')
+1
+óóóó
+1
+SET NAMES latin1;
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index 67bf9330451..cfa056d5d13 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -1379,9 +1379,6 @@ MESSAGE_TEXT = msg,
MYSQL_ERRNO = 1012;
end $$
insert into t1 values (1), (2) $$
-Warnings:
-Warning 1012 This trigger SIGNAL a warning, a=1
-Warning 1012 This trigger SIGNAL a warning, a=2
drop trigger t1_ai $$
create trigger t1_ai after insert on t1 for each row
begin
@@ -1416,11 +1413,7 @@ MESSAGE_TEXT = NEW.msg,
MYSQL_ERRNO = NEW.errno;
end $$
insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$
-Warnings:
-Warning 1012 Warning message 1 in trigger
insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$
-Warnings:
-Warning 1013 Warning message 2 in trigger
drop table t1 $$
drop table if exists t1 $$
drop procedure if exists p1 $$
diff --git a/mysql-test/r/sp-bugs.result b/mysql-test/r/sp-bugs.result
index a88c89537e2..2425f40d9c2 100644
--- a/mysql-test/r/sp-bugs.result
+++ b/mysql-test/r/sp-bugs.result
@@ -75,4 +75,40 @@ CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
+#
+# Bug#54375: Error in stored procedure leaves connection
+# in different default schema
+#
+SET @@SQL_MODE = 'STRICT_ALL_TABLES';
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+USE db1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+CREATE FUNCTION f1 (
+some_value int
+)
+RETURNS smallint
+DETERMINISTIC
+BEGIN
+INSERT INTO t1 SET c1 = some_value;
+RETURN(LAST_INSERT_ID());
+END$$
+DROP DATABASE IF EXISTS db2;
+CREATE DATABASE db2;
+USE db2;
+SELECT DATABASE();
+DATABASE()
+db2
+SELECT db1.f1(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT DATABASE();
+DATABASE()
+db2
+USE test;
+DROP FUNCTION db1.f1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
+DROP DATABASE db2;
End of 5.1 tests
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index 32d0e39c5af..a3c8574d141 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -150,3 +150,21 @@ Warnings:
Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
# Restore mysql.proc.
drop table mysql.proc;
+#
+# Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
+#
+DROP TABLE IF EXISTS proc_backup;
+DROP DATABASE IF EXISTS db1;
+# Backup the proc table
+RENAME TABLE mysql.proc TO proc_backup;
+CREATE TABLE mysql.proc LIKE proc_backup;
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SET @foo = 10;
+# Modify a field of the table.
+ALTER TABLE mysql.proc MODIFY comment CHAR (32);
+DROP DATABASE db1;
+Warnings:
+Error 1548 Cannot load from mysql.proc. The table is probably corrupted
+# Restore mysql.proc
+DROP TABLE mysql.proc;
+RENAME TABLE proc_backup TO mysql.proc;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 7b8364379df..4e97429c48f 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1877,9 +1877,6 @@ DROP PROCEDURE p1;
#
# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
#
-
-# - Case 1
-
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
@@ -1889,40 +1886,13 @@ SET NEW.a = 10;
SET NEW.a = 99999999999;
END|
UPDATE t1 SET b = 20;
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
SHOW WARNINGS;
Level Code Message
-Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
a b
10 20
DROP TRIGGER t1_bu;
DROP TABLE t1;
-
-# - Case 2
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(b CHAR(1));
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
-INSERT INTO t2 VALUES('ab'); # Produces a warning.
-INSERT INTO t2 VALUES('b'); # Does not produce a warning,
-# previous warning should be cleared.
-END|
-INSERT INTO t1 VALUES(0);
-SHOW WARNINGS;
-Level Code Message
-SELECT * FROM t1;
-a
-0
-SELECT * FROM t2;
-b
-a
-b
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-DROP TABLE t2;
#
# Bug#9857: Stored procedures: handler for sqlwarning ignored
#
@@ -1961,3 +1931,64 @@ Warning 1365 Division by 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode = @sql_mode_saved;
+#
+# Bug#55850: Trigger warnings not cleared.
+#
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
+d SMALLINT, e SMALLINT, f SMALLINT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+INSERT INTO t2(a, b, c) VALUES(99999, 99999, 99999);
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+INSERT INTO t2(d, e, f) VALUES(99999, 99999, 99999);
+CREATE PROCEDURE p1()
+INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+CALL p1();
+Warnings:
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+# ----------------------------------------------------------------------
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT NOT NULL);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+INSERT INTO t2 VALUES(
+CAST('111111 ' AS SIGNED),
+CAST('222222 ' AS SIGNED),
+NULL);
+END|
+CREATE PROCEDURE p1()
+INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+CALL p1();
+ERROR 23000: Column 'c' cannot be null
+
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+Warning 1292 Truncated incorrect INTEGER value: '111111 '
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1292 Truncated incorrect INTEGER value: '222222 '
+Warning 1264 Out of range value for column 'b' at row 1
+Error 1048 Column 'c' cannot be null
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index 0d3e87f17e2..860312dca3e 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -735,5 +735,96 @@ END latin1 latin1_swedish_ci latin1_swedish_ci
# Connection default;
DROP PROCEDURE p1;
#
+# Bug#57663 Concurrent statement using stored function and DROP DATABASE
+# breaks SBR
+#
+DROP DATABASE IF EXISTS db1;
+DROP FUNCTION IF EXISTS f1;
+# Test 1: Check that DROP DATABASE block if a function is used
+# by an active transaction.
+# Connection default
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+SELECT db1.f1();
+db1.f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on f1()
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 2: Check that DROP DATABASE blocks if a procedure is
+# used by an active transaction.
+# Connection default
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() BEGIN END;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+CALL db1.p1();
+RETURN 1;
+END|
+START TRANSACTION;
+SELECT f1();
+f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on p1()
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 3: Check that DROP DATABASE is not selected as a victim if a
+# deadlock is discovered with DML statements.
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+SELECT db1.f1();
+db1.f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on f1()
+SELECT * FROM db1.t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 4: Check that active DROP DATABASE blocks stored routine DDL.
+# Connection default
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
+START TRANSACTION;
+SELECT db1.f2();
+db1.f2()
+2
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+# Waiting for DROP DATABASE to be blocked by the lock on f2()
+# Sending:
+ALTER FUNCTION db1.f1 COMMENT "test";
+# Connection default
+# Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: ALTER FUNCTION f1 COMMENT 'test'
+ERROR 42000: FUNCTION db1.f1 does not exist
+# Connection default
+DROP FUNCTION f1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 4ea26d1021a..c09579b13eb 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -44,7 +44,7 @@ ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy;
-ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
drop function db1_secret.db;
@@ -58,7 +58,7 @@ ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
drop procedure db1_secret.dummy;
-ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
drop function db1_secret.db;
@@ -567,3 +567,28 @@ DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
End of 5.0 tests.
+#
+# Test for bug#57061 "User without privilege on routine can discover
+# its existence."
+#
+drop database if exists mysqltest_db;
+create database mysqltest_db;
+# Create user with no privileges on mysqltest_db database.
+create user bug57061_user@localhost;
+create function mysqltest_db.f1() returns int return 0;
+create procedure mysqltest_db.p1() begin end;
+# Connect as user 'bug57061_user@localhost'
+# Attempt to drop routine on which user doesn't have privileges
+# should result in the same 'access denied' type of error whether
+# routine exists or not.
+drop function if exists mysqltest_db.f_does_not_exist;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
+drop procedure if exists mysqltest_db.p_does_not_exist;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p_does_not_exist'
+drop function if exists mysqltest_db.f1;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f1'
+drop procedure if exists mysqltest_db.p1;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p1'
+# Connection 'default'.
+drop user bug57061_user@localhost;
+drop database mysqltest_db;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 13941b56040..3136b5dfcc0 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -5005,3 +5005,15 @@ 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
+#
+# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
+# Assertion `file' failed.
+#
+CREATE TABLE t1 (a INT);
+SELECT 1 FROM
+(SELECT ROW(
+(SELECT 1 FROM t1 RIGHT JOIN
+(SELECT 1 FROM t1, t1 t2) AS d ON 1),
+1) FROM t1) AS e;
+ERROR 21000: Operand should contain 1 column(s)
+DROP TABLE t1;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index e82cf229912..0028f2ce5c1 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -14,7 +14,7 @@ ndb_binlog_index
plugin
proc
procs_priv
-proxy_priv
+proxies_priv
servers
slow_log
tables_priv
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index b9b1c94ce1a..b24c5b87fa0 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1072,8 +1072,6 @@ SELECT @x;
NULL
SET @x=2;
UPDATE t1 SET i1 = @x;
-Warnings:
-Warning 1365 Division by 0
SELECT @x;
@x
NULL
@@ -1085,9 +1083,6 @@ SELECT @x;
NULL
SET @x=4;
UPDATE t1 SET i1 = @x;
-Warnings:
-Warning 1365 Division by 0
-Warning 1365 Division by 0
SELECT @x;
@x
NULL
@@ -1198,8 +1193,6 @@ Warnings:
Warning 1365 Division by 0
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
-Warnings:
-Warning 1365 Division by 0
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
@@ -1218,8 +1211,6 @@ set @a:=1/0;
end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
-Warnings:
-Warning 1365 Division by 0
select @check, @t4_bi_called, @t4_bu_called|
@check @t4_bi_called @t4_bu_called
2 1 1
@@ -2090,12 +2081,8 @@ SELECT 1 FROM t1 c WHERE
END//
SET @bug51650 = 1;
INSERT IGNORE INTO t2 VALUES();
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
INSERT IGNORE INTO t1 SET b = '777';
INSERT IGNORE INTO t2 SET a = '111';
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
SET @bug51650 = 1;
INSERT IGNORE INTO t2 SET a = '777';
DROP TRIGGER trg1;
@@ -2177,8 +2164,6 @@ SELECT 'ab' INTO a;
SELECT 'a' INTO a;
END|
INSERT INTO t1 VALUES (1);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TRIGGER IF EXISTS trg1;
@@ -2196,20 +2181,12 @@ DECLARE trg2 CHAR;
SELECT 'ab' INTO trg2;
END|
INSERT INTO t1 VALUES (0);
-Warnings:
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
SELECT * FROM t1;
a
0
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 VALUES (1),(2);
-Warnings:
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
DROP TRIGGER trg1;
DROP TRIGGER trg2;
DROP TABLE t1;
diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result
index a7a4b9c70f4..728702f7ab5 100644
--- a/mysql-test/r/truncate_coverage.result
+++ b/mysql-test/r/truncate_coverage.result
@@ -78,3 +78,30 @@ COMMIT;
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
+#
+# Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE
+#
+# Note that this test case only reproduces the problem
+# when it is run with valgrind.
+DROP TABLE IF EXISTS t1, m1;
+CREATE TABLE t1(a INT) engine=memory;
+CREATE TABLE m1(a INT) engine=merge UNION(t1);
+# Connection con1
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
+# Sending:
+TRUNCATE TABLE m1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+# Sending:
+FLUSH TABLES;
+# Connection default
+# Waiting for FLUSH TABLES to be blocked.
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+# Connection con1
+# Reaping: TRUNCATE TABLE m1
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+# Connection con2
+# Reaping: FLUSH TABLES
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE m1, t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 78f31286ea7..e3363fcabf9 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2;
LENGTH(c)
65535
DROP TABLE t1, t2;
+# Bug #52160: crash and inconsistent results when grouping
+# by a function and column
+CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
+CREATE TABLE t1(a CHAR(1));
+INSERT INTO t1 VALUES ('0'), ('0');
+SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
+COUNT(*)
+2
+DROP FUNCTION f1;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index bb441099b98..41345be5b8d 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -318,4 +318,12 @@ f1 date YES NULL
f2 date YES NULL
DROP TABLE t1;
#
+#
+# Bug#57278: Crash on min/max + with date out of range.
+#
+set @a=(select min(makedate('111','1'))) ;
+select @a;
+@a
+0111-01-01
+#
End of 6.0 tests
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index a680e837cae..e41a9bc7637 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -445,6 +445,9 @@ IF(
count(*), 1)
1
DROP TABLE t1;
+select @v:=@v:=sum(1) from dual;
+@v:=@v:=sum(1)
+1
End of 5.1 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
diff --git a/mysql-test/r/variables-big.result b/mysql-test/r/variables-big.result
index 960fc6d22f4..71b32393d82 100644
--- a/mysql-test/r/variables-big.result
+++ b/mysql-test/r/variables-big.result
@@ -1,20 +1,20 @@
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index fad2cab0e57..6b7ba57ce2e 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1093,4 +1093,37 @@ Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
+#
+# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+#
+SET NAMES utf8;
+SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds','');
+REPLACE(EXTRACTVALUE('1', '/a'),'ds','')
+
+#
+# Bug #57820 extractvalue crashes
+#
+SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k')));
+AVG(DISTINCT EXTRACTVALUE((''),('$@k')))
+NULL
+#
+# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
+#
+SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
End of 5.1 tests
+#
+# Start of 5.5 tests
+#
+#
+# Bug#58175 xml functions read initialized bytes when conversions happen
+#
+SET NAMES latin1;
+SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
+UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
+NULL
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/std_data/bug57108.cnf b/mysql-test/std_data/bug57108.cnf
new file mode 100644
index 00000000000..5fd8c485cf0
--- /dev/null
+++ b/mysql-test/std_data/bug57108.cnf
@@ -0,0 +1,95 @@
+[mysqld]
+open-files-limit=1024
+character-set-server=latin1
+connect-timeout=4711
+log-bin-trust-function-creators=1
+key_buffer_size=1M
+sort_buffer=256K
+max_heap_table_size=1M
+loose-innodb_data_file_path=ibdata1:10M:autoextend
+loose-innodb_buffer_pool_size=8M
+loose-innodb_write_io_threads=2
+loose-innodb_read_io_threads=2
+loose-innodb_log_buffer_size=1M
+loose-innodb_log_file_size=5M
+loose-innodb_additional_mem_pool_size=1M
+loose-innodb_log_files_in_group=2
+slave-net-timeout=120
+log-bin=mysqld-bin
+loose-enable-performance-schema
+loose-performance-schema-max-mutex-instances=10000
+loose-performance-schema-max-rwlock-instances=10000
+loose-performance-schema-max-table-instances=500
+loose-performance-schema-max-table-handles=1000
+binlog-direct-non-transactional-updates
+
+[mysql]
+default-character-set=latin1
+
+[mysqlshow]
+default-character-set=latin1
+
+[mysqlimport]
+default-character-set=latin1
+
+[mysqlcheck]
+default-character-set=latin1
+
+[mysql_upgrade]
+default-character-set=latin1
+tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp
+
+[mysqld.1]
+#!run-master-sh
+log-bin=master-bin
+loose-enable-performance-schema
+basedir=/home/bzr/bugs/b57108-5.5-bugteam
+tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1
+character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
+lc-messages-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/
+datadir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/data
+pid-file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/run/mysqld.1.pid
+#host=localhost
+port=13000
+socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
+#log-error=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/log/mysqld.1.err
+general_log=1
+general_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld.log
+slow_query_log=1
+slow_query_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld-slow.log
+#user=root
+#password=
+server-id=1
+secure-file-priv=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var
+ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
+ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-cert.pem
+ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-key.pem
+
+[mysqlbinlog]
+disable-force-if-open
+character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
+
+[ENV]
+MASTER_MYPORT=13000
+MASTER_MYSOCK=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
+
+[client]
+password=
+user=root
+port=13000
+host=localhost
+socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
+
+[mysqltest]
+ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
+ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-cert.pem
+ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-key.pem
+skip-ssl=1
+
+[client.1]
+password=
+user=root
+port=13000
+host=localhost
+socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
+
diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_index-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
index 6682d84d9c9..2e3e53b86f1 100644
--- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
+++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
@@ -83,17 +83,17 @@ while($i)
-- let $flags=--database=b42941
# construct CLI for mysqlbinlog
- if(`SELECT $i=3`)
+ if($i==3)
{
-- let $flags= $flags --verbose --hexdump
}
- if(`SELECT $i=2`)
+ if($i==2)
{
-- let $flags= $flags --verbose
}
-# if(`SELECT $i=1`)
+# if($i==1)
# {
# do nothing $flags is already set as it should be
# }
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 099f07e5d4e..62409b9f6be 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,2 @@
--max_binlog_size=4096 --default-storage-engine=MyISAM
+--force-restart
diff --git a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
index e2cfcb299cf..2a1187d3fe4 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
@@ -1 +1,2 @@
--binlog-do-db=b42829
+--force-restart
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
index a2f6afc1004..85571a6c582 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -116,7 +116,7 @@ DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
let $log_error_= `SELECT @@GLOBAL.log_error`;
-if(!`select LENGTH('$log_error_')`)
+if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test
index abcdf08d7a7..7d10bb73824 100644
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test
@@ -141,11 +141,11 @@ END|
# In each iteration of this loop, we select one method to make the
# statement unsafe.
--let $unsafe_type= 0
-while (`SELECT $unsafe_type < 9`) {
+while ($unsafe_type < 9) {
--echo
- if (`SELECT $unsafe_type = 0`) {
+ if ($unsafe_type == 0) {
--echo ==== Testing UUID() unsafeness ====
--let $desc_0= unsafe UUID() function
--let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID())
@@ -155,7 +155,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 1`) {
+ if ($unsafe_type == 1) {
--echo ==== Testing @@hostname unsafeness ====
--let $desc_0= unsafe @@hostname variable
--let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname)
@@ -168,7 +168,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 2`) {
+ if ($unsafe_type == 2) {
--echo ==== Testing SELECT...LIMIT unsafeness ====
--let $desc_0= unsafe SELECT...LIMIT statement
--let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1
@@ -178,7 +178,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 3`) {
+ if ($unsafe_type == 3) {
--echo ==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ====
--let $desc_0= unsafe INSERT DELAYED statement
--let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2)
@@ -188,7 +188,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 0
}
- if (`SELECT $unsafe_type = 4`) {
+ if ($unsafe_type == 4) {
--echo ==== Testing unsafeness of insert of two autoinc values ====
--let $desc_0= unsafe update of two autoinc columns
--let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL)
@@ -198,7 +198,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 5`) {
+ if ($unsafe_type == 5) {
--echo ==== Testing unsafeness of UDF's ====
--let $desc_0= unsafe UDF
--let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10))
@@ -208,7 +208,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 6`) {
+ if ($unsafe_type == 6) {
--echo ==== Testing unsafeness of access to mysql.general_log ====
--let $desc_0= unsafe use of mysql.general_log
--let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log
@@ -218,7 +218,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 1
}
- if (`SELECT $unsafe_type = 7`) {
+ if ($unsafe_type == 7) {
--echo ==== Testing a statement that is unsafe in many ways ====
--let $desc_0= statement that is unsafe in many ways
# Concatenate three unsafe values, and then concatenate NULL to
@@ -230,7 +230,7 @@ while (`SELECT $unsafe_type < 9`) {
--let $CRC_ARG_expected_number_of_warnings= 6
}
- if (`SELECT $unsafe_type = 8`) {
+ if ($unsafe_type == 8) {
--echo ==== Testing a statement that is unsafe several times ====
--let $desc_0= statement that is unsafe several times
--let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func())
@@ -249,7 +249,7 @@ while (`SELECT $unsafe_type < 9`) {
# construct. Instead, we just invoke the unsafe statement directly.
--let $call_type_1= 0
- while (`SELECT $call_type_1 < 8`) {
+ while ($call_type_1 < 8) {
#--echo debug: level 1, types $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 1
--let $CRC_ARG_type= $call_type_1
@@ -280,7 +280,7 @@ while (`SELECT $unsafe_type < 9`) {
# construct.
--let $call_type_2= 0
- while (`SELECT $call_type_2 < 7`) {
+ while ($call_type_2 < 7) {
#--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 2
--let $CRC_ARG_type= $call_type_2
@@ -309,7 +309,7 @@ while (`SELECT $unsafe_type < 9`) {
# construct.
--let $call_type_3= 0
- while (`SELECT $call_type_3 < 7`) {
+ while ($call_type_3 < 7) {
#--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 3
--let $CRC_ARG_type= $call_type_3
@@ -321,7 +321,7 @@ while (`SELECT $unsafe_type < 9`) {
--source extra/rpl_tests/create_recursive_construct.inc
# Drop created object.
- if (`SELECT '$drop_3' != ''`) {
+ if ($drop_3) {
--eval $drop_3
}
--inc $call_type_3
@@ -330,7 +330,7 @@ while (`SELECT $unsafe_type < 9`) {
} # if (!is_toplevel_2)
# Drop created object.
- if (`SELECT '$drop_2' != ''`) {
+ if ($drop_2) {
--eval $drop_2
}
--inc $call_type_2
@@ -338,7 +338,7 @@ while (`SELECT $unsafe_type < 9`) {
} # if (!is_toplevel_1)
# Drop created object.
- if (`SELECT '$drop_1' != ''`) {
+ if ($drop_1) {
--eval $drop_1
}
--inc $call_type_1
diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def
index a9841f592f8..a8485f185bc 100644
--- a/mysql-test/suite/binlog/t/disabled.def
+++ b/mysql-test/suite/binlog/t/disabled.def
@@ -9,6 +9,6 @@
# 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_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
+binlog_row_failure_mixing_engines : BUG#58416 2010-11-23 ramil Fails on win x86 debug_max
diff --git a/mysql-test/suite/bugs/r/bug57108.result b/mysql-test/suite/bugs/r/bug57108.result
new file mode 100644
index 00000000000..ad60b07a1e3
--- /dev/null
+++ b/mysql-test/suite/bugs/r/bug57108.result
@@ -0,0 +1,5 @@
+INSTALL PLUGIN example SONAME 'ha_example.so';
+SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile;
+connect_timeout 4711
+local_infile 1
+UNINSTALL PLUGIN example;
diff --git a/mysql-test/suite/bugs/t/bug57108-master.opt b/mysql-test/suite/bugs/t/bug57108-master.opt
new file mode 100644
index 00000000000..c2ab1c2ead6
--- /dev/null
+++ b/mysql-test/suite/bugs/t/bug57108-master.opt
@@ -0,0 +1,2 @@
+--defaults-file=std_data/bug57108.cnf
+$EXAMPLE_PLUGIN_OPT
diff --git a/mysql-test/suite/bugs/t/bug57108.test b/mysql-test/suite/bugs/t/bug57108.test
new file mode 100644
index 00000000000..1006a7b30f1
--- /dev/null
+++ b/mysql-test/suite/bugs/t/bug57108.test
@@ -0,0 +1,12 @@
+--source include/not_windows_embedded.inc
+--source include/have_example_plugin.inc
+
+# Test that we can install a plugin despite the fact that we have
+# switched directory after starting the server and am using a relative
+# --defaults-file.
+--replace_regex /\.dll/.so/
+eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
+
+--query_vertical SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile
+
+UNINSTALL PLUGIN example;
diff --git a/mysql-test/suite/federated/federated_bug_25714.test b/mysql-test/suite/federated/federated_bug_25714.test
index 82745b2a094..633e469f595 100644
--- a/mysql-test/suite/federated/federated_bug_25714.test
+++ b/mysql-test/suite/federated/federated_bug_25714.test
@@ -1,5 +1,5 @@
# Check that path to the specific test program has been setup
-if (`select LENGTH("$MYSQL_BUG25714") = 0`)
+if (!$MYSQL_BUG25714)
{
skip Need bug25714 test program;
}
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
index ee1548fe012..f19030834c8 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
@@ -110,10 +110,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
+DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index b2b38694680..a25147a1480 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -353,8 +353,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
@@ -364,8 +362,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
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 767f9e47f13..c61a09084a8 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -134,11 +134,13 @@ def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_
def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
-def mysql proxy_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-def mysql proxy_priv Proxied_Host 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
-def mysql proxy_priv Proxied_User 4 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-def mysql proxy_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
-def mysql proxy_priv With_Grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references
+def mysql proxies_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
+def mysql proxies_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
+def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
+def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
+def mysql proxies_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references
def mysql servers Db 3 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Host 2 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Owner 9 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
@@ -425,11 +427,13 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77)
3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant')
NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp
-3.0000 mysql proxy_priv Host char 60 180 utf8 utf8_bin char(60)
-3.0000 mysql proxy_priv User char 16 48 utf8 utf8_bin char(16)
-3.0000 mysql proxy_priv Proxied_Host char 16 48 utf8 utf8_bin char(16)
-3.0000 mysql proxy_priv Proxied_User char 60 180 utf8 utf8_bin char(60)
-NULL mysql proxy_priv With_Grant tinyint NULL NULL NULL NULL tinyint(1)
+3.0000 mysql proxies_priv Host char 60 180 utf8 utf8_bin char(60)
+3.0000 mysql proxies_priv User char 16 48 utf8 utf8_bin char(16)
+3.0000 mysql proxies_priv Proxied_host char 60 180 utf8 utf8_bin char(60)
+3.0000 mysql proxies_priv Proxied_user char 16 48 utf8 utf8_bin char(16)
+NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1)
+3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77)
+NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64)
diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
index 2e50a0c36bf..afd1fe15fed 100644
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
@@ -106,10 +106,10 @@ def mysql PRIMARY def mysql procs_priv Db
def mysql PRIMARY def mysql procs_priv User
def mysql PRIMARY def mysql procs_priv Routine_name
def mysql PRIMARY def mysql procs_priv Routine_type
-def mysql PRIMARY def mysql proxy_priv Host
-def mysql PRIMARY def mysql proxy_priv User
-def mysql PRIMARY def mysql proxy_priv Proxied_Host
-def mysql PRIMARY def mysql proxy_priv Proxied_User
+def mysql PRIMARY def mysql proxies_priv Host
+def mysql PRIMARY def mysql proxies_priv User
+def mysql PRIMARY def mysql proxies_priv Proxied_host
+def mysql PRIMARY def mysql proxies_priv Proxied_user
def mysql PRIMARY def mysql servers Server_name
def mysql PRIMARY def mysql tables_priv Host
def mysql PRIMARY def mysql tables_priv Db
diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result
index 0c43883789b..de84590e2f7 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result
@@ -118,10 +118,11 @@ def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql Grantor
-def mysql proxy_priv mysql PRIMARY
-def mysql proxy_priv mysql PRIMARY
-def mysql proxy_priv mysql PRIMARY
-def mysql proxy_priv mysql PRIMARY
+def mysql proxies_priv mysql PRIMARY
+def mysql proxies_priv mysql PRIMARY
+def mysql proxies_priv mysql PRIMARY
+def mysql proxies_priv mysql PRIMARY
+def mysql proxies_priv mysql Grantor
def mysql servers mysql PRIMARY
def mysql tables_priv mysql PRIMARY
def mysql tables_priv mysql PRIMARY
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
index 584bbeb7af5..4c7d58f96f1 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
@@ -40,10 +40,11 @@ def mysql procs_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 4 Routine_name A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 5 Routine_type A #CARD# NULL NULL BTREE
-def mysql proxy_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
-def mysql proxy_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
-def mysql proxy_priv 0 mysql PRIMARY 3 Proxied_Host A #CARD# NULL NULL BTREE
-def mysql proxy_priv 0 mysql PRIMARY 4 Proxied_User A #CARD# NULL NULL BTREE
+def mysql proxies_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
+def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
+def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
+def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE
+def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE
def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE
def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result
index d4d2c38c9ba..559a1f1f9f5 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result
@@ -73,7 +73,7 @@ def mysql PRIMARY mysql ndb_binlog_index
def mysql PRIMARY mysql plugin
def mysql PRIMARY mysql proc
def mysql PRIMARY mysql procs_priv
-def mysql PRIMARY mysql proxy_priv
+def mysql PRIMARY mysql proxies_priv
def mysql PRIMARY mysql servers
def mysql PRIMARY mysql tables_priv
def mysql PRIMARY mysql time_zone
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
index 38e9c9034c9..bca333b6387 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
@@ -23,7 +23,7 @@ def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
def mysql PRIMARY mysql procs_priv PRIMARY KEY
-def mysql PRIMARY mysql proxy_priv PRIMARY KEY
+def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
index ae512327807..7db87c4215a 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
@@ -336,7 +336,7 @@ user_comment Procedure privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
-TABLE_NAME proxy_priv
+TABLE_NAME proxies_priv
TABLE_TYPE BASE TABLE
ENGINE MyISAM
VERSION 10
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
index 096cbd1261e..0a117c830ee 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
@@ -111,10 +111,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
+DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index 03505af95c5..3f303ef607f 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -354,8 +354,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
@@ -365,8 +363,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
index 096cbd1261e..0a117c830ee 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
@@ -111,10 +111,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
+DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index 03505af95c5..3f303ef607f 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -354,8 +354,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
@@ -365,8 +363,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
-Warnings:
-Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
index 4ecca63351d..0695a0724d8 100644
--- a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
+++ b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
@@ -117,15 +117,15 @@ create user 'user_1'@'localhost';
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+--disable_warnings
+DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
+DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
+--enable_warnings
+
# disconnect default;
connect (user2, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
---disable_warnings
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
---enable_warnings
-
delimiter //;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc
deleted file mode 100644
index 7054e196153..00000000000
--- a/mysql-test/suite/ibmdb2i/include/have_i54.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Check for IBM i 6.1 or later
---disable_query_log
-system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
---disable_warnings
-drop table if exists uname_vr;
---enable_warnings
-create temporary table uname_vr (r int, v int);
---disable_warnings
-eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
---enable_warnings
-let $ok = `select count(*) from uname_vr where v = 5 and r = 4`;
-drop table uname_vr;
-remove_file $MYSQLTEST_VARDIR/tmp/version;
---enable_query_log
-if (!$ok)
-{
- skip "Need IBM i 5.4 or later";
-}
-
-
diff --git a/mysql-test/suite/ibmdb2i/include/have_i61.inc b/mysql-test/suite/ibmdb2i/include/have_i61.inc
deleted file mode 100644
index 84b9a17c1d8..00000000000
--- a/mysql-test/suite/ibmdb2i/include/have_i61.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Check for IBM i 6.1 or later
---disable_query_log
-system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
---disable_warnings
-drop table if exists uname_vr;
---enable_warnings
-create temporary table uname_vr (r int, v int);
---disable_warnings
-eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
---enable_warnings
-let $ok = `select count(*) from uname_vr where v > 5`;
-drop table uname_vr;
-remove_file $MYSQLTEST_VARDIR/tmp/version;
---enable_query_log
-if (!$ok)
-{
- skip "Need IBM i 6.1 or later";
-}
-
-
diff --git a/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc b/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc
deleted file mode 100644
index f3ef0b4f1ac..00000000000
--- a/mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-if (!`SELECT count(*) FROM information_schema.engines WHERE
- (support = 'YES' OR support = 'DEFAULT') AND
- engine = 'ibmdb2i'`)
-{
- skip Need ibmdb2i engine;
-}
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result
deleted file mode 100644
index ddf92db6bca..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result
+++ /dev/null
@@ -1,11 +0,0 @@
-create schema `A12345_@$#`;
-create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
-show create table `A12345_@$#`.t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=IBMDB2I DEFAULT CHARSET=latin1
-select * from `A12345_@$#`.t1;
-i
-drop table `A12345_@$#`.t1;
-drop schema `A12345_@$#`;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result
deleted file mode 100644
index 10a3070fcc4..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result
+++ /dev/null
@@ -1,4 +0,0 @@
-create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
-drop table t1;
-create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
deleted file mode 100644
index 8276b401073..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
+++ /dev/null
@@ -1,4 +0,0 @@
-create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
-ERROR HY000: Can't create table 'test.t1' (errno: 2504)
-create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
-ERROR HY000: Can't create table 'test.t1' (errno: 2504)
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
deleted file mode 100644
index 311e800e1b0..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
+++ /dev/null
@@ -1,18 +0,0 @@
-create table ABC (i int) engine=ibmdb2i;
-drop table ABC;
-create table `1234567890ABC` (i int) engine=ibmdb2i;
-drop table `1234567890ABC`;
-create table `!@#$%` (i int) engine=ibmdb2i;
-drop table `!@#$%`;
-create table `ABCD#########` (i int) engine=ibmdb2i;
-drop table `ABCD#########`;
-create table `_` (i int) engine=ibmdb2i;
-drop table `_`;
-create table `abc##def` (i int) engine=ibmdb2i;
-drop table `abc##def`;
-set names utf8;
-create table İ (s1 int) engine=ibmdb2i;
-drop table İ;
-create table İİ (s1 int) engine=ibmdb2i;
-drop table İİ;
-set names latin1;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result
deleted file mode 100644
index 916e1d93ee5..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45196.result
+++ /dev/null
@@ -1,33 +0,0 @@
-drop table if exists t1;
-create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
-insert into t1 values ("ch"),("h"),("i");
-select * from t1 order by c;
-c
-h
-ch
-i
-drop table t1;
-create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
-insert into t1 values ("ch"),("h"),("i");
-select * from t1 order by c;
-c
-h
-ch
-i
-drop table t1;
-create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
-insert into t1 values("abc"),("abcd"),("aaaa");
-select c from t1 order by c;
-c
-abc
-abcd
-aaaa
-drop table t1;
-create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
-insert into t1 values("abc"),("abcd"),("aaaa");
-select c from t1 order by c;
-c
-abc
-abcd
-aaaa
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result
deleted file mode 100644
index 2392b746877..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45793.result
+++ /dev/null
@@ -1,7 +0,0 @@
-drop table if exists t1;
-create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
-insert into t1 values ("test");
-select * from t1 order by c;
-c
-test
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result
deleted file mode 100644
index b9f4dcfc656..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result
+++ /dev/null
@@ -1,20 +0,0 @@
-set ibmdb2i_create_index_option=1;
-drop schema if exists test1;
-create schema test1;
-use test1;
-CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
-drop table t1;
-create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
-select * from fd;
-SQSSEQ
-*HEX
-*HEX
-*HEX
-*HEX
-drop table fd;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result
deleted file mode 100644
index d5bfc2579fd..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_49329.result
+++ /dev/null
@@ -1,9 +0,0 @@
-create table ABC (i int) engine=ibmdb2i;
-insert into ABC values(1);
-create table abc (i int) engine=ibmdb2i;
-insert into abc values (2);
-select * from ABC;
-i
-1
-drop table ABC;
-drop table abc;
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result
deleted file mode 100644
index 4f7d71cab2d..00000000000
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_collations.result
+++ /dev/null
@@ -1,1204 +0,0 @@
-drop table if exists t1, ffd, fd;
-CREATE TABLE t1 (armscii8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_bin engine=ibmdb2i;
-CREATE TABLE t1 (armscii8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (ascii_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (ascii_bin char(10) primary key) collate ascii_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ascii_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (ascii_general_ci char(10) primary key) collate ascii_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (big5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate big5_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (big5_bin char(10) primary key) collate big5_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (big5_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate big5_chinese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (big5_chinese_ci char(10) primary key) collate big5_chinese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1250_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1250_bin char(10) primary key) collate cp1250_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1250_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_croatian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1250_croatian_ci char(10) primary key) collate cp1250_croatian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1250_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_czech_cs engine=ibmdb2i;
-CREATE TABLE t1 (cp1250_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1250_general_ci char(10) primary key) collate cp1250_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1250_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_polish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1250_polish_ci char(10) primary key) collate cp1250_polish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1251_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1251_bin char(10) primary key) collate cp1251_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1251_bulgarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bulgarian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1251_bulgarian_ci char(10) primary key) collate cp1251_bulgarian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1251_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1251_general_ci char(10) primary key) collate cp1251_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1251_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_cs engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1251_general_cs char(10) primary key) collate cp1251_general_cs engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1251_ukrainian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_ukrainian_ci engine=ibmdb2i;
-CREATE TABLE t1 (cp1256_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1256_bin char(10) primary key) collate cp1256_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1256_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp1256_general_ci char(10) primary key) collate cp1256_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp1257_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_bin engine=ibmdb2i;
-CREATE TABLE t1 (cp1257_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (cp1257_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_lithuanian_ci engine=ibmdb2i;
-CREATE TABLE t1 (cp850_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp850_bin char(10) primary key) collate cp850_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp850_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp850_general_ci char(10) primary key) collate cp850_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp852_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp852_bin char(10) primary key) collate cp852_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp852_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (cp852_general_ci char(10) primary key) collate cp852_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp866_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_bin engine=ibmdb2i;
-CREATE TABLE t1 (cp866_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (cp932_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (cp932_bin char(10) primary key) collate cp932_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (cp932_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_japanese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (cp932_japanese_ci char(10) primary key) collate cp932_japanese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (dec8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_bin engine=ibmdb2i;
-CREATE TABLE t1 (dec8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_swedish_ci engine=ibmdb2i;
-CREATE TABLE t1 (eucjpms_bin integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_bin engine=ibmdb2i;
-CREATE TABLE t1 (eucjpms_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_japanese_ci engine=ibmdb2i;
-CREATE TABLE t1 (euckr_bin integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (euckr_bin char(10) primary key) collate euckr_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (euckr_korean_ci integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_korean_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (euckr_korean_ci char(10) primary key) collate euckr_korean_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (gb2312_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (gb2312_bin char(10) primary key) collate gb2312_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (gb2312_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_chinese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (gb2312_chinese_ci char(10) primary key) collate gb2312_chinese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (gbk_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (gbk_bin char(10) primary key) collate gbk_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (gbk_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_chinese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (gbk_chinese_ci char(10) primary key) collate gbk_chinese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (geostd8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_bin engine=ibmdb2i;
-CREATE TABLE t1 (geostd8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (greek_bin integer, c char(10), v varchar(20), index(c), index(v)) collate greek_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (greek_bin char(10) primary key) collate greek_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (greek_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate greek_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (greek_general_ci char(10) primary key) collate greek_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (hebrew_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (hebrew_bin char(10) primary key) collate hebrew_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (hebrew_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (hebrew_general_ci char(10) primary key) collate hebrew_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (hp8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_bin engine=ibmdb2i;
-CREATE TABLE t1 (hp8_english_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_english_ci engine=ibmdb2i;
-CREATE TABLE t1 (keybcs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_bin engine=ibmdb2i;
-CREATE TABLE t1 (keybcs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (koi8r_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_bin engine=ibmdb2i;
-CREATE TABLE t1 (koi8r_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (koi8u_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_bin engine=ibmdb2i;
-CREATE TABLE t1 (koi8u_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (latin1_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_bin char(10) primary key) collate latin1_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_danish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_danish_ci char(10) primary key) collate latin1_danish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_general_ci char(10) primary key) collate latin1_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_cs engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_general_cs char(10) primary key) collate latin1_general_cs engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_german1_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german1_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_german1_ci char(10) primary key) collate latin1_german1_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_german2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german2_ci engine=ibmdb2i;
-CREATE TABLE t1 (latin1_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_spanish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_spanish_ci char(10) primary key) collate latin1_spanish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin1_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_swedish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin1_swedish_ci char(10) primary key) collate latin1_swedish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin2_bin char(10) primary key) collate latin2_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin2_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_croatian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin2_croatian_ci char(10) primary key) collate latin2_croatian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin2_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_czech_cs engine=ibmdb2i;
-CREATE TABLE t1 (latin2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin2_general_ci char(10) primary key) collate latin2_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_hungarian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin2_hungarian_ci char(10) primary key) collate latin2_hungarian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin5_bin char(10) primary key) collate latin5_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin5_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_turkish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (latin5_turkish_ci char(10) primary key) collate latin5_turkish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (latin7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_bin engine=ibmdb2i;
-CREATE TABLE t1 (latin7_estonian_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_estonian_cs engine=ibmdb2i;
-CREATE TABLE t1 (latin7_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (latin7_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_cs engine=ibmdb2i;
-CREATE TABLE t1 (macce_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macce_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (macce_bin char(10) primary key) collate macce_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (macce_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macce_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (macce_general_ci char(10) primary key) collate macce_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (macroman_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_bin engine=ibmdb2i;
-CREATE TABLE t1 (macroman_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_general_ci engine=ibmdb2i;
-CREATE TABLE t1 (sjis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (sjis_bin char(10) primary key) collate sjis_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (sjis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_japanese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (sjis_japanese_ci char(10) primary key) collate sjis_japanese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (swe7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_bin engine=ibmdb2i;
-CREATE TABLE t1 (swe7_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_swedish_ci engine=ibmdb2i;
-CREATE TABLE t1 (tis620_bin integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (tis620_bin char(10) primary key) collate tis620_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (tis620_thai_ci integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_thai_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 11 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 23 NULL 6 Using where
-drop table t1;
-create table t1 (tis620_thai_ci char(10) primary key) collate tis620_thai_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_bin char(10) primary key) collate ucs2_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_czech_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_czech_ci char(10) primary key) collate ucs2_czech_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_danish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_danish_ci char(10) primary key) collate ucs2_danish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_esperanto_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_esperanto_ci char(10) primary key) collate ucs2_esperanto_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_estonian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_estonian_ci char(10) primary key) collate ucs2_estonian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_general_ci char(10) primary key) collate ucs2_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_hungarian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_hungarian_ci char(10) primary key) collate ucs2_hungarian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_icelandic_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_icelandic_ci char(10) primary key) collate ucs2_icelandic_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_latvian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_latvian_ci char(10) primary key) collate ucs2_latvian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_lithuanian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_lithuanian_ci char(10) primary key) collate ucs2_lithuanian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_persian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_persian_ci char(10) primary key) collate ucs2_persian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_polish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_polish_ci char(10) primary key) collate ucs2_polish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_romanian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_romanian_ci char(10) primary key) collate ucs2_romanian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_roman_ci engine=ibmdb2i;
-CREATE TABLE t1 (ucs2_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovak_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_slovak_ci char(10) primary key) collate ucs2_slovak_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovenian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_slovenian_ci char(10) primary key) collate ucs2_slovenian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish2_ci engine=ibmdb2i;
-CREATE TABLE t1 (ucs2_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_spanish_ci char(10) primary key) collate ucs2_spanish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_swedish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_swedish_ci char(10) primary key) collate ucs2_swedish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_turkish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_turkish_ci char(10) primary key) collate ucs2_turkish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ucs2_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_unicode_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 21 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 43 NULL 6 Using where
-drop table t1;
-create table t1 (ucs2_unicode_ci char(10) primary key) collate ucs2_unicode_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ujis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (ujis_bin char(10) primary key) collate ujis_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (ujis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_japanese_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (ujis_japanese_ci char(10) primary key) collate ujis_japanese_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_bin engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_bin char(10) primary key) collate utf8_bin engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_czech_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_czech_ci char(10) primary key) collate utf8_czech_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_danish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_danish_ci char(10) primary key) collate utf8_danish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_esperanto_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_esperanto_ci char(10) primary key) collate utf8_esperanto_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_estonian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_estonian_ci char(10) primary key) collate utf8_estonian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_general_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_general_ci char(10) primary key) collate utf8_general_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_hungarian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_hungarian_ci char(10) primary key) collate utf8_hungarian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_icelandic_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_icelandic_ci char(10) primary key) collate utf8_icelandic_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_latvian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_latvian_ci char(10) primary key) collate utf8_latvian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_lithuanian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_lithuanian_ci char(10) primary key) collate utf8_lithuanian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_persian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_persian_ci char(10) primary key) collate utf8_persian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_polish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_polish_ci char(10) primary key) collate utf8_polish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_romanian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_romanian_ci char(10) primary key) collate utf8_romanian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_roman_ci engine=ibmdb2i;
-CREATE TABLE t1 (utf8_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovak_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_slovak_ci char(10) primary key) collate utf8_slovak_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovenian_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_slovenian_ci char(10) primary key) collate utf8_slovenian_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish2_ci engine=ibmdb2i;
-CREATE TABLE t1 (utf8_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_spanish_ci char(10) primary key) collate utf8_spanish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_swedish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_swedish_ci char(10) primary key) collate utf8_swedish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_turkish_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_turkish_ci char(10) primary key) collate utf8_turkish_ci engine=ibmdb2i;
-drop table t1;
-CREATE TABLE t1 (utf8_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_unicode_ci engine=ibmdb2i;
-insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
-insert into t1 select * from t1;
-explain select c,v from t1 force index(c) where c like "ab%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 31 NULL 6 Using where
-explain select c,v from t1 force index(v) where v like "de%";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 63 NULL 6 Using where
-drop table t1;
-create table t1 (utf8_unicode_ci char(10) primary key) collate utf8_unicode_ci engine=ibmdb2i;
-drop table t1;
-create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
-create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
-create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
-insert into intermed (cs, ccsid) select * from ffd;
-create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
-insert into intermed2 (srtseq) select * from fd;
-select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
-ccsid cs srtseq
-500 "ascii_bin" QBLA101F4U
-500 "ascii_general_ci" QALA101F4S
-1200 "big5_bin" QBCHT04B0U
-1200 "big5_chinese_ci" QACHT04B0S
-1153 "cp1250_bin" QELA20481U
-1153 "cp1250_croatian_ci" QALA20481S
-1153 "cp1250_general_ci" QCLA20481S
-1153 "cp1250_polish_ci" QDLA20481S
-1025 "cp1251_bin" QCCYR0401U
-1025 "cp1251_bulgarian_ci QACYR0401S
-1025 "cp1251_general_ci" QBCYR0401S
-1025 "cp1251_general_cs" QBCYR0401U
-420 "cp1256_bin" QBARA01A4U
-420 "cp1256_general_ci" QAARA01A4S
-500 "cp850_bin" QDLA101F4U
-500 "cp850_general_ci" QCLA101F4S
-870 "cp852_bin" QBLA20366U
-870 "cp852_general_ci" QALA20366S
-1200 "cp932_bin" QBJPN04B0U
-1200 "cp932_japanese_ci" QAJPN04B0S
-1200 "euckr_bin" QBKOR04B0U
-1200 "euckr_korean_ci" QAKOR04B0S
-1200 "gb2312_bin" QBCHS04B0U
-1200 "gb2312_chinese_ci" QACHS04B0S
-1200 "gbk_bin" QDCHS04B0U
-1200 "gbk_chinese_ci" QCCHS04B0S
-875 "greek_bin" QBELL036BU
-875 "greek_general_ci" QAELL036BS
-424 "hebrew_bin" QBHEB01A8U
-424 "hebrew_general_ci" QAHEB01A8S
-1148 "latin1_bin" QFLA1047CU
-1148 "latin1_danish_ci" QALA1047CS
-1148 "latin1_general_ci" QBLA1047CS
-1148 "latin1_general_cs" QBLA1047CU
-1148 "latin1_german1_ci" QCLA1047CS
-1148 "latin1_spanish_ci" QDLA1047CS
-1148 "latin1_swedish_ci" QELA1047CS
-870 "latin2_bin" QGLA20366U
-870 "latin2_croatian_ci" QCLA20366S
-870 "latin2_general_ci" QELA20366S
-870 "latin2_hungarian_ci QFLA20366S
-1026 "latin5_bin" QBTRK0402U
-1026 "latin5_turkish_ci" QATRK0402S
-870 "macce_bin" QILA20366U
-870 "macce_general_ci" QHLA20366S
-1200 "sjis_bin" QDJPN04B0U
-1200 "sjis_japanese_ci" QCJPN04B0S
-838 "tis620_bin" QBTHA0346U
-838 "tis620_thai_ci" QATHA0346S
-13488 "ucs2_bin" *HEX
-13488 "ucs2_czech_ci" I34ACS_CZ
-13488 "ucs2_danish_ci" I34ADA_DK
-13488 "ucs2_esperanto_ci" I34AEO
-13488 "ucs2_estonian_ci" I34AET
-13488 "ucs2_general_ci" QAUCS04B0S
-13488 "ucs2_hungarian_ci" I34AHU
-13488 "ucs2_icelandic_ci" I34AIS
-13488 "ucs2_latvian_ci" I34ALV
-13488 "ucs2_lithuanian_ci" I34ALT
-13488 "ucs2_persian_ci" I34AFA
-13488 "ucs2_polish_ci" I34APL
-13488 "ucs2_romanian_ci" I34ARO
-13488 "ucs2_slovak_ci" I34ASK
-13488 "ucs2_slovenian_ci" I34ASL
-13488 "ucs2_spanish_ci" I34AES
-13488 "ucs2_swedish_ci" I34ASW
-13488 "ucs2_turkish_ci" I34ATR
-13488 "ucs2_unicode_ci" I34AEN
-1200 "ujis_bin" QFJPN04B0U
-1200 "ujis_japanese_ci" QEJPN04B0S
-1208 "utf8_bin" *HEX
-1208 "utf8_czech_ci" I34ACS_CZ
-1208 "utf8_danish_ci" I34ADA_DK
-1208 "utf8_esperanto_ci" I34AEO
-1208 "utf8_estonian_ci" I34AET
-1200 "utf8_general_ci" QAUCS04B0S
-1208 "utf8_hungarian_ci" I34AHU
-1208 "utf8_icelandic_ci" I34AIS
-1208 "utf8_latvian_ci" I34ALV
-1208 "utf8_lithuanian_ci" I34ALT
-1208 "utf8_persian_ci" I34AFA
-1208 "utf8_polish_ci" I34APL
-1208 "utf8_romanian_ci" I34ARO
-1208 "utf8_slovak_ci" I34ASK
-1208 "utf8_slovenian_ci" I34ASL
-1208 "utf8_spanish_ci" I34AES
-1208 "utf8_swedish_ci" I34ASW
-1208 "utf8_turkish_ci" I34ATR
-1208 "utf8_unicode_ci" I34AEN
-drop table ffd, fd;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test
deleted file mode 100644
index 09a7c75cfc0..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test
+++ /dev/null
@@ -1,9 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source include/have_case_sensitive_file_system.inc;
-
-create schema `A12345_@$#`;
-create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
-show create table `A12345_@$#`.t1;
-select * from `A12345_@$#`.t1;
-drop table `A12345_@$#`.t1;
-drop schema `A12345_@$#`;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test
deleted file mode 100644
index 9b033a2298f..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test
+++ /dev/null
@@ -1,9 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source suite/ibmdb2i/include/have_i61.inc;
-
-
-create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
-drop table t1;
-
-create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
deleted file mode 100644
index ea29b5abcd4..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source suite/ibmdb2i/include/have_ibmdb2i.inc
---source suite/ibmdb2i/include/have_i54.inc
-
---error 1005
-create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
-
---error 1005
-create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
deleted file mode 100644
index da69b5d9148..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
+++ /dev/null
@@ -1,28 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-
-# Test RCDFMT generation for a variety of kinds of table names
-create table ABC (i int) engine=ibmdb2i;
-drop table ABC;
-
-create table `1234567890ABC` (i int) engine=ibmdb2i;
-drop table `1234567890ABC`;
-
-create table `!@#$%` (i int) engine=ibmdb2i;
-drop table `!@#$%`;
-
-create table `ABCD#########` (i int) engine=ibmdb2i;
-drop table `ABCD#########`;
-
-create table `_` (i int) engine=ibmdb2i;
-drop table `_`;
-
-create table `abc##def` (i int) engine=ibmdb2i;
-drop table `abc##def`;
-
-set names utf8;
-create table İ (s1 int) engine=ibmdb2i;
-drop table İ;
-
-create table İİ (s1 int) engine=ibmdb2i;
-drop table İİ;
-set names latin1;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test
deleted file mode 100644
index 17b1d658975..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45196.test
+++ /dev/null
@@ -1,26 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source suite/ibmdb2i/include/have_i61.inc;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
-insert into t1 values ("ch"),("h"),("i");
-select * from t1 order by c;
-drop table t1;
-
-create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
-insert into t1 values ("ch"),("h"),("i");
-select * from t1 order by c;
-drop table t1;
-
-create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
-insert into t1 values("abc"),("abcd"),("aaaa");
-select c from t1 order by c;
-drop table t1;
-
-create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
-insert into t1 values("abc"),("abcd"),("aaaa");
-select c from t1 order by c;
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test
deleted file mode 100644
index 93fb78ff421..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45793.test
+++ /dev/null
@@ -1,11 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source suite/ibmdb2i/include/have_i61.inc;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
-insert into t1 values ("test");
-select * from t1 order by c;
-drop table t1;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test
deleted file mode 100644
index 695d8e90ada..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test
+++ /dev/null
@@ -1,47 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-
-# Confirm that ibmdb2i_create_index_option causes additional *HEX sorted indexes to be created for all non-binary keys.
-
-set ibmdb2i_create_index_option=1;
---disable_warnings
-drop schema if exists test1;
-create schema test1;
-use test1;
---enable_warnings
-
---disable_abort_on_error
---error 0,255
-exec system "DLTF QGPL/FDOUT" > /dev/null;
---enable_abort_on_error
-
-#No additional index because no string fields in key
-CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
---error 255
-exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
---error 255
-exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-drop table t1;
-
-#No additional index because binary sorting
-CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
---error 255
-exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
---error 255
-exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-drop table t1;
-
-CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
-exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-drop table t1;
-
-CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
-exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-exec system "DSPFD FILE(\"test1\"/\"i___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
-drop table t1;
-
-
-create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
-system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test1\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
-select * from fd;
-drop table fd;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test
deleted file mode 100644
index 615df284d8f..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_49329.test
+++ /dev/null
@@ -1,10 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source include/have_case_sensitive_file_system.inc;
-
-create table ABC (i int) engine=ibmdb2i;
-insert into ABC values(1);
-create table abc (i int) engine=ibmdb2i;
-insert into abc values (2);
-select * from ABC;
-drop table ABC;
-drop table abc;
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test
deleted file mode 100644
index 899f330d360..00000000000
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_collations.test
+++ /dev/null
@@ -1,44 +0,0 @@
-source suite/ibmdb2i/include/have_ibmdb2i.inc;
-source suite/ibmdb2i/include/have_i61.inc;
---disable_warnings
-drop table if exists t1, ffd, fd;
---enable_warnings
-
---disable_abort_on_error
---error 0,255
-exec system "DLTF QGPL/FFDOUT" > /dev/null;
---error 0,255
-exec system "DLTF QGPL/FDOUT" > /dev/null;
---enable_abort_on_error
-let $count= query_get_value(select count(*) from information_schema.COLLATIONS where COLLATION_NAME <> "binary", count(*),1);
-
-while ($count)
-{
- let $collation = query_get_value(select COLLATION_NAME from information_schema.COLLATIONS where COLLATION_NAME <> "binary" order by COLLATION_NAME desc, COLLATION_NAME, $count);
- error 0,1005,2504,2028;
- eval CREATE TABLE t1 ($collation integer, c char(10), v varchar(20), index(c), index(v)) collate $collation engine=ibmdb2i;
- if (!$mysql_errno)
- {
- insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
- insert into t1 select * from t1;
- explain select c,v from t1 force index(c) where c like "ab%";
- explain select c,v from t1 force index(v) where v like "de%";
- drop table t1;
- eval create table t1 ($collation char(10) primary key) collate $collation engine=ibmdb2i;
- system system "DSPFFD FILE(\"test\"/\"t1\") OUTPUT(*OUTFILE) OUTFILE(QGPL/FFDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
- system system "DSPFD FILE(\"test\"/\"t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
- drop table t1;
- }
- dec $count;
-}
-
-create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
-system system "CPYF FROMFILE(QGPL/FFDOUT) TOFILE(\"test\"/\"ffd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
-create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
-system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
-create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
-insert into intermed (cs, ccsid) select * from ffd;
-create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
-insert into intermed2 (srtseq) select * from fd;
-select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
-drop table ffd, fd;
diff --git a/mysql-test/suite/innodb/r/innodb-create-options.result b/mysql-test/suite/innodb/r/innodb-create-options.result
new file mode 100644
index 00000000000..aec9d731ce6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-create-options.result
@@ -0,0 +1,854 @@
+SET storage_engine=InnoDB;
+SET GLOBAL innodb_file_format=`Barracuda`;
+SET GLOBAL innodb_file_per_table=ON;
+SET SESSION innodb_strict_mode = ON;
+# Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
+# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+# 'FIXED' is sent to InnoDB since it is used by MyISAM.
+# But it is an invalid mode in InnoDB
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+# Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
+# KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+# Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1
+# Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+ALTER TABLE t1 KEY_BLOCK_SIZE=2;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+ALTER TABLE t1 KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED
+ALTER TABLE t1 KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=16
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=1
+# Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE
+# ALTER with each ROW_FORMAT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL,
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+# Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+# Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+# and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
+# and that they can be set to default values during strict mode.
+SET GLOBAL innodb_file_format=Antelope;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+Level Code Message
+ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+SET GLOBAL innodb_file_format=Barracuda;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SET GLOBAL innodb_file_format=Barracuda;
+# Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+# and a valid non-zero KEY_BLOCK_SIZE are rejected with
+# innodb_file_per_table=OFF and that they can be set to default
+# values during strict mode.
+SET GLOBAL innodb_file_per_table=OFF;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table 'test.t1' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Error 1005 Can't create table 'test.t1' (errno: 1478)
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+Level Code Message
+ALTER TABLE t1 KEY_BLOCK_SIZE=1;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+ALTER TABLE t1 ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+SET GLOBAL innodb_file_per_table=ON;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SET GLOBAL innodb_file_per_table=ON;
+##################################################
+SET SESSION innodb_strict_mode = OFF;
+# Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
+# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
+# 'FIXED' is sent to InnoDB since it is used by MyISAM.
+# It is an invalid mode in InnoDB, use COMPACT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
+Warnings:
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=FIXED
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
+Warnings:
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=FIXED
+# Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
+# KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT KEY_BLOCK_SIZE=1
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT KEY_BLOCK_SIZE=2
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC KEY_BLOCK_SIZE=4
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=8
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+# Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=FIXED KEY_BLOCK_SIZE=1
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT KEY_BLOCK_SIZE=2
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC KEY_BLOCK_SIZE=4
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT KEY_BLOCK_SIZE=8
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1
+# Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+ALTER TABLE t1 KEY_BLOCK_SIZE=2;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC KEY_BLOCK_SIZE=2
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2
+ALTER TABLE t1 KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=4
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed KEY_BLOCK_SIZE=8
+# Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE
+# ALTER with each ROW_FORMAT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL,
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Redundant row_format=REDUNDANT KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=16
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPACT
+# Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE, it defaults to 8
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact KEY_BLOCK_SIZE=15
+# Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
+valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT
+is reverted to Antelope and then used again when ROW_FORMAT=Barracuda.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPRESSED KEY_BLOCK_SIZE=1
+SET GLOBAL innodb_file_format=Barracuda;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=1
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=DYNAMIC
+SET GLOBAL innodb_file_format=Barracuda;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+# Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
+valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF
+and then used again when innodb_file_per_table=ON.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=COMPRESSED KEY_BLOCK_SIZE=2
+SET GLOBAL innodb_file_per_table=ON;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compressed row_format=COMPRESSED KEY_BLOCK_SIZE=2
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Compact row_format=DYNAMIC
+SET GLOBAL innodb_file_per_table=ON;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+# Cleanup
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result
index 18fdb63d889..a63ddff15ce 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-zip.result
@@ -84,8 +84,6 @@ test t8 Compact
test t9 Compact
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
alter table t1 row_format=dynamic;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@@ -191,16 +189,9 @@ set global innodb_file_per_table = on;
set global innodb_file_format = `1`;
set innodb_strict_mode = off;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
drop table t1;
set innodb_strict_mode = on;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 9;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show warnings;
@@ -219,6 +210,7 @@ create table t11(id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
+test t1 Compact
test t10 Compact
test t11 Redundant
test t3 Compressed
@@ -228,7 +220,7 @@ test t6 Compressed
test t7 Compressed
test t8 Compressed
test t9 Dynamic
-drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
+drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
create table t1 (id int primary key) engine = innodb
key_block_size = 8 row_format = compressed;
create table t2 (id int primary key) engine = innodb
@@ -254,16 +246,12 @@ Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Compressed
-drop table t1;
+test t5 Compressed
+drop table t1, t5;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
diff --git a/mysql-test/suite/innodb/r/innodb_bug53046.result b/mysql-test/suite/innodb/r/innodb_bug53046.result
new file mode 100644
index 00000000000..69be6c4e0a7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug53046.result
@@ -0,0 +1,27 @@
+CREATE TABLE bug53046_1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE bug53046_2 (c2 INT PRIMARY KEY,
+FOREIGN KEY (c2) REFERENCES bug53046_1(c1)
+ON UPDATE CASCADE ON DELETE CASCADE) ENGINE=INNODB;
+INSERT INTO bug53046_1 VALUES (1);
+INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+FROM bug53046_1;
+INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+FROM bug53046_1;
+INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+FROM bug53046_1;
+INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+FROM bug53046_1;
+INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+FROM bug53046_1;
+INSERT INTO bug53046_2 VALUES (1), (2);
+ANALYZE TABLE bug53046_1;
+Table Op Msg_type Msg_text
+test.bug53046_1 analyze status OK
+SHOW TABLE STATUS LIKE 'bug53046_1';
+UPDATE bug53046_1 SET c1 = c1 - 1;
+DELETE FROM bug53046_1;
+INSERT INTO bug53046_1 VALUES (1);
+INSERT INTO bug53046_2 VALUES (1);
+TRUNCATE TABLE bug53046_2;
+DROP TABLE bug53046_2;
+DROP TABLE bug53046_1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug54679.result b/mysql-test/suite/innodb/r/innodb_bug54679.result
deleted file mode 100644
index 948696fb31d..00000000000
--- a/mysql-test/suite/innodb/r/innodb_bug54679.result
+++ /dev/null
@@ -1,88 +0,0 @@
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET innodb_strict_mode=ON;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Compressed row_format=COMPRESSED
-ALTER TABLE bug54679 ADD COLUMN b INT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Compressed row_format=COMPRESSED
-DROP TABLE bug54679;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Compact
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Compressed KEY_BLOCK_SIZE=1
-ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 1478)
-DROP TABLE bug54679;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Redundant row_format=REDUNDANT
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug54679 Compressed row_format=REDUNDANT KEY_BLOCK_SIZE=2
-SET GLOBAL innodb_file_format=Antelope;
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table '#sql-temporary' (errno: 1478)
-ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 1478)
-DROP TABLE bug54679;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table 'test.bug54679' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.bug54679' (errno: 1478)
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
-SET GLOBAL innodb_file_format=Barracuda;
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 1478)
-ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 1478)
-DROP TABLE bug54679;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table 'test.bug54679' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table 'test.bug54679' (errno: 1478)
-SET GLOBAL innodb_file_per_table=ON;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-DROP TABLE bug54679;
diff --git a/mysql-test/suite/innodb/r/innodb_bug56143.result b/mysql-test/suite/innodb/r/innodb_bug56143.result
new file mode 100644
index 00000000000..1efec7e8887
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug56143.result
@@ -0,0 +1,556 @@
+SHOW CREATE TABLE bug56143_2;
+Table Create Table
+bug56143_2 CREATE TABLE `bug56143_2` (
+ `a` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa100` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa101` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa102` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa103` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa104` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa105` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa106` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa107` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa108` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa109` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa110` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa111` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa112` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa113` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa114` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa115` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa116` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa117` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa118` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa119` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa120` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa121` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa122` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa124` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa125` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa126` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa128` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa129` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa130` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa131` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa132` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa133` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa134` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa135` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa136` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa137` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa138` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa139` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa140` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa141` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa142` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa143` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa144` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa145` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa146` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa147` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa148` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa149` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa150` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa151` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa152` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa153` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa154` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa155` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa156` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa157` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa158` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa159` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa160` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa161` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa162` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa163` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa164` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa165` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa166` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa167` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa168` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa169` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa170` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa171` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa172` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa173` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa174` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa175` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa176` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa177` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa178` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa179` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa180` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa181` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa182` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa183` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa184` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa185` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa186` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa187` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa188` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa189` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa190` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa191` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa192` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa193` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa194` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa195` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa196` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa197` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa198` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa199` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa200` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa201` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa202` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa203` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa204` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa205` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa206` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa207` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa208` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa209` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa210` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa211` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa212` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa213` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa214` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa215` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa216` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa217` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa218` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa219` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa220` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa221` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa222` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa223` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa224` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa225` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa226` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa227` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa228` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa229` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa230` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa231` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa232` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa233` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa234` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa235` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa236` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa237` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa238` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa239` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa240` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa241` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa242` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa243` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa244` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa245` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa246` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa247` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa248` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa249` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa250` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa251` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa252` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa253` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa254` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa255` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa256` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa257` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa258` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa259` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa260` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa261` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa262` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa263` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa264` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa265` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa266` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa267` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa268` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa269` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa270` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa271` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa272` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa273` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa274` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa275` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa276` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa277` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa278` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa279` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa280` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa281` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa282` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa283` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa284` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa285` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa286` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa287` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa288` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa289` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa290` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa291` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa292` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa293` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa294` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa295` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa296` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa297` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa298` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa299` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa300` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa301` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa302` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa303` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa304` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa305` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa306` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa307` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa308` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa309` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa310` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa311` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa312` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa313` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa314` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa315` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa316` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa317` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa318` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa319` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa320` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa321` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa322` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa323` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa324` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa325` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa326` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa327` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa328` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa329` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa330` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa331` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa332` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa333` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa334` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa335` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa336` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa337` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa338` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa339` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa340` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa341` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa342` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa343` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa344` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa345` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa346` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa347` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa348` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa349` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa350` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa351` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa352` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa353` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa354` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa355` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa356` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa357` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa358` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa359` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa360` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa361` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa362` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa363` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa364` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa365` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa366` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa367` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa368` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa369` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa370` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa371` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa372` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa373` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa374` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa375` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa376` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa377` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa378` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa379` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa380` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa381` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa382` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa383` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa384` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa385` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa386` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa387` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa388` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa389` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa390` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa391` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa392` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa393` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa394` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa395` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa396` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa397` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa398` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa399` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa400` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa401` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa402` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa403` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa404` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa405` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa406` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa407` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa408` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa409` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa410` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa411` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa412` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa413` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa414` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa415` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa416` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa417` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa418` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa419` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa420` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa421` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa422` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa423` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa424` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa425` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa426` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa427` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa428` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa429` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa430` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa431` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa432` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa433` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa434` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa435` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa436` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa437` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa438` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa439` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa440` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa441` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa442` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa443` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa444` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa445` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa446` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa447` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa448` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa449` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa450` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa451` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa452` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa453` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa454` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa455` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa456` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa457` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa458` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa459` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa460` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa461` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa462` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa463` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa464` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa465` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa466` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa467` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa468` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa469` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa470` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa471` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa472` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa473` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa474` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa475` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa476` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa477` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa478` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa479` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa480` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa481` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa482` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa483` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa484` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa485` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa486` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa487` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa488` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa489` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa490` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa491` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa492` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa493` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa494` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa495` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa496` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa497` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa498` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa499` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa500` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa501` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa502` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa503` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa504` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa505` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa506` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa507` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa508` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa509` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa510` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa511` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa512` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa513` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa514` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa515` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa516` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa517` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa518` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa519` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa520` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa521` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa522` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa523` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa524` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa525` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa526` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa527` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa528` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa529` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa53` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa530` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa531` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa532` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa533` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa534` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa535` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa536` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa537` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa538` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa539` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa54` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa540` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa541` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa542` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa543` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa544` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa545` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa546` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa547` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa548` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa549` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa55` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa550` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa56` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa57` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa58` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa59` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa6` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa60` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa61` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa62` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa63` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa64` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa65` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa66` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa67` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa68` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa69` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa7` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa70` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa71` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa72` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa73` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa74` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa75` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa76` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa77` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa78` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa79` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa8` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa80` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa81` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa82` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa83` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa84` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa85` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa86` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa87` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa88` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa89` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa90` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa91` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa92` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa93` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa94` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa95` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa96` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa97` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa98` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa99` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
diff --git a/mysql-test/suite/innodb/r/innodb_bug56680.result b/mysql-test/suite/innodb/r/innodb_bug56680.result
new file mode 100644
index 00000000000..5e798b69167
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug56680.result
@@ -0,0 +1,109 @@
+SET GLOBAL tx_isolation='REPEATABLE-READ';
+SET GLOBAL innodb_file_format=Barracuda;
+SET GLOBAL innodb_file_per_table=on;
+CREATE TABLE bug56680(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(1),
+c INT,
+INDEX(b))
+ENGINE=InnoDB;
+INSERT INTO bug56680 VALUES(0,'x',1);
+BEGIN;
+SELECT b FROM bug56680;
+b
+x
+BEGIN;
+UPDATE bug56680 SET b='X';
+SELECT b FROM bug56680;
+b
+x
+SELECT * FROM bug56680;
+a b c
+1 x 1
+ROLLBACK;
+SELECT b FROM bug56680;
+b
+x
+SET GLOBAL tx_isolation='READ-UNCOMMITTED';
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+BEGIN;
+SELECT b FROM bug56680 LIMIT 2;
+b
+x
+x
+BEGIN;
+DELETE FROM bug56680 WHERE a=1;
+INSERT INTO bug56680 VALUES(1,'X',1);
+SELECT b FROM bug56680 LIMIT 3;
+b
+X
+x
+x
+SELECT b FROM bug56680 LIMIT 2;
+b
+x
+x
+CHECK TABLE bug56680;
+Table Op Msg_type Msg_text
+test.bug56680 check status OK
+ROLLBACK;
+SELECT b FROM bug56680 LIMIT 2;
+b
+x
+x
+CHECK TABLE bug56680;
+Table Op Msg_type Msg_text
+test.bug56680 check status OK
+SELECT b FROM bug56680 LIMIT 2;
+b
+x
+x
+CREATE TABLE bug56680_2(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b VARCHAR(2) CHARSET latin1 COLLATE latin1_german2_ci,
+c INT,
+INDEX(b))
+ENGINE=InnoDB;
+INSERT INTO bug56680_2 SELECT 0,_latin1 0xdf,c FROM bug56680;
+BEGIN;
+SELECT HEX(b) FROM bug56680_2 LIMIT 2;
+HEX(b)
+DF
+DF
+DELETE FROM bug56680_2 WHERE a=1;
+INSERT INTO bug56680_2 VALUES(1,'SS',1);
+SELECT HEX(b) FROM bug56680_2 LIMIT 3;
+HEX(b)
+5353
+DF
+DF
+CHECK TABLE bug56680_2;
+Table Op Msg_type Msg_text
+test.bug56680_2 check status OK
+ALTER TABLE bug56680_2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SELECT HEX(b) FROM bug56680_2 LIMIT 2;
+HEX(b)
+5353
+DF
+DELETE FROM bug56680_2 WHERE a=1;
+INSERT INTO bug56680_2 VALUES(1,_latin1 0xdf,1);
+SELECT HEX(b) FROM bug56680_2 LIMIT 3;
+HEX(b)
+DF
+DF
+DF
+CHECK TABLE bug56680_2;
+Table Op Msg_type Msg_text
+test.bug56680_2 check status OK
+DROP TABLE bug56680_2;
+DROP TABLE bug56680;
diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result
new file mode 100644
index 00000000000..b279069d834
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug56947.result
@@ -0,0 +1,8 @@
+SET @old_innodb_file_per_table=@@innodb_file_per_table;
+SET GLOBAL innodb_file_per_table=0;
+create table bug56947(a int not null) engine = innodb;
+CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB;
+alter table bug56947 add unique index (a);
+ERROR HY000: Table 'test.bug56947#1' already exists
+drop table `bug56947#1`;
+drop table bug56947;
diff --git a/mysql-test/suite/innodb/r/innodb_bug57252.result b/mysql-test/suite/innodb/r/innodb_bug57252.result
new file mode 100644
index 00000000000..efa50c742e0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug57252.result
@@ -0,0 +1,6 @@
+cardinality
+10
+Table Op Msg_type Msg_text
+test.bug57252 analyze status OK
+cardinality
+10
diff --git a/mysql-test/suite/innodb/r/innodb_bug57904.result b/mysql-test/suite/innodb/r/innodb_bug57904.result
new file mode 100755
index 00000000000..84868dcf46b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug57904.result
@@ -0,0 +1,41 @@
+CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
+price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB;
+CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
+product_category INT NOT NULL,
+product_id INT NOT NULL,
+customer_id INT NOT NULL,
+PRIMARY KEY(no),
+INDEX (product_category, product_id),
+FOREIGN KEY (product_category, product_id)
+REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT,
+INDEX (customer_id),
+FOREIGN KEY (customer_id)
+REFERENCES customer(id)
+) ENGINE=INNODB;
+SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA test
+CONSTRAINT_NAME product_order_ibfk_1
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA test
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE CASCADE
+DELETE_RULE RESTRICT
+TABLE_NAME product_order
+REFERENCED_TABLE_NAME product
+CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA test
+CONSTRAINT_NAME product_order_ibfk_2
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA test
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE RESTRICT
+DELETE_RULE RESTRICT
+TABLE_NAME product_order
+REFERENCED_TABLE_NAME customer
+DROP TABLE product_order;
+DROP TABLE product;
+DROP TABLE customer;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 5a52ba0ee54..7d96a4acf3f 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2622,6 +2622,47 @@ SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
ERROR 22007: Incorrect datetime value: '' for column 'NOW()' at row 2
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
+#
+# Bug#56862 Execution of a query that uses index merge returns a wrong result
+#
+CREATE TABLE t1 (
+pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a int,
+b int,
+INDEX idx(a))
+ENGINE=INNODB;
+INSERT INTO t1(a,b) VALUES
+(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
+(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
+(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
+(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
+INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
+INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
+INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1 VALUES (1000000, 0, 0);
+SET SESSION sort_buffer_size = 1024*36;
+EXPLAIN
+SELECT COUNT(*) FROM
+(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
+WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1536 Using sort_union(idx,PRIMARY); Using where
+SELECT COUNT(*) FROM
+(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
+WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
+COUNT(*)
+1537
+SET SESSION sort_buffer_size = DEFAULT;
+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-create-options.test b/mysql-test/suite/innodb/t/innodb-create-options.test
new file mode 100644
index 00000000000..3daa5f09e71
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-create-options.test
@@ -0,0 +1,575 @@
+# Tests for various combinations of ROW_FORMAT and KEY_BLOCK_SIZE
+# Related bugs;
+# Bug#54679: ALTER TABLE causes compressed row_format to revert to compact
+# Bug#56628: ALTER TABLE .. KEY_BLOCK_SIZE=0 produces untrue warning or unnecessary error
+# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED
+# Rules for interpreting CREATE_OPTIONS
+# 1) Create options on an ALTER are added to the options on the
+# previous CREATE or ALTER statements.
+# 2) KEY_BLOCK_SIZE=0 is considered a unspecified value.
+# If the current ROW_FORMAT has explicitly been set to COMPRESSED,
+# InnoDB will use a default value of 8. Otherwise KEY_BLOCK_SIZE
+# will not be used.
+# 3) ROW_FORMAT=DEFAULT allows InnoDB to choose its own default, COMPACT.
+# 4) ROW_FORMAT=DEFAULT and KEY_BLOCK_SIZE=0 can be used at any time to
+# unset or erase the values persisted in the MySQL dictionary and
+# by SHOW CTREATE TABLE.
+# 5) When incompatible values for ROW_FORMAT and KEY_BLOCK_SIZE are
+# both explicitly given, the ROW_FORMAT is always used in non-strict
+# mode.
+# 6) InnoDB will automatically convert a table to COMPRESSED only if a
+# valid non-zero KEY_BLOCK_SIZE has been given and ROW_FORMAT=DEFAULT
+# or has not been used on a previous CREATE TABLE or ALTER TABLE.
+# 7) InnoDB strict mode is designed to prevent incompatible create
+# options from being used together.
+# 8) The non-strict behavior is intended to permit you to import a
+# mysqldump file into a database that does not support compressed
+# tables, even if the source database contained compressed tables.
+# All invalid values and/or incompatible combinations of ROW_FORMAT
+# and KEY_BLOCK_SIZE are automatically corrected
+#
+# *** innodb_strict_mode=ON ***
+# 1) Valid ROW_FORMATs are COMPRESSED, COMPACT, DEFAULT, DYNAMIC
+# & REDUNDANT. All others are rejected.
+# 2) Valid KEY_BLOCK_SIZEs are 0,1,2,4,8,16. All others are rejected.
+# 3) KEY_BLOCK_SIZE=0 can be used to set it to 'unspecified'.
+# 4) KEY_BLOCK_SIZE=1,2,4,8 & 16 are incompatible with COMPACT, DYNAMIC &
+# REDUNDANT.
+# 5) KEY_BLOCK_SIZE=1,2,4,8 & 16 as well as ROW_FORMAT=COMPRESSED and
+# ROW_FORMAT=DYNAMIC are incompatible with innodb_file_format=Antelope
+# and innodb_file_per_table=OFF
+# 6) KEY_BLOCK_SIZE on an ALTER must occur with ROW_FORMAT=COMPRESSED
+# or ROW_FORMAT=DEFAULT if the ROW_FORMAT was previously specified
+# as COMPACT, DYNAMIC or REDUNDANT.
+# 7) KEY_BLOCK_SIZE on an ALTER can occur without a ROW_FORMAT if the
+# previous ROW_FORMAT was DEFAULT, COMPRESSED, or unspecified.
+#
+# *** innodb_strict_mode=OFF ***
+# 1. Ignore a bad KEY_BLOCK_SIZE, defaulting it to 8.
+# 2. Ignore a bad ROW_FORMAT, defaulting to COMPACT.
+# 3. Ignore a valid KEY_BLOCK_SIZE when an incompatible but valid
+# ROW_FORMAT is specified.
+# 4. If innodb_file_format=Antelope or innodb_file_per_table=OFF
+# it will ignore ROW_FORMAT=COMPRESSED or DYNAMIC and it will
+# ignore all non-zero KEY_BLOCK_SIZEs.
+#
+# See InnoDB documentation page "SQL Compression Syntax Warnings and Errors"
+
+-- source include/have_innodb.inc
+SET storage_engine=InnoDB;
+
+--disable_query_log
+# These values can change during the test
+LET $innodb_file_format_orig=`select @@innodb_file_format`;
+LET $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
+LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
+--enable_query_log
+
+SET GLOBAL innodb_file_format=`Barracuda`;
+SET GLOBAL innodb_file_per_table=ON;
+
+# The first half of these tests are with strict mode ON.
+SET SESSION innodb_strict_mode = ON;
+
+--echo # Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
+--echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
+DROP TABLE IF EXISTS t1;
+--echo # 'FIXED' is sent to InnoDB since it is used by MyISAM.
+--echo # But it is an invalid mode in InnoDB
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
+SHOW WARNINGS;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+
+--echo # Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
+--echo # KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC
+DROP TABLE IF EXISTS t1;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+--echo # Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+--echo # Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE=2;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE=4;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE
+--echo # ALTER with each ROW_FORMAT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW CREATE TABLE t1;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE.
+DROP TABLE IF EXISTS t1;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
+SHOW WARNINGS;
+
+--echo # Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
+--echo # and that they can be set to default values during strict mode.
+SET GLOBAL innodb_file_format=Antelope;
+DROP TABLE IF EXISTS t1;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+SET GLOBAL innodb_file_format=Barracuda;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET GLOBAL innodb_file_format=Antelope;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ADD COLUMN f1 INT;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SET GLOBAL innodb_file_format=Barracuda;
+
+--echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with
+--echo # innodb_file_per_table=OFF and that they can be set to default
+--echo # values during strict mode.
+SET GLOBAL innodb_file_per_table=OFF;
+DROP TABLE IF EXISTS t1;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE=1;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DEFAULT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_per_table=ON;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET GLOBAL innodb_file_per_table=OFF;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ADD COLUMN f1 INT;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SET GLOBAL innodb_file_per_table=ON;
+
+--echo ##################################################
+SET SESSION innodb_strict_mode = OFF;
+
+--echo # Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
+--echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
+--echo # 'FIXED' is sent to InnoDB since it is used by MyISAM.
+--echo # It is an invalid mode in InnoDB, use COMPACT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
+--echo # KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+--echo # Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT );
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+--echo # Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=8;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE
+--echo # ALTER with each ROW_FORMAT
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE, it defaults to 8
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
+--echo valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT
+--echo is reverted to Antelope and then used again when ROW_FORMAT=Barracuda.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_format=Barracuda;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_format=Barracuda;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+--echo # Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
+--echo valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF
+--echo and then used again when innodb_file_per_table=ON.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_per_table=ON;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SET GLOBAL innodb_file_per_table=ON;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+
+
+--echo # Cleanup
+DROP TABLE IF EXISTS t1;
+
+--disable_query_log
+EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
+EVAL SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
+EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
+EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
+--enable_query_log
+
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test
index 8e00a8b019b..2b4631f83db 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-zip.test
@@ -176,9 +176,7 @@ set innodb_strict_mode = on;
#Test different values of KEY_BLOCK_SIZE
---error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 0;
-show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 9;
@@ -199,7 +197,7 @@ create table t11(id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
-drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
+drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
create table t1 (id int primary key) engine = innodb
@@ -220,14 +218,12 @@ create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
show warnings;
---error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-show warnings;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
-drop table t1;
+drop table t1, t5;
#test multiple errors
--error ER_CANT_CREATE_TABLE
diff --git a/mysql-test/suite/innodb/t/innodb_bug53046.test b/mysql-test/suite/innodb/t/innodb_bug53046.test
new file mode 100644
index 00000000000..77f0a638728
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug53046.test
@@ -0,0 +1,48 @@
+#
+# http://bugs.mysql.com/53046
+# dict_update_statistics_low can still be run concurrently on same table
+#
+# This is a symbolic test, it would not fail if the bug is present.
+# Rather those SQL commands have been used during manual testing under
+# UNIV_DEBUG & UNIV_SYNC_DEBUG to test all changed codepaths for locking
+# correctness.
+#
+
+-- source include/have_innodb.inc
+
+CREATE TABLE bug53046_1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE bug53046_2 (c2 INT PRIMARY KEY,
+ FOREIGN KEY (c2) REFERENCES bug53046_1(c1)
+ ON UPDATE CASCADE ON DELETE CASCADE) ENGINE=INNODB;
+
+INSERT INTO bug53046_1 VALUES (1);
+let $i = 5;
+while ($i) {
+ eval INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1)
+ FROM bug53046_1;
+ dec $i;
+}
+
+INSERT INTO bug53046_2 VALUES (1), (2);
+
+# CREATE TABLE innodb_table_monitor (a int) ENGINE=INNODB;
+# wait more than 1 minute and observe the mysqld output
+# DROP TABLE innodb_table_monitor;
+
+ANALYZE TABLE bug53046_1;
+
+# this prints create time and other nondeterministic data
+-- disable_result_log
+SHOW TABLE STATUS LIKE 'bug53046_1';
+-- enable_result_log
+
+UPDATE bug53046_1 SET c1 = c1 - 1;
+
+DELETE FROM bug53046_1;
+
+INSERT INTO bug53046_1 VALUES (1);
+INSERT INTO bug53046_2 VALUES (1);
+TRUNCATE TABLE bug53046_2;
+
+DROP TABLE bug53046_2;
+DROP TABLE bug53046_1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug54679.test b/mysql-test/suite/innodb/t/innodb_bug54679.test
deleted file mode 100644
index c5e308acb5e..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug54679.test
+++ /dev/null
@@ -1,101 +0,0 @@
-# Test Bug #54679 alter table causes compressed row_format to revert to compact
-
---source include/have_innodb.inc
-
-let $file_format=`select @@innodb_file_format`;
-let $file_format_max=`select @@innodb_file_format_max`;
-let $file_per_table=`select @@innodb_file_per_table`;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET innodb_strict_mode=ON;
-
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
-# The ROW_FORMAT of the table should be preserved when it is not specified
-# in ALTER TABLE.
-ALTER TABLE bug54679 ADD COLUMN b INT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
-DROP TABLE bug54679;
-
-# Check that the ROW_FORMAT conversion to/from COMPRESSED works.
-
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
-# KEY_BLOCK_SIZE implies COMPRESSED.
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
-DROP TABLE bug54679;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
-WHERE TABLE_NAME='bug54679';
-
-# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables.
-SET GLOBAL innodb_file_format=Antelope;
-
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
-DROP TABLE bug54679;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
-
-SET GLOBAL innodb_file_format=Barracuda;
-# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace
-# cannot be compressed.
-SET GLOBAL innodb_file_per_table=OFF;
-
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
-DROP TABLE bug54679;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-SHOW WARNINGS;
-SET GLOBAL innodb_file_per_table=ON;
-CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-DROP TABLE bug54679;
-
-# restore original values, quietly so the test does not fail if those
-# defaults are changed
--- disable_query_log
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_format_max=$file_format_max;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
--- enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug56143.test b/mysql-test/suite/innodb/t/innodb_bug56143.test
new file mode 100644
index 00000000000..3b46f7e1621
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug56143.test
@@ -0,0 +1,581 @@
+#
+# Bug#56143 too many foreign keys causes output of show create table to become invalid
+# http://bugs.mysql.com/56143
+#
+
+-- source include/have_innodb.inc
+
+-- disable_query_log
+-- disable_result_log
+
+SET foreign_key_checks=0;
+
+DROP TABLE IF EXISTS bug56143_1;
+DROP TABLE IF EXISTS bug56143_2;
+
+CREATE TABLE bug56143_1 (a INT, KEY(a)) ENGINE=INNODB;
+
+CREATE TABLE `bug56143_2` (
+ `a` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa100` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa101` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa102` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa103` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa104` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa105` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa106` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa107` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa108` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa109` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa110` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa111` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa112` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa113` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa114` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa115` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa116` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa117` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa118` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa119` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa120` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa121` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa122` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa124` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa125` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa126` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa128` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa129` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa130` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa131` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa132` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa133` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa134` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa135` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa136` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa137` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa138` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa139` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa140` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa141` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa142` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa143` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa144` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa145` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa146` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa147` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa148` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa149` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa150` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa151` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa152` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa153` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa154` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa155` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa156` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa157` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa158` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa159` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa160` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa161` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa162` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa163` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa164` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa165` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa166` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa167` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa168` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa169` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa170` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa171` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa172` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa173` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa174` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa175` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa176` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa177` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa178` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa179` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa180` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa181` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa182` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa183` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa184` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa185` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa186` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa187` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa188` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa189` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa190` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa191` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa192` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa193` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa194` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa195` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa196` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa197` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa198` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa199` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa200` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa201` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa202` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa203` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa204` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa205` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa206` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa207` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa208` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa209` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa210` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa211` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa212` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa213` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa214` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa215` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa216` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa217` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa218` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa219` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa220` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa221` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa222` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa223` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa224` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa225` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa226` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa227` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa228` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa229` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa230` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa231` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa232` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa233` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa234` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa235` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa236` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa237` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa238` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa239` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa240` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa241` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa242` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa243` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa244` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa245` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa246` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa247` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa248` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa249` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa250` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa251` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa252` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa253` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa254` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa255` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa256` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa257` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa258` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa259` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa260` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa261` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa262` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa263` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa264` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa265` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa266` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa267` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa268` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa269` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa270` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa271` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa272` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa273` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa274` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa275` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa276` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa277` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa278` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa279` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa280` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa281` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa282` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa283` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa284` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa285` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa286` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa287` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa288` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa289` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa290` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa291` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa292` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa293` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa294` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa295` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa296` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa297` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa298` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa299` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa300` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa301` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa302` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa303` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa304` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa305` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa306` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa307` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa308` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa309` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa310` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa311` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa312` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa313` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa314` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa315` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa316` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa317` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa318` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa319` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa320` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa321` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa322` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa323` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa324` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa325` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa326` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa327` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa328` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa329` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa330` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa331` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa332` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa333` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa334` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa335` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa336` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa337` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa338` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa339` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa340` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa341` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa342` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa343` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa344` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa345` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa346` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa347` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa348` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa349` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa350` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa351` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa352` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa353` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa354` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa355` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa356` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa357` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa358` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa359` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa360` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa361` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa362` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa363` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa364` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa365` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa366` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa367` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa368` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa369` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa370` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa371` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa372` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa373` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa374` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa375` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa376` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa377` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa378` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa379` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa380` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa381` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa382` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa383` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa384` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa385` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa386` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa387` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa388` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa389` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa390` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa391` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa392` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa393` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa394` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa395` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa396` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa397` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa398` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa399` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa400` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa401` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa402` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa403` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa404` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa405` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa406` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa407` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa408` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa409` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa410` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa411` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa412` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa413` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa414` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa415` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa416` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa417` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa418` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa419` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa420` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa421` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa422` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa423` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa424` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa425` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa426` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa427` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa428` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa429` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa430` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa431` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa432` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa433` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa434` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa435` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa436` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa437` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa438` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa439` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa440` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa441` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa442` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa443` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa444` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa445` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa446` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa447` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa448` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa449` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa450` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa451` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa452` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa453` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa454` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa455` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa456` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa457` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa458` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa459` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa460` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa461` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa462` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa463` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa464` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa465` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa466` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa467` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa468` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa469` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa470` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa471` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa472` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa473` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa474` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa475` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa476` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa477` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa478` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa479` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa480` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa481` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa482` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa483` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa484` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa485` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa486` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa487` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa488` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa489` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa490` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa491` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa492` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa493` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa494` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa495` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa496` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa497` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa498` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa499` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa500` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa501` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa502` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa503` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa504` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa505` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa506` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa507` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa508` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa509` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa510` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa511` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa512` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa513` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa514` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa515` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa516` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa517` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa518` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa519` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa520` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa521` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa522` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa523` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa524` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa525` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa526` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa527` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa528` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa529` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa53` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa530` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa531` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa532` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa533` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa534` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa535` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa536` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa537` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa538` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa539` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa54` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa540` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa541` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa542` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa543` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa544` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa545` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa546` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa547` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa548` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa549` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa55` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa550` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa56` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa57` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa58` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa59` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa6` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa60` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa61` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa62` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa63` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa64` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa65` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa66` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa67` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa68` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa69` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa7` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa70` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa71` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa72` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa73` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa74` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa75` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa76` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa77` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa78` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa79` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa8` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa80` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa81` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa82` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa83` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa84` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa85` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa86` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa87` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa88` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa89` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa90` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa91` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa92` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa93` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa94` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa95` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa96` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa97` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa98` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL,
+ CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa99` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL
+) ENGINE=InnoDB;
+
+-- enable_query_log
+-- enable_result_log
+
+SHOW CREATE TABLE bug56143_2;
+
+-- disable_query_log
+-- disable_result_log
+DROP TABLE bug56143_1;
+DROP TABLE bug56143_2;
diff --git a/mysql-test/suite/innodb/t/innodb_bug56680.test b/mysql-test/suite/innodb/t/innodb_bug56680.test
new file mode 100644
index 00000000000..48723195141
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug56680.test
@@ -0,0 +1,142 @@
+#
+# Bug #56680 InnoDB may return wrong results from a case-insensitive index
+#
+-- source include/have_innodb.inc
+
+-- disable_query_log
+SET @tx_isolation_orig = @@tx_isolation;
+SET @innodb_file_per_table_orig = @@innodb_file_per_table;
+SET @innodb_file_format_orig = @@innodb_file_format;
+SET @innodb_file_format_max_orig = @@innodb_file_format_max;
+# The flag innodb_change_buffering_debug is only available in debug builds.
+# It instructs InnoDB to try to evict pages from the buffer pool when
+# change buffering is possible, so that the change buffer will be used
+# whenever possible.
+-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
+SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
+-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
+SET GLOBAL innodb_change_buffering_debug = 1;
+-- enable_query_log
+SET GLOBAL tx_isolation='REPEATABLE-READ';
+SET GLOBAL innodb_file_format=Barracuda;
+SET GLOBAL innodb_file_per_table=on;
+
+CREATE TABLE bug56680(
+ a INT AUTO_INCREMENT PRIMARY KEY,
+ b CHAR(1),
+ c INT,
+ INDEX(b))
+ENGINE=InnoDB;
+
+INSERT INTO bug56680 VALUES(0,'x',1);
+BEGIN;
+SELECT b FROM bug56680;
+
+connect (con1,localhost,root,,);
+connection con1;
+BEGIN;
+UPDATE bug56680 SET b='X';
+
+connection default;
+# This should return the last committed value 'x', but would return 'X'
+# due to a bug in row_search_for_mysql().
+SELECT b FROM bug56680;
+# This would always return the last committed value 'x'.
+SELECT * FROM bug56680;
+
+connection con1;
+ROLLBACK;
+disconnect con1;
+
+connection default;
+
+SELECT b FROM bug56680;
+
+# For the rest of this test, use the READ UNCOMMITTED isolation level
+# to see what exists in the secondary index.
+SET GLOBAL tx_isolation='READ-UNCOMMITTED';
+
+# Create enough rows for the table, so that the insert buffer will be
+# used for modifying the secondary index page. There must be multiple
+# index pages, because changes to the root page are never buffered.
+
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
+
+BEGIN;
+SELECT b FROM bug56680 LIMIT 2;
+
+connect (con1,localhost,root,,);
+connection con1;
+BEGIN;
+DELETE FROM bug56680 WHERE a=1;
+# This should be buffered, if innodb_change_buffering_debug = 1 is in effect.
+INSERT INTO bug56680 VALUES(1,'X',1);
+
+# This should force an insert buffer merge, and return 'X' in the first row.
+SELECT b FROM bug56680 LIMIT 3;
+
+connection default;
+SELECT b FROM bug56680 LIMIT 2;
+CHECK TABLE bug56680;
+
+connection con1;
+ROLLBACK;
+SELECT b FROM bug56680 LIMIT 2;
+CHECK TABLE bug56680;
+
+connection default;
+disconnect con1;
+
+SELECT b FROM bug56680 LIMIT 2;
+
+CREATE TABLE bug56680_2(
+ a INT AUTO_INCREMENT PRIMARY KEY,
+ b VARCHAR(2) CHARSET latin1 COLLATE latin1_german2_ci,
+ c INT,
+ INDEX(b))
+ENGINE=InnoDB;
+
+INSERT INTO bug56680_2 SELECT 0,_latin1 0xdf,c FROM bug56680;
+
+BEGIN;
+SELECT HEX(b) FROM bug56680_2 LIMIT 2;
+DELETE FROM bug56680_2 WHERE a=1;
+# This should be buffered, if innodb_change_buffering_debug = 1 is in effect.
+INSERT INTO bug56680_2 VALUES(1,'SS',1);
+
+# This should force an insert buffer merge, and return 'SS' in the first row.
+SELECT HEX(b) FROM bug56680_2 LIMIT 3;
+CHECK TABLE bug56680_2;
+
+# Test this with compressed tables.
+ALTER TABLE bug56680_2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+
+SELECT HEX(b) FROM bug56680_2 LIMIT 2;
+DELETE FROM bug56680_2 WHERE a=1;
+# This should be buffered, if innodb_change_buffering_debug = 1 is in effect.
+INSERT INTO bug56680_2 VALUES(1,_latin1 0xdf,1);
+
+# This should force an insert buffer merge, and return 0xdf in the first row.
+SELECT HEX(b) FROM bug56680_2 LIMIT 3;
+CHECK TABLE bug56680_2;
+
+DROP TABLE bug56680_2;
+DROP TABLE bug56680;
+
+-- disable_query_log
+SET GLOBAL tx_isolation = @tx_isolation_orig;
+SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig;
+SET GLOBAL innodb_file_format = @innodb_file_format_orig;
+SET GLOBAL innodb_file_format_max = @innodb_file_format_max_orig;
+-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
+SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig;
diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test
new file mode 100644
index 00000000000..e11f39b97a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug56947.test
@@ -0,0 +1,16 @@
+#
+# Bug #56947 valgrind reports a memory leak in innodb-plugin.innodb-index
+#
+-- source include/have_innodb.inc
+
+SET @old_innodb_file_per_table=@@innodb_file_per_table;
+# avoid a message about filed *.ibd file creation in the error log
+SET GLOBAL innodb_file_per_table=0;
+create table bug56947(a int not null) engine = innodb;
+CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB;
+--error 156
+alter table bug56947 add unique index (a);
+drop table `bug56947#1`;
+drop table bug56947;
+--disable_query_log
+SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb_bug57252.test b/mysql-test/suite/innodb/t/innodb_bug57252.test
new file mode 100644
index 00000000000..04c3ed0cea7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug57252.test
@@ -0,0 +1,46 @@
+#
+# Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
+# http://bugs.mysql.com/57252
+#
+
+-- source include/have_innodb.inc
+
+-- disable_query_log
+-- disable_result_log
+
+SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
+
+CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB;
+
+BEGIN;
+let $i = 10;
+while ($i) {
+ eval INSERT INTO bug57252 VALUES ($i);
+ dec $i;
+}
+COMMIT;
+
+-- enable_result_log
+
+SET GLOBAL innodb_stats_on_metadata=0;
+
+# this calls ::info() without HA_STATUS_CONST and so
+# index->stat_n_diff_key_vals[] is not copied to the mysql-visible
+# rec_per_key
+SELECT cardinality FROM information_schema.statistics
+WHERE table_name='bug57252' AND index_name='akey';
+
+# this calls ::info() with HA_STATUS_CONST and so
+# index->stat_n_diff_key_vals[] is copied to the mysql-visible
+# rec_per_key at the end; when the bug is present dict_update_statistics()
+# is not called beforehand and so index->stat_n_diff_key_vals[] contains
+# an outdated data and thus we get an outdated data in the result when the
+# bug is present
+ANALYZE TABLE bug57252;
+
+SELECT cardinality FROM information_schema.statistics
+WHERE table_name='bug57252' AND index_name='akey';
+
+DROP TABLE bug57252;
+
+SET GLOBAL innodb_stats_on_metadata = @innodb_stats_on_metadata_orig;
diff --git a/mysql-test/suite/innodb/t/innodb_bug57904.test b/mysql-test/suite/innodb/t/innodb_bug57904.test
new file mode 100755
index 00000000000..d283ad11c3a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug57904.test
@@ -0,0 +1,27 @@
+#
+# Bug #57904 Missing constraint from information schema REFERENTIAL_CONSTRAINTS table
+#
+-- source include/have_innodb.inc
+
+CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
+ price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB;
+CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
+ product_category INT NOT NULL,
+ product_id INT NOT NULL,
+ customer_id INT NOT NULL,
+ PRIMARY KEY(no),
+ INDEX (product_category, product_id),
+ FOREIGN KEY (product_category, product_id)
+ REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT,
+ INDEX (customer_id),
+ FOREIGN KEY (customer_id)
+ REFERENCES customer(id)
+ ) ENGINE=INNODB;
+
+query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+
+DROP TABLE product_order;
+DROP TABLE product;
+DROP TABLE customer;
+
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 052db7d789a..acc843341eb 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -786,6 +786,49 @@ CREATE TABLE t2
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
+--echo #
+--echo # Bug#56862 Execution of a query that uses index merge returns a wrong result
+--echo #
+
+CREATE TABLE t1 (
+ pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a int,
+ b int,
+ INDEX idx(a))
+ENGINE=INNODB;
+
+INSERT INTO t1(a,b) VALUES
+ (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
+ (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
+ (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
+ (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
+INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
+INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
+INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1(a,b) SELECT a,b FROM t1;
+INSERT INTO t1 VALUES (1000000, 0, 0);
+
+SET SESSION sort_buffer_size = 1024*36;
+
+EXPLAIN
+SELECT COUNT(*) FROM
+ (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
+ WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
+
+SELECT COUNT(*) FROM
+ (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
+ WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
+
+SET SESSION sort_buffer_size = DEFAULT;
+
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc
index 102e57d3d04..034460d49ac 100644
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc
@@ -105,6 +105,30 @@ OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+if (!$skip_update)
+{
+eval CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+ UNIQUE KEY (a))
+ENGINE=$engine;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+SET INSERT_ID = 1;
+}
+
-- echo # Simple test with NULL
eval CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -831,5 +855,30 @@ SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
+if (!$skip_update)
+{
+eval CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+ UNIQUE KEY (a))
+ENGINE=$engine
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+}
+
+
--echo ##############################################################################
}
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
index d6ea8ba0fe4..2344f03ce3f 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
@@ -120,6 +120,38 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Blackhole';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
index 4cd7aa57417..5fd576322d5 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='InnoDB';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1023,4 +1059,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='InnoDB'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result
index 1a27d1c2e52..c3a5073b029 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result
@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Memory';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1051,4 +1087,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Memory'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
index 9885c78a921..ad440155d33 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='MyISAM';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1070,4 +1106,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='MyISAM'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/perfschema/include/binlog_common.inc b/mysql-test/suite/perfschema/include/binlog_common.inc
index 10afe54ab5b..96c01d9a4c8 100644
--- a/mysql-test/suite/perfschema/include/binlog_common.inc
+++ b/mysql-test/suite/perfschema/include/binlog_common.inc
@@ -17,12 +17,12 @@
RESET MASTER;
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
+update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
-select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
+select count(*) > 0 from performance_schema.events_waits_current;
--disable_warnings
drop table if exists test.t1;
@@ -33,16 +33,16 @@ create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
- select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
+ select thread_id from performance_schema.events_waits_current;
insert into test.t2
- select name from performance_schema.SETUP_INSTRUMENTS
+ select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
drop table test.t1;
drop table test.t2;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
--source include/show_binlog_events.inc
diff --git a/mysql-test/suite/perfschema/include/cleanup_helper.inc b/mysql-test/suite/perfschema/include/cleanup_helper.inc
index 5c2429ddb97..b7e37849f78 100644
--- a/mysql-test/suite/perfschema/include/cleanup_helper.inc
+++ b/mysql-test/suite/perfschema/include/cleanup_helper.inc
@@ -15,7 +15,7 @@
# Tests for PERFORMANCE_SCHEMA
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
disconnect con1;
disconnect con2;
diff --git a/mysql-test/suite/perfschema/include/privilege.inc b/mysql-test/suite/perfschema/include/privilege.inc
index ef2acc995d5..3973c41b51b 100644
--- a/mysql-test/suite/perfschema/include/privilege.inc
+++ b/mysql-test/suite/perfschema/include/privilege.inc
@@ -32,48 +32,48 @@ drop table if exists test.t1;
## drop table performance_schema.t1;
##
## --error ER_DBACCESS_DENIED_ERROR
-## create table performance_schema.SETUP_INSTRUMENTS(a int);
+## create table performance_schema.setup_instruments(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
-## create table performance_schema.EVENTS_WAITS_CURRENT(a int);
+## create table performance_schema.events_waits_current(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
-## create table performance_schema.FILE_INSTANCES(a int);
+## create table performance_schema.file_instances(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
-## drop table performance_schema.SETUP_INSTRUMENTS;
+## drop table performance_schema.setup_instruments;
##
## --error ER_DBACCESS_DENIED_ERROR
-## drop table performance_schema.EVENTS_WAITS_CURRENT;
+## drop table performance_schema.events_waits_current;
##
## --error ER_DBACCESS_DENIED_ERROR
-## drop table performance_schema.FILE_INSTANCES;
+## drop table performance_schema.file_instances;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
+rename table performance_schema.setup_instruments to test.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
+rename table performance_schema.events_waits_current to test.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.FILE_INSTANCES to test.t1;
+rename table performance_schema.file_instances to test.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
+rename table performance_schema.setup_instruments to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
+rename table performance_schema.events_waits_current to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
+rename table performance_schema.file_instances to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.SETUP_INSTRUMENTS
- to performance_schema.EVENTS_WAITS_CURRENT;
+rename table performance_schema.setup_instruments
+ to performance_schema.events_waits_current;
--error ER_DBACCESS_DENIED_ERROR
-rename table performance_schema.EVENTS_WAITS_CURRENT
- to performance_schema.SETUP_INSTRUMENTS;
+rename table performance_schema.events_waits_current
+ to performance_schema.setup_instruments;
--error ER_DBACCESS_DENIED_ERROR
create procedure performance_schema.my_proc() begin end;
@@ -87,108 +87,93 @@ do begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_setup_instruments
- before insert on performance_schema.SETUP_INSTRUMENTS
+ before insert on performance_schema.setup_instruments
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_events_waits_current
- before insert on performance_schema.EVENTS_WAITS_CURRENT
+ before insert on performance_schema.events_waits_current
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_file_instances
- before insert on performance_schema.FILE_INSTANCES
+ before insert on performance_schema.file_instances
for each row begin end;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
--error ER_WRONG_PERFSCHEMA_USAGE
-create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
+create table test.t1 like performance_schema.setup_instruments;
--error ER_WRONG_PERFSCHEMA_USAGE
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
--error ER_WRONG_PERFSCHEMA_USAGE
-create table test.t1 like performance_schema.FILE_INSTANCES;
+create table test.t1 like performance_schema.file_instances;
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name="foo";
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_CURRENT
+insert into performance_schema.events_waits_current
set name="foo";
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.FILE_INSTANCES
+insert into performance_schema.file_instances
set name="foo";
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_INSTRUMENTS;
+delete from performance_schema.setup_instruments;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_CURRENT;
+delete from performance_schema.events_waits_current;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_INSTANCES;
+delete from performance_schema.file_instances;
-lock table performance_schema.SETUP_INSTRUMENTS read;
+lock table performance_schema.setup_instruments read;
unlock tables;
-lock table performance_schema.SETUP_INSTRUMENTS write;
+lock table performance_schema.setup_instruments write;
unlock tables;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-lock table performance_schema.EVENTS_WAITS_CURRENT read;
+lock table performance_schema.events_waits_current read;
unlock tables;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-lock table performance_schema.EVENTS_WAITS_CURRENT write;
+lock table performance_schema.events_waits_current write;
unlock tables;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-lock table performance_schema.FILE_INSTANCES read;
+lock table performance_schema.file_instances read;
unlock tables;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-lock table performance_schema.FILE_INSTANCES write;
+lock table performance_schema.file_instances write;
unlock tables;
--echo #
--echo # WL#4818, NFS2: Can use grants to give normal user access
---echo # to view data from _CURRENT and _HISTORY tables
+--echo # to view data from _current and _history tables
--echo #
--echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
---echo # (Except for EVENTS_WAITS_CURRENT, which is granted.)
+--echo # (Except for events_waits_current, which is granted.)
# Errors here will be caught by the diff afterwards
--disable_abort_on_error
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
-SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
--enable_abort_on_error
diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc
index 1c8d4e412d5..cdbfd81a24c 100644
--- a/mysql-test/suite/perfschema/include/setup_helper.inc
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc
@@ -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
@@ -19,24 +19,24 @@ let $MYSQLD_DATADIR= `select @@datadir`;
let $MYSQLD_TMPDIR= `select @@tmpdir`;
--disable_query_log
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_CONSUMERS set enabled='YES';
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_consumers set enabled='YES';
--enable_query_log
connect (con1, localhost, root, , );
-let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+let $con1_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
-let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+let $con2_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connect (con3, localhost, root, , );
-let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+let $con3_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connection default;
@@ -45,10 +45,10 @@ prepare stmt_dump_events from
"select event_name,
left(source, locate(\":\", source)) as short_source,
operation, number_of_bytes
- from performance_schema.EVENTS_WAITS_HISTORY_LONG
+ from performance_schema.events_waits_history_long
where thread_id=? order by event_id;";
prepare stmt_dump_thread from
- "select name from performance_schema.THREADS where thread_id=? ;";
+ "select name from performance_schema.threads where thread_id=? ;";
--enable_query_log
diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc
index 083b302c5f7..f6e549ea44e 100644
--- a/mysql-test/suite/perfschema/include/start_server_common.inc
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc
@@ -17,31 +17,31 @@
show databases;
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
-select count(*) from performance_schema.SETUP_CONSUMERS;
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.performance_timers;
+select count(*) from performance_schema.setup_consumers;
+select count(*) > 0 from performance_schema.setup_instruments;
+select count(*) from performance_schema.setup_timers;
# Make sure we don't crash, no matter what the starting parameters are
--disable_result_log
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
--enable_result_log
# This has a stable output, printing the result:
diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result
index c7ac05ba69d..edc7ce0bcca 100644
--- a/mysql-test/suite/perfschema/r/aggregate.result
+++ b/mysql-test/suite/perfschema/r/aggregate.result
@@ -1,87 +1,87 @@
"General cleanup"
drop table if exists t1;
-update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO';
-update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
-truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments set enabled = 'NO';
+update performance_schema.setup_consumers set enabled = 'NO';
+truncate table performance_schema.file_summary_by_event_name;
+truncate table performance_schema.file_summary_by_instance;
+truncate table performance_schema.events_waits_summary_global_by_event_name;
+truncate table performance_schema.events_waits_summary_by_instance;
+truncate table performance_schema.events_waits_summary_by_thread_by_event_name;
+update performance_schema.setup_consumers set enabled = 'YES';
+update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
create table t1 (
id INT PRIMARY KEY,
b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8);
-update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO';
-update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
+update performance_schema.setup_instruments SET enabled = 'NO';
+update performance_schema.setup_consumers set enabled = 'NO';
set @dump_all=FALSE;
"Verifying file aggregate consistency"
SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.COUNT_READ <> SUM(i.COUNT_READ))
OR @dump_all;
EVENT_NAME COUNT_READ SUM(i.COUNT_READ)
SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE))
OR @dump_all;
EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE)
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ))
OR @dump_all;
EVENT_NAME SUM_NUMBER_OF_BYTES_READ SUM(i.SUM_NUMBER_OF_BYTES_READ)
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE))
OR @dump_all;
EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
"Verifying waits aggregate consistency (instance)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT)
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
OR @dump_all;
EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT)
"Verifying waits aggregate consistency (thread)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT))
@@ -89,14 +89,14 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT)
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT))
OR @dump_all;
EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT)
-update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_consumers set enabled = 'YES';
+update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
drop table test.t1;
diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result
index 1e58179af51..b31b853b06d 100644
--- a/mysql-test/suite/perfschema/r/binlog_mix.result
+++ b/mysql-test/suite/perfschema/r/binlog_mix.result
@@ -1,11 +1,11 @@
set binlog_format=mixed;
RESET MASTER;
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
+update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
-select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
+select count(*) > 0 from performance_schema.events_waits_current;
count(*) > 0
1
drop table if exists test.t1;
@@ -13,18 +13,18 @@ drop table if exists test.t2;
create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
+select thread_id from performance_schema.events_waits_current;
insert into test.t2
-select name from performance_schema.SETUP_INSTRUMENTS
+select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
drop table test.t1;
drop table test.t2;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
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: # (performance_schema.SETUP_INSTRUMENTS)
+master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
@@ -43,7 +43,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS)
+master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result
index 28803c73a84..010f2de06e6 100644
--- a/mysql-test/suite/perfschema/r/binlog_row.result
+++ b/mysql-test/suite/perfschema/r/binlog_row.result
@@ -1,11 +1,11 @@
set binlog_format=row;
RESET MASTER;
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
+update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
-select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
+select count(*) > 0 from performance_schema.events_waits_current;
count(*) > 0
1
drop table if exists test.t1;
@@ -13,18 +13,18 @@ drop table if exists test.t2;
create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
+select thread_id from performance_schema.events_waits_current;
insert into test.t2
-select name from performance_schema.SETUP_INSTRUMENTS
+select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
drop table test.t1;
drop table test.t2;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
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: # (performance_schema.SETUP_INSTRUMENTS)
+master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
@@ -43,7 +43,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS)
+master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result
index 288eba4d3d6..60054ee8a74 100644
--- a/mysql-test/suite/perfschema/r/binlog_stmt.result
+++ b/mysql-test/suite/perfschema/r/binlog_stmt.result
@@ -1,14 +1,14 @@
set binlog_format=statement;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
RESET MASTER;
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
+update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
-select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
+select count(*) > 0 from performance_schema.events_waits_current;
count(*) > 0
1
drop table if exists test.t1;
@@ -16,24 +16,24 @@ drop table if exists test.t2;
create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
+select thread_id from performance_schema.events_waits_current;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
insert into test.t2
-select name from performance_schema.SETUP_INSTRUMENTS
+select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
drop table test.t1;
drop table test.t2;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
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`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
+master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%"
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
@@ -42,16 +42,16 @@ master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id intege
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into test.t1
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT
+select thread_id from performance_schema.events_waits_current
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into test.t2
-select name from performance_schema.SETUP_INSTRUMENTS
+select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%"
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%"
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/perfschema/r/checksum.result b/mysql-test/suite/perfschema/r/checksum.result
index 323cb303dae..587dead845a 100644
--- a/mysql-test/suite/perfschema/r/checksum.result
+++ b/mysql-test/suite/perfschema/r/checksum.result
@@ -1,34 +1,34 @@
-checksum table performance_schema.COND_INSTANCES;
-checksum table performance_schema.EVENTS_WAITS_CURRENT;
-checksum table performance_schema.EVENTS_WAITS_HISTORY;
-checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-checksum table performance_schema.FILE_INSTANCES;
-checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-checksum table performance_schema.MUTEX_INSTANCES;
-checksum table performance_schema.PERFORMANCE_TIMERS;
-checksum table performance_schema.RWLOCK_INSTANCES;
-checksum table performance_schema.SETUP_CONSUMERS;
-checksum table performance_schema.SETUP_INSTRUMENTS;
-checksum table performance_schema.SETUP_TIMERS;
-checksum table performance_schema.THREADS;
-checksum table performance_schema.COND_INSTANCES extended;
-checksum table performance_schema.EVENTS_WAITS_CURRENT extended;
-checksum table performance_schema.EVENTS_WAITS_HISTORY extended;
-checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended;
-checksum table performance_schema.FILE_INSTANCES extended;
-checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended;
-checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended;
-checksum table performance_schema.MUTEX_INSTANCES extended;
-checksum table performance_schema.PERFORMANCE_TIMERS extended;
-checksum table performance_schema.RWLOCK_INSTANCES extended;
-checksum table performance_schema.SETUP_CONSUMERS extended;
-checksum table performance_schema.SETUP_INSTRUMENTS extended;
-checksum table performance_schema.SETUP_TIMERS extended;
-checksum table performance_schema.THREADS extended;
+checksum table performance_schema.cond_instances;
+checksum table performance_schema.events_waits_current;
+checksum table performance_schema.events_waits_history;
+checksum table performance_schema.events_waits_history_long;
+checksum table performance_schema.events_waits_summary_by_instance;
+checksum table performance_schema.events_waits_summary_by_thread_by_event_name;
+checksum table performance_schema.events_waits_summary_global_by_event_name;
+checksum table performance_schema.file_instances;
+checksum table performance_schema.file_summary_by_event_name;
+checksum table performance_schema.file_summary_by_instance;
+checksum table performance_schema.mutex_instances;
+checksum table performance_schema.performance_timers;
+checksum table performance_schema.rwlock_instances;
+checksum table performance_schema.setup_consumers;
+checksum table performance_schema.setup_instruments;
+checksum table performance_schema.setup_timers;
+checksum table performance_schema.threads;
+checksum table performance_schema.cond_instances extended;
+checksum table performance_schema.events_waits_current extended;
+checksum table performance_schema.events_waits_history extended;
+checksum table performance_schema.events_waits_history_long extended;
+checksum table performance_schema.events_waits_summary_by_instance extended;
+checksum table performance_schema.events_waits_summary_by_thread_by_event_name extended;
+checksum table performance_schema.events_waits_summary_global_by_event_name extended;
+checksum table performance_schema.file_instances extended;
+checksum table performance_schema.file_summary_by_event_name extended;
+checksum table performance_schema.file_summary_by_instance extended;
+checksum table performance_schema.mutex_instances extended;
+checksum table performance_schema.performance_timers extended;
+checksum table performance_schema.rwlock_instances extended;
+checksum table performance_schema.setup_consumers extended;
+checksum table performance_schema.setup_instruments extended;
+checksum table performance_schema.setup_timers extended;
+checksum table performance_schema.threads extended;
diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result
index ac6030690dd..aff5f3e6eee 100644
--- a/mysql-test/suite/perfschema/r/column_privilege.result
+++ b/mysql-test/suite/perfschema/r/column_privilege.result
@@ -3,26 +3,26 @@ Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION;
-grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT
+grant SELECT(thread_id, event_id) on performance_schema.events_waits_current
to 'pfs_user_5'@localhost;
-grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS
+grant UPDATE(enabled) on performance_schema.setup_instruments
to 'pfs_user_5'@localhost;
flush privileges;
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
-select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
-select event_name from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT'
+select thread_id from performance_schema.events_waits_current;
+select thread_id, event_id from performance_schema.events_waits_current;
+update performance_schema.setup_instruments set enabled='YES';
+select event_name from performance_schema.events_waits_current;
+ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'events_waits_current'
select thread_id, event_id, event_name
-from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT'
-update performance_schema.SETUP_INSTRUMENTS set name='illegal';
-ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'SETUP_INSTRUMENTS'
-update performance_schema.SETUP_INSTRUMENTS set timed='NO';
-ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'SETUP_INSTRUMENTS'
+from performance_schema.events_waits_current;
+ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'events_waits_current'
+update performance_schema.setup_instruments set name='illegal';
+ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'setup_instruments'
+update performance_schema.setup_instruments set timed='NO';
+ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'setup_instruments'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost;
DROP USER 'pfs_user_5'@localhost;
flush privileges;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE';
diff --git a/mysql-test/suite/perfschema/r/ddl_cond_instances.result b/mysql-test/suite/perfschema/r/ddl_cond_instances.result
index 33adcebaceb..6b8b40af463 100644
--- a/mysql-test/suite/perfschema/r/ddl_cond_instances.result
+++ b/mysql-test/suite/perfschema/r/ddl_cond_instances.result
@@ -1,8 +1,8 @@
-alter table performance_schema.COND_INSTANCES add column foo integer;
+alter table performance_schema.cond_instances add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.COND_INSTANCES;
+truncate table performance_schema.cond_instances;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.cond_instances ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.cond_instances(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result
index a438c93affe..545134e5bd0 100644
--- a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result
+++ b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result
@@ -1,7 +1,7 @@
-alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer;
+alter table performance_schema.events_waits_current add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_CURRENT;
-ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID);
+truncate table performance_schema.events_waits_current;
+ALTER TABLE performance_schema.events_waits_current ADD INDEX test_index(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_current(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result
index 748dc2f29cd..2907e865b37 100644
--- a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result
+++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result
@@ -1,7 +1,7 @@
-alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer;
+alter table performance_schema.events_waits_history add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_HISTORY;
-ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID);
+truncate table performance_schema.events_waits_history;
+ALTER TABLE performance_schema.events_waits_history ADD INDEX test_index(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result
index 1a047a765f6..8926d39374b 100644
--- a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result
@@ -1,7 +1,7 @@
-alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer;
+alter table performance_schema.events_waits_history_long add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
-ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID);
+truncate table performance_schema.events_waits_history_long;
+ALTER TABLE performance_schema.events_waits_history_long ADD INDEX test_index(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history_long(EVENT_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result
index 4a35565bae0..94168f16eb7 100644
--- a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result
+++ b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result
@@ -1,7 +1,7 @@
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer;
+alter table performance_schema.events_waits_summary_by_instance add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME);
+truncate table performance_schema.events_waits_summary_by_instance;
+ALTER TABLE performance_schema.events_waits_summary_by_instance ADD INDEX test_index(EVENT_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_summary_by_instance(EVENT_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result
index 18d98006220..1694ff9287d 100644
--- a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result
@@ -1,9 +1,9 @@
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+alter table performance_schema.events_waits_summary_by_thread_by_event_name
add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID);
+truncate table performance_schema.events_waits_summary_by_thread_by_event_name;
+ALTER TABLE performance_schema.events_waits_summary_by_thread_by_event_name ADD INDEX test_index(THREAD_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
CREATE UNIQUE INDEX test_index
-ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID);
+ON performance_schema.events_waits_summary_by_thread_by_event_name(THREAD_ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
index 4f3ebcaea43..3b8cf851f80 100644
--- a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
@@ -1,10 +1,10 @@
-alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+alter table performance_schema.events_waits_summary_global_by_event_name
add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+truncate table performance_schema.events_waits_summary_global_by_event_name;
+ALTER TABLE performance_schema.events_waits_summary_global_by_event_name
ADD INDEX test_index(EVENT_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
CREATE UNIQUE INDEX test_index
-ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
+ON performance_schema.events_waits_summary_global_by_event_name(EVENT_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_file_instances.result b/mysql-test/suite/perfschema/r/ddl_file_instances.result
index 21e65c62405..338a0260326 100644
--- a/mysql-test/suite/perfschema/r/ddl_file_instances.result
+++ b/mysql-test/suite/perfschema/r/ddl_file_instances.result
@@ -1,8 +1,8 @@
-alter table performance_schema.FILE_INSTANCES add column foo integer;
+alter table performance_schema.file_instances add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.FILE_INSTANCES;
+truncate table performance_schema.file_instances;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME);
+ALTER TABLE performance_schema.file_instances ADD INDEX test_index(FILE_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_instances(FILE_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result
index 2f21ef56832..11bff4104bb 100644
--- a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result
@@ -1,7 +1,7 @@
-alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer;
+alter table performance_schema.file_summary_by_event_name add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME);
+truncate table performance_schema.file_summary_by_event_name;
+ALTER TABLE performance_schema.file_summary_by_event_name ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_event_name(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result
index 8e256d1fd8d..b28847b3aca 100644
--- a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result
+++ b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result
@@ -1,7 +1,7 @@
-alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer;
+alter table performance_schema.file_summary_by_instance add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME);
+truncate table performance_schema.file_summary_by_instance;
+ALTER TABLE performance_schema.file_summary_by_instance ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_instance(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result
index 35397a5294d..0e35b0d766a 100644
--- a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result
+++ b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result
@@ -1,8 +1,8 @@
-alter table performance_schema.MUTEX_INSTANCES add column foo integer;
+alter table performance_schema.mutex_instances add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.MUTEX_INSTANCES;
+truncate table performance_schema.mutex_instances;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.mutex_instances ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.mutex_instances(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_performance_timers.result b/mysql-test/suite/perfschema/r/ddl_performance_timers.result
index 5de8193b205..6868d419f1b 100644
--- a/mysql-test/suite/perfschema/r/ddl_performance_timers.result
+++ b/mysql-test/suite/perfschema/r/ddl_performance_timers.result
@@ -1,8 +1,8 @@
-alter table performance_schema.PERFORMANCE_TIMERS add column foo integer;
+alter table performance_schema.performance_timers add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.PERFORMANCE_TIMERS;
+truncate table performance_schema.performance_timers;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME);
+ALTER TABLE performance_schema.performance_timers ADD INDEX test_index(TIMER_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.performance_timers(TIMER_NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result
index 849d191b17f..e93aef47a5c 100644
--- a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result
+++ b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result
@@ -1,8 +1,8 @@
-alter table performance_schema.RWLOCK_INSTANCES add column foo integer;
+alter table performance_schema.rwlock_instances add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.RWLOCK_INSTANCES;
+truncate table performance_schema.rwlock_instances;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.rwlock_instances ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.rwlock_instances(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result
index f141725ee1f..1b121a0ec4c 100644
--- a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result
+++ b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result
@@ -1,8 +1,8 @@
-alter table performance_schema.SETUP_CONSUMERS add column foo integer;
+alter table performance_schema.setup_consumers add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.SETUP_CONSUMERS;
+truncate table performance_schema.setup_consumers;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_consumers ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_consumers(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result
index 42e54b587d8..f67b4f5791b 100644
--- a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result
@@ -1,8 +1,8 @@
-alter table performance_schema.SETUP_INSTRUMENTS add column foo integer;
+alter table performance_schema.setup_instruments add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.SETUP_INSTRUMENTS;
+truncate table performance_schema.setup_instruments;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_instruments ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_instruments(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_setup_timers.result b/mysql-test/suite/perfschema/r/ddl_setup_timers.result
index fc74730bd50..69b3d36cc1b 100644
--- a/mysql-test/suite/perfschema/r/ddl_setup_timers.result
+++ b/mysql-test/suite/perfschema/r/ddl_setup_timers.result
@@ -1,8 +1,8 @@
-alter table performance_schema.SETUP_TIMERS add column foo integer;
+alter table performance_schema.setup_timers add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.SETUP_TIMERS;
+truncate table performance_schema.setup_timers;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_timers ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_timers(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_threads.result b/mysql-test/suite/perfschema/r/ddl_threads.result
index 5d4b54d8bbe..9d949e0920f 100644
--- a/mysql-test/suite/perfschema/r/ddl_threads.result
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result
@@ -1,8 +1,8 @@
-alter table performance_schema.THREADS add column foo integer;
+alter table performance_schema.threads add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.THREADS;
+truncate table performance_schema.threads;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
+ALTER TABLE performance_schema.threads ADD INDEX test_index(ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.threads(ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/dml_cond_instances.result b/mysql-test/suite/perfschema/r/dml_cond_instances.result
index 8adc632b91b..922effc59ae 100644
--- a/mysql-test/suite/perfschema/r/dml_cond_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_cond_instances.result
@@ -1,23 +1,23 @@
-select * from performance_schema.COND_INSTANCES limit 1;
+select * from performance_schema.cond_instances limit 1;
NAME OBJECT_INSTANCE_BEGIN
# #
-select * from performance_schema.COND_INSTANCES
+select * from performance_schema.cond_instances
where name='FOO';
NAME OBJECT_INSTANCE_BEGIN
-insert into performance_schema.COND_INSTANCES
+insert into performance_schema.cond_instances
set name='FOO', object_instance_begin=12;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
-update performance_schema.COND_INSTANCES
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'cond_instances'
+update performance_schema.cond_instances
set name='FOO';
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
-delete from performance_schema.COND_INSTANCES
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'cond_instances'
+delete from performance_schema.cond_instances
where name like "wait/%";
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
-delete from performance_schema.COND_INSTANCES;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
-LOCK TABLES performance_schema.COND_INSTANCES READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'cond_instances'
+delete from performance_schema.cond_instances;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'cond_instances'
+LOCK TABLES performance_schema.cond_instances READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances'
UNLOCK TABLES;
-LOCK TABLES performance_schema.COND_INSTANCES WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES'
+LOCK TABLES performance_schema.cond_instances WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_current.result b/mysql-test/suite/perfschema/r/dml_events_waits_current.result
index 5cd0dba7ad1..9b0bcf7f876 100644
--- a/mysql-test/suite/perfschema/r/dml_events_waits_current.result
+++ b/mysql-test/suite/perfschema/r/dml_events_waits_current.result
@@ -1,28 +1,28 @@
-select * from performance_schema.EVENTS_WAITS_CURRENT
+select * from performance_schema.events_waits_current
where event_name like 'Wait/Synch/%' limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-select * from performance_schema.EVENTS_WAITS_CURRENT
+select * from performance_schema.events_waits_current
where event_name='FOO';
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-insert into performance_schema.EVENTS_WAITS_CURRENT
+insert into performance_schema.events_waits_current
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-update performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_current'
+update performance_schema.events_waits_current
set timer_start=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-update performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_current'
+update performance_schema.events_waits_current
set timer_start=12 where thread_id=0;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_current'
+delete from performance_schema.events_waits_current
where thread_id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current'
+delete from performance_schema.events_waits_current;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current'
+LOCK TABLES performance_schema.events_waits_current READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+LOCK TABLES performance_schema.events_waits_current WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history.result b/mysql-test/suite/perfschema/r/dml_events_waits_history.result
index 953922868fb..5fc95584c7f 100644
--- a/mysql-test/suite/perfschema/r/dml_events_waits_history.result
+++ b/mysql-test/suite/perfschema/r/dml_events_waits_history.result
@@ -1,36 +1,36 @@
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name='FOO';
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' order by timer_wait limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-insert into performance_schema.EVENTS_WAITS_HISTORY
+insert into performance_schema.events_waits_history
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-update performance_schema.EVENTS_WAITS_HISTORY
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_history'
+update performance_schema.events_waits_history
set timer_start=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-update performance_schema.EVENTS_WAITS_HISTORY
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history'
+update performance_schema.events_waits_history
set timer_start=12 where thread_id=0;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-delete from performance_schema.EVENTS_WAITS_HISTORY
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history'
+delete from performance_schema.events_waits_history
where thread_id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-delete from performance_schema.EVENTS_WAITS_HISTORY;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history'
+delete from performance_schema.events_waits_history;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history'
+LOCK TABLES performance_schema.events_waits_history READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY'
+LOCK TABLES performance_schema.events_waits_history WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result
index 494469a0db8..2ce949b2228 100644
--- a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result
@@ -1,36 +1,36 @@
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name='FOO';
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' order by timer_wait limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
# # # # # # # # NULL NULL NULL # NULL # NULL 0
-insert into performance_schema.EVENTS_WAITS_HISTORY_LONG
+insert into performance_schema.events_waits_history_long
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-update performance_schema.EVENTS_WAITS_HISTORY_LONG
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_history_long'
+update performance_schema.events_waits_history_long
set timer_start=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-update performance_schema.EVENTS_WAITS_HISTORY_LONG
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history_long'
+update performance_schema.events_waits_history_long
set timer_start=12 where thread_id=0;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-delete from performance_schema.EVENTS_WAITS_HISTORY_LONG
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_history_long'
+delete from performance_schema.events_waits_history_long
where thread_id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-delete from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history_long'
+delete from performance_schema.events_waits_history_long;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_history_long'
+LOCK TABLES performance_schema.events_waits_history_long READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history_long'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
+LOCK TABLES performance_schema.events_waits_history_long WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_history_long'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result
index dc262982340..0a745a2c38a 100644
--- a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result
+++ b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result
@@ -1,45 +1,45 @@
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where event_name like 'Wait/Synch/%' limit 1;
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where event_name='FOO';
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
order by count_star limit 1;
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
order by count_star desc limit 1;
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where min_timer_wait > 0 order by count_star limit 1;
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where min_timer_wait > 0 order by count_star desc limit 1;
EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+insert into performance_schema.events_waits_summary_by_instance
set event_name='FOO', object_instance_begin=0,
count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
+update performance_schema.events_waits_summary_by_instance
set count_star=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
+update performance_schema.events_waits_summary_by_instance
set count_star=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
+delete from performance_schema.events_waits_summary_by_instance
where count_star=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
+delete from performance_schema.events_waits_summary_by_instance;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
+LOCK TABLES performance_schema.events_waits_summary_by_instance READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
+LOCK TABLES performance_schema.events_waits_summary_by_instance WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_instance'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result
index 2a085659431..c64bcdd40f6 100644
--- a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result
@@ -1,29 +1,29 @@
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_by_thread_by_event_name
where event_name like 'Wait/Synch/%' limit 1;
THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_by_thread_by_event_name
where event_name='FOO';
THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+insert into performance_schema.events_waits_summary_by_thread_by_event_name
set event_name='FOO', thread_id=1,
count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
+update performance_schema.events_waits_summary_by_thread_by_event_name
set count_star=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
+update performance_schema.events_waits_summary_by_thread_by_event_name
set count_star=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
+delete from performance_schema.events_waits_summary_by_thread_by_event_name
where count_star=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
+delete from performance_schema.events_waits_summary_by_thread_by_event_name;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
+LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
+LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_by_thread_by_event_name'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
index 64ede2fddac..c59451922c5 100644
--- a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
@@ -1,28 +1,28 @@
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_global_by_event_name
where event_name like 'Wait/Synch/%' limit 1;
EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
# # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_global_by_event_name
where event_name='FOO';
EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
-insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+insert into performance_schema.events_waits_summary_global_by_event_name
set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
+update performance_schema.events_waits_summary_global_by_event_name
set count_star=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
+update performance_schema.events_waits_summary_global_by_event_name
set count_star=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
+delete from performance_schema.events_waits_summary_global_by_event_name
where count_star=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
+delete from performance_schema.events_waits_summary_global_by_event_name;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
+LOCK TABLES performance_schema.events_waits_summary_global_by_event_name READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+LOCK TABLES performance_schema.events_waits_summary_global_by_event_name WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_summary_global_by_event_name'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_file_instances.result b/mysql-test/suite/perfschema/r/dml_file_instances.result
index e15d68cbad3..5a51a4ca018 100644
--- a/mysql-test/suite/perfschema/r/dml_file_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_file_instances.result
@@ -1,23 +1,23 @@
-select * from performance_schema.FILE_INSTANCES limit 1;
+select * from performance_schema.file_instances limit 1;
FILE_NAME EVENT_NAME OPEN_COUNT
# # #
-select * from performance_schema.FILE_INSTANCES
+select * from performance_schema.file_instances
where file_name='FOO';
FILE_NAME EVENT_NAME OPEN_COUNT
-insert into performance_schema.FILE_INSTANCES
+insert into performance_schema.file_instances
set file_name='FOO', event_name='BAR', open_count=12;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-update performance_schema.FILE_INSTANCES
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_instances'
+update performance_schema.file_instances
set file_name='FOO';
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.FILE_INSTANCES
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_instances'
+delete from performance_schema.file_instances
where event_name like "wait/%";
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.FILE_INSTANCES;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-LOCK TABLES performance_schema.FILE_INSTANCES READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances'
+delete from performance_schema.file_instances;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances'
+LOCK TABLES performance_schema.file_instances READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances'
UNLOCK TABLES;
-LOCK TABLES performance_schema.FILE_INSTANCES WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
+LOCK TABLES performance_schema.file_instances WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result
index 1ecc82f40a5..97a196dbf19 100644
--- a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result
+++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result
@@ -1,28 +1,28 @@
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.file_summary_by_event_name
where event_name like 'Wait/io/%' limit 1;
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
# # # # #
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.file_summary_by_event_name
where event_name='FOO';
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
-insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+insert into performance_schema.file_summary_by_event_name
set event_name='FOO', count_read=1, count_write=2,
sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
-update performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+update performance_schema.file_summary_by_event_name
set count_read=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
-update performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+update performance_schema.file_summary_by_event_name
set count_write=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+delete from performance_schema.file_summary_by_event_name
where count_read=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+delete from performance_schema.file_summary_by_event_name;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+LOCK TABLES performance_schema.file_summary_by_event_name READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
UNLOCK TABLES;
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME'
+LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result
index 05b204cc1a9..d85e23cb6f4 100644
--- a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result
+++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result
@@ -1,28 +1,28 @@
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE
+select * from performance_schema.file_summary_by_instance
where event_name like 'Wait/io/%' limit 1;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
# # # # # #
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE
+select * from performance_schema.file_summary_by_instance
where event_name='FOO';
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
-insert into performance_schema.FILE_SUMMARY_BY_INSTANCE
+insert into performance_schema.file_summary_by_instance
set event_name='FOO', count_read=1, count_write=2,
sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
-update performance_schema.FILE_SUMMARY_BY_INSTANCE
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+update performance_schema.file_summary_by_instance
set count_read=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
-update performance_schema.FILE_SUMMARY_BY_INSTANCE
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+update performance_schema.file_summary_by_instance
set count_write=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
-delete from performance_schema.FILE_SUMMARY_BY_INSTANCE
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+delete from performance_schema.file_summary_by_instance
where count_read=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
-delete from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+delete from performance_schema.file_summary_by_instance;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+LOCK TABLES performance_schema.file_summary_by_instance READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
UNLOCK TABLES;
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
+LOCK TABLES performance_schema.file_summary_by_instance WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result
index 862123b3450..1ea7311b149 100644
--- a/mysql-test/suite/perfschema/r/dml_mutex_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result
@@ -1,23 +1,23 @@
-select * from performance_schema.MUTEX_INSTANCES limit 1;
+select * from performance_schema.mutex_instances limit 1;
NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID
# # #
-select * from performance_schema.MUTEX_INSTANCES
+select * from performance_schema.mutex_instances
where name='FOO';
NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID
-insert into performance_schema.MUTEX_INSTANCES
+insert into performance_schema.mutex_instances
set name='FOO', object_instance_begin=12;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
-update performance_schema.MUTEX_INSTANCES
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'mutex_instances'
+update performance_schema.mutex_instances
set name='FOO';
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
-delete from performance_schema.MUTEX_INSTANCES
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'mutex_instances'
+delete from performance_schema.mutex_instances
where name like "wait/%";
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
-delete from performance_schema.MUTEX_INSTANCES;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
-LOCK TABLES performance_schema.MUTEX_INSTANCES READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'mutex_instances'
+delete from performance_schema.mutex_instances;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'mutex_instances'
+LOCK TABLES performance_schema.mutex_instances READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'mutex_instances'
UNLOCK TABLES;
-LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES'
+LOCK TABLES performance_schema.mutex_instances WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'mutex_instances'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_performance_timers.result b/mysql-test/suite/perfschema/r/dml_performance_timers.result
index 99c1c74b797..f345cce921e 100644
--- a/mysql-test/suite/perfschema/r/dml_performance_timers.result
+++ b/mysql-test/suite/perfschema/r/dml_performance_timers.result
@@ -1,29 +1,29 @@
-select * from performance_schema.PERFORMANCE_TIMERS;
+select * from performance_schema.performance_timers;
TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD
CYCLE <frequency> <resolution> <overhead>
NANOSECOND <frequency> <resolution> <overhead>
MICROSECOND <frequency> <resolution> <overhead>
MILLISECOND <frequency> <resolution> <overhead>
TICK <frequency> <resolution> <overhead>
-select * from performance_schema.PERFORMANCE_TIMERS
+select * from performance_schema.performance_timers
where timer_name='CYCLE';
TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD
CYCLE <frequency> <resolution> <overhead>
-insert into performance_schema.PERFORMANCE_TIMERS
+insert into performance_schema.performance_timers
set timer_name='FOO', timer_frequency=1,
timer_resolution=2, timer_overhead=3;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
-update performance_schema.PERFORMANCE_TIMERS
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'performance_timers'
+update performance_schema.performance_timers
set timer_frequency=12 where timer_name='CYCLE';
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
-delete from performance_schema.PERFORMANCE_TIMERS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
-delete from performance_schema.PERFORMANCE_TIMERS
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'performance_timers'
+delete from performance_schema.performance_timers;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'performance_timers'
+delete from performance_schema.performance_timers
where timer_name='CYCLE';
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
-LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'performance_timers'
+LOCK TABLES performance_schema.performance_timers READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'performance_timers'
UNLOCK TABLES;
-LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS'
+LOCK TABLES performance_schema.performance_timers WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'performance_timers'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
index 686007e58e9..964fa0fa46f 100644
--- a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
@@ -1,23 +1,23 @@
-select * from performance_schema.RWLOCK_INSTANCES limit 1;
+select * from performance_schema.rwlock_instances limit 1;
NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT
# # # #
-select * from performance_schema.RWLOCK_INSTANCES
+select * from performance_schema.rwlock_instances
where name='FOO';
NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT
-insert into performance_schema.RWLOCK_INSTANCES
+insert into performance_schema.rwlock_instances
set name='FOO', object_instance_begin=12;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
-update performance_schema.RWLOCK_INSTANCES
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'rwlock_instances'
+update performance_schema.rwlock_instances
set name='FOO';
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
-delete from performance_schema.RWLOCK_INSTANCES
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'rwlock_instances'
+delete from performance_schema.rwlock_instances
where name like "wait/%";
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
-delete from performance_schema.RWLOCK_INSTANCES;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
-LOCK TABLES performance_schema.RWLOCK_INSTANCES READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'rwlock_instances'
+delete from performance_schema.rwlock_instances;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'rwlock_instances'
+LOCK TABLES performance_schema.rwlock_instances READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'rwlock_instances'
UNLOCK TABLES;
-LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES'
+LOCK TABLES performance_schema.rwlock_instances WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'rwlock_instances'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_setup_consumers.result b/mysql-test/suite/perfschema/r/dml_setup_consumers.result
index 44ed751dcd2..db0a6820de9 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_consumers.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_consumers.result
@@ -1,4 +1,4 @@
-select * from performance_schema.SETUP_CONSUMERS;
+select * from performance_schema.setup_consumers;
NAME ENABLED
events_waits_current YES
events_waits_history YES
@@ -8,11 +8,11 @@ events_waits_summary_by_event_name YES
events_waits_summary_by_instance YES
file_summary_by_event_name YES
file_summary_by_instance YES
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where name='events_waits_current';
NAME ENABLED
events_waits_current YES
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where enabled='YES';
NAME ENABLED
events_waits_current YES
@@ -23,23 +23,23 @@ events_waits_summary_by_event_name YES
events_waits_summary_by_instance YES
file_summary_by_event_name YES
file_summary_by_instance YES
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where enabled='NO';
NAME ENABLED
-insert into performance_schema.SETUP_CONSUMERS
+insert into performance_schema.setup_consumers
set name='FOO', enabled='YES';
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS'
-update performance_schema.SETUP_CONSUMERS
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_consumers'
+update performance_schema.setup_consumers
set name='FOO';
ERROR HY000: Invalid performance_schema usage.
-update performance_schema.SETUP_CONSUMERS
+update performance_schema.setup_consumers
set enabled='YES';
-delete from performance_schema.SETUP_CONSUMERS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS'
-delete from performance_schema.SETUP_CONSUMERS
+delete from performance_schema.setup_consumers;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_consumers'
+delete from performance_schema.setup_consumers
where name='events_waits_current';
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS'
-LOCK TABLES performance_schema.SETUP_CONSUMERS READ;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_consumers'
+LOCK TABLES performance_schema.setup_consumers READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE;
+LOCK TABLES performance_schema.setup_consumers WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index 2338252976c..fefc4f46061 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -1,5 +1,5 @@
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Mutex/sql/%'
and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
order by name limit 10;
@@ -14,7 +14,7 @@ wait/synch/mutex/sql/LOCK_audit_mask YES YES
wait/synch/mutex/sql/LOCK_connection_count YES YES
wait/synch/mutex/sql/LOCK_crypt YES YES
wait/synch/mutex/sql/LOCK_delayed_create YES YES
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
order by name limit 10;
@@ -29,7 +29,7 @@ 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
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Cond/sql/%'
and name not in (
'wait/synch/cond/sql/COND_handler_count',
@@ -37,7 +37,6 @@ where name like 'Wait/Synch/Cond/sql/%'
order by name limit 10;
NAME ENABLED TIMED
wait/synch/cond/sql/COND_flush_thread_cache YES YES
-wait/synch/cond/sql/COND_global_read_lock YES YES
wait/synch/cond/sql/COND_manager YES YES
wait/synch/cond/sql/COND_queue_state YES YES
wait/synch/cond/sql/COND_rpl_status YES YES
@@ -46,29 +45,30 @@ wait/synch/cond/sql/COND_thread_cache YES YES
wait/synch/cond/sql/COND_thread_count YES YES
wait/synch/cond/sql/Delayed_insert::cond YES YES
wait/synch/cond/sql/Delayed_insert::cond_client YES YES
-select * from performance_schema.SETUP_INSTRUMENTS
+wait/synch/cond/sql/Event_scheduler::COND_state YES YES
+select * from performance_schema.setup_instruments
where name='Wait';
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where enabled='YES';
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name='FOO', enabled='YES', timed='YES';
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-update performance_schema.SETUP_INSTRUMENTS
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments'
+update performance_schema.setup_instruments
set name='FOO';
ERROR HY000: Invalid performance_schema usage.
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set timed='NO';
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments
set enabled='YES', timed='YES';
-delete from performance_schema.SETUP_INSTRUMENTS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-delete from performance_schema.SETUP_INSTRUMENTS
+delete from performance_schema.setup_instruments;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments'
+delete from performance_schema.setup_instruments
where name like 'Wait/Synch/%';
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments'
+LOCK TABLES performance_schema.setup_instruments READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE;
+LOCK TABLES performance_schema.setup_instruments WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_setup_timers.result b/mysql-test/suite/perfschema/r/dml_setup_timers.result
index a9bee916cde..ad1f6df3e81 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_timers.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_timers.result
@@ -1,33 +1,33 @@
-select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.setup_timers;
NAME TIMER_NAME
wait CYCLE
-select * from performance_schema.SETUP_TIMERS
+select * from performance_schema.setup_timers
where name='Wait';
NAME TIMER_NAME
wait CYCLE
-select * from performance_schema.SETUP_TIMERS
+select * from performance_schema.setup_timers
where timer_name='CYCLE';
NAME TIMER_NAME
wait CYCLE
-insert into performance_schema.SETUP_TIMERS
+insert into performance_schema.setup_timers
set name='FOO', timer_name='CYCLE';
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_TIMERS'
-update performance_schema.SETUP_TIMERS
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_timers'
+update performance_schema.setup_timers
set name='FOO';
ERROR HY000: Invalid performance_schema usage.
-update performance_schema.SETUP_TIMERS
+update performance_schema.setup_timers
set timer_name='MILLISECOND';
-select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.setup_timers;
NAME TIMER_NAME
wait MILLISECOND
-update performance_schema.SETUP_TIMERS
+update performance_schema.setup_timers
set timer_name='CYCLE';
-delete from performance_schema.SETUP_TIMERS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS'
-delete from performance_schema.SETUP_TIMERS
+delete from performance_schema.setup_timers;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_timers'
+delete from performance_schema.setup_timers
where name='Wait';
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS'
-LOCK TABLES performance_schema.SETUP_TIMERS READ;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_timers'
+LOCK TABLES performance_schema.setup_timers READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_TIMERS WRITE;
+LOCK TABLES performance_schema.setup_timers WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_threads.result b/mysql-test/suite/perfschema/r/dml_threads.result
index b4fa8705c95..8c61521d091 100644
--- a/mysql-test/suite/perfschema/r/dml_threads.result
+++ b/mysql-test/suite/perfschema/r/dml_threads.result
@@ -1,27 +1,27 @@
-select * from performance_schema.THREADS
+select * from performance_schema.threads
where name like 'Thread/%' limit 1;
-THREAD_ID ID NAME
+THREAD_ID PROCESSLIST_ID NAME
# # #
-select * from performance_schema.THREADS
+select * from performance_schema.threads
where name='FOO';
-THREAD_ID ID NAME
-insert into performance_schema.THREADS
-set name='FOO', thread_id=1, id=2;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
-update performance_schema.THREADS
+THREAD_ID PROCESSLIST_ID NAME
+insert into performance_schema.threads
+set name='FOO', thread_id=1, processlist_id=2;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'threads'
+update performance_schema.threads
set thread_id=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
-update performance_schema.THREADS
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'threads'
+update performance_schema.threads
set thread_id=12 where name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
-delete from performance_schema.THREADS
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'threads'
+delete from performance_schema.threads
where id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
-delete from performance_schema.THREADS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
-LOCK TABLES performance_schema.THREADS READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads'
+delete from performance_schema.threads;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads'
+LOCK TABLES performance_schema.threads READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'threads'
UNLOCK TABLES;
-LOCK TABLES performance_schema.THREADS WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
+LOCK TABLES performance_schema.threads WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'threads'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index 201254aca21..d99e77dcd8c 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -1,18 +1,18 @@
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
id b
1 initial value
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD'));
SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
@@ -24,15 +24,15 @@ id b
2 initial value
3 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
test_ff1_timed
Success
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO';
+UPDATE performance_schema.setup_instruments SET enabled='NO';
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
SELECT * FROM t1 WHERE id < 6;
@@ -43,40 +43,40 @@ id b
4 initial value
5 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed;
test_ff2_timed
Success
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+UPDATE performance_schema.setup_instruments SET timed = 'NO';
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id > 4;
id b
5 initial value
6 initial value
7 initial value
8 initial value
-SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+SELECT * FROM performance_schema.events_waits_history_long
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY
+SELECT * FROM performance_schema.events_waits_history
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT * FROM performance_schema.events_waits_current
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS
-UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES';
+UPDATE performance_schema.setup_instruments SET timed = 'YES';
SELECT * FROM t1 WHERE id < 4;
id b
1 initial value
@@ -87,31 +87,17 @@ SELECT SUM(COUNT_READ) AS sum_count_read,
SUM(COUNT_WRITE) AS sum_count_write,
SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read,
SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write
-FROM performance_schema.FILE_SUMMARY_BY_INSTANCE
+FROM performance_schema.file_summary_by_instance
WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+FROM performance_schema.events_waits_summary_global_by_event_name
WHERE COUNT_STAR > 0
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
-# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
-ORDER BY SUM_WAIT DESC
-LIMIT 20;
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+FROM performance_schema.events_waits_history_long h
+INNER JOIN performance_schema.threads p USING (THREAD_ID)
+WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
-HAVING BYTES > 0
-ORDER BY i.user, h.operation;
+UPDATE performance_schema.setup_instruments SET enabled = 'YES';
diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result
index e32d7267bb1..93a8ae5d218 100644
--- a/mysql-test/suite/perfschema/r/func_mutex.result
+++ b/mysql-test/suite/perfschema/r/func_mutex.result
@@ -1,19 +1,19 @@
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
id b
1 initial value
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT * FROM t1;
id b
@@ -26,21 +26,21 @@ id b
7 initial value
8 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed;
test_fm1_timed
Success
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO'
WHERE NAME = 'wait/synch/mutex/sql/LOCK_open';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
id b
1 initial value
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT * FROM t1;
id b
@@ -53,19 +53,19 @@ id b
7 initial value
8 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed;
test_fm2_timed
Success
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
id b
1 initial value
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT * FROM t1;
id b
@@ -78,21 +78,21 @@ id b
7 initial value
8 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed;
test_fm1_rw_timed
Success
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO'
WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
id b
1 initial value
SET @before_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT * FROM t1;
id b
@@ -105,9 +105,10 @@ id b
7 initial value
8 initial value
SET @after_count = (SELECT SUM(TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed;
test_fm2_rw_timed
Success
+UPDATE performance_schema.setup_instruments SET enabled = 'YES';
DROP TABLE t1;
diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result
index 93d6adfd049..d71bcf81ea7 100644
--- a/mysql-test/suite/perfschema/r/global_read_lock.result
+++ b/mysql-test/suite/perfschema/r/global_read_lock.result
@@ -1,32 +1,33 @@
use performance_schema;
+update performance_schema.setup_instruments set enabled='YES';
grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
flush privileges;
connect (con1, localhost, pfsuser, , test);
-lock tables performance_schema.SETUP_INSTRUMENTS read;
-select * from performance_schema.SETUP_INSTRUMENTS;
+lock tables performance_schema.setup_instruments read;
+select * from performance_schema.setup_instruments;
unlock tables;
-lock tables performance_schema.SETUP_INSTRUMENTS write;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+lock tables performance_schema.setup_instruments write;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
unlock tables;
connection default;
flush tables with read lock;
connection con1;
-lock tables performance_schema.SETUP_INSTRUMENTS read;
-select * from performance_schema.SETUP_INSTRUMENTS;
+lock tables performance_schema.setup_instruments read;
+select * from performance_schema.setup_instruments;
unlock tables;
-lock tables performance_schema.SETUP_INSTRUMENTS write;
+lock tables performance_schema.setup_instruments write;
connection default;
select event_name,
left(source, locate(":", source)) as short_source,
timer_end, timer_wait, operation
-from performance_schema.EVENTS_WAITS_CURRENT
-where event_name like "wait/synch/cond/sql/COND_global_read_lock";
+from performance_schema.events_waits_current
+where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
event_name short_source timer_end timer_wait operation
-wait/synch/cond/sql/COND_global_read_lock lock.cc: NULL NULL wait
+wait/synch/cond/sql/MDL_context::COND_wait_status mdl.cc: NULL NULL timed_wait
unlock tables;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
unlock tables;
connection default;
drop user pfsuser@localhost;
diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result
index 8e7478564fb..ab464cce687 100644
--- a/mysql-test/suite/perfschema/r/information_schema.result
+++ b/mysql-test/suite/perfschema/r/information_schema.result
@@ -1,189 +1,189 @@
-select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG
+select TABLE_SCHEMA, lower(TABLE_NAME), TABLE_CATALOG
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-TABLE_SCHEMA upper(TABLE_NAME) TABLE_CATALOG
-performance_schema COND_INSTANCES def
-performance_schema EVENTS_WAITS_CURRENT def
-performance_schema EVENTS_WAITS_HISTORY def
-performance_schema EVENTS_WAITS_HISTORY_LONG def
-performance_schema EVENTS_WAITS_SUMMARY_BY_INSTANCE def
-performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME def
-performance_schema EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME def
-performance_schema FILE_INSTANCES def
-performance_schema FILE_SUMMARY_BY_EVENT_NAME def
-performance_schema FILE_SUMMARY_BY_INSTANCE def
-performance_schema MUTEX_INSTANCES def
-performance_schema PERFORMANCE_TIMERS def
-performance_schema RWLOCK_INSTANCES def
-performance_schema SETUP_CONSUMERS def
-performance_schema SETUP_INSTRUMENTS def
-performance_schema SETUP_TIMERS def
-performance_schema THREADS def
-select upper(TABLE_NAME), TABLE_TYPE, ENGINE
+TABLE_SCHEMA lower(TABLE_NAME) TABLE_CATALOG
+performance_schema cond_instances def
+performance_schema events_waits_current def
+performance_schema events_waits_history def
+performance_schema events_waits_history_long def
+performance_schema events_waits_summary_by_instance def
+performance_schema events_waits_summary_by_thread_by_event_name def
+performance_schema events_waits_summary_global_by_event_name def
+performance_schema file_instances def
+performance_schema file_summary_by_event_name def
+performance_schema file_summary_by_instance def
+performance_schema mutex_instances def
+performance_schema performance_timers def
+performance_schema rwlock_instances def
+performance_schema setup_consumers def
+performance_schema setup_instruments def
+performance_schema setup_timers def
+performance_schema threads def
+select lower(TABLE_NAME), TABLE_TYPE, ENGINE
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) TABLE_TYPE ENGINE
-COND_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_CURRENT BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_HISTORY BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_HISTORY_LONG BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
-FILE_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
-FILE_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
-FILE_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA
-MUTEX_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
-PERFORMANCE_TIMERS BASE TABLE PERFORMANCE_SCHEMA
-RWLOCK_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
-SETUP_CONSUMERS BASE TABLE PERFORMANCE_SCHEMA
-SETUP_INSTRUMENTS BASE TABLE PERFORMANCE_SCHEMA
-SETUP_TIMERS BASE TABLE PERFORMANCE_SCHEMA
-THREADS BASE TABLE PERFORMANCE_SCHEMA
-select upper(TABLE_NAME), VERSION, ROW_FORMAT
+lower(TABLE_NAME) TABLE_TYPE ENGINE
+cond_instances BASE TABLE PERFORMANCE_SCHEMA
+events_waits_current BASE TABLE PERFORMANCE_SCHEMA
+events_waits_history BASE TABLE PERFORMANCE_SCHEMA
+events_waits_history_long BASE TABLE PERFORMANCE_SCHEMA
+events_waits_summary_by_instance BASE TABLE PERFORMANCE_SCHEMA
+events_waits_summary_by_thread_by_event_name BASE TABLE PERFORMANCE_SCHEMA
+events_waits_summary_global_by_event_name BASE TABLE PERFORMANCE_SCHEMA
+file_instances BASE TABLE PERFORMANCE_SCHEMA
+file_summary_by_event_name BASE TABLE PERFORMANCE_SCHEMA
+file_summary_by_instance BASE TABLE PERFORMANCE_SCHEMA
+mutex_instances BASE TABLE PERFORMANCE_SCHEMA
+performance_timers BASE TABLE PERFORMANCE_SCHEMA
+rwlock_instances BASE TABLE PERFORMANCE_SCHEMA
+setup_consumers BASE TABLE PERFORMANCE_SCHEMA
+setup_instruments BASE TABLE PERFORMANCE_SCHEMA
+setup_timers BASE TABLE PERFORMANCE_SCHEMA
+threads BASE TABLE PERFORMANCE_SCHEMA
+select lower(TABLE_NAME), VERSION, ROW_FORMAT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) VERSION ROW_FORMAT
-COND_INSTANCES 10 Dynamic
-EVENTS_WAITS_CURRENT 10 Dynamic
-EVENTS_WAITS_HISTORY 10 Dynamic
-EVENTS_WAITS_HISTORY_LONG 10 Dynamic
-EVENTS_WAITS_SUMMARY_BY_INSTANCE 10 Dynamic
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 10 Dynamic
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 10 Dynamic
-FILE_INSTANCES 10 Dynamic
-FILE_SUMMARY_BY_EVENT_NAME 10 Dynamic
-FILE_SUMMARY_BY_INSTANCE 10 Dynamic
-MUTEX_INSTANCES 10 Dynamic
-PERFORMANCE_TIMERS 10 Fixed
-RWLOCK_INSTANCES 10 Dynamic
-SETUP_CONSUMERS 10 Dynamic
-SETUP_INSTRUMENTS 10 Dynamic
-SETUP_TIMERS 10 Dynamic
-THREADS 10 Dynamic
-select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
+lower(TABLE_NAME) VERSION ROW_FORMAT
+cond_instances 10 Dynamic
+events_waits_current 10 Dynamic
+events_waits_history 10 Dynamic
+events_waits_history_long 10 Dynamic
+events_waits_summary_by_instance 10 Dynamic
+events_waits_summary_by_thread_by_event_name 10 Dynamic
+events_waits_summary_global_by_event_name 10 Dynamic
+file_instances 10 Dynamic
+file_summary_by_event_name 10 Dynamic
+file_summary_by_instance 10 Dynamic
+mutex_instances 10 Dynamic
+performance_timers 10 Fixed
+rwlock_instances 10 Dynamic
+setup_consumers 10 Dynamic
+setup_instruments 10 Dynamic
+setup_timers 10 Dynamic
+threads 10 Dynamic
+select lower(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH
-COND_INSTANCES 1000 0
-EVENTS_WAITS_CURRENT 1000 0
-EVENTS_WAITS_HISTORY 1000 0
-EVENTS_WAITS_HISTORY_LONG 10000 0
-EVENTS_WAITS_SUMMARY_BY_INSTANCE 1000 0
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 1000 0
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 1000 0
-FILE_INSTANCES 1000 0
-FILE_SUMMARY_BY_EVENT_NAME 1000 0
-FILE_SUMMARY_BY_INSTANCE 1000 0
-MUTEX_INSTANCES 1000 0
-PERFORMANCE_TIMERS 5 0
-RWLOCK_INSTANCES 1000 0
-SETUP_CONSUMERS 8 0
-SETUP_INSTRUMENTS 1000 0
-SETUP_TIMERS 1 0
-THREADS 1000 0
-select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
+lower(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH
+cond_instances 1000 0
+events_waits_current 1000 0
+events_waits_history 1000 0
+events_waits_history_long 10000 0
+events_waits_summary_by_instance 1000 0
+events_waits_summary_by_thread_by_event_name 1000 0
+events_waits_summary_global_by_event_name 1000 0
+file_instances 1000 0
+file_summary_by_event_name 1000 0
+file_summary_by_instance 1000 0
+mutex_instances 1000 0
+performance_timers 5 0
+rwlock_instances 1000 0
+setup_consumers 8 0
+setup_instruments 1000 0
+setup_timers 1 0
+threads 1000 0
+select lower(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH
-COND_INSTANCES 0 0
-EVENTS_WAITS_CURRENT 0 0
-EVENTS_WAITS_HISTORY 0 0
-EVENTS_WAITS_HISTORY_LONG 0 0
-EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0
-FILE_INSTANCES 0 0
-FILE_SUMMARY_BY_EVENT_NAME 0 0
-FILE_SUMMARY_BY_INSTANCE 0 0
-MUTEX_INSTANCES 0 0
-PERFORMANCE_TIMERS 0 0
-RWLOCK_INSTANCES 0 0
-SETUP_CONSUMERS 0 0
-SETUP_INSTRUMENTS 0 0
-SETUP_TIMERS 0 0
-THREADS 0 0
-select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
+lower(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH
+cond_instances 0 0
+events_waits_current 0 0
+events_waits_history 0 0
+events_waits_history_long 0 0
+events_waits_summary_by_instance 0 0
+events_waits_summary_by_thread_by_event_name 0 0
+events_waits_summary_global_by_event_name 0 0
+file_instances 0 0
+file_summary_by_event_name 0 0
+file_summary_by_instance 0 0
+mutex_instances 0 0
+performance_timers 0 0
+rwlock_instances 0 0
+setup_consumers 0 0
+setup_instruments 0 0
+setup_timers 0 0
+threads 0 0
+select lower(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT
-COND_INSTANCES 0 0 NULL
-EVENTS_WAITS_CURRENT 0 0 NULL
-EVENTS_WAITS_HISTORY 0 0 NULL
-EVENTS_WAITS_HISTORY_LONG 0 0 NULL
-EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 NULL
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 NULL
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0 NULL
-FILE_INSTANCES 0 0 NULL
-FILE_SUMMARY_BY_EVENT_NAME 0 0 NULL
-FILE_SUMMARY_BY_INSTANCE 0 0 NULL
-MUTEX_INSTANCES 0 0 NULL
-PERFORMANCE_TIMERS 0 0 NULL
-RWLOCK_INSTANCES 0 0 NULL
-SETUP_CONSUMERS 0 0 NULL
-SETUP_INSTRUMENTS 0 0 NULL
-SETUP_TIMERS 0 0 NULL
-THREADS 0 0 NULL
-select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
+lower(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT
+cond_instances 0 0 NULL
+events_waits_current 0 0 NULL
+events_waits_history 0 0 NULL
+events_waits_history_long 0 0 NULL
+events_waits_summary_by_instance 0 0 NULL
+events_waits_summary_by_thread_by_event_name 0 0 NULL
+events_waits_summary_global_by_event_name 0 0 NULL
+file_instances 0 0 NULL
+file_summary_by_event_name 0 0 NULL
+file_summary_by_instance 0 0 NULL
+mutex_instances 0 0 NULL
+performance_timers 0 0 NULL
+rwlock_instances 0 0 NULL
+setup_consumers 0 0 NULL
+setup_instruments 0 0 NULL
+setup_timers 0 0 NULL
+threads 0 0 NULL
+select lower(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME
-COND_INSTANCES NULL NULL NULL
-EVENTS_WAITS_CURRENT NULL NULL NULL
-EVENTS_WAITS_HISTORY NULL NULL NULL
-EVENTS_WAITS_HISTORY_LONG NULL NULL NULL
-EVENTS_WAITS_SUMMARY_BY_INSTANCE NULL NULL NULL
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME NULL NULL NULL
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME NULL NULL NULL
-FILE_INSTANCES NULL NULL NULL
-FILE_SUMMARY_BY_EVENT_NAME NULL NULL NULL
-FILE_SUMMARY_BY_INSTANCE NULL NULL NULL
-MUTEX_INSTANCES NULL NULL NULL
-PERFORMANCE_TIMERS NULL NULL NULL
-RWLOCK_INSTANCES NULL NULL NULL
-SETUP_CONSUMERS NULL NULL NULL
-SETUP_INSTRUMENTS NULL NULL NULL
-SETUP_TIMERS NULL NULL NULL
-THREADS NULL NULL NULL
-select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM
+lower(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME
+cond_instances NULL NULL NULL
+events_waits_current NULL NULL NULL
+events_waits_history NULL NULL NULL
+events_waits_history_long NULL NULL NULL
+events_waits_summary_by_instance NULL NULL NULL
+events_waits_summary_by_thread_by_event_name NULL NULL NULL
+events_waits_summary_global_by_event_name NULL NULL NULL
+file_instances NULL NULL NULL
+file_summary_by_event_name NULL NULL NULL
+file_summary_by_instance NULL NULL NULL
+mutex_instances NULL NULL NULL
+performance_timers NULL NULL NULL
+rwlock_instances NULL NULL NULL
+setup_consumers NULL NULL NULL
+setup_instruments NULL NULL NULL
+setup_timers NULL NULL NULL
+threads NULL NULL NULL
+select lower(TABLE_NAME), TABLE_COLLATION, CHECKSUM
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) TABLE_COLLATION CHECKSUM
-COND_INSTANCES utf8_general_ci NULL
-EVENTS_WAITS_CURRENT utf8_general_ci NULL
-EVENTS_WAITS_HISTORY utf8_general_ci NULL
-EVENTS_WAITS_HISTORY_LONG utf8_general_ci NULL
-EVENTS_WAITS_SUMMARY_BY_INSTANCE utf8_general_ci NULL
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME utf8_general_ci NULL
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME utf8_general_ci NULL
-FILE_INSTANCES utf8_general_ci NULL
-FILE_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL
-FILE_SUMMARY_BY_INSTANCE utf8_general_ci NULL
-MUTEX_INSTANCES utf8_general_ci NULL
-PERFORMANCE_TIMERS utf8_general_ci NULL
-RWLOCK_INSTANCES utf8_general_ci NULL
-SETUP_CONSUMERS utf8_general_ci NULL
-SETUP_INSTRUMENTS utf8_general_ci NULL
-SETUP_TIMERS utf8_general_ci NULL
-THREADS utf8_general_ci NULL
-select upper(TABLE_NAME), TABLE_COMMENT
+lower(TABLE_NAME) TABLE_COLLATION CHECKSUM
+cond_instances utf8_general_ci NULL
+events_waits_current utf8_general_ci NULL
+events_waits_history utf8_general_ci NULL
+events_waits_history_long utf8_general_ci NULL
+events_waits_summary_by_instance utf8_general_ci NULL
+events_waits_summary_by_thread_by_event_name utf8_general_ci NULL
+events_waits_summary_global_by_event_name utf8_general_ci NULL
+file_instances utf8_general_ci NULL
+file_summary_by_event_name utf8_general_ci NULL
+file_summary_by_instance utf8_general_ci NULL
+mutex_instances utf8_general_ci NULL
+performance_timers utf8_general_ci NULL
+rwlock_instances utf8_general_ci NULL
+setup_consumers utf8_general_ci NULL
+setup_instruments utf8_general_ci NULL
+setup_timers utf8_general_ci NULL
+threads utf8_general_ci NULL
+select lower(TABLE_NAME), TABLE_COMMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-upper(TABLE_NAME) TABLE_COMMENT
-COND_INSTANCES
-EVENTS_WAITS_CURRENT
-EVENTS_WAITS_HISTORY
-EVENTS_WAITS_HISTORY_LONG
-EVENTS_WAITS_SUMMARY_BY_INSTANCE
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
-FILE_INSTANCES
-FILE_SUMMARY_BY_EVENT_NAME
-FILE_SUMMARY_BY_INSTANCE
-MUTEX_INSTANCES
-PERFORMANCE_TIMERS
-RWLOCK_INSTANCES
-SETUP_CONSUMERS
-SETUP_INSTRUMENTS
-SETUP_TIMERS
-THREADS
+lower(TABLE_NAME) TABLE_COMMENT
+cond_instances
+events_waits_current
+events_waits_history
+events_waits_history_long
+events_waits_summary_by_instance
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_global_by_event_name
+file_instances
+file_summary_by_event_name
+file_summary_by_instance
+mutex_instances
+performance_timers
+rwlock_instances
+setup_consumers
+setup_instruments
+setup_timers
+threads
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index e389a4ce65c..4e9b08e00ef 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -1,13 +1,13 @@
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.THREADS)
+(SELECT THREAD_ID FROM performance_schema.threads)
AND EVENT_NAME IN
-(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
+(SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
create table test.t1(a int) engine=performance_schema;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
create table performance_schema.t1(a int);
ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1'
@@ -22,7 +22,7 @@ a b
1 3
2 4
drop table test.ghost;
-select * from performance_schema.FILE_INSTANCES
+select * from performance_schema.file_instances
where file_name like "%ghost%";
FILE_NAME EVENT_NAME OPEN_COUNT
select * from performance_schema.no_such_table;
diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result
index 5d710d9183d..287abd43d74 100644
--- a/mysql-test/suite/perfschema/r/myisam_file_io.result
+++ b/mysql-test/suite/perfschema/r/myisam_file_io.result
@@ -1,9 +1,9 @@
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/io/file/myisam/%";
-update performance_schema.SETUP_CONSUMERS
+update performance_schema.setup_consumers
set enabled='YES';
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+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;
@@ -14,7 +14,7 @@ select event_name,
left(source, locate(":", source)) as short_source,
operation, number_of_bytes,
substring(object_name, locate("no_index_tab", object_name)) as short_name
-from performance_schema.EVENTS_WAITS_HISTORY_LONG
+from performance_schema.events_waits_history_long
where operation not like "tell"
order by thread_id, event_id;
event_name short_source operation number_of_bytes short_name
@@ -56,5 +56,5 @@ Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
drop table test.no_index_tab;
diff --git a/mysql-test/suite/perfschema/r/no_threads.result b/mysql-test/suite/perfschema/r/no_threads.result
index 79d16809eee..89ae72c8df1 100644
--- a/mysql-test/suite/perfschema/r/no_threads.result
+++ b/mysql-test/suite/perfschema/r/no_threads.result
@@ -1,11 +1,11 @@
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_CONSUMERS set enabled='YES';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_consumers set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
drop table if exists test.t1;
-truncate table performance_schema.EVENTS_WAITS_CURRENT;
-truncate table performance_schema.EVENTS_WAITS_HISTORY;
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_current;
+truncate table performance_schema.events_waits_history;
+truncate table performance_schema.events_waits_history_long;
show variables like "thread_handling";
Variable_name Value
thread_handling no-threads
@@ -17,27 +17,27 @@ show variables like "performance_schema_max_thread%";
Variable_name Value
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 10
-select count(*) from performance_schema.THREADS
+select count(*) from performance_schema.threads
where name like "thread/sql/main";
count(*)
1
-select count(*) from performance_schema.THREADS
+select count(*) from performance_schema.threads
where name like "thread/sql/OneConnection";
count(*)
0
select event_name, operation,
left(source, locate(":", source)) as short_source
-from performance_schema.EVENTS_WAITS_CURRENT;
+from performance_schema.events_waits_current;
event_name operation short_source
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
select event_name, operation,
left(source, locate(":", source)) as short_source
-from performance_schema.EVENTS_WAITS_HISTORY;
+from performance_schema.events_waits_history;
event_name operation short_source
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
select event_name, operation,
left(source, locate(":", source)) as short_source
-from performance_schema.EVENTS_WAITS_HISTORY_LONG;
+from performance_schema.events_waits_history_long;
event_name operation short_source
wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c:
drop table test.t1;
diff --git a/mysql-test/suite/perfschema/r/one_thread_per_con.result b/mysql-test/suite/perfschema/r/one_thread_per_con.result
index 9677a09933a..998aba6281c 100644
--- a/mysql-test/suite/perfschema/r/one_thread_per_con.result
+++ b/mysql-test/suite/perfschema/r/one_thread_per_con.result
@@ -1,9 +1,9 @@
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
drop table if exists test.t1;
drop table if exists test.t2;
drop table if exists test.t3;
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_history_long;
show variables like "thread_handling";
Variable_name Value
thread_handling one-thread-per-connection
@@ -35,4 +35,4 @@ thread/sql/one_connection
drop table test.t1;
drop table test.t2;
drop table test.t3;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result
index 7a782687184..2ec6a3bd1dd 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result
@@ -8,23 +8,23 @@ use performance_schema;
show tables like "user_table";
Tables_in_performance_schema (user_table)
user_table
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
@@ -38,23 +38,23 @@ use performance_schema;
show tables like "user_view";
Tables_in_performance_schema (user_view)
user_view
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
@@ -66,23 +66,23 @@ drop view test.user_view;
create procedure test.user_proc()
select "Not supposed to be here";
update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
@@ -94,23 +94,23 @@ drop procedure test.user_proc;
create function test.user_func() returns integer
return 0;
update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
@@ -122,23 +122,23 @@ drop function test.user_func;
create event test.user_event on schedule every 1 day do
select "not supposed to be here";
update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result
index 4283b250cee..61f5adac354 100644
--- a/mysql-test/suite/perfschema/r/privilege.result
+++ b/mysql-test/suite/perfschema/r/privilege.result
@@ -35,102 +35,102 @@ grant INSERT on performance_schema.* to 'pfs_user_2'@localhost;
grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost;
grant DELETE on performance_schema.* to 'pfs_user_2'@localhost;
grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost;
-grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant ALL on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
-grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
-grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
-ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
-ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant INSERT on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
+ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'setup_instruments'
+grant DELETE on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
+ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'setup_instruments'
+grant SELECT on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
-grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant UPDATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
-grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost
+grant ALL on performance_schema.events_waits_current to 'pfs_user_3'@localhost
with GRANT OPTION;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
-grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
-grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
-ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
-ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
-ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost
+grant INSERT on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
+ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current'
+grant UPDATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
+ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current'
+grant DELETE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
+ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'events_waits_current'
+grant SELECT on performance_schema.events_waits_current to 'pfs_user_3'@localhost
with GRANT OPTION;
-grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost
+grant ALL on performance_schema.file_instances to 'pfs_user_3'@localhost
with GRANT OPTION;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
-grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
-grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.file_instances to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.file_instances to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.file_instances to 'pfs_user_3'@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
-ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
-ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
-ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost
+grant INSERT on performance_schema.file_instances to 'pfs_user_3'@localhost;
+ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'file_instances'
+grant UPDATE on performance_schema.file_instances to 'pfs_user_3'@localhost;
+ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'file_instances'
+grant DELETE on performance_schema.file_instances to 'pfs_user_3'@localhost;
+ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'file_instances'
+grant SELECT on performance_schema.file_instances to 'pfs_user_3'@localhost
with GRANT OPTION;
grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost
with GRANT OPTION;
flush privileges;
drop table if exists test.t1;
-rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
+rename table performance_schema.setup_instruments to test.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
+rename table performance_schema.events_waits_current to test.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to test.t1;
+rename table performance_schema.file_instances to test.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
+rename table performance_schema.setup_instruments to performance_schema.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
+rename table performance_schema.events_waits_current to performance_schema.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
+rename table performance_schema.file_instances to performance_schema.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS
-to performance_schema.EVENTS_WAITS_CURRENT;
+rename table performance_schema.setup_instruments
+to performance_schema.events_waits_current;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT
-to performance_schema.SETUP_INSTRUMENTS;
+rename table performance_schema.events_waits_current
+to performance_schema.setup_instruments;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create procedure performance_schema.my_proc() begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
@@ -140,95 +140,95 @@ create event performance_schema.my_event on schedule every 15 minute
do begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_setup_instruments
-before insert on performance_schema.SETUP_INSTRUMENTS
+before insert on performance_schema.setup_instruments
for each row begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_events_waits_current
-before insert on performance_schema.EVENTS_WAITS_CURRENT
+before insert on performance_schema.events_waits_current
for each row begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_file_instances
-before insert on performance_schema.FILE_INSTANCES
+before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
+create table test.t1 like performance_schema.setup_instruments;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.FILE_INSTANCES;
+create table test.t1 like performance_schema.file_instances;
ERROR HY000: Invalid performance_schema usage.
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name="foo";
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-insert into performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments'
+insert into performance_schema.events_waits_current
set name="foo";
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-insert into performance_schema.FILE_INSTANCES
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'events_waits_current'
+insert into performance_schema.file_instances
set name="foo";
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.SETUP_INSTRUMENTS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS'
-delete from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.FILE_INSTANCES;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
-lock table performance_schema.SETUP_INSTRUMENTS read;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_instances'
+delete from performance_schema.setup_instruments;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'setup_instruments'
+delete from performance_schema.events_waits_current;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'events_waits_current'
+delete from performance_schema.file_instances;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_instances'
+lock table performance_schema.setup_instruments read;
unlock tables;
-lock table performance_schema.SETUP_INSTRUMENTS write;
+lock table performance_schema.setup_instruments write;
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.FILE_INSTANCES read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances'
unlock tables;
-lock table performance_schema.FILE_INSTANCES write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'file_instances'
unlock tables;
#
# WL#4818, NFS2: Can use grants to give normal user access
-# to view data from _CURRENT and _HISTORY tables
+# to view data from _current and _history tables
#
# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
-# (Except for EVENTS_WAITS_CURRENT, which is granted.)
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
+# (Except for events_waits_current, which is granted.)
+SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
can select
can select
drop table if exists test.t1;
-rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
+rename table performance_schema.setup_instruments to test.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
+rename table performance_schema.events_waits_current to test.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to test.t1;
+rename table performance_schema.file_instances to test.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
+rename table performance_schema.setup_instruments to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
+rename table performance_schema.events_waits_current to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
+rename table performance_schema.file_instances to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS
-to performance_schema.EVENTS_WAITS_CURRENT;
+rename table performance_schema.setup_instruments
+to performance_schema.events_waits_current;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT
-to performance_schema.SETUP_INSTRUMENTS;
+rename table performance_schema.events_waits_current
+to performance_schema.setup_instruments;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create procedure performance_schema.my_proc() begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
@@ -238,95 +238,95 @@ create event performance_schema.my_event on schedule every 15 minute
do begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_setup_instruments
-before insert on performance_schema.SETUP_INSTRUMENTS
+before insert on performance_schema.setup_instruments
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_events_waits_current
-before insert on performance_schema.EVENTS_WAITS_CURRENT
+before insert on performance_schema.events_waits_current
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_file_instances
-before insert on performance_schema.FILE_INSTANCES
+before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
+create table test.t1 like performance_schema.setup_instruments;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.FILE_INSTANCES;
+create table test.t1 like performance_schema.file_instances;
ERROR HY000: Invalid performance_schema usage.
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS'
-insert into performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments'
+insert into performance_schema.events_waits_current
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-insert into performance_schema.FILE_INSTANCES
+ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current'
+insert into performance_schema.file_instances
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.SETUP_INSTRUMENTS;
-ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS'
-delete from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.FILE_INSTANCES;
-ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES'
-lock table performance_schema.SETUP_INSTRUMENTS read;
+ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'file_instances'
+delete from performance_schema.setup_instruments;
+ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments'
+delete from performance_schema.events_waits_current;
+ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current'
+delete from performance_schema.file_instances;
+ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'file_instances'
+lock table performance_schema.setup_instruments read;
unlock tables;
-lock table performance_schema.SETUP_INSTRUMENTS write;
+lock table performance_schema.setup_instruments write;
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.FILE_INSTANCES read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'file_instances'
unlock tables;
-lock table performance_schema.FILE_INSTANCES write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'file_instances'
unlock tables;
#
# WL#4818, NFS2: Can use grants to give normal user access
-# to view data from _CURRENT and _HISTORY tables
+# to view data from _current and _history tables
#
# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
-# (Except for EVENTS_WAITS_CURRENT, which is granted.)
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
+# (Except for events_waits_current, which is granted.)
+SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
can select
can select
drop table if exists test.t1;
-rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
+rename table performance_schema.setup_instruments to test.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
+rename table performance_schema.events_waits_current to test.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to test.t1;
+rename table performance_schema.file_instances to test.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
+rename table performance_schema.setup_instruments to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
+rename table performance_schema.events_waits_current to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
+rename table performance_schema.file_instances to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS
-to performance_schema.EVENTS_WAITS_CURRENT;
+rename table performance_schema.setup_instruments
+to performance_schema.events_waits_current;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT
-to performance_schema.SETUP_INSTRUMENTS;
+rename table performance_schema.events_waits_current
+to performance_schema.setup_instruments;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create procedure performance_schema.my_proc() begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
@@ -336,95 +336,95 @@ create event performance_schema.my_event on schedule every 15 minute
do begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_setup_instruments
-before insert on performance_schema.SETUP_INSTRUMENTS
+before insert on performance_schema.setup_instruments
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_events_waits_current
-before insert on performance_schema.EVENTS_WAITS_CURRENT
+before insert on performance_schema.events_waits_current
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_file_instances
-before insert on performance_schema.FILE_INSTANCES
+before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
+create table test.t1 like performance_schema.setup_instruments;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.FILE_INSTANCES;
+create table test.t1 like performance_schema.file_instances;
ERROR HY000: Invalid performance_schema usage.
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS'
-insert into performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments'
+insert into performance_schema.events_waits_current
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-insert into performance_schema.FILE_INSTANCES
+ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current'
+insert into performance_schema.file_instances
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.SETUP_INSTRUMENTS;
-ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS'
-delete from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.FILE_INSTANCES;
-ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES'
-lock table performance_schema.SETUP_INSTRUMENTS read;
+ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'file_instances'
+delete from performance_schema.setup_instruments;
+ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments'
+delete from performance_schema.events_waits_current;
+ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current'
+delete from performance_schema.file_instances;
+ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'file_instances'
+lock table performance_schema.setup_instruments read;
unlock tables;
-lock table performance_schema.SETUP_INSTRUMENTS write;
+lock table performance_schema.setup_instruments write;
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.FILE_INSTANCES read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'file_instances'
unlock tables;
-lock table performance_schema.FILE_INSTANCES write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'file_instances'
unlock tables;
#
# WL#4818, NFS2: Can use grants to give normal user access
-# to view data from _CURRENT and _HISTORY tables
+# to view data from _current and _history tables
#
# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
-# (Except for EVENTS_WAITS_CURRENT, which is granted.)
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
+# (Except for events_waits_current, which is granted.)
+SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
can select
can select
-SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
+SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
can select
can select
drop table if exists test.t1;
-rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
+rename table performance_schema.setup_instruments to test.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
+rename table performance_schema.events_waits_current to test.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to test.t1;
+rename table performance_schema.file_instances to test.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
+rename table performance_schema.setup_instruments to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
+rename table performance_schema.events_waits_current to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
+rename table performance_schema.file_instances to performance_schema.t1;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.SETUP_INSTRUMENTS
-to performance_schema.EVENTS_WAITS_CURRENT;
+rename table performance_schema.setup_instruments
+to performance_schema.events_waits_current;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
-rename table performance_schema.EVENTS_WAITS_CURRENT
-to performance_schema.SETUP_INSTRUMENTS;
+rename table performance_schema.events_waits_current
+to performance_schema.setup_instruments;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create procedure performance_schema.my_proc() begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
@@ -434,73 +434,73 @@ create event performance_schema.my_event on schedule every 15 minute
do begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_setup_instruments
-before insert on performance_schema.SETUP_INSTRUMENTS
+before insert on performance_schema.setup_instruments
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_events_waits_current
-before insert on performance_schema.EVENTS_WAITS_CURRENT
+before insert on performance_schema.events_waits_current
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create trigger performance_schema.bi_file_instances
-before insert on performance_schema.FILE_INSTANCES
+before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
+create table test.t1 like performance_schema.setup_instruments;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
-create table test.t1 like performance_schema.FILE_INSTANCES;
+create table test.t1 like performance_schema.file_instances;
ERROR HY000: Invalid performance_schema usage.
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS'
-insert into performance_schema.EVENTS_WAITS_CURRENT
+ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments'
+insert into performance_schema.events_waits_current
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-insert into performance_schema.FILE_INSTANCES
+ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current'
+insert into performance_schema.file_instances
set name="foo";
-ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES'
-delete from performance_schema.SETUP_INSTRUMENTS;
-ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS'
-delete from performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-delete from performance_schema.FILE_INSTANCES;
-ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES'
-lock table performance_schema.SETUP_INSTRUMENTS read;
+ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'file_instances'
+delete from performance_schema.setup_instruments;
+ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments'
+delete from performance_schema.events_waits_current;
+ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current'
+delete from performance_schema.file_instances;
+ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'file_instances'
+lock table performance_schema.setup_instruments read;
unlock tables;
-lock table performance_schema.SETUP_INSTRUMENTS write;
+lock table performance_schema.setup_instruments write;
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.EVENTS_WAITS_CURRENT write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+lock table performance_schema.events_waits_current write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_current'
unlock tables;
-lock table performance_schema.FILE_INSTANCES read;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances read;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'file_instances'
unlock tables;
-lock table performance_schema.FILE_INSTANCES write;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES'
+lock table performance_schema.file_instances write;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'file_instances'
unlock tables;
#
# WL#4818, NFS2: Can use grants to give normal user access
-# to view data from _CURRENT and _HISTORY tables
+# to view data from _current and _history tables
#
# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
-# (Except for EVENTS_WAITS_CURRENT, which is granted.)
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
-ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
-ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
-can select
-can select
-SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
-ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
-ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
+# (Except for events_waits_current, which is granted.)
+SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
+ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_history'
+SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
+ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_history_long'
+SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
+can select
+can select
+SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
+ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'events_waits_summary_by_instance'
+SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
+ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'file_summary_by_instance'
revoke all privileges, grant option from 'pfs_user_1'@localhost;
revoke all privileges, grant option from 'pfs_user_2'@localhost;
revoke all privileges, grant option from 'pfs_user_3'@localhost;
@@ -516,63 +516,63 @@ CREATE user pfs_user_4;
# without grants
#
# Select as pfs_user_4 should fail without grant
-SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY;
-ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG;
-ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT'
-SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE;
-ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE'
+SELECT event_id FROM performance_schema.events_waits_history;
+ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history'
+SELECT event_id FROM performance_schema.events_waits_history_long;
+ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history_long'
+SELECT event_id FROM performance_schema.events_waits_current;
+ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_current'
+SELECT event_name FROM performance_schema.events_waits_summary_by_instance;
+ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_summary_by_instance'
+SELECT event_name FROM performance_schema.file_summary_by_instance;
+ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'file_summary_by_instance'
#
# WL#4818, NFS3: Normal user does not have access to change what is
# instrumented without grants
#
# User pfs_user_4 should not be allowed to tweak instrumentation without
# explicit grant
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
-ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS'
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
+ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_instruments'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
-ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS'
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_CONSUMERS'
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK';
-ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_TIMERS'
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG'
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY'
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
-ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT'
+ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_instruments'
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_consumers'
+UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
+ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'setup_timers'
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history_long'
+TRUNCATE TABLE performance_schema.events_waits_history;
+ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_history'
+TRUNCATE TABLE performance_schema.events_waits_current;
+ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'events_waits_current'
#
# WL#4814, NFS1: Can use grants to give normal user access
# to turn on and off instrumentation
#
# Grant access to change tables with the root account
-GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4;
-GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4;
-GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4;
+GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4;
+GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4;
+GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_history_long TO pfs_user_4;
# User pfs_user_4 should now be allowed to tweak instrumentation
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
# Clean up
REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4;
DROP USER pfs_user_4;
flush privileges;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE';
diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result
index a0aeac5a916..c7ac3d499b4 100644
--- a/mysql-test/suite/perfschema/r/query_cache.result
+++ b/mysql-test/suite/perfschema/r/query_cache.result
@@ -33,10 +33,10 @@ Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
-select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1;
+select spins from performance_schema.events_waits_current order by event_name limit 1;
spins
NULL
-select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1;
+select name from performance_schema.setup_instruments order by name limit 1;
name
wait/io/file/csv/data
show status like "Qcache_queries_in_cache";
@@ -48,10 +48,10 @@ Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
-select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1;
+select spins from performance_schema.events_waits_current order by event_name limit 1;
spins
NULL
-select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1;
+select name from performance_schema.setup_instruments order by name limit 1;
name
wait/io/file/csv/data
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result
index 6a30eb4ab8b..19108326f1b 100644
--- a/mysql-test/suite/perfschema/r/read_only.result
+++ b/mysql-test/suite/perfschema/r/read_only.result
@@ -13,9 +13,9 @@ show grants;
Grants for pfsuser@localhost
GRANT USAGE ON *.* TO 'pfsuser'@'localhost'
GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost'
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
connection default;
set global read_only=1;
connection con1;
@@ -26,9 +26,9 @@ show grants;
Grants for pfsuser@localhost
GRANT USAGE ON *.* TO 'pfsuser'@'localhost'
GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost'
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
connection default;
grant super on *.* to pfsuser@localhost;
flush privileges;
@@ -40,9 +40,9 @@ show grants;
Grants for pfsuser@localhost
GRANT SUPER ON *.* TO 'pfsuser'@'localhost'
GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost'
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
connection default;
set global read_only= @start_read_only;
drop user pfsuser@localhost;
diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result
index a802539b7e0..5bafa137af5 100644
--- a/mysql-test/suite/perfschema/r/schema.result
+++ b/mysql-test/suite/perfschema/r/schema.result
@@ -8,32 +8,32 @@ test
use performance_schema;
show tables;
Tables_in_performance_schema
-COND_INSTANCES
-EVENTS_WAITS_CURRENT
-EVENTS_WAITS_HISTORY
-EVENTS_WAITS_HISTORY_LONG
-EVENTS_WAITS_SUMMARY_BY_INSTANCE
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
-FILE_INSTANCES
-FILE_SUMMARY_BY_EVENT_NAME
-FILE_SUMMARY_BY_INSTANCE
-MUTEX_INSTANCES
-PERFORMANCE_TIMERS
-RWLOCK_INSTANCES
-SETUP_CONSUMERS
-SETUP_INSTRUMENTS
-SETUP_TIMERS
-THREADS
-show create table COND_INSTANCES;
-Table Create Table
-COND_INSTANCES CREATE TABLE `COND_INSTANCES` (
+cond_instances
+events_waits_current
+events_waits_history
+events_waits_history_long
+events_waits_summary_by_instance
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_global_by_event_name
+file_instances
+file_summary_by_event_name
+file_summary_by_instance
+mutex_instances
+performance_timers
+rwlock_instances
+setup_consumers
+setup_instruments
+setup_timers
+threads
+show create table cond_instances;
+Table Create Table
+cond_instances CREATE TABLE `cond_instances` (
`NAME` varchar(128) NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_CURRENT;
+show create table events_waits_current;
Table Create Table
-EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` (
+events_waits_current CREATE TABLE `events_waits_current` (
`THREAD_ID` int(11) NOT NULL,
`EVENT_ID` bigint(20) unsigned NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
@@ -51,9 +51,9 @@ EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` (
`NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_HISTORY;
+show create table events_waits_history;
Table Create Table
-EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` (
+events_waits_history CREATE TABLE `events_waits_history` (
`THREAD_ID` int(11) NOT NULL,
`EVENT_ID` bigint(20) unsigned NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
@@ -71,9 +71,9 @@ EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` (
`NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_HISTORY_LONG;
+show create table events_waits_history_long;
Table Create Table
-EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` (
+events_waits_history_long CREATE TABLE `events_waits_history_long` (
`THREAD_ID` int(11) NOT NULL,
`EVENT_ID` bigint(20) unsigned NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
@@ -91,9 +91,9 @@ EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` (
`NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+show create table events_waits_summary_by_instance;
Table Create Table
-EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
+events_waits_summary_by_instance CREATE TABLE `events_waits_summary_by_instance` (
`EVENT_NAME` varchar(128) NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
@@ -102,9 +102,9 @@ EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE`
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table events_waits_summary_by_thread_by_event_name;
Table Create Table
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
+events_waits_summary_by_thread_by_event_name CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
`THREAD_ID` int(11) NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
@@ -113,9 +113,9 @@ EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+show create table events_waits_summary_global_by_event_name;
Table Create Table
-EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` (
+events_waits_summary_global_by_event_name CREATE TABLE `events_waits_summary_global_by_event_name` (
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -123,25 +123,25 @@ EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_GLO
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table FILE_INSTANCES;
+show create table file_instances;
Table Create Table
-FILE_INSTANCES CREATE TABLE `FILE_INSTANCES` (
+file_instances CREATE TABLE `file_instances` (
`FILE_NAME` varchar(512) NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`OPEN_COUNT` int(10) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table FILE_SUMMARY_BY_EVENT_NAME;
+show create table file_summary_by_event_name;
Table Create Table
-FILE_SUMMARY_BY_EVENT_NAME CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` (
+file_summary_by_event_name CREATE TABLE `file_summary_by_event_name` (
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_READ` bigint(20) unsigned NOT NULL,
`COUNT_WRITE` bigint(20) unsigned NOT NULL,
`SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
`SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table FILE_SUMMARY_BY_INSTANCE;
+show create table file_summary_by_instance;
Table Create Table
-FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` (
+file_summary_by_instance CREATE TABLE `file_summary_by_instance` (
`FILE_NAME` varchar(512) NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_READ` bigint(20) unsigned NOT NULL,
@@ -149,52 +149,52 @@ FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` (
`SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
`SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table MUTEX_INSTANCES;
+show create table mutex_instances;
Table Create Table
-MUTEX_INSTANCES CREATE TABLE `MUTEX_INSTANCES` (
+mutex_instances CREATE TABLE `mutex_instances` (
`NAME` varchar(128) NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table PERFORMANCE_TIMERS;
+show create table performance_timers;
Table Create Table
-PERFORMANCE_TIMERS CREATE TABLE `PERFORMANCE_TIMERS` (
+performance_timers CREATE TABLE `performance_timers` (
`TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
`TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
`TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
`TIMER_OVERHEAD` bigint(20) DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table RWLOCK_INSTANCES;
+show create table rwlock_instances;
Table Create Table
-RWLOCK_INSTANCES CREATE TABLE `RWLOCK_INSTANCES` (
+rwlock_instances CREATE TABLE `rwlock_instances` (
`NAME` varchar(128) NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
`READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table SETUP_CONSUMERS;
+show create table setup_consumers;
Table Create Table
-SETUP_CONSUMERS CREATE TABLE `SETUP_CONSUMERS` (
+setup_consumers CREATE TABLE `setup_consumers` (
`NAME` varchar(64) NOT NULL,
`ENABLED` enum('YES','NO') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table SETUP_INSTRUMENTS;
+show create table setup_instruments;
Table Create Table
-SETUP_INSTRUMENTS CREATE TABLE `SETUP_INSTRUMENTS` (
+setup_instruments CREATE TABLE `setup_instruments` (
`NAME` varchar(128) NOT NULL,
`ENABLED` enum('YES','NO') NOT NULL,
`TIMED` enum('YES','NO') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table SETUP_TIMERS;
+show create table setup_timers;
Table Create Table
-SETUP_TIMERS CREATE TABLE `SETUP_TIMERS` (
+setup_timers CREATE TABLE `setup_timers` (
`NAME` varchar(64) NOT NULL,
`TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table THREADS;
+show create table threads;
Table Create Table
-THREADS CREATE TABLE `THREADS` (
+threads CREATE TABLE `threads` (
`THREAD_ID` int(11) NOT NULL,
- `ID` int(11) NOT NULL,
- `NAME` varchar(64) NOT NULL
+ `PROCESSLIST_ID` int(11) DEFAULT NULL,
+ `NAME` varchar(128) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result
index dfc9007c740..a3d0931cf4c 100644
--- a/mysql-test/suite/perfschema/r/selects.result
+++ b/mysql-test/suite/perfschema/r/selects.result
@@ -1,38 +1,38 @@
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
GROUP BY OPERATION
HAVING TOTAL IS NOT NULL
ORDER BY OPERATION
LIMIT 1;
OPERATION TOTAL
chsize [NUM_BYTES]
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.THREADS)
+(SELECT THREAD_ID FROM performance_schema.threads)
AND EVENT_NAME IN
-(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
+(SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
EVENT_ID
[EVENT_ID]
SELECT DISTINCT EVENT_ID
-FROM performance_schema.EVENTS_WAITS_CURRENT
-JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID)
+FROM performance_schema.events_waits_current
+JOIN performance_schema.events_waits_history USING (EVENT_ID)
+JOIN performance_schema.events_waits_history_long USING (EVENT_ID)
ORDER BY EVENT_ID
LIMIT 1;
EVENT_ID
[EVENT_ID]
SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_HISTORY t1
-JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME)
+FROM performance_schema.events_waits_history t1
+JOIN performance_schema.events_waits_history t2 USING (EVENT_ID)
+JOIN performance_schema.events_waits_history t3 ON (t2.THREAD_ID = t3.THREAD_ID)
+JOIN performance_schema.events_waits_history t4 ON (t3.EVENT_NAME = t4.EVENT_NAME)
ORDER BY t1.EVENT_ID, t2.EVENT_ID
LIMIT 5;
THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT
@@ -42,11 +42,11 @@ THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT
[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT]
[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT]
SELECT THREAD_ID, EVENT_ID FROM (
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_current
UNION
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history
UNION
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history_long
) t1 ORDER BY THREAD_ID, EVENT_ID
LIMIT 5;
THREAD_ID EVENT_ID
@@ -58,14 +58,14 @@ THREAD_ID EVENT_ID
DROP TABLE IF EXISTS t_event;
DROP EVENT IF EXISTS t_ps_event;
CREATE TABLE t_event AS
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
DO INSERT INTO t_event
SELECT DISTINCT EVENT_ID
-FROM performance_schema.EVENTS_WAITS_CURRENT
-JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
+FROM performance_schema.events_waits_current
+JOIN performance_schema.events_waits_history USING (EVENT_ID)
ORDER BY EVENT_ID
LIMIT 1;
ALTER TABLE t1 ADD COLUMN c INT;
@@ -73,7 +73,7 @@ DROP TRIGGER IF EXISTS t_ps_trigger;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
FOR EACH ROW BEGIN
SET NEW.c = (SELECT MAX(EVENT_ID)
-FROM performance_schema.EVENTS_WAITS_CURRENT);
+FROM performance_schema.events_waits_current);
END;
|
INSERT INTO t1 (id) VALUES (11), (12), (13);
@@ -84,22 +84,22 @@ id c
13 [EVENT_ID]
DROP TRIGGER t_ps_trigger;
DROP PROCEDURE IF EXISTS t_ps_proc;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
BEGIN
-SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid INTO pid;
+SELECT thread_id FROM performance_schema.threads
+WHERE PROCESSLIST_ID = conid INTO pid;
END;
|
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
DROP FUNCTION IF EXISTS t_ps_proc;
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
BEGIN
-return (SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid);
+return (SELECT thread_id FROM performance_schema.threads
+WHERE PROCESSLIST_ID = conid);
END;
|
-SELECT t_ps_func(0) = @p_id;
-t_ps_func(0) = @p_id
+SELECT t_ps_func(connection_id()) = @p_id;
+t_ps_func(connection_id()) = @p_id
1
SELECT * FROM t_event;
EVENT_ID
diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result
index 0c1e06d157c..b6f1d4828c3 100644
--- a/mysql-test/suite/perfschema/r/server_init.result
+++ b/mysql-test/suite/perfschema/r/server_init.result
@@ -1,209 +1,197 @@
use performance_schema;
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_threads";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_malloc";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_open";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_isam";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_heap";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_net";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_charset";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_time";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/mysys/THR_COND_threads";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_open";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_thread_count";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_status";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_error_log";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_insert";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_uuid_generator";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_status";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_create";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_crypt";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_slave_list";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_active_mi";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_manager";
count(name)
1
-select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_global_read_lock";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_global_system_variables";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_user_conn";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_connection_count";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_rpl_status";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
count(name)
1
-select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_event_metadata";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_event_queue";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_user_locks";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/Cversion_lock";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_audit_mask";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_xid_cache";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_plugin";
count(name)
1
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/tz_LOCK";
count(name)
1
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_grant";
count(name)
1
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect";
count(name)
1
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave";
count(name)
1
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_server_started";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_refresh";
count(name)
0
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_thread_count";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_manager";
count(name)
1
-select count(name) from COND_INSTANCES
-where name like "wait/synch/cond/sql/COND_global_read_lock";
-count(name)
-1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_thread_cache";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_flush_thread_cache";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_rpl_status";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed";
count(name)
1
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_queue_state";
count(name)
1
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index d03e227fc83..f32ffe327a2 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_cond_classes";
Variable_name Value
performance_schema_max_cond_classes 0
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/cond/%";
count(*)
0
@@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.COND_INSTANCES;
+select count(*) from performance_schema.cond_instances;
count(*)
0
show status like "performance_schema_cond_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index 812dc329aaf..ef853ccc710 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_cond_classes";
Variable_name Value
performance_schema_max_cond_classes 80
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/cond/%";
count(*) > 0
1
@@ -67,7 +67,7 @@ Performance_schema_cond_classes_lost 0
show variables like "performance_schema_max_cond_instances";
Variable_name Value
performance_schema_max_cond_instances 0
-select count(*) from performance_schema.COND_INSTANCES;
+select count(*) from performance_schema.cond_instances;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index 7ef247e0755..bafb4cac270 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_file_classes";
Variable_name Value
performance_schema_max_file_classes 0
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/io/file/%";
count(*)
0
@@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.FILE_INSTANCES;
+select count(*) from performance_schema.file_instances;
count(*)
0
show status like "performance_schema_file_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index 301c4e44f1e..2e557e5510a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_file_classes";
Variable_name Value
performance_schema_max_file_classes 50
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/io/file/%";
count(*) > 0
1
@@ -67,7 +67,7 @@ Performance_schema_file_classes_lost 0
show variables like "performance_schema_max_file_instances";
Variable_name Value
performance_schema_max_file_instances 0
-select count(*) from performance_schema.FILE_INSTANCES;
+select count(*) from performance_schema.file_instances;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index a1f880d3b9e..b6d359ae5d2 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_mutex_classes";
Variable_name Value
performance_schema_max_mutex_classes 0
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/mutex/%";
count(*)
0
@@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.MUTEX_INSTANCES;
+select count(*) from performance_schema.mutex_instances;
count(*)
0
show status like "performance_schema_mutex_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index ab566f0703a..190d58378ac 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_mutex_classes";
Variable_name Value
performance_schema_max_mutex_classes 200
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/mutex/%";
count(*) > 0
1
@@ -67,7 +67,7 @@ Performance_schema_mutex_classes_lost 0
show variables like "performance_schema_max_mutex_instances";
Variable_name Value
performance_schema_max_mutex_instances 0
-select count(*) from performance_schema.MUTEX_INSTANCES;
+select count(*) from performance_schema.mutex_instances;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index aabc9ec49bb..b27159828f6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_rwlock_classes";
Variable_name Value
performance_schema_max_rwlock_classes 0
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
count(*)
0
@@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.RWLOCK_INSTANCES;
+select count(*) from performance_schema.rwlock_instances;
count(*)
0
show status like "performance_schema_rwlock_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index 5e5998a9959..7466235c42f 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_rwlock_classes";
Variable_name Value
performance_schema_max_rwlock_classes 30
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
count(*) > 0
1
@@ -67,7 +67,7 @@ Performance_schema_rwlock_classes_lost 0
show variables like "performance_schema_max_rwlock_instances";
Variable_name Value
performance_schema_max_rwlock_instances 0
-select count(*) from performance_schema.RWLOCK_INSTANCES;
+select count(*) from performance_schema.rwlock_instances;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index 96c3cae97ab..075c22bc405 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -57,7 +57,7 @@ show status like "performance_schema%";
show variables like "performance_schema_max_thread_classes";
Variable_name Value
performance_schema_max_thread_classes 0
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "thread/%";
count(*)
0
@@ -65,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.THREADS;
+select count(*) from performance_schema.threads;
count(*)
0
show status like "performance_schema_thread_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index e2cf0917cbf..763b5b69ca1 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -63,7 +63,7 @@ Performance_schema_thread_classes_lost 0
show variables like "performance_schema_max_thread_instances";
Variable_name Value
performance_schema_max_thread_instances 0
-select count(*) from performance_schema.THREADS;
+select count(*) from performance_schema.threads;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 8bf52580e77..4cdfad654ae 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
0
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema OFF
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 15fe4e082ab..a17f78b27db 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -5,35 +5,35 @@ mtr
mysql
performance_schema
test
-select count(*) from performance_schema.PERFORMANCE_TIMERS;
+select count(*) from performance_schema.performance_timers;
count(*)
5
-select count(*) from performance_schema.SETUP_CONSUMERS;
+select count(*) from performance_schema.setup_consumers;
count(*)
8
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
+select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
-select count(*) from performance_schema.SETUP_TIMERS;
+select count(*) from performance_schema.setup_timers;
count(*)
1
-select * from performance_schema.COND_INSTANCES;
-select * from performance_schema.EVENTS_WAITS_CURRENT;
-select * from performance_schema.EVENTS_WAITS_HISTORY;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-select * from performance_schema.FILE_INSTANCES;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
-select * from performance_schema.MUTEX_INSTANCES;
-select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.RWLOCK_INSTANCES;
-select * from performance_schema.SETUP_CONSUMERS;
-select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_TIMERS;
-select * from performance_schema.THREADS;
+select * from performance_schema.cond_instances;
+select * from performance_schema.events_waits_current;
+select * from performance_schema.events_waits_history;
+select * from performance_schema.events_waits_history_long;
+select * from performance_schema.events_waits_summary_by_instance;
+select * from performance_schema.events_waits_summary_by_thread_by_event_name;
+select * from performance_schema.events_waits_summary_global_by_event_name;
+select * from performance_schema.file_instances;
+select * from performance_schema.file_summary_by_event_name;
+select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.mutex_instances;
+select * from performance_schema.performance_timers;
+select * from performance_schema.rwlock_instances;
+select * from performance_schema.setup_consumers;
+select * from performance_schema.setup_instruments;
+select * from performance_schema.setup_timers;
+select * from performance_schema.threads;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
diff --git a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result
index cdf0029eeb9..86252d4ca01 100644
--- a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result
+++ b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result
@@ -1,6 +1,6 @@
call mtr.add_suppression(
-"Column count of mysql.SETUP_INSTRUMENTS is wrong. "
+"Column count of mysql.setup_instruments is wrong. "
"Expected 4, found 3. The table is probably corrupted");
-select * from performance_schema.SETUP_INSTRUMENTS limit 1;
-ERROR HY000: Native table 'performance_schema'.'SETUP_INSTRUMENTS' has the wrong structure
-select * from performance_schema.SETUP_CONSUMERS limit 1;
+select * from performance_schema.setup_instruments limit 1;
+ERROR HY000: Native table 'performance_schema'.'setup_instruments' has the wrong structure
+select * from performance_schema.setup_consumers limit 1;
diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test
index a8ca3dd91e2..13906af3099 100644
--- a/mysql-test/suite/perfschema/t/aggregate.test
+++ b/mysql-test/suite/perfschema/t/aggregate.test
@@ -25,19 +25,19 @@
drop table if exists t1;
--enable_warnings
-update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO';
-update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
+update performance_schema.setup_instruments set enabled = 'NO';
+update performance_schema.setup_consumers set enabled = 'NO';
# Cleanup statistics
-truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+truncate table performance_schema.file_summary_by_event_name;
+truncate table performance_schema.file_summary_by_instance;
+truncate table performance_schema.events_waits_summary_global_by_event_name;
+truncate table performance_schema.events_waits_summary_by_instance;
+truncate table performance_schema.events_waits_summary_by_thread_by_event_name;
# Start recording data
-update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_consumers set enabled = 'YES';
+update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
@@ -49,27 +49,27 @@ create table t1 (
insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8);
# Stop recording data, so the select below don't add noise.
-update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO';
+update performance_schema.setup_instruments SET enabled = 'NO';
# Disable all consumers, for long standing waits
-update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
+update performance_schema.setup_consumers set enabled = 'NO';
# Helper to debug
set @dump_all=FALSE;
# Note that in general:
-# - COUNT/SUM/MAX(FILE_SUMMARY_BY_EVENT_NAME) >=
-# COUNT/SUM/MAX(FILE_SUMMARY_BY_INSTANCE).
-# - MIN(FILE_SUMMARY_BY_EVENT_NAME) <=
-# MIN(FILE_SUMMARY_BY_INSTANCE).
+# - COUNT/SUM/MAX(file_summary_by_event_name) >=
+# COUNT/SUM/MAX(file_summary_by_instance).
+# - MIN(file_summary_by_event_name) <=
+# MIN(file_summary_by_instance).
# There will be equality only when file instances are not removed,
# aka when a file is not deleted from the file system,
-# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE.
+# because doing so removes a row in file_summary_by_instance.
# Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
-# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
-# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
-# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
+# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >=
+# COUNT/SUM/MAX(events_waits_summary_by_instance)
+# - MIN(events_waits_summary_global_by_event_name) <=
+# MIN(events_waits_summary_by_instance)
# There will be equality only when an instrument instance
# is not removed, which is next to impossible to predictably guarantee
# in the server.
@@ -77,18 +77,18 @@ set @dump_all=FALSE;
# will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock.
# Another example, a thread terminating will cause a mysql_mutex_destroy
# on sql/LOCK_delete
-# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE.
+# Both cause a row to be deleted from events_waits_summary_by_instance.
# Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
-# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
-# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
-# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
+# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >=
+# COUNT/SUM/MAX(events_waits_summary_by_thread_by_event_name)
+# - MIN(events_waits_summary_global_by_event_name) <=
+# MIN(events_waits_summary_by_thread_by_event_name)
# There will be equality only when no thread is removed,
# that is if no thread disconnects, or no sub thread (for example insert
# delayed) ever completes.
# A thread completing will cause rows in
-# EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME to be removed.
+# events_waits_summary_by_thread_by_event_name to be removed.
--echo "Verifying file aggregate consistency"
@@ -101,29 +101,29 @@ set @dump_all=FALSE;
# If any of these queries returns data, the test failed.
SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.COUNT_READ <> SUM(i.COUNT_READ))
OR @dump_all;
SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE))
OR @dump_all;
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ))
OR @dump_all;
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
-FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
-JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.file_summary_by_event_name AS e
+JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE))
OR @dump_all;
@@ -131,23 +131,23 @@ OR @dump_all;
--echo "Verifying waits aggregate consistency (instance)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
OR @dump_all;
@@ -155,16 +155,16 @@ OR @dump_all;
--echo "Verifying waits aggregate consistency (thread)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT))
@@ -172,8 +172,8 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
-JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
+FROM performance_schema.events_waits_summary_global_by_event_name AS e
+JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT))
@@ -182,8 +182,8 @@ OR @dump_all;
# Cleanup
-update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_consumers set enabled = 'YES';
+update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
drop table test.t1;
diff --git a/mysql-test/suite/perfschema/t/checksum.test b/mysql-test/suite/perfschema/t/checksum.test
index d7fdd7b4c2c..0600edcef26 100644
--- a/mysql-test/suite/perfschema/t/checksum.test
+++ b/mysql-test/suite/perfschema/t/checksum.test
@@ -24,41 +24,41 @@
#
--disable_result_log
-checksum table performance_schema.COND_INSTANCES;
-checksum table performance_schema.EVENTS_WAITS_CURRENT;
-checksum table performance_schema.EVENTS_WAITS_HISTORY;
-checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-checksum table performance_schema.FILE_INSTANCES;
-checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
-checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-checksum table performance_schema.MUTEX_INSTANCES;
-checksum table performance_schema.PERFORMANCE_TIMERS;
-checksum table performance_schema.RWLOCK_INSTANCES;
-checksum table performance_schema.SETUP_CONSUMERS;
-checksum table performance_schema.SETUP_INSTRUMENTS;
-checksum table performance_schema.SETUP_TIMERS;
-checksum table performance_schema.THREADS;
+checksum table performance_schema.cond_instances;
+checksum table performance_schema.events_waits_current;
+checksum table performance_schema.events_waits_history;
+checksum table performance_schema.events_waits_history_long;
+checksum table performance_schema.events_waits_summary_by_instance;
+checksum table performance_schema.events_waits_summary_by_thread_by_event_name;
+checksum table performance_schema.events_waits_summary_global_by_event_name;
+checksum table performance_schema.file_instances;
+checksum table performance_schema.file_summary_by_event_name;
+checksum table performance_schema.file_summary_by_instance;
+checksum table performance_schema.mutex_instances;
+checksum table performance_schema.performance_timers;
+checksum table performance_schema.rwlock_instances;
+checksum table performance_schema.setup_consumers;
+checksum table performance_schema.setup_instruments;
+checksum table performance_schema.setup_timers;
+checksum table performance_schema.threads;
-checksum table performance_schema.COND_INSTANCES extended;
-checksum table performance_schema.EVENTS_WAITS_CURRENT extended;
-checksum table performance_schema.EVENTS_WAITS_HISTORY extended;
-checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended;
-checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended;
-checksum table performance_schema.FILE_INSTANCES extended;
-checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended;
-checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended;
-checksum table performance_schema.MUTEX_INSTANCES extended;
-checksum table performance_schema.PERFORMANCE_TIMERS extended;
-checksum table performance_schema.RWLOCK_INSTANCES extended;
-checksum table performance_schema.SETUP_CONSUMERS extended;
-checksum table performance_schema.SETUP_INSTRUMENTS extended;
-checksum table performance_schema.SETUP_TIMERS extended;
-checksum table performance_schema.THREADS extended;
+checksum table performance_schema.cond_instances extended;
+checksum table performance_schema.events_waits_current extended;
+checksum table performance_schema.events_waits_history extended;
+checksum table performance_schema.events_waits_history_long extended;
+checksum table performance_schema.events_waits_summary_by_instance extended;
+checksum table performance_schema.events_waits_summary_by_thread_by_event_name extended;
+checksum table performance_schema.events_waits_summary_global_by_event_name extended;
+checksum table performance_schema.file_instances extended;
+checksum table performance_schema.file_summary_by_event_name extended;
+checksum table performance_schema.file_summary_by_instance extended;
+checksum table performance_schema.mutex_instances extended;
+checksum table performance_schema.performance_timers extended;
+checksum table performance_schema.rwlock_instances extended;
+checksum table performance_schema.setup_consumers extended;
+checksum table performance_schema.setup_instruments extended;
+checksum table performance_schema.setup_timers extended;
+checksum table performance_schema.threads extended;
--enable_result_log
diff --git a/mysql-test/suite/perfschema/t/column_privilege.test b/mysql-test/suite/perfschema/t/column_privilege.test
index b6bcbdb3396..a1b0ede6b45 100644
--- a/mysql-test/suite/perfschema/t/column_privilege.test
+++ b/mysql-test/suite/perfschema/t/column_privilege.test
@@ -26,10 +26,10 @@ grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION;
# Test per column privileges on performance_schema
-grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT
+grant SELECT(thread_id, event_id) on performance_schema.events_waits_current
to 'pfs_user_5'@localhost;
-grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS
+grant UPDATE(enabled) on performance_schema.setup_instruments
to 'pfs_user_5'@localhost;
flush privileges;
@@ -42,32 +42,28 @@ connect (con1, localhost, pfs_user_5, , );
# For statements that works, we do not look at the output
--disable_result_log
-select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
+select thread_id from performance_schema.events_waits_current;
-select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT;
+select thread_id, event_id from performance_schema.events_waits_current;
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
--enable_result_log
# For statements that are denied, check the error number and error text.
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_COLUMNACCESS_DENIED_ERROR
-select event_name from performance_schema.EVENTS_WAITS_CURRENT;
+select event_name from performance_schema.events_waits_current;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_COLUMNACCESS_DENIED_ERROR
select thread_id, event_id, event_name
- from performance_schema.EVENTS_WAITS_CURRENT;
+ from performance_schema.events_waits_current;
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_COLUMNACCESS_DENIED_ERROR
-update performance_schema.SETUP_INSTRUMENTS set name='illegal';
+update performance_schema.setup_instruments set name='illegal';
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_COLUMNACCESS_DENIED_ERROR
-update performance_schema.SETUP_INSTRUMENTS set timed='NO';
+update performance_schema.setup_instruments set timed='NO';
# Cleanup
@@ -76,7 +72,7 @@ update performance_schema.SETUP_INSTRUMENTS set timed='NO';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost;
DROP USER 'pfs_user_5'@localhost;
flush privileges;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE';
diff --git a/mysql-test/suite/perfschema/t/ddl_cond_instances.test b/mysql-test/suite/perfschema/t/ddl_cond_instances.test
index e78429cb181..2da1100702f 100644
--- a/mysql-test/suite/perfschema/t/ddl_cond_instances.test
+++ b/mysql-test/suite/perfschema/t/ddl_cond_instances.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.COND_INSTANCES add column foo integer;
+alter table performance_schema.cond_instances add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.COND_INSTANCES;
+truncate table performance_schema.cond_instances;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.cond_instances ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.cond_instances(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test
index 34f735c1271..1914d333f00 100644
--- a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test
+++ b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer;
+alter table performance_schema.events_waits_current add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_CURRENT;
+truncate table performance_schema.events_waits_current;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID);
+ALTER TABLE performance_schema.events_waits_current ADD INDEX test_index(EVENT_ID);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_current(EVENT_ID);
diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test
index 76ebe3d85c4..97c840a350d 100644
--- a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test
+++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer;
+alter table performance_schema.events_waits_history add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_HISTORY;
+truncate table performance_schema.events_waits_history;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID);
+ALTER TABLE performance_schema.events_waits_history ADD INDEX test_index(EVENT_ID);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history(EVENT_ID);
diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test
index 549c5d6880b..b57a3864e1a 100644
--- a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test
+++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer;
+alter table performance_schema.events_waits_history_long add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_history_long;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID);
+ALTER TABLE performance_schema.events_waits_history_long ADD INDEX test_index(EVENT_ID);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_history_long(EVENT_ID);
diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test
index e6dad07fd63..a6315edd31d 100644
--- a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test
+++ b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer;
+alter table performance_schema.events_waits_summary_by_instance add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+truncate table performance_schema.events_waits_summary_by_instance;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME);
+ALTER TABLE performance_schema.events_waits_summary_by_instance ADD INDEX test_index(EVENT_NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.events_waits_summary_by_instance(EVENT_NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test
index 5b65ec26064..f59daca4b46 100644
--- a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test
@@ -19,15 +19,15 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+alter table performance_schema.events_waits_summary_by_thread_by_event_name
add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+truncate table performance_schema.events_waits_summary_by_thread_by_event_name;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID);
+ALTER TABLE performance_schema.events_waits_summary_by_thread_by_event_name ADD INDEX test_index(THREAD_ID);
-- error ER_DBACCESS_DENIED_ERROR
CREATE UNIQUE INDEX test_index
- ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID);
+ ON performance_schema.events_waits_summary_by_thread_by_event_name(THREAD_ID);
diff --git a/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
index c7a767b013b..880b4bf1a59 100644
--- a/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
@@ -19,16 +19,16 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+alter table performance_schema.events_waits_summary_global_by_event_name
add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+truncate table performance_schema.events_waits_summary_global_by_event_name;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ALTER TABLE performance_schema.events_waits_summary_global_by_event_name
ADD INDEX test_index(EVENT_NAME);
-- error ER_DBACCESS_DENIED_ERROR
CREATE UNIQUE INDEX test_index
- ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
+ ON performance_schema.events_waits_summary_global_by_event_name(EVENT_NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_file_instances.test b/mysql-test/suite/perfschema/t/ddl_file_instances.test
index a9c9a2a95b6..9d6b8c3cf26 100644
--- a/mysql-test/suite/perfschema/t/ddl_file_instances.test
+++ b/mysql-test/suite/perfschema/t/ddl_file_instances.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.FILE_INSTANCES add column foo integer;
+alter table performance_schema.file_instances add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.FILE_INSTANCES;
+truncate table performance_schema.file_instances;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME);
+ALTER TABLE performance_schema.file_instances ADD INDEX test_index(FILE_NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_instances(FILE_NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test
index 2581f07c0d2..f9a9cabb5b2 100644
--- a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer;
+alter table performance_schema.file_summary_by_event_name add column foo integer;
-truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.file_summary_by_event_name;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.file_summary_by_event_name ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_event_name(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test
index e06ad2eb7cd..defbff34321 100644
--- a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test
+++ b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test
@@ -19,13 +19,13 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer;
+alter table performance_schema.file_summary_by_instance add column foo integer;
-truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
+truncate table performance_schema.file_summary_by_instance;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.file_summary_by_instance ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.file_summary_by_instance(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test
index 6489a689620..ccd970655af 100644
--- a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test
+++ b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.MUTEX_INSTANCES add column foo integer;
+alter table performance_schema.mutex_instances add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.MUTEX_INSTANCES;
+truncate table performance_schema.mutex_instances;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.mutex_instances ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.mutex_instances(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_performance_timers.test b/mysql-test/suite/perfschema/t/ddl_performance_timers.test
index b692291b8cf..f6fcfd58bab 100644
--- a/mysql-test/suite/perfschema/t/ddl_performance_timers.test
+++ b/mysql-test/suite/perfschema/t/ddl_performance_timers.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.PERFORMANCE_TIMERS add column foo integer;
+alter table performance_schema.performance_timers add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.PERFORMANCE_TIMERS;
+truncate table performance_schema.performance_timers;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME);
+ALTER TABLE performance_schema.performance_timers ADD INDEX test_index(TIMER_NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.performance_timers(TIMER_NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test
index c07cd1ede48..e5bd8b890a1 100644
--- a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test
+++ b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.RWLOCK_INSTANCES add column foo integer;
+alter table performance_schema.rwlock_instances add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.RWLOCK_INSTANCES;
+truncate table performance_schema.rwlock_instances;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.rwlock_instances ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.rwlock_instances(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test
index c44db822145..3984e0b7fab 100644
--- a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test
+++ b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test
@@ -18,16 +18,15 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.SETUP_CONSUMERS add column foo integer;
+alter table performance_schema.setup_consumers add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.SETUP_CONSUMERS;
+truncate table performance_schema.setup_consumers;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_consumers ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_consumers(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test
index c20c386447c..b900f69e801 100644
--- a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test
+++ b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test
@@ -18,16 +18,15 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.SETUP_INSTRUMENTS add column foo integer;
+alter table performance_schema.setup_instruments add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.SETUP_INSTRUMENTS;
+truncate table performance_schema.setup_instruments;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_instruments ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_instruments(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_setup_timers.test b/mysql-test/suite/perfschema/t/ddl_setup_timers.test
index b9a5c32ecbe..bf8878a496d 100644
--- a/mysql-test/suite/perfschema/t/ddl_setup_timers.test
+++ b/mysql-test/suite/perfschema/t/ddl_setup_timers.test
@@ -18,16 +18,15 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.SETUP_TIMERS add column foo integer;
+alter table performance_schema.setup_timers add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.SETUP_TIMERS;
+truncate table performance_schema.setup_timers;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME);
+ALTER TABLE performance_schema.setup_timers ADD INDEX test_index(NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME);
+CREATE UNIQUE INDEX test_index ON performance_schema.setup_timers(NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_threads.test b/mysql-test/suite/perfschema/t/ddl_threads.test
index 12613e30c1f..d9ff3356b8d 100644
--- a/mysql-test/suite/perfschema/t/ddl_threads.test
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.THREADS add column foo integer;
+alter table performance_schema.threads add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.THREADS;
+truncate table performance_schema.threads;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
+ALTER TABLE performance_schema.threads ADD INDEX test_index(ID);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.threads(ID);
diff --git a/mysql-test/suite/perfschema/t/dml_cond_instances.test b/mysql-test/suite/perfschema/t/dml_cond_instances.test
index 1d1614db73f..528dae80dfa 100644
--- a/mysql-test/suite/perfschema/t/dml_cond_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_cond_instances.test
@@ -19,37 +19,31 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 #
-select * from performance_schema.COND_INSTANCES limit 1;
+select * from performance_schema.cond_instances limit 1;
-select * from performance_schema.COND_INSTANCES
+select * from performance_schema.cond_instances
where name='FOO';
---replace_result '\'cond_instances' '\'COND_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.COND_INSTANCES
+insert into performance_schema.cond_instances
set name='FOO', object_instance_begin=12;
---replace_result '\'cond_instances' '\'COND_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.COND_INSTANCES
+update performance_schema.cond_instances
set name='FOO';
---replace_result '\'cond_instances' '\'COND_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.COND_INSTANCES
+delete from performance_schema.cond_instances
where name like "wait/%";
---replace_result '\'cond_instances' '\'COND_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.COND_INSTANCES;
+delete from performance_schema.cond_instances;
---replace_result '\'cond_instances' '\'COND_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.COND_INSTANCES READ;
+LOCK TABLES performance_schema.cond_instances READ;
UNLOCK TABLES;
---replace_result '\'cond_instances' '\'COND_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.COND_INSTANCES WRITE;
+LOCK TABLES performance_schema.cond_instances WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_current.test b/mysql-test/suite/perfschema/t/dml_events_waits_current.test
index 3a93b98cb57..f82fac63df9 100644
--- a/mysql-test/suite/perfschema/t/dml_events_waits_current.test
+++ b/mysql-test/suite/perfschema/t/dml_events_waits_current.test
@@ -19,44 +19,37 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_CURRENT
+select * from performance_schema.events_waits_current
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_CURRENT
+select * from performance_schema.events_waits_current
where event_name='FOO';
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_CURRENT
+insert into performance_schema.events_waits_current
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_CURRENT
+update performance_schema.events_waits_current
set timer_start=12;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_CURRENT
+update performance_schema.events_waits_current
set timer_start=12 where thread_id=0;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_CURRENT
+delete from performance_schema.events_waits_current
where thread_id=1;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_CURRENT;
+delete from performance_schema.events_waits_current;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ;
+LOCK TABLES performance_schema.events_waits_current READ;
UNLOCK TABLES;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE;
+LOCK TABLES performance_schema.events_waits_current WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history.test b/mysql-test/suite/perfschema/t/dml_events_waits_history.test
index 174ef2147d1..865d261d7f9 100644
--- a/mysql-test/suite/perfschema/t/dml_events_waits_history.test
+++ b/mysql-test/suite/perfschema/t/dml_events_waits_history.test
@@ -19,52 +19,45 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name='FOO';
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' order by timer_wait limit 1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY
+select * from performance_schema.events_waits_history
where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_HISTORY
+insert into performance_schema.events_waits_history
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_HISTORY
+update performance_schema.events_waits_history
set timer_start=12;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_HISTORY
+update performance_schema.events_waits_history
set timer_start=12 where thread_id=0;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_HISTORY
+delete from performance_schema.events_waits_history
where thread_id=1;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_HISTORY;
+delete from performance_schema.events_waits_history;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ;
+LOCK TABLES performance_schema.events_waits_history READ;
UNLOCK TABLES;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE;
+LOCK TABLES performance_schema.events_waits_history WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test
index 73dc0aefd06..606e33b3e80 100644
--- a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test
+++ b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test
@@ -19,52 +19,45 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name='FOO';
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' order by timer_wait limit 1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 #
-select * from performance_schema.EVENTS_WAITS_HISTORY_LONG
+select * from performance_schema.events_waits_history_long
where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_HISTORY_LONG
+insert into performance_schema.events_waits_history_long
set thread_id='1', event_id=1,
event_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_HISTORY_LONG
+update performance_schema.events_waits_history_long
set timer_start=12;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_HISTORY_LONG
+update performance_schema.events_waits_history_long
set timer_start=12 where thread_id=0;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_HISTORY_LONG
+delete from performance_schema.events_waits_history_long
where thread_id=1;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_HISTORY_LONG;
+delete from performance_schema.events_waits_history_long;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ;
+LOCK TABLES performance_schema.events_waits_history_long READ;
UNLOCK TABLES;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE;
+LOCK TABLES performance_schema.events_waits_history_long WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test
index 4c386313bc5..2e4ab9bcc74 100644
--- a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test
+++ b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test
@@ -19,61 +19,54 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where event_name='FOO';
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
order by count_star limit 1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
order by count_star desc limit 1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where min_timer_wait > 0 order by count_star limit 1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+select * from performance_schema.events_waits_summary_by_instance
where min_timer_wait > 0 order by count_star desc limit 1;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+insert into performance_schema.events_waits_summary_by_instance
set event_name='FOO', object_instance_begin=0,
count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+update performance_schema.events_waits_summary_by_instance
set count_star=12;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+update performance_schema.events_waits_summary_by_instance
set count_star=12 where event_name like "FOO";
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE
+delete from performance_schema.events_waits_summary_by_instance
where count_star=1;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+delete from performance_schema.events_waits_summary_by_instance;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ;
+LOCK TABLES performance_schema.events_waits_summary_by_instance READ;
UNLOCK TABLES;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE;
+LOCK TABLES performance_schema.events_waits_summary_by_instance WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test
index ce29e59d014..bdbee9a90c1 100644
--- a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test
@@ -19,45 +19,38 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_by_thread_by_event_name
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_by_thread_by_event_name
where event_name='FOO';
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+insert into performance_schema.events_waits_summary_by_thread_by_event_name
set event_name='FOO', thread_id=1,
count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+update performance_schema.events_waits_summary_by_thread_by_event_name
set count_star=12;
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+update performance_schema.events_waits_summary_by_thread_by_event_name
set count_star=12 where event_name like "FOO";
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+delete from performance_schema.events_waits_summary_by_thread_by_event_name
where count_star=1;
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+delete from performance_schema.events_waits_summary_by_thread_by_event_name;
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ;
+LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name READ;
UNLOCK TABLES;
---replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE;
+LOCK TABLES performance_schema.events_waits_summary_by_thread_by_event_name WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
index cd3918f38be..4f1b50bb7c0 100644
--- a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
@@ -19,44 +19,37 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_global_by_event_name
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+select * from performance_schema.events_waits_summary_global_by_event_name
where event_name='FOO';
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+insert into performance_schema.events_waits_summary_global_by_event_name
set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+update performance_schema.events_waits_summary_global_by_event_name
set count_star=12;
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+update performance_schema.events_waits_summary_global_by_event_name
set count_star=12 where event_name like "FOO";
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+delete from performance_schema.events_waits_summary_global_by_event_name
where count_star=1;
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+delete from performance_schema.events_waits_summary_global_by_event_name;
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
+LOCK TABLES performance_schema.events_waits_summary_global_by_event_name READ;
UNLOCK TABLES;
---replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
+LOCK TABLES performance_schema.events_waits_summary_global_by_event_name WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_file_instances.test b/mysql-test/suite/perfschema/t/dml_file_instances.test
index 71a053c21be..f3a13eaee32 100644
--- a/mysql-test/suite/perfschema/t/dml_file_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_file_instances.test
@@ -19,37 +19,31 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 #
-select * from performance_schema.FILE_INSTANCES limit 1;
+select * from performance_schema.file_instances limit 1;
-select * from performance_schema.FILE_INSTANCES
+select * from performance_schema.file_instances
where file_name='FOO';
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.FILE_INSTANCES
+insert into performance_schema.file_instances
set file_name='FOO', event_name='BAR', open_count=12;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.FILE_INSTANCES
+update performance_schema.file_instances
set file_name='FOO';
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_INSTANCES
+delete from performance_schema.file_instances
where event_name like "wait/%";
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_INSTANCES;
+delete from performance_schema.file_instances;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_INSTANCES READ;
+LOCK TABLES performance_schema.file_instances READ;
UNLOCK TABLES;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_INSTANCES WRITE;
+LOCK TABLES performance_schema.file_instances WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
index 3753f581560..f5e1f90e9c9 100644
--- a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
@@ -19,44 +19,37 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 #
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.file_summary_by_event_name
where event_name like 'Wait/io/%' limit 1;
-select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.file_summary_by_event_name
where event_name='FOO';
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+insert into performance_schema.file_summary_by_event_name
set event_name='FOO', count_read=1, count_write=2,
sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+update performance_schema.file_summary_by_event_name
set count_read=12;
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+update performance_schema.file_summary_by_event_name
set count_write=12 where event_name like "FOO";
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME
+delete from performance_schema.file_summary_by_event_name
where count_read=1;
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
+delete from performance_schema.file_summary_by_event_name;
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ;
+LOCK TABLES performance_schema.file_summary_by_event_name READ;
UNLOCK TABLES;
---replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE;
+LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
index 07372af5f36..2ac32b97f56 100644
--- a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
+++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
@@ -19,44 +19,37 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 #
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE
+select * from performance_schema.file_summary_by_instance
where event_name like 'Wait/io/%' limit 1;
-select * from performance_schema.FILE_SUMMARY_BY_INSTANCE
+select * from performance_schema.file_summary_by_instance
where event_name='FOO';
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.FILE_SUMMARY_BY_INSTANCE
+insert into performance_schema.file_summary_by_instance
set event_name='FOO', count_read=1, count_write=2,
sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.FILE_SUMMARY_BY_INSTANCE
+update performance_schema.file_summary_by_instance
set count_read=12;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.FILE_SUMMARY_BY_INSTANCE
+update performance_schema.file_summary_by_instance
set count_write=12 where event_name like "FOO";
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_SUMMARY_BY_INSTANCE
+delete from performance_schema.file_summary_by_instance
where count_read=1;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.FILE_SUMMARY_BY_INSTANCE;
+delete from performance_schema.file_summary_by_instance;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ;
+LOCK TABLES performance_schema.file_summary_by_instance READ;
UNLOCK TABLES;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE;
+LOCK TABLES performance_schema.file_summary_by_instance WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test
index 0971c664eb8..c0bbd5276a0 100644
--- a/mysql-test/suite/perfschema/t/dml_mutex_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test
@@ -19,37 +19,31 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 #
-select * from performance_schema.MUTEX_INSTANCES limit 1;
+select * from performance_schema.mutex_instances limit 1;
-select * from performance_schema.MUTEX_INSTANCES
+select * from performance_schema.mutex_instances
where name='FOO';
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.MUTEX_INSTANCES
+insert into performance_schema.mutex_instances
set name='FOO', object_instance_begin=12;
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.MUTEX_INSTANCES
+update performance_schema.mutex_instances
set name='FOO';
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.MUTEX_INSTANCES
+delete from performance_schema.mutex_instances
where name like "wait/%";
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.MUTEX_INSTANCES;
+delete from performance_schema.mutex_instances;
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.MUTEX_INSTANCES READ;
+LOCK TABLES performance_schema.mutex_instances READ;
UNLOCK TABLES;
---replace_result '\'mutex_instances' '\'MUTEX_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE;
+LOCK TABLES performance_schema.mutex_instances WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_performance_timers.test b/mysql-test/suite/perfschema/t/dml_performance_timers.test
index 9c2efb6f709..211e6db4fb1 100644
--- a/mysql-test/suite/perfschema/t/dml_performance_timers.test
+++ b/mysql-test/suite/perfschema/t/dml_performance_timers.test
@@ -19,39 +19,33 @@
--source include/have_perfschema.inc
--replace_column 2 <frequency> 3 <resolution> 4 <overhead>
-select * from performance_schema.PERFORMANCE_TIMERS;
+select * from performance_schema.performance_timers;
--replace_column 2 <frequency> 3 <resolution> 4 <overhead>
-select * from performance_schema.PERFORMANCE_TIMERS
+select * from performance_schema.performance_timers
where timer_name='CYCLE';
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.PERFORMANCE_TIMERS
+insert into performance_schema.performance_timers
set timer_name='FOO', timer_frequency=1,
timer_resolution=2, timer_overhead=3;
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PERFORMANCE_TIMERS
+update performance_schema.performance_timers
set timer_frequency=12 where timer_name='CYCLE';
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PERFORMANCE_TIMERS;
+delete from performance_schema.performance_timers;
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PERFORMANCE_TIMERS
+delete from performance_schema.performance_timers
where timer_name='CYCLE';
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ;
+LOCK TABLES performance_schema.performance_timers READ;
UNLOCK TABLES;
---replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE;
+LOCK TABLES performance_schema.performance_timers WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
index 33a42450681..c0fd89a8e75 100644
--- a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
@@ -19,37 +19,31 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 #
-select * from performance_schema.RWLOCK_INSTANCES limit 1;
+select * from performance_schema.rwlock_instances limit 1;
-select * from performance_schema.RWLOCK_INSTANCES
+select * from performance_schema.rwlock_instances
where name='FOO';
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.RWLOCK_INSTANCES
+insert into performance_schema.rwlock_instances
set name='FOO', object_instance_begin=12;
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.RWLOCK_INSTANCES
+update performance_schema.rwlock_instances
set name='FOO';
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.RWLOCK_INSTANCES
+delete from performance_schema.rwlock_instances
where name like "wait/%";
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.RWLOCK_INSTANCES;
+delete from performance_schema.rwlock_instances;
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.RWLOCK_INSTANCES READ;
+LOCK TABLES performance_schema.rwlock_instances READ;
UNLOCK TABLES;
---replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE;
+LOCK TABLES performance_schema.rwlock_instances WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_setup_consumers.test b/mysql-test/suite/perfschema/t/dml_setup_consumers.test
index 85b65864f91..2a29f428f3d 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_consumers.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_consumers.test
@@ -18,42 +18,38 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-select * from performance_schema.SETUP_CONSUMERS;
+select * from performance_schema.setup_consumers;
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where name='events_waits_current';
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where enabled='YES';
-select * from performance_schema.SETUP_CONSUMERS
+select * from performance_schema.setup_consumers
where enabled='NO';
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.SETUP_CONSUMERS
+insert into performance_schema.setup_consumers
set name='FOO', enabled='YES';
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
--error ER_WRONG_PERFSCHEMA_USAGE
-update performance_schema.SETUP_CONSUMERS
+update performance_schema.setup_consumers
set name='FOO';
-update performance_schema.SETUP_CONSUMERS
+update performance_schema.setup_consumers
set enabled='YES';
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_CONSUMERS;
+delete from performance_schema.setup_consumers;
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_CONSUMERS
+delete from performance_schema.setup_consumers
where name='events_waits_current';
-LOCK TABLES performance_schema.SETUP_CONSUMERS READ;
+LOCK TABLES performance_schema.setup_consumers READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE;
+LOCK TABLES performance_schema.setup_consumers WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
index b82cde15fb5..b6e28440758 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
@@ -26,19 +26,19 @@
# - valgrind coverage
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.setup_instruments;
--enable_result_log
# DEBUG_SYNC::mutex is dependent on the build (DEBUG only)
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Mutex/sql/%'
and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
order by name limit 10;
# CRYPTO_dynlock_value::lock is dependent on the build (SSL)
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
order by name limit 10;
@@ -46,7 +46,7 @@ select * from performance_schema.SETUP_INSTRUMENTS
# COND_handler_count is dependent on the build (Windows only)
# DEBUG_SYNC::cond is dependent on the build (DEBUG only)
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Cond/sql/%'
and name not in (
'wait/synch/cond/sql/COND_handler_count',
@@ -54,50 +54,46 @@ select * from performance_schema.SETUP_INSTRUMENTS
order by name limit 10;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where name='Wait';
--enable_result_log
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS
+select * from performance_schema.setup_instruments
where enabled='YES';
--enable_result_log
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.SETUP_INSTRUMENTS
+insert into performance_schema.setup_instruments
set name='FOO', enabled='YES', timed='YES';
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_WRONG_PERFSCHEMA_USAGE
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set name='FOO';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set timed='NO';
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.setup_instruments;
--enable_result_log
-update performance_schema.SETUP_INSTRUMENTS
+update performance_schema.setup_instruments
set enabled='YES', timed='YES';
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_INSTRUMENTS;
+delete from performance_schema.setup_instruments;
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_INSTRUMENTS
+delete from performance_schema.setup_instruments
where name like 'Wait/Synch/%';
-LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ;
+LOCK TABLES performance_schema.setup_instruments READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE;
+LOCK TABLES performance_schema.setup_instruments WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_setup_timers.test b/mysql-test/suite/perfschema/t/dml_setup_timers.test
index 5b5850db575..1bfc0ab83a2 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_timers.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_timers.test
@@ -18,44 +18,40 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.setup_timers;
-select * from performance_schema.SETUP_TIMERS
+select * from performance_schema.setup_timers
where name='Wait';
-select * from performance_schema.SETUP_TIMERS
+select * from performance_schema.setup_timers
where timer_name='CYCLE';
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.SETUP_TIMERS
+insert into performance_schema.setup_timers
set name='FOO', timer_name='CYCLE';
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
--error ER_WRONG_PERFSCHEMA_USAGE
-update performance_schema.SETUP_TIMERS
+update performance_schema.setup_timers
set name='FOO';
-update performance_schema.SETUP_TIMERS
+update performance_schema.setup_timers
set timer_name='MILLISECOND';
-select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.setup_timers;
-update performance_schema.SETUP_TIMERS
+update performance_schema.setup_timers
set timer_name='CYCLE';
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_TIMERS;
+delete from performance_schema.setup_timers;
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.SETUP_TIMERS
+delete from performance_schema.setup_timers
where name='Wait';
-LOCK TABLES performance_schema.SETUP_TIMERS READ;
+LOCK TABLES performance_schema.setup_timers READ;
UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_TIMERS WRITE;
+LOCK TABLES performance_schema.setup_timers WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_threads.test b/mysql-test/suite/perfschema/t/dml_threads.test
index 6ea456fee69..e7188497061 100644
--- a/mysql-test/suite/perfschema/t/dml_threads.test
+++ b/mysql-test/suite/perfschema/t/dml_threads.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
@@ -19,43 +19,36 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 #
-select * from performance_schema.THREADS
+select * from performance_schema.threads
where name like 'Thread/%' limit 1;
-select * from performance_schema.THREADS
+select * from performance_schema.threads
where name='FOO';
---replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.THREADS
- set name='FOO', thread_id=1, id=2;
+insert into performance_schema.threads
+ set name='FOO', thread_id=1, processlist_id=2;
---replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.THREADS
+update performance_schema.threads
set thread_id=12;
---replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.THREADS
+update performance_schema.threads
set thread_id=12 where name like "FOO";
---replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.THREADS
+delete from performance_schema.threads
where id=1;
---replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.THREADS;
+delete from performance_schema.threads;
---replace_result '\'threads' '\'THREADS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.THREADS READ;
+LOCK TABLES performance_schema.threads READ;
UNLOCK TABLES;
---replace_result '\'threads' '\'THREADS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.THREADS WRITE;
+LOCK TABLES performance_schema.threads WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index 6b6335ac424..64f71a99ee6 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -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
##
## WL#4814, 4.1.4 FILE IO
@@ -22,9 +22,9 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
--disable_warnings
@@ -40,9 +40,9 @@ ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
#
# FF1: Count for file should increase with instrumentation enabled and
@@ -52,7 +52,7 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
SELECT * FROM t1 WHERE id = 1;
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD'));
@@ -61,23 +61,23 @@ SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
SELECT * FROM t1 WHERE id < 4;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO';
+UPDATE performance_schema.setup_instruments SET enabled='NO';
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
SELECT * FROM t1 WHERE id < 6;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
@@ -87,33 +87,33 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success
# Check not timed measurements
#
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO';
+UPDATE performance_schema.setup_instruments SET timed = 'NO';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id > 4;
-SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+SELECT * FROM performance_schema.events_waits_history_long
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
-SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY
+SELECT * FROM performance_schema.events_waits_history
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
-SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT * FROM performance_schema.events_waits_current
WHERE TIMER_WAIT != NULL
OR TIMER_START != NULL
OR TIMER_END != NULL;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES';
+UPDATE performance_schema.setup_instruments SET timed = 'YES';
SELECT * FROM t1 WHERE id < 4;
@@ -128,7 +128,7 @@ SELECT SUM(COUNT_READ) AS sum_count_read,
SUM(COUNT_WRITE) AS sum_count_write,
SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read,
SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write
-FROM performance_schema.FILE_SUMMARY_BY_INSTANCE
+FROM performance_schema.file_summary_by_instance
WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
--enable_result_log
@@ -144,7 +144,7 @@ WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
#
--disable_result_log
SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+FROM performance_schema.events_waits_summary_global_by_event_name
WHERE COUNT_STAR > 0
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
@@ -154,25 +154,25 @@ LIMIT 10;
# Total and average wait time for different users
#
---disable_result_log
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
-# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
-ORDER BY SUM_WAIT DESC
-LIMIT 20;
---enable_result_log
+## --disable_result_log
+## SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+## # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
+## FROM performance_schema.events_waits_history_long h
+## INNER JOIN performance_schema.threads p USING (THREAD_ID)
+## LEFT JOIN information_schema.PROCESSLIST i USING (ID)
+## GROUP BY i.user
+## ORDER BY SUM_WAIT DESC
+## LIMIT 20;
+## --enable_result_log
#
# Total and average wait times for different events for a session
#
--disable_result_log
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+FROM performance_schema.events_waits_history_long h
+INNER JOIN performance_schema.threads p USING (THREAD_ID)
+WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
--enable_result_log
@@ -181,12 +181,15 @@ HAVING TOTAL_WAIT > 0;
# Which user reads and writes data
#
---disable_result_log
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
-HAVING BYTES > 0
-ORDER BY i.user, h.operation;
---enable_result_log
+## --disable_result_log
+## SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+## FROM performance_schema.events_waits_history_long h
+## INNER JOIN performance_schema.threads p USING (THREAD_ID)
+## LEFT JOIN information_schema.PROCESSLIST i USING (ID)
+## GROUP BY i.user, h.operation
+## HAVING BYTES > 0
+## ORDER BY i.user, h.operation;
+## --enable_result_log
+
+# Clean-up.
+UPDATE performance_schema.setup_instruments SET enabled = 'YES';
diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test
index 98cb905c67c..51cbc77790e 100644
--- a/mysql-test/suite/perfschema/t/func_mutex.test
+++ b/mysql-test/suite/perfschema/t/func_mutex.test
@@ -22,9 +22,9 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
@@ -46,41 +46,41 @@ INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
# FM2: Count for mutex should not increase with instrumentation disabled
#
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT * FROM t1;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO'
WHERE NAME = 'wait/synch/mutex/sql/LOCK_open';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT * FROM t1;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed;
@@ -89,43 +89,45 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success
# Repeat for RW-lock
#
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT * FROM t1;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'
+UPDATE performance_schema.setup_instruments SET enabled = 'NO'
WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
SELECT * FROM t1 WHERE id = 1;
SET @before_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT * FROM t1;
SET @after_count = (SELECT SUM(TIMER_WAIT)
- FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+ FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed;
+# Clean-up.
+UPDATE performance_schema.setup_instruments SET enabled = 'YES';
DROP TABLE t1;
diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test
index b953ea32ce0..d00c6583e31 100644
--- a/mysql-test/suite/perfschema/t/global_read_lock.test
+++ b/mysql-test/suite/perfschema/t/global_read_lock.test
@@ -15,28 +15,32 @@
# Tests for PERFORMANCE_SCHEMA
#
-# Test the effect of a flush tables with read lock on SETUP_ tables.
+# Test the effect of a flush tables with read lock on setup_ tables.
--source include/not_embedded.inc
--source include/have_perfschema.inc
use performance_schema;
+# Make test robust against errors in other tests.
+# Ensure that instrumentation is turned on when we create new connection.
+update performance_schema.setup_instruments set enabled='YES';
+
grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
flush privileges;
--echo connect (con1, localhost, pfsuser, , test);
connect (con1, localhost, pfsuser, , test);
-lock tables performance_schema.SETUP_INSTRUMENTS read;
+lock tables performance_schema.setup_instruments read;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.setup_instruments;
--enable_result_log
unlock tables;
-lock tables performance_schema.SETUP_INSTRUMENTS write;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+lock tables performance_schema.setup_instruments write;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
unlock tables;
--echo connection default;
@@ -47,20 +51,20 @@ flush tables with read lock;
--echo connection con1;
connection con1;
-lock tables performance_schema.SETUP_INSTRUMENTS read;
+lock tables performance_schema.setup_instruments read;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.setup_instruments;
--enable_result_log
unlock tables;
# This will block
--send
-lock tables performance_schema.SETUP_INSTRUMENTS write;
+lock tables performance_schema.setup_instruments write;
--echo connection default;
connection default;
-let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where event_name like "wait/synch/cond/sql/COND_global_read_lock";
+let $wait_condition= select 1 from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
--source include/wait_condition.inc
@@ -68,16 +72,16 @@ let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where
select event_name,
left(source, locate(":", source)) as short_source,
timer_end, timer_wait, operation
- from performance_schema.EVENTS_WAITS_CURRENT
- where event_name like "wait/synch/cond/sql/COND_global_read_lock";
+ from performance_schema.events_waits_current
+ where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
unlock tables;
connection con1;
--reap
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
unlock tables;
disconnect con1;
diff --git a/mysql-test/suite/perfschema/t/information_schema.test b/mysql-test/suite/perfschema/t/information_schema.test
index 3d2822a1db3..36ba1912df3 100644
--- a/mysql-test/suite/perfschema/t/information_schema.test
+++ b/mysql-test/suite/perfschema/t/information_schema.test
@@ -22,46 +22,46 @@
# Note that TABLE_NAME is in uppercase is some platforms,
# and in lowercase in others.
-# Using upper(TABLE_NAME) to have consistent results.
+# Using lower(TABLE_NAME) to have consistent results.
-select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG
+select TABLE_SCHEMA, lower(TABLE_NAME), TABLE_CATALOG
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), TABLE_TYPE, ENGINE
+select lower(TABLE_NAME), TABLE_TYPE, ENGINE
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), VERSION, ROW_FORMAT
+select lower(TABLE_NAME), VERSION, ROW_FORMAT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
+select lower(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
+select lower(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
+select lower(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
+select lower(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM
+select lower(TABLE_NAME), TABLE_COLLATION, CHECKSUM
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
# TABLESPACE_NAME does not exist in 5.4
-# select upper(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME
+# select lower(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME
# from information_schema.tables
# where TABLE_SCHEMA='performance_schema';
-select upper(TABLE_NAME), TABLE_COMMENT
+select lower(TABLE_NAME), TABLE_COMMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index d497c205d50..72e891ca805 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -25,11 +25,11 @@
#
--disable_result_log
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
- (SELECT THREAD_ID FROM performance_schema.THREADS)
+ (SELECT THREAD_ID FROM performance_schema.threads)
AND EVENT_NAME IN
- (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
+ (SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
--enable_result_log
@@ -46,7 +46,7 @@ create table test.t1(a int) engine=performance_schema;
#
--error ER_WRONG_PERFSCHEMA_USAGE
-create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
+create table test.t1 like performance_schema.events_waits_current;
#
# Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert
@@ -73,7 +73,7 @@ select * from test.ghost;
drop table test.ghost;
# Shoud return nothing
-select * from performance_schema.FILE_INSTANCES
+select * from performance_schema.file_instances
where file_name like "%ghost%";
#
diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test
index 0861e8f4b74..c2502b5895a 100644
--- a/mysql-test/suite/perfschema/t/myisam_file_io.test
+++ b/mysql-test/suite/perfschema/t/myisam_file_io.test
@@ -20,14 +20,14 @@
# Setup
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/io/file/myisam/%";
-update performance_schema.SETUP_CONSUMERS
+update performance_schema.setup_consumers
set enabled='YES';
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_history_long;
# Reset lost counters to a known state
flush status;
@@ -51,7 +51,7 @@ select event_name,
left(source, locate(":", source)) as short_source,
operation, number_of_bytes,
substring(object_name, locate("no_index_tab", object_name)) as short_name
- from performance_schema.EVENTS_WAITS_HISTORY_LONG
+ from performance_schema.events_waits_history_long
where operation not like "tell"
order by thread_id, event_id;
@@ -60,7 +60,7 @@ show status like 'performance_schema_%';
# Cleanup
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
drop table test.no_index_tab;
diff --git a/mysql-test/suite/perfschema/t/no_threads.test b/mysql-test/suite/perfschema/t/no_threads.test
index 9254535bf1f..f98aa8abdb7 100644
--- a/mysql-test/suite/perfschema/t/no_threads.test
+++ b/mysql-test/suite/perfschema/t/no_threads.test
@@ -21,18 +21,18 @@
# Setup : in this main thread
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_CONSUMERS set enabled='YES';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_consumers set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
--disable_warnings
drop table if exists test.t1;
--enable_warnings
-truncate table performance_schema.EVENTS_WAITS_CURRENT;
-truncate table performance_schema.EVENTS_WAITS_HISTORY;
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_current;
+truncate table performance_schema.events_waits_history;
+truncate table performance_schema.events_waits_history_long;
show variables like "thread_handling";
@@ -45,23 +45,23 @@ show variables like "performance_schema_max_thread%";
# Verification : in this main thread
-select count(*) from performance_schema.THREADS
+select count(*) from performance_schema.threads
where name like "thread/sql/main";
-select count(*) from performance_schema.THREADS
+select count(*) from performance_schema.threads
where name like "thread/sql/OneConnection";
select event_name, operation,
left(source, locate(":", source)) as short_source
- from performance_schema.EVENTS_WAITS_CURRENT;
+ from performance_schema.events_waits_current;
select event_name, operation,
left(source, locate(":", source)) as short_source
- from performance_schema.EVENTS_WAITS_HISTORY;
+ from performance_schema.events_waits_history;
select event_name, operation,
left(source, locate(":", source)) as short_source
- from performance_schema.EVENTS_WAITS_HISTORY_LONG;
+ from performance_schema.events_waits_history_long;
# Cleanup
diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con.test b/mysql-test/suite/perfschema/t/one_thread_per_con.test
index 7d0daffe228..5393152f7d2 100644
--- a/mysql-test/suite/perfschema/t/one_thread_per_con.test
+++ b/mysql-test/suite/perfschema/t/one_thread_per_con.test
@@ -27,7 +27,7 @@
# The point is not to test myisam, but to test that each
# connection is properly instrumented, with one-thread-per-connection
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
--disable_warnings
@@ -36,7 +36,7 @@ drop table if exists test.t2;
drop table if exists test.t3;
--enable_warnings
-truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+truncate table performance_schema.events_waits_history_long;
show variables like "thread_handling";
diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test
index 2d682de2870..277ba9bf3b8 100644
--- a/mysql-test/suite/perfschema/t/privilege.test
+++ b/mysql-test/suite/perfschema/t/privilege.test
@@ -76,136 +76,128 @@ grant DELETE on performance_schema.* to 'pfs_user_2'@localhost;
grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost;
# Test denied privileges on specific performance_schema tables.
-# SETUP_INSTRUMENT : example of PFS_updatable_acl
-# EVENTS_WAITS_CURRENT : example of PFS_truncatable_acl
-# FILE_INSTANCES : example of PFS_readonly_acl
+# setup_instrument : example of PFS_updatable_acl
+# events_waits_current : example of PFS_truncatable_acl
+# file_instances : example of PFS_readonly_acl
--error ER_DBACCESS_DENIED_ERROR
-grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant ALL on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant INSERT on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost;
+grant DELETE on performance_schema.setup_instruments to 'pfs_user_3'@localhost;
-grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant SELECT on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
-grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost
+grant UPDATE on performance_schema.setup_instruments to 'pfs_user_3'@localhost
with GRANT OPTION;
--error ER_DBACCESS_DENIED_ERROR
-grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost
+grant ALL on performance_schema.events_waits_current to 'pfs_user_3'@localhost
with GRANT OPTION;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant INSERT on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant UPDATE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost;
+grant DELETE on performance_schema.events_waits_current to 'pfs_user_3'@localhost;
-grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost
+grant SELECT on performance_schema.events_waits_current to 'pfs_user_3'@localhost
with GRANT OPTION;
--error ER_DBACCESS_DENIED_ERROR
-grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost
+grant ALL on performance_schema.file_instances to 'pfs_user_3'@localhost
with GRANT OPTION;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant CREATE on performance_schema.file_instances to 'pfs_user_3'@localhost;
# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed
-grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant DROP on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant REFERENCES on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant INDEX on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant ALTER on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant CREATE VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant SHOW VIEW on performance_schema.file_instances to 'pfs_user_3'@localhost;
--error ER_DBACCESS_DENIED_ERROR
-grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant TRIGGER on performance_schema.file_instances to 'pfs_user_3'@localhost;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant INSERT on performance_schema.file_instances to 'pfs_user_3'@localhost;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant UPDATE on performance_schema.file_instances to 'pfs_user_3'@localhost;
---replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
-grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost;
+grant DELETE on performance_schema.file_instances to 'pfs_user_3'@localhost;
-grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost
+grant SELECT on performance_schema.file_instances to 'pfs_user_3'@localhost
with GRANT OPTION;
# See bug#45354 LOCK TABLES is not a TABLE privilege
@@ -258,25 +250,20 @@ CREATE user pfs_user_4;
--connection pfs_user_4
--echo # Select as pfs_user_4 should fail without grant
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY;
+SELECT event_id FROM performance_schema.events_waits_history;
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG;
+SELECT event_id FROM performance_schema.events_waits_history_long;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT;
+SELECT event_id FROM performance_schema.events_waits_current;
---replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+SELECT event_name FROM performance_schema.events_waits_summary_by_instance;
---replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
--error ER_TABLEACCESS_DENIED_ERROR
-SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE;
+SELECT event_name FROM performance_schema.file_summary_by_instance;
--echo #
--echo # WL#4818, NFS3: Normal user does not have access to change what is
@@ -287,35 +274,28 @@ SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE;
--echo # User pfs_user_4 should not be allowed to tweak instrumentation without
--echo # explicit grant
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
---replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
---replace_result '\'setup_consumers' '\'SETUP_CONSUMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
---replace_result '\'setup_timers' '\'SETUP_TIMERS'
--error ER_TABLEACCESS_DENIED_ERROR
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK';
+UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
---replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
--error ER_TABLEACCESS_DENIED_ERROR
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
---replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
--error ER_TABLEACCESS_DENIED_ERROR
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
+TRUNCATE TABLE performance_schema.events_waits_history;
---replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_current;
--echo #
--echo # WL#4814, NFS1: Can use grants to give normal user access
@@ -325,29 +305,29 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
--connection default
--echo # Grant access to change tables with the root account
-GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4;
-GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4;
-GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4;
-GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4;
+GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4;
+GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4;
+GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4;
+GRANT DROP ON performance_schema.events_waits_history_long TO pfs_user_4;
--connection pfs_user_4
--echo # User pfs_user_4 should now be allowed to tweak instrumentation
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
+UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK';
+UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
-TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
+TRUNCATE TABLE performance_schema.events_waits_history_long;
+TRUNCATE TABLE performance_schema.events_waits_history;
+TRUNCATE TABLE performance_schema.events_waits_current;
--echo # Clean up
--disconnect pfs_user_4
@@ -356,7 +336,7 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4;
DROP USER pfs_user_4;
flush privileges;
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
-UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES';
-UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_consumers SET enabled = 'YES';
+UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE';
diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test
index a48704dc9d6..6e322434ae0 100644
--- a/mysql-test/suite/perfschema/t/query_cache.test
+++ b/mysql-test/suite/perfschema/t/query_cache.test
@@ -47,17 +47,17 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
-select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1;
+select spins from performance_schema.events_waits_current order by event_name limit 1;
-select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1;
+select name from performance_schema.setup_instruments order by name limit 1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
-select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1;
+select spins from performance_schema.events_waits_current order by event_name limit 1;
-select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1;
+select name from performance_schema.setup_instruments order by name limit 1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test
index 73150207f66..98683e36327 100644
--- a/mysql-test/suite/perfschema/t/read_only.test
+++ b/mysql-test/suite/perfschema/t/read_only.test
@@ -16,8 +16,8 @@
# Tests for PERFORMANCE_SCHEMA
#
# Check that
-# - a regular user can not update SETUP_ tables under --read-only
-# - a user with SUPER privileges cam
+# - a regular user can not update setup_ tables under --read-only
+# - a user with SUPER privileges can
--source include/not_embedded.inc
--source include/have_perfschema.inc
@@ -43,9 +43,9 @@ connection con1;
select @@global.read_only;
show grants;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
--enable_result_log
--echo connection default;
@@ -59,11 +59,11 @@ connection con1;
select @@global.read_only;
show grants;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.setup_instruments;
--error ER_OPTION_PREVENTS_STATEMENT
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
+update performance_schema.setup_instruments set enabled='NO';
--error ER_OPTION_PREVENTS_STATEMENT
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+update performance_schema.setup_instruments set enabled='YES';
--enable_result_log
--echo connection default;
@@ -79,9 +79,9 @@ connect (con1, localhost, pfsuser, , test);
select @@global.read_only;
show grants;
--disable_result_log
-select * from performance_schema.SETUP_INSTRUMENTS;
-update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
-update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
+select * from performance_schema.setup_instruments;
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES';
--enable_result_log
disconnect con1;
diff --git a/mysql-test/suite/perfschema/t/schema.test b/mysql-test/suite/perfschema/t/schema.test
index 727c4f5a755..32ee4a26676 100644
--- a/mysql-test/suite/perfschema/t/schema.test
+++ b/mysql-test/suite/perfschema/t/schema.test
@@ -25,21 +25,21 @@ use performance_schema;
show tables;
-show create table COND_INSTANCES;
-show create table EVENTS_WAITS_CURRENT;
-show create table EVENTS_WAITS_HISTORY;
-show create table EVENTS_WAITS_HISTORY_LONG;
-show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-show create table FILE_INSTANCES;
-show create table FILE_SUMMARY_BY_EVENT_NAME;
-show create table FILE_SUMMARY_BY_INSTANCE;
-show create table MUTEX_INSTANCES;
-show create table PERFORMANCE_TIMERS;
-show create table RWLOCK_INSTANCES;
-show create table SETUP_CONSUMERS;
-show create table SETUP_INSTRUMENTS;
-show create table SETUP_TIMERS;
-show create table THREADS;
+show create table cond_instances;
+show create table events_waits_current;
+show create table events_waits_history;
+show create table events_waits_history_long;
+show create table events_waits_summary_by_instance;
+show create table events_waits_summary_by_thread_by_event_name;
+show create table events_waits_summary_global_by_event_name;
+show create table file_instances;
+show create table file_summary_by_event_name;
+show create table file_summary_by_instance;
+show create table mutex_instances;
+show create table performance_timers;
+show create table rwlock_instances;
+show create table setup_consumers;
+show create table setup_instruments;
+show create table setup_timers;
+show create table threads;
diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test
index b673c896024..e8fd0827c53 100644
--- a/mysql-test/suite/perfschema/t/selects.test
+++ b/mysql-test/suite/perfschema/t/selects.test
@@ -22,7 +22,7 @@
# Make some data that we can work on:
-UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';
+UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
--disable_warnings
DROP TABLE IF EXISTS t1;
@@ -35,7 +35,7 @@ INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
--replace_column 2 [NUM_BYTES]
SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+FROM performance_schema.events_waits_history_long
GROUP BY OPERATION
HAVING TOTAL IS NOT NULL
ORDER BY OPERATION
@@ -43,11 +43,11 @@ LIMIT 1;
# Sub SELECT
--replace_column 1 [EVENT_ID]
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
- (SELECT THREAD_ID FROM performance_schema.THREADS)
+ (SELECT THREAD_ID FROM performance_schema.threads)
AND EVENT_NAME IN
- (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
+ (SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
@@ -55,9 +55,9 @@ LIMIT 1;
--replace_column 1 [EVENT_ID]
SELECT DISTINCT EVENT_ID
-FROM performance_schema.EVENTS_WAITS_CURRENT
-JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID)
+FROM performance_schema.events_waits_current
+JOIN performance_schema.events_waits_history USING (EVENT_ID)
+JOIN performance_schema.events_waits_history_long USING (EVENT_ID)
ORDER BY EVENT_ID
LIMIT 1;
@@ -65,21 +65,21 @@ LIMIT 1;
--replace_column 1 [THREAD_ID] 2 [EVENT_ID] 3 [EVENT_NAME] 4 [TIMER_WAIT]
SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_HISTORY t1
-JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID)
-JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME)
+FROM performance_schema.events_waits_history t1
+JOIN performance_schema.events_waits_history t2 USING (EVENT_ID)
+JOIN performance_schema.events_waits_history t3 ON (t2.THREAD_ID = t3.THREAD_ID)
+JOIN performance_schema.events_waits_history t4 ON (t3.EVENT_NAME = t4.EVENT_NAME)
ORDER BY t1.EVENT_ID, t2.EVENT_ID
LIMIT 5;
# UNION
--replace_column 1 [THREAD_ID] 2 [EVENT_ID]
SELECT THREAD_ID, EVENT_ID FROM (
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_current
UNION
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history
UNION
-SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG
+SELECT THREAD_ID, EVENT_ID FROM performance_schema.events_waits_history_long
) t1 ORDER BY THREAD_ID, EVENT_ID
LIMIT 5;
@@ -93,14 +93,14 @@ DROP TABLE IF EXISTS t_event;
DROP EVENT IF EXISTS t_ps_event;
--enable_warnings
CREATE TABLE t_event AS
-SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
DO INSERT INTO t_event
SELECT DISTINCT EVENT_ID
- FROM performance_schema.EVENTS_WAITS_CURRENT
- JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
+ FROM performance_schema.events_waits_current
+ JOIN performance_schema.events_waits_history USING (EVENT_ID)
ORDER BY EVENT_ID
LIMIT 1;
@@ -116,7 +116,7 @@ delimiter |;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
FOR EACH ROW BEGIN
SET NEW.c = (SELECT MAX(EVENT_ID)
- FROM performance_schema.EVENTS_WAITS_CURRENT);
+ FROM performance_schema.events_waits_current);
END;
|
@@ -136,17 +136,17 @@ DROP PROCEDURE IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
BEGIN
- SELECT id FROM performance_schema.THREADS
- WHERE THREAD_ID = tid INTO pid;
+ SELECT thread_id FROM performance_schema.threads
+ WHERE PROCESSLIST_ID = conid INTO pid;
END;
|
delimiter ;|
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
# FUNCTION
@@ -155,17 +155,17 @@ DROP FUNCTION IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
BEGIN
- return (SELECT id FROM performance_schema.THREADS
- WHERE THREAD_ID = tid);
+ return (SELECT thread_id FROM performance_schema.threads
+ WHERE PROCESSLIST_ID = conid);
END;
|
delimiter ;|
-SELECT t_ps_func(0) = @p_id;
+SELECT t_ps_func(connection_id()) = @p_id;
# We might reach this point too early which means the event scheduler has not
# execute our "t_ps_event". Therefore we poll till the record was inserted
diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test
index cc461374a79..33eeeb7edb2 100644
--- a/mysql-test/suite/perfschema/t/server_init.test
+++ b/mysql-test/suite/perfschema/t/server_init.test
@@ -28,185 +28,176 @@ use performance_schema;
# Verify that these global mutexes have been properly initilized in mysys
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_threads";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_malloc";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_open";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_isam";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_heap";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_net";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_charset";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/mysys/THR_LOCK_time";
# There are no global rwlock in mysys
# Verify that these global conditions have been properly initilized in mysys
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/mysys/THR_COND_threads";
# Verify that these global mutexes have been properly initilized in sql
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_open";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_thread_count";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_status";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_error_log";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_insert";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_uuid_generator";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_status";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_delayed_create";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_crypt";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_slave_list";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_active_mi";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_manager";
-select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_global_read_lock";
-
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_global_system_variables";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_user_conn";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_connection_count";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_rpl_status";
# LOG_INFO object are created on demand, and are not global.
-# select count(name) from MUTEX_INSTANCES
+# select count(name) from mutex_instances
# where name like "wait/synch/mutex/sql/LOG_INFO::lock";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
# The event scheduler may be disabled
-# select count(name) from MUTEX_INSTANCES
+# select count(name) from mutex_instances
# where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
-select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_event_metadata";
-
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_event_queue";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_user_locks";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/Cversion_lock";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_audit_mask";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_xid_cache";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_plugin";
# Not a global variable, may be destroyed already.
-# select count(name) from MUTEX_INSTANCES
+# select count(name) from mutex_instances
# where name like "wait/synch/mutex/sql/LOCK_gdl";
-select count(name) from MUTEX_INSTANCES
+select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/tz_LOCK";
# Verify that these global rwlocks have been properly initilized in sql
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_grant";
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect";
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave";
-select count(name) from RWLOCK_INSTANCES
+select count(name) from rwlock_instances
where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash";
# Verify that these global conditions have been properly initilized in sql
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_server_started";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_refresh";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_thread_count";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_manager";
-select count(name) from COND_INSTANCES
- where name like "wait/synch/cond/sql/COND_global_read_lock";
-
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_thread_cache";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_flush_thread_cache";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_rpl_status";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed";
# The event scheduler may be disabled
-# select count(name) from COND_INSTANCES
+# select count(name) from cond_instances
# where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
-select count(name) from COND_INSTANCES
+select count(name) from cond_instances
where name like "wait/synch/cond/sql/COND_queue_state";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test
index 34ff61c358e..da75306c2ca 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test
@@ -23,7 +23,7 @@
# Expect no classes
show variables like "performance_schema_max_cond_classes";
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/cond/%";
# We lost all the classes
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.COND_INSTANCES;
+select count(*) from performance_schema.cond_instances;
# Expect no instances lost
show status like "performance_schema_cond_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test
index fe2177adb82..eb77d76b70e 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test
@@ -23,7 +23,7 @@
# Expect classes
show variables like "performance_schema_max_cond_classes";
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/cond/%";
# Expect no class lost
@@ -32,7 +32,7 @@ show status like "performance_schema_cond_classes_lost";
# Expect no instances
show variables like "performance_schema_max_cond_instances";
-select count(*) from performance_schema.COND_INSTANCES;
+select count(*) from performance_schema.cond_instances;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class.test b/mysql-test/suite/perfschema/t/start_server_no_file_class.test
index ca84fbbdcf2..03180dae01e 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_file_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_file_class.test
@@ -23,7 +23,7 @@
# Expect no classes
show variables like "performance_schema_max_file_classes";
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/io/file/%";
# We lost all the classes
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.FILE_INSTANCES;
+select count(*) from performance_schema.file_instances;
# Expect no instances lost
show status like "performance_schema_file_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test
index dbbba7bbe4a..faa5e97a853 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test
@@ -23,7 +23,7 @@
# Expect classes
show variables like "performance_schema_max_file_classes";
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/io/file/%";
# Expect no class lost
@@ -32,7 +32,7 @@ show status like "performance_schema_file_classes_lost";
# Expect no instances
show variables like "performance_schema_max_file_instances";
-select count(*) from performance_schema.FILE_INSTANCES;
+select count(*) from performance_schema.file_instances;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test
index 142e150ede6..79bf3d52bc5 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test
@@ -23,7 +23,7 @@
# Expect no classes
show variables like "performance_schema_max_mutex_classes";
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/mutex/%";
# We lost all the classes
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.MUTEX_INSTANCES;
+select count(*) from performance_schema.mutex_instances;
# Expect no instances lost
show status like "performance_schema_mutex_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test
index 5a03251d97a..32c0a02b642 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test
@@ -23,7 +23,7 @@
# Expect classes
show variables like "performance_schema_max_mutex_classes";
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/mutex/%";
# Expect no class lost
@@ -32,7 +32,7 @@ show status like "performance_schema_mutex_classes_lost";
# Expect no instances
show variables like "performance_schema_max_mutex_instances";
-select count(*) from performance_schema.MUTEX_INSTANCES;
+select count(*) from performance_schema.mutex_instances;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test
index e4dfe121fcf..10780b59fbe 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test
@@ -23,7 +23,7 @@
# Expect no classes
show variables like "performance_schema_max_rwlock_classes";
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
# We lost all the classes
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.RWLOCK_INSTANCES;
+select count(*) from performance_schema.rwlock_instances;
# Expect no instances lost
show status like "performance_schema_rwlock_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test
index 1d79d2d3991..2ba2ebcdd4b 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test
@@ -23,7 +23,7 @@
# Expect classes
show variables like "performance_schema_max_rwlock_classes";
-select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+select count(*) > 0 from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
# Expect no class lost
@@ -32,7 +32,7 @@ show status like "performance_schema_rwlock_classes_lost";
# Expect no instances
show variables like "performance_schema_max_rwlock_instances";
-select count(*) from performance_schema.RWLOCK_INSTANCES;
+select count(*) from performance_schema.rwlock_instances;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
index 1ed0fecb538..df825ede637 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
@@ -23,7 +23,7 @@
# Expect no classes
show variables like "performance_schema_max_thread_classes";
-select count(*) from performance_schema.SETUP_INSTRUMENTS
+select count(*) from performance_schema.setup_instruments
where name like "thread/%";
# We lost all the classes
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.THREADS;
+select count(*) from performance_schema.threads;
# Expect no instances lost
show status like "performance_schema_thread_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
index 489f814ba10..150886d01f9 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
@@ -24,7 +24,7 @@
show variables like "performance_schema_max_thread_classes";
# Not observable yet
-# select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
+# select count(*) > 0 from performance_schema.setup_instruments
# where name like "thread/%";
# Expect no class lost
@@ -33,7 +33,7 @@ show status like "performance_schema_thread_classes_lost";
# Expect no instances
show variables like "performance_schema_max_thread_instances";
-select count(*) from performance_schema.THREADS;
+select count(*) from performance_schema.threads;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test
index be079bacfbf..741b41ec46b 100644
--- a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test
+++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test
@@ -27,18 +27,18 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-# The message prints 'mysql.SETUP_INSTRUMENTS'
-# instead of 'performance_schema.SETUP_INSTRUMENTS',
+# The message prints 'mysql.setup_instruments'
+# instead of 'performance_schema.setup_instruments',
# due to Bug#46792
call mtr.add_suppression(
-"Column count of mysql.SETUP_INSTRUMENTS is wrong. "
+"Column count of mysql.setup_instruments is wrong. "
"Expected 4, found 3. The table is probably corrupted");
--error ER_WRONG_NATIVE_TABLE_STRUCTURE
-select * from performance_schema.SETUP_INSTRUMENTS limit 1;
+select * from performance_schema.setup_instruments limit 1;
--disable_result_log
-select * from performance_schema.SETUP_CONSUMERS limit 1;
+select * from performance_schema.setup_consumers limit 1;
--enable_result_log
diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test
index 5560f66babb..488b359cd34 100644
--- a/mysql-test/suite/perfschema/t/thread_cache.test
+++ b/mysql-test/suite/perfschema/t/thread_cache.test
@@ -30,15 +30,15 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
-let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con1_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
-let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con2_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connection default;
@@ -58,8 +58,8 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
-let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con3_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
disconnect con3;
disconnect con1;
@@ -82,15 +82,15 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
-let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con1_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
-let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con2_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
connection default;
@@ -108,8 +108,8 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
-let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+let $con3_THREAD_ID=`select thread_id from performance_schema.threads
+ where PROCESSLIST_ID = connection_id()`;
disconnect con3;
disconnect con1;
diff --git a/mysql-test/suite/perfschema_stress/t/modify.test b/mysql-test/suite/perfschema_stress/t/modify.test
index 08b0699ace6..f37255c6b09 100644
--- a/mysql-test/suite/perfschema_stress/t/modify.test
+++ b/mysql-test/suite/perfschema_stress/t/modify.test
@@ -19,7 +19,7 @@
let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`;
-if (`SELECT ($have_table = 0)`) {
+if (!$have_table) {
--source suite/perfschema_stress/t/setup.test
}
diff --git a/mysql-test/suite/perfschema_stress/t/setup.test b/mysql-test/suite/perfschema_stress/t/setup.test
index 9f643edfebe..e55ed5e8630 100644
--- a/mysql-test/suite/perfschema_stress/t/setup.test
+++ b/mysql-test/suite/perfschema_stress/t/setup.test
@@ -23,10 +23,10 @@ if (`SELECT VERSION() LIKE '%embedded%'`)
--disable_query_log
--disable_result_log
-if (`SELECT LENGTH('$engine_type') = 0`) {
+if (!$engine_type) {
let $engine_type= $default_engine_type;
}
-if (`SELECT '$engine_type' = 'Falcon'`) {
+if ($engine_type == Falcon) {
--source include/have_falcon.inc
}
diff --git a/mysql-test/suite/perfschema_stress/t/work.test b/mysql-test/suite/perfschema_stress/t/work.test
index 8f1bc42c5bc..4408a00b0c9 100644
--- a/mysql-test/suite/perfschema_stress/t/work.test
+++ b/mysql-test/suite/perfschema_stress/t/work.test
@@ -19,7 +19,7 @@
let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`;
-if (`SELECT ($have_table = 0)`) {
+if (!$have_table) {
--source suite/perfschema_stress/t/setup.test
}
diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl000017.result
index 403f4d4d4fe..39f46c41217 100644
--- a/mysql-test/suite/rpl/r/rpl000017.result
+++ b/mysql-test/suite/rpl/r/rpl000017.result
@@ -13,3 +13,4 @@ n
24
drop table t1;
delete from mysql.user where user="replicate";
+call mtr.force_restart();
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
index ce0417cce07..0739fcbcc5c 100644
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -264,4 +264,27 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
DROP USER foo@"1.2.3.4";
+
+# Bug#27606 GRANT statement should be replicated with DEFINER information
+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;
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+DROP USER user_bug27606@localhost;
"End of test"
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
index a6c59918b93..37f27ab0e4b 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -142,3 +142,4 @@ HEX(word)
SELECT * FROM tmptbl504451f4258$1;
ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist
DROP TABLE t5;
+call mtr.force_restart();
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp003.result b/mysql-test/suite/rpl/r/rpl_row_sp003.result
index df3e2a7ceed..c3e2dc57740 100644
--- a/mysql-test/suite/rpl/r/rpl_row_sp003.result
+++ b/mysql-test/suite/rpl/r/rpl_row_sp003.result
@@ -26,6 +26,11 @@ CALL test.p2();
SELECT release_lock("test");
release_lock("test")
1
+get_lock("test", 100)
+1
+SELECT release_lock("test");
+release_lock("test")
+1
SELECT * FROM test.t1;
a
5
@@ -37,7 +42,10 @@ CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=INNODB;
CALL test.p2();
CALL test.p1();
get_lock("test", 100)
-0
+1
+SELECT release_lock("test");
+release_lock("test")
+1
SELECT * FROM test.t1;
a
8
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig003.result b/mysql-test/suite/rpl/r/rpl_row_trig003.result
index 131af933b41..43c2ecde2b4 100644
--- a/mysql-test/suite/rpl/r/rpl_row_trig003.result
+++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result
@@ -69,15 +69,9 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C
UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
DELETE FROM test.t1 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DELETE FROM test.t2 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
index a98a81dc74f..315008d559a 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result
@@ -33,3 +33,4 @@ Slave_IO_Running = No (should be No)
DROP TABLE t1;
[on master]
DROP TABLE t1;
+call mtr.force_restart();
diff --git a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
index 71ad0177bae..8bb8b0bdf08 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
@@ -43,3 +43,25 @@ one
1
include/start_slave.inc
drop table t1i, t2m;
+#
+# Bug#56096 STOP SLAVE hangs if executed in parallel with user sleep
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT );
+# Slave1: lock table for synchronization
+LOCK TABLES t1 WRITE;
+# Master: insert into the table
+INSERT INTO t1 SELECT SLEEP(4);
+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.
+# Slave: wait for the insert
+# Slave: send slave stop
+STOP SLAVE;
+# Slave1: wait for stop slave
+# Slave1: unlock the table
+UNLOCK TABLES;
+# Slave: wait for the slave to stop
+# Start slave again
+include/start_slave.inc
+# Clean up
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result
new file mode 100644
index 00000000000..37870f3e028
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result
@@ -0,0 +1,77 @@
+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#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
+#
+# If a temporary table is created or dropped, the transaction should be
+# regarded similarly that a non-transactional table is modified. So
+# STOP SLAVE should wait until the transaction has finished.
+CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
+CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
+SET DEBUG_SYNC= 'RESET';
+include/stop_slave.inc
+
+# Suspend the INSERT statement in current transaction on SQL thread.
+# It guarantees that SQL thread is applying the transaction when
+# STOP SLAVE command launchs.
+SET GLOBAL debug= 'd,after_mysql_insert';
+include/start_slave.inc
+
+# CREATE TEMPORARY TABLE with InnoDB engine
+# -----------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+
+# CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
+# ----------------------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
+SELECT c1 FROM t2;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+
+# Test end
+SET GLOBAL debug= '$debug_save';
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
index e90d7c3f2d2..4f9c9e09dfe 100644
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
@@ -65,9 +65,53 @@ slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
-slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */
+
+# Bug#55478 Row events wrongly apply on the temporary table of the same name
+# ==========================================================================
+# The statement should be binlogged
+CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
+
+# Case 1: CREATE TABLE t1 ... SELECT
+# ----------------------------------
+
+# The statement generates row events on t1. And the rows events should
+# be inserted into the base table on slave.
+CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
+ `rand()` double NOT NULL DEFAULT '0'
+) ENGINE=MyISAM
+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
+
+# Case 2: DROP TEMPORARY TABLE in a transacation
+# ----------------------------------------------
+
+BEGIN;
+DROP TEMPORARY TABLE t1;
+# The rows event will binlogged before 'DROP TEMPORARY TABLE t1',
+# as t1 is non-transactional table
+INSERT INTO t1 VALUES(Rand());
+COMMIT;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+# Compare the base table.
+Comparing tables master:test.t1 and slave:test.t1
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
index 3136599e5aa..14af782a4d5 100644
--- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
+++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
@@ -123,16 +123,16 @@ DROP PROCEDURE p2;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
INSERT INTO t2 VALUES ("DROP PROCEDURE p2 with table locked");
CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
INSERT INTO t2 VALUES ("CREATE EVENT e1 with table locked");
UNLOCK TABLE;
CREATE EVENT e2 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
LOCK TABLE t1 WRITE;
ALTER EVENT e2 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
INSERT INTO t2 VALUES ("ALTER EVENT e2 with table locked");
DROP EVENT e2;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
INSERT INTO t2 VALUES ("DROP EVENT e2 with table locked");
CREATE DATABASE mysqltest1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test
index a65189657cc..d271ba49c68 100644
--- a/mysql-test/suite/rpl/t/rpl000017.test
+++ b/mysql-test/suite/rpl/t/rpl000017.test
@@ -31,4 +31,6 @@ drop table t1;
delete from mysql.user where user="replicate";
sync_slave_with_master;
+call mtr.force_restart();
+
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-master.opt b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index 514d6cf8c0f..5a8362e3df0 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -23,7 +23,7 @@ source include/stop_slave.inc;
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-if (`SELECT $read_pos = $exec_pos`)
+if ($read_pos == $exec_pos)
{
source include/show_rpl_debug_info.inc;
echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
@@ -32,7 +32,7 @@ if (`SELECT $read_pos = $exec_pos`)
change master to master_user='root';
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-if (`SELECT $read_pos <> $exec_pos`)
+if ($read_pos != $exec_pos)
{
source include/show_rpl_debug_info.inc;
echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
diff --git a/mysql-test/suite/rpl/t/rpl_concurrency_error.test b/mysql-test/suite/rpl/t/rpl_concurrency_error.test
index 2e216d25211..8f5277b3f72 100644
--- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test
+++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test
@@ -53,24 +53,24 @@ while ($type)
{
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
connection conn1;
- if (`select $type = 2`)
+ if ($type == 2)
{
SET AUTOCOMMIT = 1;
BEGIN;
}
- if (`select $type = 1`)
+ if ($type == 1)
{
SET AUTOCOMMIT = 0;
}
eval UPDATE t SET f = 'yellow $type' WHERE i = 3;
connection conn2;
- if (`select $type = 2`)
+ if ($type == 2)
{
SET AUTOCOMMIT = 1;
BEGIN;
}
- if (`select $type = 1`)
+ if ($type == 1)
{
SET AUTOCOMMIT = 0;
}
@@ -88,24 +88,24 @@ while ($type)
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
connection conn1;
- if (`select $type = 2`)
+ if ($type == 2)
{
SET AUTOCOMMIT = 1;
BEGIN;
}
- if (`select $type = 1`)
+ if ($type == 1)
{
SET AUTOCOMMIT = 0;
}
eval UPDATE t SET f = 'gray $type' WHERE i = 3;
connection conn2;
- if (`select $type = 2`)
+ if ($type == 2)
{
SET AUTOCOMMIT = 1;
BEGIN;
}
- if (`select $type = 1`)
+ if ($type == 1)
{
SET AUTOCOMMIT = 0;
}
diff --git a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt
index 815a8f81d32..b0a1ce4a0be 100644
--- a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt
@@ -1 +1,2 @@
--replicate-same-server-id --relay-log=slave-relay-bin
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_current_user-master.opt b/mysql-test/suite/rpl/t/rpl_current_user-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_current_user-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index 37358077145..2ac36e62563 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -347,4 +347,25 @@ revoke all privileges, grant option from "foo";
DROP USER foo@"1.2.3.4";
-- sync_slave_with_master
+--echo
+--echo # Bug#27606 GRANT statement should be replicated with DEFINER information
+--connection master
+--source include/master-slave-reset.inc
+--connection master
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+sync_slave_with_master;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+
+--connection master
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+sync_slave_with_master;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+
+--connection master
+DROP USER user_bug27606@localhost;
+
+--source include/master-slave-end.inc
--echo "End of test"
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test
index 59c3e10915e..5862abf5c6b 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test
@@ -142,7 +142,7 @@ source include/check_slave_param.inc;
let $slave_wait_param_counter= 300;
let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1);
# Checking the fact that at least one heartbeat is received
-while (`select $slave_value = 0`)
+while (!$slave_value)
{
dec $slave_wait_param_counter;
if (!$slave_wait_param_counter)
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
index 66f96e8f4e8..b5666ad6e91 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -174,3 +174,5 @@ SELECT * FROM tmptbl504451f4258$1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
+
+call mtr.force_restart();
diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
index 22bf194cc08..6171086f747 100644
--- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test
+++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
@@ -119,7 +119,7 @@ echo [on master];
# This will block the execution of a statement at the DBUG_SYNC_POINT
# with given lock name
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
{
disable_query_log;
disable_result_log;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh
index 066f72926af..e5bb3e61d11 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh
@@ -1 +1,2 @@
+rm -f $MYSQLTEST_VARDIR/std_data_master_link
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh
index 218209a2542..7a0c0bb382a 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh
@@ -1 +1,2 @@
+rm -f $MYSQLTEST_VARDIR/std_data_slave_link
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link
diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
index 8797da4eccc..3790bed029d 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -30,7 +30,7 @@ sync_slave_with_master;
connection master;
let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1);
-if (`SELECT '$before_position'='$after_position'`)
+if ($before_position == $after_position)
{
echo Master position is not changed;
}
@@ -48,7 +48,7 @@ connection master;
let $after_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1);
-if (!`SELECT '$before_position'='$after_position'`)
+if ($before_position != $after_position)
{
echo Master position has been changed;
}
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
index 58029d28ace..1e8eb90679e 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
@@ -1 +1,2 @@
$SEMISYNC_PLUGIN_OPT
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 1bf4f1a3396..47a54fc72e6 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -58,7 +58,7 @@ echo [ on master ];
disable_query_log;
let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
-if (`select '$value' = 'No such row'`)
+if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
@@ -123,7 +123,7 @@ echo [ on slave ];
disable_query_log;
let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
-if (`select '$value' = 'No such row'`)
+if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
index feb885ce07b..3499b846c31 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
@@ -20,7 +20,7 @@ enable_query_log;
connection master;
disable_query_log;
let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
-if (`select '$value' = 'No such row'`)
+if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
@@ -34,7 +34,7 @@ source include/stop_slave.inc;
disable_query_log;
let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
-if (`select '$value' = 'No such row'`)
+if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
index 02fd555d13c..9601062b65f 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -68,3 +68,4 @@ DROP TABLE t1;
--echo [on master]
connection master;
DROP TABLE t1;
+call mtr.force_restart();
diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
index 334c4393b83..b1ea55ee8ee 100644
--- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test
+++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
@@ -233,7 +233,7 @@ let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text
-- sync_slave_with_master
let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
-if (`SELECT $master_slow_query != $slave_slow_query`)
+if ($master_slow_query != $slave_slow_query)
{
-- connection master
-- echo ***********************************************
@@ -250,7 +250,7 @@ if (`SELECT $master_slow_query != $slave_slow_query`)
-- die "Assertion failed! Master and slave slow log contents differ. Bailing out!"
}
-if (`SELECT $master_slow_query = $slave_slow_query`)
+if ($master_slow_query == $slave_slow_query)
{
-- echo ### Assertion is good. Both Master and Slave exhibit the
-- echo ### same number of queries in slow log: $master_slow_query
@@ -276,7 +276,7 @@ let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text
-- sync_slave_with_master
let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
-if (`SELECT $master_slow_query != $slave_slow_query`)
+if ($master_slow_query != $slave_slow_query)
{
-- connection master
-- echo ***********************************************
@@ -293,7 +293,7 @@ if (`SELECT $master_slow_query != $slave_slow_query`)
-- die "Assertion failed! Master and slave slow log contents differ. Bailing out!"
}
-if (`SELECT $master_slow_query = $slave_slow_query`)
+if ($master_slow_query == $slave_slow_query)
{
-- echo ### Assertion is good. Both Master and Slave exhibit the
-- echo ### same number of queries in slow log: $master_slow_query
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index 0f216983a32..38a61e07358 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -75,7 +75,7 @@ source include/check_slave_is_running.inc;
let $slave_count= `select count(*) from t1`;
-if (`select $slave_count != $master_count`)
+if ($slave_count != $master_count)
{
echo master and slave differed in number of rows;
echo master: $master_count;
diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
new file mode 100644
index 00000000000..3950b59908a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -0,0 +1,51 @@
+source include/master-slave.inc;
+source include/have_innodb.inc;
+source include/have_debug.inc;
+source include/have_debug_sync.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
+
+--echo
+--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
+--echo #
+--echo # If a temporary table is created or dropped, the transaction should be
+--echo # regarded similarly that a non-transactional table is modified. So
+--echo # STOP SLAVE should wait until the transaction has finished.
+
+CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
+CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
+
+sync_slave_with_master;
+SET DEBUG_SYNC= 'RESET';
+source include/stop_slave.inc;
+
+--echo
+--echo # Suspend the INSERT statement in current transaction on SQL thread.
+--echo # It guarantees that SQL thread is applying the transaction when
+--echo # STOP SLAVE command launchs.
+let $debug_save= `SELECT @@GLOBAL.debug`;
+SET GLOBAL debug= 'd,after_mysql_insert';
+source include/start_slave.inc;
+
+--echo
+--echo # CREATE TEMPORARY TABLE with InnoDB engine
+--echo # -----------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+--echo
+--echo # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
+--echo # ----------------------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
+ SELECT c1 FROM t2;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+# Don't need to verify 'CREATE TEMPORARY TABLE' with MyIASM engine, as it
+# never is binlogged into a transaction since 5.5.
+
+--echo
+--echo # Test end
+SET GLOBAL debug= '$debug_save';
+
+connection master;
+DROP TABLE t1, t2;
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test
index 48c8dc02efb..3b0cbbabe25 100644
--- a/mysql-test/suite/rpl/t/rpl_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_sync.test
@@ -150,3 +150,5 @@ source include/diff_tables.inc;
--echo =====Clean up=======;
connection master;
drop table t1;
+--remove_file $MYSQLD_SLAVE_DATADIR/master.backup
+--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
index e19c3019aa1..624a6467350 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
@@ -11,6 +11,7 @@
source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;
+source include/have_innodb.inc;
--echo ==== Initialize ====
@@ -146,3 +147,59 @@ DROP TABLE t3, t1;
-- sync_slave_with_master
-- source include/show_binlog_events.inc
+
+--echo
+--echo # Bug#55478 Row events wrongly apply on the temporary table of the same name
+--echo # ==========================================================================
+connection master;
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo # The statement should be binlogged
+CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
+
+--echo
+--echo # Case 1: CREATE TABLE t1 ... SELECT
+--echo # ----------------------------------
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # The statement generates row events on t1. And the rows events should
+--echo # be inserted into the base table on slave.
+CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
+
+source include/show_binlog_events.inc;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Case 2: DROP TEMPORARY TABLE in a transacation
+--echo # ----------------------------------------------
+--echo
+
+BEGIN;
+DROP TEMPORARY TABLE t1;
+
+# The patch for BUG#55478 fixed the problem only on RBR. The problem on SBR
+# will be fixed by the patch for bug#55709. So This statement cannot be
+# executed until Bug#55709 is fixed
+#
+# INSERT INTO t1 VALUES(1);
+
+--echo # The rows event will binlogged before 'DROP TEMPORARY TABLE t1',
+--echo # as t1 is non-transactional table
+INSERT INTO t1 VALUES(Rand());
+COMMIT;
+
+source include/show_binlog_events.inc;
+
+--echo # Compare the base table.
+let diff_table= test.t1;
+source include/rpl_diff_tables.inc;
+
+--echo
+connection master;
+DROP TABLE t1;
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt
index 80c171170f6..b37427aa2cd 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt
@@ -1,3 +1,2 @@
--loose-debug="+d,all_errors_are_temporary_errors" --slave-transaction-retries=2
-
-
+--force-restart
diff --git a/mysql-test/suite/sys_vars/inc/autocommit_func2.inc b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc
new file mode 100644
index 00000000000..5fff72157b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc
@@ -0,0 +1,29 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+
+SELECT @@global.autocommit;
+SELECT @@autocommit;
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+ROLLBACK;
+SELECT * from t1;
+
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+SELECT @@autocommit;
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+ROLLBACK;
+SELECT * from t1;
+
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 7f6dca3eb7b..e635f1201a3 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -3,6 +3,7 @@ create table t2 (variable_name text);
load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1;
insert into t2 select variable_name from information_schema.global_variables;
insert into t2 select variable_name from information_schema.session_variables;
+delete from t2 where variable_name='innodb_change_buffering_debug';
update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_");
select variable_name as `There should be *no* long test name listed below:` from t2
where length(variable_name) > 50;
diff --git a/mysql-test/suite/sys_vars/r/autocommit_func2.result b/mysql-test/suite/sys_vars/r/autocommit_func2.result
new file mode 100644
index 00000000000..5fcb50526f2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/autocommit_func2.result
@@ -0,0 +1,46 @@
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+SELECT @@global.autocommit;
+@@global.autocommit
+1
+SELECT @@autocommit;
+@@autocommit
+1
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id name
+1 Record_1
+2 Record_2
+ROLLBACK;
+SELECT * from t1;
+id name
+1 Record_1
+2 Record_2
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+@@global.autocommit
+0
+SELECT @@autocommit;
+@@autocommit
+0
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id name
+1 Record_1
+2 Record_2
+3 Record_1
+4 Record_2
+ROLLBACK;
+SELECT * from t1;
+id name
+1 Record_1
+2 Record_2
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;
diff --git a/mysql-test/suite/sys_vars/r/autocommit_func3.result b/mysql-test/suite/sys_vars/r/autocommit_func3.result
new file mode 100644
index 00000000000..6807c594cb1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/autocommit_func3.result
@@ -0,0 +1,42 @@
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+SELECT @@global.autocommit;
+@@global.autocommit
+0
+SELECT @@autocommit;
+@@autocommit
+0
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id name
+1 Record_1
+2 Record_2
+ROLLBACK;
+SELECT * from t1;
+id name
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+@@global.autocommit
+1
+SELECT @@autocommit;
+@@autocommit
+1
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id name
+3 Record_1
+4 Record_2
+ROLLBACK;
+SELECT * from t1;
+id name
+3 Record_1
+4 Record_2
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;
diff --git a/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result b/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
index a94a906e121..356b3c9e879 100644
--- a/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
+++ b/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
@@ -1,20 +1,20 @@
select @@global.shared_memory_base_name;
@@global.shared_memory_base_name
-MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+MYSQL_TMP_DIR/mysqld.1.sock
select @@session.shared_memory_base_name;
ERROR HY000: Variable 'shared_memory_base_name' is a GLOBAL variable
show global variables like 'shared_memory_base_name';
Variable_name Value
-shared_memory_base_name MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+shared_memory_base_name MYSQL_TMP_DIR/mysqld.1.sock
show session variables like 'shared_memory_base_name';
Variable_name Value
-shared_memory_base_name MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+shared_memory_base_name MYSQL_TMP_DIR/mysqld.1.sock
select * from information_schema.global_variables where variable_name='shared_memory_base_name';
VARIABLE_NAME VARIABLE_VALUE
-SHARED_MEMORY_BASE_NAME MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+SHARED_MEMORY_BASE_NAME MYSQL_TMP_DIR/mysqld.1.sock
select * from information_schema.session_variables where variable_name='shared_memory_base_name';
VARIABLE_NAME VARIABLE_VALUE
-SHARED_MEMORY_BASE_NAME MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+SHARED_MEMORY_BASE_NAME MYSQL_TMP_DIR/mysqld.1.sock
set global shared_memory_base_name=1;
ERROR HY000: Variable 'shared_memory_base_name' is a read only variable
set session shared_memory_base_name=1;
diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test
index e9e7e16687a..a00b7d5fbb9 100644
--- a/mysql-test/suite/sys_vars/t/all_vars.test
+++ b/mysql-test/suite/sys_vars/t/all_vars.test
@@ -61,6 +61,9 @@ eval load data infile "$MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t
insert into t2 select variable_name from information_schema.global_variables;
insert into t2 select variable_name from information_schema.session_variables;
+# This is only present in debug builds.
+delete from t2 where variable_name='innodb_change_buffering_debug';
+
# Performance schema variables are too long for files named
# 'mysql-test/suite/sys_vars/t/' ...
# ... 'performance_schema_events_waits_history_long_size_basic-master.opt'
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
new file mode 100644
index 00000000000..85e5d17d5e8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
@@ -0,0 +1 @@
+--autocommit=1
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2.test b/mysql-test/suite/sys_vars/t/autocommit_func2.test
new file mode 100644
index 00000000000..9bb4c26d5d5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func2.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
new file mode 100644
index 00000000000..e0fa81e6eeb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
@@ -0,0 +1 @@
+--autocommit=0
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3.test b/mysql-test/suite/sys_vars/t/autocommit_func3.test
new file mode 100644
index 00000000000..9bb4c26d5d5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func3.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test b/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
index 24418a78687..da165564791 100644
--- a/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
+++ b/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
@@ -3,17 +3,17 @@
#
# only global
#
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select @@global.shared_memory_base_name;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.shared_memory_base_name;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
show global variables like 'shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
show session variables like 'shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select * from information_schema.global_variables where variable_name='shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select * from information_schema.session_variables where variable_name='shared_memory_base_name';
#
diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test
index c9a7d28bb8a..1f384888f81 100644
--- a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test
+++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test
@@ -84,7 +84,7 @@ let $value_before=
CONNECT (conn2,localhost,root,,);
let $value_after=
query_get_value(show status like 'slow_launch_threads', Value, 1);
-if (!`SELECT $value_after = $value_before`)
+if ($value_after != $value_before)
{
--echo ERROR: Subtest FN_DYNVARS_124_02 failed
--echo A new connect must not be counted as 'slow_launch_thread' if
diff --git a/mysql-test/t/bug58669-master.opt b/mysql-test/t/bug58669-master.opt
new file mode 100644
index 00000000000..6d909680527
--- /dev/null
+++ b/mysql-test/t/bug58669-master.opt
@@ -0,0 +1 @@
+--read-only
diff --git a/mysql-test/t/bug58669.test b/mysql-test/t/bug58669.test
new file mode 100644
index 00000000000..332c104cfea
--- /dev/null
+++ b/mysql-test/t/bug58669.test
@@ -0,0 +1,22 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug#58669: read_only not enforced on 5.5.x
+--echo #
+
+CREATE USER user1@localhost;
+CREATE DATABASE db1;
+GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
+CREATE TABLE db1.t1(a INT);
+
+connect (con1,localhost,user1,,);
+connection con1;
+SELECT CURRENT_USER();
+SHOW VARIABLES LIKE "%read_only%";
+--error ER_OPTION_PREVENTS_STATEMENT
+INSERT INTO db1.t1 VALUES (1);
+
+connection default;
+disconnect con1;
+DROP DATABASE db1;
+DROP USER user1@localhost;
diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test
index ed2e1d05f86..1879dbc53cf 100644
--- a/mysql-test/t/change_user.test
+++ b/mysql-test/t/change_user.test
@@ -117,7 +117,7 @@ let $before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
-if (`select $after != $before`){
+if ($after != $before){
SHOW GLOBAL STATUS LIKE 'com_select';
die The value of com_select changed during change_user;
}
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 1733ee299d1..b8aae2eae40 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -128,6 +128,14 @@ select hex(cast(_ascii 0x7f as char(1) character set latin1));
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
+--echo #
+SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '');
+
+--echo End of 5.1 tests
+
--echo #
--echo # Start of 5.5 tests
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 78701127ec3..4e1ee55e019 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1209,6 +1209,13 @@ DROP PROCEDURE sp1;
DROP TABLE t1;
DROP TABLE t2;
+--echo #
+--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+--echo #
+SET NAMES utf8;
+SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis);
+
+
set names default;
set character_set_database=default;
set character_set_server=default;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 5b665e24958..2aea21afe68 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1439,6 +1439,26 @@ DROP TABLE t1;
--echo End of 5.0 tests
+#
+# Bug #57272: crash in rpad() when using utf8
+#
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'ÑÑÑŽÑ'));
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуÑ'));
+SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
+SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
+SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
+SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
+
+SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
+SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
+
+SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
+SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+
+
+--echo End of 5.1 tests
+
+
--echo Start of 5.4 tests
#
@@ -1477,6 +1497,15 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17, x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682');
SELECT predicted_order, hex(utf8_encoding) FROM t1 ORDER BY utf8_encoding COLLATE utf8_sinhala_ci;
DROP TABLE t1;
+#
+# Postfix for Bug#26474
+#
+SET NAMES utf8 COLLATE utf8_sinhala_ci;
+CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci);
+INSERT INTO t1 VALUES ('a'),('ae'),('af');
+SELECT s1,hex(s1) FROM t1 ORDER BY s1;
+SELECT * FROM t1 ORDER BY s1;
+DROP TABLE t1;
--echo End of 5.4 tests
@@ -1509,6 +1538,18 @@ DROP TABLE t1, t2;
SET NAMES utf8;
--source include/ctype_numconv.inc
+--echo #
+--echo # Bug#57687 crash when reporting duplicate group_key error and utf8
+--echo # Make sure to modify this when Bug#58081 is fixed.
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
+--error ER_DUP_ENTRY
+SELECT COUNT(*) FROM t1, t1 t2
+GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
+DROP TABLE t1;
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index a83e18c44d9..669a66bc6c5 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -354,3 +354,19 @@ SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
--echo "End of 5.0 tests"
+
+
+--echo #
+--echo # Start of 5.1 tests
+--echo #
+
+--echo #
+--echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
+--echo #
+SET NAMES utf8;
+SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
+SET NAMES latin1;
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 3a2bc982ad3..c47db78a11b 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -539,6 +539,21 @@ connection con1;
--echo # Reaping: INSERT DELAYED INTO t1 VALUES (5)
--reap
+--echo # Connection default
+connection default;
+
+--echo # Test 5: LOCK TABLES + INSERT DELAYED in one connection.
+--echo # This test has triggered some asserts in metadata locking
+--echo # subsystem at some point in time..
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (7);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 0;
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (8);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 1;
+
--echo # Connection con2
connection con2;
disconnect con2;
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 5bd53ec568e..d312254da19 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -9,10 +9,13 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
-mysqlhotcopy_myisam : Bug#54129 2010-08-31 alik mysqlhotcopy* fails
-mysqlhotcopy_archive : Bug#54129 2010-08-31 alik mysqlhotcopy* fails
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06
+main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
+main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
+log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists
+read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists
+sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested
+alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested
+create-big : Bug#37248 2010-11-15 mattiasj was not tested
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index f308c340645..82822c87e89 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -155,3 +155,19 @@ INSERT INTO t1 VALUES ('abc\0\0');
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES ('abc\0\0');
DROP TABLE t1;
+
+--echo #
+--echo # Bug#57882: Item_func_conv_charset::val_str(String*):
+--echo # Assertion `fixed == 1' failed
+--echo #
+
+--error ER_DATA_OUT_OF_RANGE
+SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
+
+SET NAMES utf8 COLLATE utf8_latvian_ci ;
+--error ER_DATA_OUT_OF_RANGE
+SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
+
+--echo #
+--echo # End Bug#57882
+--echo #
diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test
index 08412d2f5b0..3d609654b21 100644
--- a/mysql-test/t/events_2.test
+++ b/mysql-test/t/events_2.test
@@ -212,15 +212,15 @@ lock table t1 read;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
create event e2 on schedule every 10 hour do select 1;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 disable;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 rename to e3;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e2;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e1;
unlock tables;
#
@@ -229,15 +229,15 @@ lock table t1 write;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
create event e2 on schedule every 10 hour do select 1;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 disable;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 rename to e3;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e2;
---error ER_TABLE_NOT_LOCKED
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e1;
unlock tables;
#
@@ -246,15 +246,15 @@ lock table t1 read, mysql.event read;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
create event e2 on schedule every 10 hour do select 1;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 disable;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 rename to e3;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e1;
unlock tables;
#
@@ -263,15 +263,15 @@ lock table t1 write, mysql.event read;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
create event e2 on schedule every 10 hour do select 1;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 disable;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 rename to e3;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e1;
unlock tables;
#
@@ -285,12 +285,18 @@ lock table mysql.event write;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
create event e2 on schedule every 10 hour do select 1;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 disable;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter event e2 rename to e3;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e3;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
drop event e1;
unlock tables;
+drop event e1;
--echo Make sure we have left no events
select event_name from information_schema.events;
--echo
diff --git a/mysql-test/t/execution_constants.test b/mysql-test/t/execution_constants.test
index e61d79f5249..92b1deb9921 100644
--- a/mysql-test/t/execution_constants.test
+++ b/mysql-test/t/execution_constants.test
@@ -49,7 +49,7 @@ while ($i)
let $i = 1//
# Check that mysql_errno is 1436
- if (`select $mysql_errno != 1436`)
+ if ($mysql_errno != 1436)
{
die Wrong error triggered, expected 1436 but got $mysql_errno//
}
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 60108b3b038..931948b1b65 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -238,4 +238,40 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
DROP TABLE t1;
+--echo #
+--echo # Bug#56814 Explain + subselect + fulltext crashes server
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
+FULLTEXT KEY(f1),UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test
index eeda9bc8d15..f68c8b518c8 100644
--- a/mysql-test/t/fix_priv_tables.test
+++ b/mysql-test/t/fix_priv_tables.test
@@ -3,7 +3,7 @@
# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
# to the location of mysql_fix_privilege_tables.sql
-if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
+if (!$MYSQL_FIX_PRIVILEGE_TABLES)
{
skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
}
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 1cafbe3e6bd..944c9c43019 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -577,3 +577,70 @@ select * from t1;
select * from t2;
unlock tables;
drop tables tm, t1, t2;
+
+
+--echo #
+--echo # Test for bug #57006 "Deadlock between HANDLER and
+--echo # FLUSH TABLES WITH READ LOCK".
+--echo #
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connection default;
+create table t1 (i int);
+create table t2 (i int);
+handler t1 open;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Sending:
+--send flush tables with read lock
+
+--echo # Switching to connection 'con2'.
+connection con2;
+--echo # Wait until FTWRL starts waiting for 't1' to be closed.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "flush tables with read lock";
+--source include/wait_condition.inc
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # The below statement should not cause deadlock.
+--echo # Sending:
+--send insert into t2 values (1)
+
+--echo # Switching to connection 'con2'.
+connection con2;
+--echo # Wait until INSERT starts to wait for FTWRL to go away.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock"
+ and info = "insert into t2 values (1)";
+--source include/wait_condition.inc
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # FTWRL should be able to continue now.
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap INSERT.
+--reap
+handler t1 close;
+
+--echo # Cleanup.
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+connection con2;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+connection default;
+drop tables t1, t2;
diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test
index 0b3bede1684..90443dc9242 100644
--- a/mysql-test/t/flush_block_commit.test
+++ b/mysql-test/t/flush_block_commit.test
@@ -39,7 +39,7 @@ connection con2;
--echo # Wait until COMMIT gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for release of readlock" and info = "COMMIT";
+ where state = "Waiting for commit lock" and info = "COMMIT";
--source include/wait_condition.inc
--echo # Verify that 'con1' was blocked and data did not move.
SELECT * FROM t1;
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
index 7e3f4838ffb..fe9dbf7c19e 100644
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ b/mysql-test/t/flush_block_commit_notembedded.test
@@ -53,7 +53,7 @@ begin;
connection con1;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for release of readlock" and
+ where state = "Waiting for global read lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
unlock tables;
diff --git a/mysql-test/t/flush_read_lock.test b/mysql-test/t/flush_read_lock.test
new file mode 100644
index 00000000000..dbb1dd7cb49
--- /dev/null
+++ b/mysql-test/t/flush_read_lock.test
@@ -0,0 +1,2190 @@
+#
+# Test coverage for various aspects of FLUSH TABLES WITH READ LOCK
+# functionality.
+#
+
+# We need InnoDB for COMMIT/ROLLBACK related tests.
+--source include/have_innodb.inc
+# We need the Debug Sync Facility.
+--source include/have_debug_sync.inc
+# Parts of this test use DDL on events, BINLOG statement and
+# other statements which are not supported in embedded server.
+-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+--echo # FTWRL takes two global metadata locks -- a global shared
+--echo # metadata lock and the commit blocker lock.
+--echo # The first lock prevents DDL from taking place.
+--echo # Let's say that all DDL statements that take metadata
+--echo # locks form class #1 -- incompatible with FTWRL because
+--echo # take incompatible MDL table locks.
+--echo # The first global lock doesn't, however, prevent standalone
+--echo # COMMITs (or implicit COMMITs) from taking place, since a
+--echo # COMMIT doesn't take table locks. It doesn't prevent
+--echo # DDL on temporary tables either, since they don't
+--echo # take any table locks either.
+--echo # Most DDL statements do not perform an implicit commit
+--echo # if operate on a temporary table. Examples are CREATE
+--echo # TEMPORARY TABLE and DROP TEMPORARY TABLE.
+--echo # Thus, these DDL statements can go through in presence
+--echo # of FTWRL. This is class #2 -- compatible because
+--echo # do not take incompatible MDL locks and do not issue
+--echo # implicit commit..
+--echo # (Although these operations do not commit, their effects
+--echo # cannot be rolled back either.)
+--echo # ALTER TABLE, ANALYZE, OPTIMIZE and some others always
+--echo # issue an implicit commit, even if its argument is a
+--echo # temporary table.
+--echo # *Howewer* an implicit commit is a no-op if all engines
+--echo # used since the start of transactiona are non-
+--echo # transactional. Thus, for non-transactional engines,
+--echo # these operations are not blocked by FTWRL.
+--echo # This is class #3 -- compatible because do not take
+--echo # MDL table locks and are non-transactional.
+--echo # On the contrary, for transactional engines, there
+--echo # is always a commit, regardless of whether a table
+--echo # is temporary or not. Thus, for example, ALTER TABLE
+--echo # for a transactional engine will wait for FTWRL,
+--echo # even if the subject table is temporary.
+--echo # Thus ALTER TABLE <temporary> is incompatible
+--echo # with FTWRL. This is class #4 -- incompatible
+--echo # becuase issue implicit COMMIT which is not a no-op.
+--echo # Finally, there are administrative statements (such as
+--echo # RESET SLAVE) that do not take any locks and do not
+--echo # issue COMMIT.
+--echo # This is class #5.
+--echo # The goal of this coverage is to test statements
+--echo # of all classes.
+--echo # @todo: documents the effects of @@autocommit,
+--echo # DML and temporary transactional tables.
+
+--echo # Use MyISAM engine for the most of the tables
+--echo # used in this test in order to be able to
+--echo # check that DDL statements on temporary tables
+--echo # are compatible with FTRWL.
+--disable_warnings
+drop tables if exists t1_base, t2_base, t3_trans;
+drop tables if exists tm_base, tm_base_temp;
+drop database if exists mysqltest1;
+--echo # We're going to test ALTER DATABASE UPGRADE
+drop database if exists `#mysql50#mysqltest-2`;
+drop procedure if exists p1;
+drop function if exists f1;
+drop view if exists v1;
+drop procedure if exists p2;
+drop function if exists f2_base;
+drop function if exists f2_temp;
+drop event if exists e1;
+drop event if exists e2;
+--enable_warnings
+create table t1_base(i int) engine=myisam;
+create table t2_base(j int) engine=myisam;
+create table t3_trans(i int) engine=innodb;
+create temporary table t1_temp(i int) engine=myisam;
+create temporary table t2_temp(j int) engine=myisam;
+create temporary table t3_temp_trans(i int) engine=innodb;
+create database mysqltest1;
+create database `#mysql50#mysqltest-2`;
+create procedure p1() begin end;
+create function f1() returns int return 0;
+create view v1 as select 1 as i;
+create procedure p2(i int) begin end;
+delimiter |;
+create function f2_base() returns int
+begin
+ insert into t1_base values (1);
+ return 0;
+end|
+create function f2_temp() returns int
+begin
+ insert into t1_temp values (1);
+ return 0;
+end|
+delimiter ;|
+create event e1 on schedule every 1 minute do begin end;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connect (con3,localhost,root,,);
+connection default;
+
+--echo #
+--echo # Test compatibility of FLUSH TABLES WITH READ LOCK
+--echo # with various statements.
+--echo #
+--echo # These tests don't cover some classes of statements:
+--echo # - Replication-related - CHANGE MASTER TO, START/STOP SLAVE and etc
+--echo # (all compatible with FTWRL).
+--echo # - Plugin-related - INSTALL/UNINSTALL (incompatible with FTWRL,
+--echo # require plugin support).
+
+let $con_aux1=con1;
+let $con_aux2=con2;
+let $cleanup_stmt2= ;
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 1) ALTER variants.
+--echo #
+--echo # 1.1) ALTER TABLE
+--echo #
+--echo # 1.1.a) For base table should be incompatible with FTWRL.
+--echo #
+let $statement= alter table t1_base add column c1 int;
+let $cleanup_stmt1= alter table t1_base drop column c1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.1.b) For a temporary table should be compatible with FTWRL.
+--echo #
+let $statement= alter table t1_temp add column c1 int;
+let $cleanup_stmt= alter table t1_temp drop column c1;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 1.2) ALTER DATABASE should be incompatible with FTWRL.
+--echo #
+let $statement= alter database mysqltest1 default character set utf8;
+let $cleanup_stmt1= alter database mysqltest1 default character set latin1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.3) ALTER DATABASE UPGRADE DATA DIRECTORY NAME should be
+--echo # incompatible with FTWRL.
+--echo #
+let $statement= alter database `#mysql50#mysqltest-2` upgrade data directory name;
+let $cleanup_stmt1= drop database `mysqltest-2`;
+let $cleanup_stmt2= create database `#mysql50#mysqltest-2`;
+--source include/check_ftwrl_incompatible.inc
+let $cleanup_stmt2= ;
+
+--echo #
+--echo # 1.4) ALTER PROCEDURE should be incompatible with FTWRL.
+--echo #
+let $statement= alter procedure p1 comment 'a';
+let $cleanup_stmt1= alter procedure p1 comment '';
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.5) ALTER FUNCTION should be incompatible with FTWRL.
+--echo #
+let $statement= alter function f1 comment 'a';
+let $cleanup_stmt1= alter function f1 comment '';
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.6) ALTER VIEW should be incompatible with FTWRL.
+--echo #
+let $statement= alter view v1 as select 2 as j;
+let $cleanup_stmt1= alter view v1 as select 1 as i;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.7) ALTER EVENT should be incompatible with FTWRL.
+--echo #
+let $statement= alter event e1 comment 'test';
+let $cleanup_stmt1= alter event e1 comment '';
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 1.x) The rest of ALTER statements (ALTER TABLESPACE,
+--echo # ALTER LOGFILE GROUP and ALTER SERVER) are too
+--echo # special to be tested here.
+--echo #
+
+
+--echo #
+--echo # 2) ANALYZE TABLE statement is compatible with FTWRL.
+--echo # See Bug#43336 ANALYZE and OPTIMIZE do not honour
+--echo # --read-only for a discussion why.
+--echo #
+let $statement= analyze table t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 3) BEGIN, ROLLBACK and COMMIT statements.
+--echo # BEGIN and ROLLBACK are compatible with FTWRL.
+--echo # COMMIT is not.
+--echo #
+--echo # We need a special test for these statements as
+--echo # FTWRL commits a transaction and because COMMIT
+--echo # is handled in a special way.
+flush tables with read lock;
+begin;
+--echo # ROLLBACK is allowed under FTWRL although there
+--echo # no much sense in it. FTWRL commits any previous
+--echo # changes and doesn't allows any DML after it.
+--echo # So such a ROLLBACK is always a no-op.
+rollback;
+--echo # Although COMMIT is incompatible with FTWRL in
+--echo # other senses it is still allowed under FTWRL.
+--echo # This fact relied upon by some versions of
+--echo # innobackup tool.
+--echo # Similarly to ROLLBACK it is a no-op in this situation.
+commit;
+unlock tables;
+--echo # Check that BEGIN/ROLLBACK are not blocked and
+--echo # COMMIT is blocked by active FTWRL in another
+--echo # connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+begin;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Do some work so ROLLBACK is not a no-op.
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+rollback;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+begin;
+--echo # Do some work so COMMIT is not a no-op.
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Send:
+--send commit
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Wait until COMMIT is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "commit";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap COMMIT.
+--reap
+delete from t3_trans;
+--echo #
+--echo # Check that COMMIT blocks FTWRL in another connection.
+begin;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+--send commit
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap COMMIT.
+--reap
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+delete from t3_trans;
+set debug_sync= "RESET";
+--echo # We don't run similar test for BEGIN and ROLLBACK as
+--echo # they release metadata locks in non-standard place.
+
+
+--echo #
+--echo # 4) BINLOG statement should be incompatible with FTWRL.
+--echo #
+--echo #
+--echo # Provide format description BINLOG statement first.
+BINLOG '
+MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
+';
+--echo # Now test compatibility for BINLOG statement which is
+--echo # equivalent to INSERT INTO t1_base VALUES (1).
+let $statement= BINLOG '
+MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
+MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
+';
+let $cleanup_stmt1= delete from t1_base where i = 1 limit 1;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_incompatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 5) CALL statement. This statement uses resources in two
+--echo # ways: through expressions used as parameters and through
+--echo # sub-statements. This test covers only usage through
+--echo # parameters as sub-statements do locking individually.
+--echo #
+--echo # 5.a) In simple cases a parameter expression should be
+--echo # compatible with FTWRL.
+let $statement= call p2((select count(*) from t1_base));
+let $cleanup_stmt1= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 5.b) In case when an expression uses function which updates
+--echo # base tables CALL should be incompatible with FTWRL.
+--echo #
+let $statement= call p2(f2_base());
+let $cleanup_stmt1= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_incompatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 5.c) If function used as argument updates temporary tables
+--echo # CALL statement should be compatible with FTWRL.
+--echo #
+let $statement= call p2(f2_temp());
+let $cleanup_stmt1= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 6) CHECK TABLE statement is compatible with FTWRL.
+--echo #
+let $statement= check table t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 7) CHECKSUM TABLE statement is compatible with FTWRL.
+--echo #
+let $statement= checksum table t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 8) CREATE variants.
+--echo #
+--echo # 8.1) CREATE TABLE statement.
+--echo #
+--echo # 8.1.a) CREATE TABLE is incompatible with FTWRL when
+--echo # base table is created.
+let $statement= create table t3_base(i int);
+let $cleanup_stmt1= drop table t3_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 8.1.b) CREATE TABLE is compatible with FTWRL when
+--echo # temporary table is created.
+let $statement= create temporary table t3_temp(i int);
+let $cleanup_stmt= drop temporary tables t3_temp;
+--source include/check_ftwrl_compatible.inc
+
+--echo # 8.1.c) CREATE TABLE LIKE is incompatible with FTWRL when
+--echo # base table is created.
+let $statement= create table t3_base like t1_temp;
+let $cleanup_stmt1= drop table t3_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 8.1.d) CREATE TABLE LIKE is compatible with FTWRL when
+--echo # temporary table is created.
+let $statement= create temporary table t3_temp like t1_base;
+let $cleanup_stmt= drop temporary table t3_temp;
+--source include/check_ftwrl_compatible.inc
+
+--echo # 8.1.e) CREATE TABLE SELECT is incompatible with FTWRL when
+--echo # base table is created.
+let $statement= create table t3_base select 1 as i;
+let $cleanup_stmt1= drop table t3_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 8.1.f) CREATE TABLE SELECT is compatible with FTWRL when
+--echo # temporary table is created.
+let $statement= create temporary table t3_temp select 1 as i;
+let $cleanup_stmt= drop temporary table t3_temp;
+--source include/check_ftwrl_compatible.inc
+
+--echo # 8.2) CREATE INDEX statement.
+--echo #
+--echo # 8.2.a) CREATE INDEX is incompatible with FTWRL when
+--echo # applied to base table.
+let $statement= create index i on t1_base (i);
+let $cleanup_stmt1= drop index i on t1_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 8.2.b) CREATE INDEX is compatible with FTWRL when
+--echo # applied to temporary table.
+let $statement= create index i on t1_temp (i);
+let $cleanup_stmt= drop index i on t1_temp;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 8.3) CREATE DATABASE is incompatible with FTWRL.
+--echo #
+let $statement= create database mysqltest2;
+let $cleanup_stmt1= drop database mysqltest2;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.4) CREATE VIEW is incompatible with FTWRL.
+--echo #
+let $statement= create view v2 as select 1 as j;
+let $cleanup_stmt1= drop view v2;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.5) CREATE TRIGGER is incompatible with FTWRL.
+--echo #
+let $statement= create trigger t1_bi before insert on t1_base for each row begin end;
+let $cleanup_stmt1= drop trigger t1_bi;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.6) CREATE FUNCTION is incompatible with FTWRL.
+--echo #
+let $statement= create function f2() returns int return 0;
+let $cleanup_stmt1= drop function f2;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.7) CREATE PROCEDURE is incompatible with FTWRL.
+--echo #
+let $statement= create procedure p3() begin end;
+let $cleanup_stmt1= drop procedure p3;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.8) CREATE EVENT should be incompatible with FTWRL.
+--echo #
+let $statement= create event e2 on schedule every 1 minute do begin end;
+let $cleanup_stmt1= drop event e2;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.9) CREATE USER should be incompatible with FTWRL.
+--echo #
+let $statement= create user mysqltest_u1;
+let $cleanup_stmt1= drop user mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 8.x) The rest of CREATE variants (CREATE LOGFILE GROUP,
+--echo # CREATE TABLESPACE and CREATE SERVER) are too special
+--echo # to test here.
+--echo #
+
+
+--echo #
+--echo # 9) PREPARE, EXECUTE and DEALLOCATE PREPARE statements.
+--echo #
+--echo # 9.1) PREPARE statement is compatible with FTWRL as it
+--echo # doesn't change any data.
+--echo #
+--echo # 9.1.a) Prepare of simple INSERT statement.
+--echo #
+let $statement= prepare stmt1 from 'insert into t1_base values (1)';
+let $cleanup_stmt= deallocate prepare stmt1;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 9.1.b) Prepare of multi-UPDATE. At some point such statements
+--echo # tried to acquire thr_lock.c locks during prepare phase.
+--echo # This no longer happens and thus it is compatible with
+--echo # FTWRL.
+let $statement= prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j';
+let $cleanup_stmt= deallocate prepare stmt1;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 9.1.c) Prepare of multi-DELETE. Again PREPARE of such
+--echo # statement should be compatible with FTWRL.
+let $statement= prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j';
+let $cleanup_stmt= deallocate prepare stmt1;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 9.2) Compatibility of EXECUTE statement depends on statement
+--echo # to be executed.
+--echo #
+--echo # 9.2.a) EXECUTE for statement which is itself compatible with
+--echo # FTWRL should be compatible.
+prepare stmt1 from 'select * from t1_base';
+let $statement= execute stmt1;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+deallocate prepare stmt1;
+
+--echo #
+--echo # 9.2.b) EXECUTE for statement which is incompatible with FTWRL
+--echo # should be also incompatible.
+--echo #
+--echo # Check that EXECUTE is not allowed under FTWRL.
+prepare stmt1 from 'insert into t1_base values (1)';
+flush tables with read lock;
+--error ER_CANT_UPDATE_WITH_READLOCK
+execute stmt1;
+unlock tables;
+--echo # Check that active FTWRL in another connection
+--echo # blocks EXECUTE which changes data.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send execute stmt1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that EXECUTE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "insert into t1_base values (1)";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap EXECUTE.
+--reap
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send execute stmt1;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap EXECUTE.
+--reap
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+set debug_sync= "RESET";
+delete from t1_base;
+deallocate prepare stmt1;
+
+--echo #
+--echo # 9.3) DEALLOCATE PREPARE is compatible with FTWRL.
+--echo #
+prepare stmt1 from 'insert into t1_base values (1)';
+let $statement= deallocate prepare stmt1;
+let $cleanup_stmt= prepare stmt1 from 'insert into t1_base values (1)';
+--source include/check_ftwrl_compatible.inc
+deallocate prepare stmt1;
+
+
+--echo #
+--echo # 10) DELETE variations.
+--echo #
+--echo # 10.1) Simple DELETE.
+--echo #
+--echo # 10.1.a) Simple DELETE on base table is incompatible with FTWRL.
+let $statement= delete from t1_base;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 10.1.b) Simple DELETE on temporary table is compatible with FTWRL.
+let $statement= delete from t1_temp;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 10.2) Multi DELETE.
+--echo #
+--echo # 10.2.a) Multi DELETE on base tables is incompatible with FTWRL.
+let $statement= delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 10.2.b) Multi DELETE on temporary tables is compatible with FTWRL.
+let $statement= delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 11) DESCRIBE should be compatible with FTWRL.
+--echo #
+let $statement= describe t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 12) Compatibility of DO statement with FTWRL depends on its
+--echo # expression.
+--echo #
+--echo # 12.a) DO with expression which does not change base table
+--echo # should be compatible with FTWRL.
+let $statement= do (select count(*) from t1_base);
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 12.b) DO which calls SF updating base table should be
+--echo # incompatible with FTWRL.
+let $statement= do f2_base();
+let $cleanup_stmt1= delete from t1_base limit 1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 12.c) DO which calls SF updating temporary table should be
+--echo # compatible with FTWRL.
+let $statement= do f2_temp();
+let $cleanup_stmt= delete from t1_temp limit 1;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 13) DROP variants.
+--echo #
+--echo # 13.1) DROP TABLES.
+--echo #
+--echo # 13.1.a) DROP TABLES which affects base tables is incompatible
+--echo # with FTWRL.
+let $statement= drop table t2_base;
+let $cleanup_stmt1= create table t2_base(j int);
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 13.1.b) DROP TABLES which affects only temporary tables
+--echo # in theory can be compatible with FTWRL.
+--echo # In practice it is not yet.
+let $statement= drop table t2_temp;
+let $cleanup_stmt1= create temporary table t2_temp(j int);
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.1.c) DROP TEMPORARY TABLES should be compatible with FTWRL.
+let $statement= drop temporary table t2_temp;
+let $cleanup_stmt= create temporary table t2_temp(j int);
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 13.2) DROP INDEX.
+--echo #
+--echo # 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
+create index i on t1_base (i);
+let $statement= drop index i on t1_base;
+let $cleanup_stmt1= create index i on t1_base (i);
+--source include/check_ftwrl_incompatible.inc
+drop index i on t1_base;
+
+--echo #
+--echo # 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
+create index i on t1_temp (i);
+let $statement= drop index i on t1_temp;
+let $cleanup_stmt= create index i on t1_temp (i);
+--source include/check_ftwrl_compatible.inc
+drop index i on t1_temp;
+
+--echo #
+--echo # 13.3) DROP DATABASE is incompatible with FTWRL
+--echo #
+let $statement= drop database mysqltest1;
+let $cleanup_stmt1= create database mysqltest1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.4) DROP FUNCTION is incompatible with FTWRL.
+--echo #
+let $statement= drop function f1;
+let $cleanup_stmt1= create function f1() returns int return 0;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.5) DROP PROCEDURE is incompatible with FTWRL.
+--echo #
+let $statement= drop procedure p1;
+let $cleanup_stmt1= create procedure p1() begin end;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.6) DROP USER should be incompatible with FTWRL.
+--echo #
+create user mysqltest_u1;
+let $statement= drop user mysqltest_u1;
+let $cleanup_stmt1= create user mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+drop user mysqltest_u1;
+
+--echo #
+--echo # 13.7) DROP VIEW should be incompatible with FTWRL.
+--echo #
+let $statement= drop view v1;
+let $cleanup_stmt1= create view v1 as select 1 as i;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.8) DROP EVENT should be incompatible with FTWRL.
+--echo #
+let $statement= drop event e1;
+let $cleanup_stmt1= create event e1 on schedule every 1 minute do begin end;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 13.9) DROP TRIGGER is incompatible with FTWRL.
+--echo #
+create trigger t1_bi before insert on t1_base for each row begin end;
+let $statement= drop trigger t1_bi;
+let $cleanup_stmt1= create trigger t1_bi before insert on t1_base for each row begin end;
+--source include/check_ftwrl_incompatible.inc
+drop trigger t1_bi;
+
+--echo #
+--echo # 13.x) The rest of DROP variants (DROP TABLESPACE, DROP LOGFILE
+--echo # GROUP and DROP SERVER) are too special to test here.
+--echo #
+
+
+--echo #
+--echo # 14) FLUSH variants.
+--echo #
+--echo # Test compatibility of _some_ important FLUSH variants with FTWRL.
+--echo #
+--echo # 14.1) FLUSH TABLES WITH READ LOCK is compatible with itself.
+--echo #
+--echo # Check that FTWRL statements can be run while FTWRL
+--echo # is active in another connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+flush tables with read lock;
+--echo # The second FTWRL in a row is allowed at the moment.
+--echo # It does not make much sense as it does only flush.
+flush tables with read lock;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+flush tables with read lock;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+
+--echo #
+--echo # 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
+--echo # active FTWRL. But since the latter keeps tables open
+--echo # FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
+flush tables with read lock;
+--echo # FT <list> WRL is allowed under FTWRL at the moment.
+--echo # It does not make much sense though.
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+flush tables t1_base, t2_base with read lock;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+--echo # Switching to connection 'default'.
+connection default;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+
+
+--echo #
+--echo # 14.3) FLUSH TABLES is compatible with FTWRL.
+let $statement= flush tables;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 14.4) FLUSH TABLES <list> is compatible with FTWRL.
+let $statement= flush table t1_base, t2_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 14.5) FLUSH PRIVILEGES is compatible with FTWRL.
+let $statement= flush privileges;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 15) GRANT statement should be incompatible with FTWRL.
+--echo #
+let $statement= grant all privileges on t1_base to mysqltest_u1;
+let $cleanup_stmt1= revoke all privileges on t1_base from mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+drop user mysqltest_u1;
+
+
+--echo #
+--echo # 16) All HANDLER variants are half-compatible with FTWRL.
+--echo # I.e. they are not blocked by active FTWRL. But since open
+--echo # HANDLER means open table instance FTWRL is blocked while
+--echo # HANDLER is not closed.
+--echo #
+--echo # Check that HANDLER statements succeed under FTWRL.
+flush tables with read lock;
+handler t1_base open;
+handler t1_base read first;
+handler t1_base close;
+unlock tables;
+--echo # Check that HANDLER statements can be run while FTWRL
+--echo # is active in another connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+handler t1_base open;
+handler t1_base read first;
+handler t1_base close;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+
+
+--echo #
+--echo # 17) HELP statement is compatible with FTWRL.
+--echo #
+let $statement= help no_such_topic;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 18) INSERT statement.
+--echo #
+--echo # 18.a) Ordinary INSERT into base table is incompatible with FTWRL.
+let $statement= insert into t1_base values (1);
+let $cleanup_stmt1= delete from t1_base limit 1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 18.b) Ordinary INSERT into temp table is compatible with FTWRL.
+let $statement= insert into t1_temp values (1);
+let $cleanup_stmt= delete from t1_temp limit 1;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 18.c) INSERT DELAYED is incompatible with FTWRL.
+let $statement= insert delayed into t1_base values (1);
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+delete from t1_base;
+
+--echo #
+--echo # 18.d) INSERT SELECT into base table is incompatible with FTWRL.
+let $statement= insert into t1_base select * from t1_temp;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 18.e) INSERT SELECT into temp table is compatible with FTWRL.
+let $statement= insert into t1_temp select * from t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 19) KILL statement is compatible with FTWRL.
+--echo #
+--echo # Check that KILL can be run under FTWRL.
+flush tables with read lock;
+set @id:= connection_id();
+--error ER_QUERY_INTERRUPTED
+kill query @id;
+unlock tables;
+--echo # Check that KILL statements can be run while FTWRL
+--echo # is active in another connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--error ER_QUERY_INTERRUPTED
+kill query @id;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Finally check that KILL doesn't block FTWRL
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send kill query @id
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap KILL.
+--error ER_QUERY_INTERRUPTED
+--reap
+set debug_sync='RESET';
+
+
+--echo #
+--echo # 20) LOAD DATA statement.
+--echo #
+--echo # 20.a) LOAD DATA into base table is incompatible with FTWRL.
+let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i);
+let $cleanup_stmt1= delete from t1_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 20.b) LOAD DATA into temporary table is compatible with FTWRL.
+let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i);
+let $cleanup_stmt= delete from t1_temp;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 21) LOCK/UNLOCK TABLES statements.
+--echo #
+--echo # LOCK TABLES statement always (almost) blocks FTWRL as it
+--echo # keeps tables open until UNLOCK TABLES.
+--echo # Active FTWRL on the other hand blocks only those
+--echo # LOCK TABLES which allow updating of base tables.
+--echo #
+--echo # 21.a) LOCK TABLES READ is allowed under FTWRL and
+--echo # is not blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_base read;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+lock tables t1_base read;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+
+--echo #
+--echo # 21.b) LOCK TABLES WRITE on a base table is disallowed
+--echo # under FTWRL and should be blocked by active FTWRL.
+flush tables with read lock;
+--error ER_CANT_UPDATE_WITH_READLOCK
+lock tables t1_base write;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send lock tables t1_base write
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that LOCK TABLES WRITE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "lock tables t1_base write";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap LOCK TABLES WRITE
+--reap
+unlock tables;
+
+--echo #
+--echo # 21.c) LOCK TABLES WRITE on temporary table doesn't
+--echo # make much sense but is allowed under FTWRL
+--echo # and should not be blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_temp write;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+lock tables t1_temp write;
+unlock tables;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+
+
+--echo #
+--echo # 22) OPTIMIZE TABLE statement.
+--echo #
+--echo # 22.a) OPTIMIZE TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+--echo # OPTIMIZE statement returns errors as part of result-set.
+optimize table t1_base;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send optimize table t1_base
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that OPTIMIZE TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "optimize table t1_base";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap OPTIMIZE TABLE
+--reap
+--echo # We don't check that active OPTIMIZE TABLE blocks
+--echo # FTWRL as this one of statements releasing metadata
+--echo # locks in non-standard place.
+
+--echo #
+--echo # 22.b) OPTIMIZE TABLE of temporary table is compatible with FTWRL.
+let $statement= optimize table t1_temp;
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 23) CACHE statement is compatible with FTWRL.
+--echo #
+let $statement= cache index t1_base in default;
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 24) LOAD INDEX statement is compatible with FTWRL.
+--echo #
+let $statement= load index into cache t1_base;
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 25) SAVEPOINT/RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT are
+--echo # compatible with FTWRL.
+--echo #
+--echo # Since manipulations on savepoint have to be done
+--echo # inside transaction and FTWRL commits transaction we
+--echo # need a special test for these statements.
+flush tables with read lock;
+begin;
+savepoint sv1;
+rollback to savepoint sv1;
+release savepoint sv1;
+unlock tables;
+commit;
+--echo # Check that these statements are not blocked by
+--echo # active FTWRL in another connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+begin;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Do some changes to avoid SAVEPOINT and friends
+--echo # being almost no-ops.
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+savepoint sv1;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+insert into t3_trans values (2);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+rollback to savepoint sv1;
+release savepoint sv1;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+rollback;
+--echo # Check that these statements don't block FTWRL in
+--echo # another connection.
+begin;
+--echo # Do some changes to avoid SAVEPOINT and friends
+--echo # being almost no-ops.
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send savepoint sv1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap SAVEPOINT
+--reap
+insert into t3_trans values (2);
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send rollback to savepoint sv1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap ROLLBACK TO SAVEPOINT
+--reap
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send release savepoint sv1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap RELEASE SAVEPOINT
+--reap
+rollback;
+set debug_sync= "RESET";
+
+
+--echo #
+--echo # 26) RENAME variants.
+--echo #
+--echo # 26.1) RENAME TABLES is incompatible with FTWRL.
+let $statement= rename table t1_base to t3_base;
+let $cleanup_stmt1= rename table t3_base to t1_base;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 26.2) RENAME USER is incompatible with FTWRL.
+create user mysqltest_u1;
+let $statement= rename user mysqltest_u1 to mysqltest_u2;
+let $cleanup_stmt1= rename user mysqltest_u2 to mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+drop user mysqltest_u1;
+
+
+--echo #
+--echo # 27) REPAIR TABLE statement.
+--echo #
+--echo # 27.a) REPAIR TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+--echo # REPAIR statement returns errors as part of result-set.
+repair table t1_base;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send repair table t1_base
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that REPAIR TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "repair table t1_base";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap REPAIR TABLE
+--reap
+--echo # We don't check that active REPAIR TABLE blocks
+--echo # FTWRL as this one of statements releasing metadata
+--echo # locks in non-standard place.
+
+--echo #
+--echo # 27.b) REPAIR TABLE of temporary table is compatible with FTWRL.
+let $statement= repair table t1_temp;
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+
+--echo #
+--echo # 28) REPLACE statement.
+--echo #
+--echo # 28.a) Ordinary REPLACE into base table is incompatible with FTWRL.
+let $statement= replace into t1_base values (1);
+let $cleanup_stmt1= delete from t1_base limit 1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 28.b) Ordinary REPLACE into temp table is compatible with FTWRL.
+let $statement= replace into t1_temp values (1);
+let $cleanup_stmt= delete from t1_temp limit 1;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 28.c) REPLACE SELECT into base table is incompatible with FTWRL.
+let $statement= replace into t1_base select * from t1_temp;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 28.d) REPLACE SELECT into temp table is compatible with FTWRL.
+let $statement= replace into t1_temp select * from t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 29) REVOKE variants.
+--echo #
+--echo # 29.1) REVOKE privileges is incompatible with FTWRL.
+grant all privileges on t1_base to mysqltest_u1;
+let $statement= revoke all privileges on t1_base from mysqltest_u1;
+let $cleanup_stmt1= grant all privileges on t1_base to mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 29.2) REVOKE ALL PRIVILEGES, GRANT OPTION is incompatible with FTWRL.
+let $statement= revoke all privileges, grant option from mysqltest_u1;
+let $cleanup_stmt1= grant all privileges on t1_base to mysqltest_u1;
+--source include/check_ftwrl_incompatible.inc
+drop user mysqltest_u1;
+
+
+--echo #
+--echo # 30) Compatibility of SELECT statement with FTWRL depends on
+--echo # locking mode used and on functions being invoked by it.
+--echo #
+--echo # 30.a) Simple SELECT which does not change tables should be
+--echo # compatible with FTWRL.
+let $statement= select count(*) from t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo # 30.b) SELECT ... FOR UPDATE is incompatible with FTWRL.
+let $statement= select count(*) from t1_base for update;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo # 30.c) SELECT ... LOCK IN SHARE MODE is compatible with FTWRL.
+let $statement= select count(*) from t1_base lock in share mode;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 30.d) SELECT which calls SF updating base table should be
+--echo # incompatible with FTWRL.
+let $statement= select f2_base();
+let $cleanup_stmt1= delete from t1_base limit 1;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 30.e) SELECT which calls SF updating temporary table should be
+--echo # compatible with FTWRL.
+let $statement= select f2_temp();
+let $cleanup_stmt= delete from t1_temp limit 1;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 31) Compatibility of SET statement with FTWRL depends on its
+--echo # expression and on whether it is a special SET statement.
+--echo #
+--echo # 31.a) Ordinary SET with expression which does not
+--echo # changes base table should be compatible with FTWRL.
+let $statement= set @a:= (select count(*) from t1_base);
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as our helper debug
+--echo # sync-point doesn't work for SET statements.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 31.b) Ordinary SET which calls SF updating base table should
+--echo # be incompatible with FTWRL.
+let $statement= set @a:= f2_base();
+let $cleanup_stmt1= delete from t1_base limit 1;
+--echo # Skip last part of compatibility testing as our helper debug
+--echo # sync-point doesn't work for SET statements.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_incompatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 31.c) Ordinary SET which calls SF updating temporary table
+--echo # should be compatible with FTWRL.
+let $statement= set @a:= f2_temp();
+let $cleanup_stmt= delete from t1_temp limit 1;
+--echo # Skip last part of compatibility testing as our helper debug
+--echo # sync-point doesn't work for SET statements.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 31.d) Special SET variants have different compatibility with FTWRL.
+--echo #
+--echo # 31.d.I) SET PASSWORD is incompatible with FTWRL as it changes data.
+create user mysqltest_u1;
+let $statement= set password for 'mysqltest_u1' = password('');
+let $cleanup_stmt1= ;
+--echo # Skip last part of compatibility testing as our helper debug
+--echo # sync-point doesn't work for SET statements.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_incompatible.inc
+let $skip_3rd_check= ;
+drop user mysqltest_u1;
+--echo #
+--echo # 31.d.II) SET READ_ONLY is compatible with FTWRL (but has no
+--echo # effect when executed under it).
+let $statement= set global read_only= 1;
+let $cleanup_stmt= set global read_only= 0;
+--echo # Skip last part of compatibility testing as our helper debug
+--echo # sync-point doesn't work for SET statements.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+--echo #
+--echo # 31.d.III) Situation with SET AUTOCOMMIT is complex.
+--echo # Turning auto-commit off is always compatible with FTWRL.
+--echo # Turning auto-commit on causes implicit commit and so
+--echo # is incompatible with FTWRL if there are changes to be
+--echo # committed.
+flush tables with read lock;
+set autocommit= 0;
+--echo # Turning auto-commit on causes implicit commit so can
+--echo # be incompatible with FTWRL if there is something to
+--echo # commit. But since even in this case we allow commits
+--echo # under active FTWRL such statement should always succeed.
+insert into t3_temp_trans values (1);
+set autocommit= 1;
+unlock tables;
+delete from t3_temp_trans;
+--echo # Check that SET AUTOCOMMIT=0 is not blocked and
+--echo # SET AUTOCOMMIT=1 is blocked by active FTWRL in
+--echo # another connection.
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+set autocommit= 0;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Do some work so implicit commit in SET AUTOCOMMIT=1
+--echo # is not a no-op.
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Send:
+--send set autocommit= 1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Wait until SET AUTOCOMMIT=1 is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "set autocommit= 1";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap SET AUTOCOMMIT=1.
+--reap
+delete from t3_trans;
+--echo #
+--echo # Check that SET AUTOCOMMIT=1 blocks FTWRL in another connection.
+set autocommit= 0;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+--send set autocommit= 1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap SET AUTOCOMMIT=1.
+--reap
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+delete from t3_trans;
+set debug_sync= "RESET";
+
+
+--echo #
+--echo # 32) SHOW statements are compatible with FTWRL.
+--echo # Let us test _some_ of them.
+--echo #
+--echo # 32.1) SHOW TABLES.
+let $statement= show tables from test;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 32.1) SHOW TABLES.
+let $statement= show tables from test;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 32.2) SHOW EVENTS.
+let $statement= show events from test;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 32.3) SHOW GRANTS.
+create user mysqltest_u1;
+let $statement= show grants for mysqltest_u1;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+drop user mysqltest_u1;
+
+--echo #
+--echo # 32.4) SHOW CREATE TABLE.
+let $statement= show create table t1_base;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 32.5) SHOW CREATE FUNCTION.
+let $statement= show create function f1;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 33) SIGNAL statement is compatible with FTWRL.
+--echo #
+--echo # Note that we don't cover RESIGNAL as it requires
+--echo # active handler context.
+let $statement= signal sqlstate '01000';
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 34) TRUNCATE TABLE statement.
+--echo #
+--echo # 34.a) TRUNCATE of base table is incompatible with FTWRL.
+let $statement= truncate table t1_base;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 34.b) TRUNCATE of temporary table is compatible with FTWRL.
+let $statement= truncate table t1_temp;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 35) UPDATE variants.
+--echo #
+--echo # 35.1) Simple UPDATE.
+--echo #
+--echo # 35.1.a) Simple UPDATE on base table is incompatible with FTWRL.
+let $statement= update t1_base set i= 1 where i = 0;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 35.1.b) Simple UPDATE on temporary table is compatible with FTWRL.
+let $statement= update t1_temp set i= 1 where i = 0;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 35.2) Multi UPDATE.
+--echo #
+--echo # 35.2.a) Multi UPDATE on base tables is incompatible with FTWRL.
+let $statement= update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j;
+let $cleanup_stmt1= ;
+--source include/check_ftwrl_incompatible.inc
+
+--echo #
+--echo # 35.2.b) Multi UPDATE on temporary tables is compatible with FTWRL.
+let $statement= update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 36) USE statement is compatible with FTWRL.
+--echo #
+let $statement= use mysqltest1;
+let $cleanup_stmt= use test;
+--source include/check_ftwrl_compatible.inc
+
+
+--echo #
+--echo # 37) XA statements.
+--echo #
+--echo # XA statements are similar to BEGIN/COMMIT/ROLLBACK.
+--echo #
+--echo # XA BEGIN, END, PREPARE, ROLLBACK and RECOVER are compatible
+--echo # with FTWRL. XA COMMIT is not.
+flush tables with read lock;
+--echo # Although all below statements are allowed under FTWRL they
+--echo # are almost no-ops as FTWRL does commit and does not allows
+--echo # any non-temporary DML under it.
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa commit 'test1';
+--disable_result_log
+xa recover;
+--enable_result_log
+unlock tables;
+--echo # Check that XA non-COMMIT statements are not and COMMIT is
+--echo # blocked by active FTWRL in another connection
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+xa start 'test1';
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+xa start 'test1';
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+connection default;
+xa end 'test1';
+xa prepare 'test1';
+--echo # Send:
+--send xa commit 'test1';
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Wait until XA COMMIT is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "xa commit 'test1'";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap XA COMMIT.
+--reap
+delete from t3_trans;
+--echo #
+--echo # Check that XA COMMIT blocks FTWRL in another connection.
+xa start 'test1';
+insert into t3_trans values (1);
+xa end 'test1';
+xa prepare 'test1';
+set debug_sync='RESET';
+set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+--send xa commit 'test1'
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap XA COMMIT.
+--reap
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+delete from t3_trans;
+set debug_sync= "RESET";
+
+
+--echo #
+--echo # 38) Test effect of auto-commit mode for DML on transactional
+--echo # temporary tables.
+--echo #
+--echo # 38.1) When auto-commit is on each such a statement ends with commit
+--echo # of changes to temporary tables. But since transactions doing
+--echo # such changes are considered read only [sic!/QQ] this commit
+--echo # is compatible with FTWRL.
+--echo #
+--echo # Let us demostrate this fact for some common DML statements.
+let $statement= delete from t3_temp_trans;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+let $statement= insert into t3_temp_trans values (1);
+let $cleanup_stmt= delete from t3_temp_trans limit 1;
+--source include/check_ftwrl_compatible.inc
+
+let $statement= update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+--echo #
+--echo # 38.2) When auto-commit is off DML on transaction temporary tables
+--echo # is compatible with FTWRL.
+--echo #
+set autocommit= 0;
+let $statement= delete from t3_temp_trans;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+
+let $statement= insert into t3_temp_trans values (1);
+let $cleanup_stmt= delete from t3_temp_trans limit 1;
+--source include/check_ftwrl_compatible.inc
+
+let $statement= update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+set autocommit= 1;
+
+
+--echo #
+--echo # 39) Test effect of DDL on transactional tables.
+--echo #
+--echo # 39.1) Due to implicit commit at the end of statement some of DDL
+--echo # statements which are compatible with FTWRL in non-transactional
+--echo # case are not compatible in case of transactional tables.
+--echo #
+--echo # 39.1.a) ANALYZE TABLE for transactional table is incompatible with
+--echo # FTWRL.
+flush tables with read lock;
+--echo # Implicit commits are allowed under FTWRL.
+analyze table t3_trans;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send analyze table t3_trans
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that ANALYZE TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "analyze table t3_trans";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap ANALYZE TABLE
+--reap
+
+--echo #
+--echo # 39.1.b) CHECK TABLE for transactional table is compatible with FTWRL.
+--echo # Although it does implicit commit at the end of statement it
+--echo # is considered to be read-only operation.
+let $statement= check table t3_trans;
+let $cleanup_stmt= ;
+--echo # Skip last part of compatibility testing as this statement
+--echo # releases metadata locks in non-standard place.
+let $skip_3rd_check= 1;
+--source include/check_ftwrl_compatible.inc
+let $skip_3rd_check= ;
+
+--echo #
+--echo # 39.2) Situation with DDL on temporary transactional tables is
+--echo # complex.
+--echo #
+--echo # 39.2.a) Some statements compatible with FTWRL since they don't
+--echo # do implicit commit.
+--echo #
+--echo # For example, CREATE TEMPORARY TABLE:
+let $statement= create temporary table t4_temp_trans(i int) engine=innodb;
+let $cleanup_stmt= drop temporary tables t4_temp_trans;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # Or DROP TEMPORARY TABLE:
+let $statement= drop temporary tables t3_temp_trans;
+let $cleanup_stmt= create temporary table t3_temp_trans(i int) engine=innodb;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # 39.2.b) Some statements do implicit commit but are considered
+--echo # read-only and so are compatible with FTWRL.
+--echo #
+--echo # For example, REPAIR TABLE:
+let $statement= repair table t3_temp_trans;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # And ANALYZE TABLE:
+let $statement= analyze table t3_temp_trans;
+let $cleanup_stmt= ;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # 39.2.c) Some statements do implicit commit and not
+--echo # considered read-only. As result they are
+--echo # not compatible with FTWRL.
+--echo #
+flush tables with read lock;
+--echo # Implicit commits are allowed under FTWRL.
+alter table t3_temp_trans add column c1 int;
+unlock tables;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send alter table t3_temp_trans drop column c1
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that ALTER TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "alter table t3_temp_trans drop column c1";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap ALTER TABLE
+--reap
+
+
+--echo #
+--echo # 40) Test effect of implicit commit for DDL which is otherwise
+--echo # compatible with FTWRL. Implicit commit at the start of DDL
+--echo # statement can make it incompatible with FTWRL if there are
+--echo # some changes to be commited even in case when DDL statement
+--echo # itself is compatible with FTWRL.
+--echo #
+--echo # For example CHECK TABLE for base non-transactional tables and
+--echo # ALTER TABLE for temporary non-transactional tables are affected.
+begin;
+insert into t3_trans values (1);
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send check table t1_base
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that CHECK TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "check table t1_base";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap CHECK TABLE
+--reap
+begin;
+delete from t3_trans;
+--echo #
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--send alter table t1_temp add column c1 int
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Check that ALTER TABLE is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for commit lock" and
+ info = "alter table t1_temp add column c1 int";
+--source include/wait_condition.inc
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap ALTER TABLE
+--reap
+alter table t1_temp drop column c1;
+
+
+--echo #
+--echo # Check that FLUSH TABLES WITH READ LOCK is blocked by individual
+--echo # statements and is not blocked in the presence of transaction which
+--echo # has done some changes earlier but is idle now (or does only reads).
+--echo # This allows to use this statement even on systems which has long
+--echo # running transactions.
+--echo #
+begin;
+insert into t1_base values (1);
+insert into t3_trans values (1);
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Transaction still is able to read even with FTWRL active in another
+--echo # connection.
+select * from t1_base;
+select * from t2_base;
+select * from t3_trans;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+commit;
+delete from t1_base;
+delete from t3_trans;
+
+
+--echo #
+--echo # Check that impending FTWRL blocks new DML statements and
+--echo # so can't be starved by a constant flow of DML.
+--echo # (a.k.a. test for bug #54673 "It takes too long to get
+--echo # readlock for 'FLUSH TABLES WITH READ LOCK'").
+--echo #
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+--send insert into t1_base values (1)
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+set debug_sync='now WAIT_FOR parked';
+--send flush tables with read lock
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Wait until FTWRL is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "flush tables with read lock";
+--source include/wait_condition.inc
+--echo # Try to run another INSERT and see that it is blocked.
+--send insert into t2_base values (1);
+--echo # Switching to connection 'con3'.
+connection con3;
+--echo # Wait until new INSERT is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "insert into t2_base values (1)";
+--echo # Unblock INSERT in the first connection.
+set debug_sync='now SIGNAL go';
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reap first INSERT.
+--reap
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # Reap FTWRL.
+--reap
+unlock tables;
+--echo # Switching to connection '$con_aux2'.
+connection $con_aux2;
+--echo # Reap second INSERT.
+--reap
+--echo # Switching to connection 'default'.
+connection default;
+set debug_sync= "RESET";
+delete from t1_base;
+delete from t2_base;
+
+--echo
+--echo # Check that COMMIT thas is issued after
+--echo # FLUSH TABLES WITH READ LOCK is not blocked by
+--echo # FLUSH TABLES WITH READ LOCK from another connection.
+--echo # This scenario is used in innobackup.pl. The COMMIT goes
+--echo # through because the transaction started by FTWRL does
+--echo # not modify any tables, and the commit blocker lock is
+--echo # only taken when there were such modifications.
+--echo
+flush tables with read lock;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+--echo # The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+--echo # Switching to connection 'default'.
+connection default;
+select * from t1_base;
+select * from t3_trans;
+commit;
+--echo # Switching to connection '$con_aux1'.
+connection $con_aux1;
+select * from t1_base;
+select * from t3_trans;
+commit;
+unlock tables;
+--echo # Switching to connection 'default'.
+connection default;
+unlock tables;
+
+
+--echo #
+--echo # Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
+--echo # As usual there are tricky cases related to this type of tables.
+--echo #
+--echo #
+--echo # 1) Most typical case - base MERGE table with base underlying tables.
+--echo #
+--echo # 1.a) DML statements which change data should be incompatible with FTWRL.
+create table tm_base (i int) engine=merge union=(t1_base) insert_method=last;
+let $statement= insert into tm_base values (1);
+let $cleanup_stmt1= delete from tm_base;
+--source include/check_ftwrl_incompatible.inc
+--echo #
+--echo # 1.b) DDL statement on such table should be incompatible with FTWRL as well.
+let $statement= alter table tm_base insert_method=first;
+let $cleanup_stmt1= alter table tm_base insert_method=last;
+--source include/check_ftwrl_incompatible.inc
+drop table tm_base;
+
+--echo #
+--echo # 2) Temporary MERGE table with base underlying tables.
+--echo #
+--echo # 2.a) DML statements which change data should be incompatible with FTWRL
+--echo # as they affect base tables.
+create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
+let $statement= insert into tm_temp_base values (1);
+let $cleanup_stmt1= delete from tm_temp_base;
+--source include/check_ftwrl_incompatible.inc
+--echo #
+--echo # 2.b) Some of DDL statements on such table can be compatible with FTWRL
+--echo # as they don't affect base tables.
+let $statement= drop temporary tables tm_temp_base;
+let $cleanup_stmt= create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # 2.c) ALTER statement is incompatible with FTWRL. Even though it does
+--echo # not change data in base table it still acquires strong metadata
+--echo # locks on them.
+let $statement= alter table tm_temp_base insert_method=first;
+let $cleanup_stmt1= alter table tm_temp_base insert_method=last;
+--source include/check_ftwrl_incompatible.inc
+drop table tm_temp_base;
+
+--echo #
+--echo # 3) Temporary MERGE table with temporary underlying tables.
+--echo #
+--echo # 3.a) DML statements should be compatible with FTWRL as
+--echo # no base table is going to be affected.
+create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+let $statement= insert into tm_temp_temp values (1);
+let $cleanup_stmt= delete from tm_temp_temp;
+--source include/check_ftwrl_compatible.inc
+--echo #
+--echo # 3.b) DDL statements should be compatible with FTWRL as well
+--echo # as no base table is going to be affected too.
+let $statement= alter table tm_temp_temp union=(t1_temp) insert_method=first;
+let $cleanup_stmt= alter table tm_temp_temp union=(t1_temp) insert_method=last;
+--source include/check_ftwrl_compatible.inc
+drop table tm_temp_temp;
+
+--echo #
+--echo # 4) For the sake of completeness let us check that base MERGE tables
+--echo # with temporary underlying tables are not functional.
+create table tm_base_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+--error ER_WRONG_MRG_TABLE
+select * from tm_base_temp;
+drop table tm_base_temp;
+
+
+--echo #
+--echo # Clean-up.
+--echo #
+drop event e1;
+drop function f2_temp;
+drop function f2_base;
+drop procedure p2;
+drop view v1;
+drop function f1;
+drop procedure p1;
+drop database `#mysql50#mysqltest-2`;
+drop database mysqltest1;
+drop temporary tables t1_temp, t2_temp;
+drop tables t1_base, t2_base, t3_trans;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/flush_read_lock_kill-master.opt b/mysql-test/t/flush_read_lock_kill-master.opt
deleted file mode 100644
index 61e2b242351..00000000000
--- a/mysql-test/t/flush_read_lock_kill-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=+d,make_global_read_lock_block_commit_loop
diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test
index 2d359383949..a672fa5dfc5 100644
--- a/mysql-test/t/flush_read_lock_kill.test
+++ b/mysql-test/t/flush_read_lock_kill.test
@@ -2,24 +2,19 @@
# for running commits to finish (in the past it could not)
# This will not be a meaningful test on non-debug servers so will be
# skipped.
-# If running mysql-test-run --debug, the --debug added by
-# mysql-test-run to the mysqld command line will override the one of
-# -master.opt. But this test is designed to still pass then (though it
-# won't test anything interesting).
# This also won't work with the embedded server test
--source include/not_embedded.inc
--source include/have_debug.inc
+# This test needs transactional engine as otherwise COMMIT
+# won't block FLUSH TABLES WITH GLOBAL READ LOCK.
+--source include/have_innodb.inc
+
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
-# Disable concurrent inserts to avoid test failures when reading the
-# connection id which was inserted into a table by another thread.
-SET @old_concurrent_insert= @@global.concurrent_insert;
-SET @@global.concurrent_insert= 0;
-
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
@@ -27,47 +22,64 @@ connection con1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-CREATE TABLE t1 (kill_id INT);
+SET DEBUG_SYNC= 'RESET';
+CREATE TABLE t1 (kill_id INT) engine = InnoDB;
+INSERT INTO t1 VALUES(connection_id());
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Start transaction.
+BEGIN;
INSERT INTO t1 VALUES(connection_id());
+--echo # Ensure that COMMIT will pause once it acquires protection
+--echo # against its global read lock.
+SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
-# Thanks to the parameter we passed to --debug, this FLUSH will
-# block on a debug build running with our --debug=make_global... It
-# will block until killed. In other cases (non-debug build or other
-# --debug) it will succeed immediately
+--echo # Sending:
+--send COMMIT
+--echo # Switching to 'con1'.
connection con1;
+--echo # Wait till COMMIT acquires protection against global read
+--echo # lock and pauses.
+SET DEBUG_SYNC='now WAIT_FOR acquired';
+--echo # Sending:
send FLUSH TABLES WITH READ LOCK;
-# kill con1
+--echo # Switching to 'con2'.
connection con2;
-SELECT ((@id := kill_id) - kill_id) FROM t1;
+SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
-# Wait for the debug sync point, test won't run on non-debug
-# builds anyway.
+--echo # Wait till FLUSH TABLES WITH READ LOCK blocks due
+--echo # to active COMMIT
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for all running commits to finish"
+ where state = "Waiting for commit lock"
and info = "flush tables with read lock";
--source include/wait_condition.inc
+--echo # Kill connection 'con1'.
KILL CONNECTION @id;
+--echo # Switching to 'con1'.
connection con1;
-# On debug builds it will be error 1053 (killed); on non-debug, or
-# debug build running without our --debug=make_global..., will be
-# error 0 (no error). The only important thing to test is that on
-# debug builds with our --debug=make_global... we don't hang forever.
---error 0,1317,2013
+--echo # Try to reap FLUSH TABLES WITH READ LOCK,
+--echo # it fail due to killed statement and connection.
+--error 1317,2013
reap;
+--echo # Switching to 'con2'.
connection con2;
-DROP TABLE t1;
+--echo # Resume COMMIT.
+SET DEBUG_SYNC='now SIGNAL go';
+--echo # Switching to 'default'.
connection default;
+--echo # Reaping COMMIT.
+--reap
disconnect con2;
-
-# Restore global concurrent_insert value
-SET @@global.concurrent_insert= @old_concurrent_insert;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 388b1432390..db7d9fd2d08 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -594,4 +594,41 @@ REPAIR TABLE t1;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
+--echo #
+--echo # Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+--disable_warnings
+SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+--enable_warnings
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 0624fce3a34..13b3697cbf6 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -738,6 +738,17 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+--echo #
+--echo # Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
+--echo #
+
+CREATE TABLE t1(f1 int);
+INSERT INTO t1 values (0),(0);
+--disable_ps_protocol
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
+--enable_ps_protocol
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index efdf7201a40..7f9ed6d8a93 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -316,6 +316,14 @@ SELECT RAND(i) FROM t1;
DROP TABLE t1;
--echo #
+--echo # Bug#57477 SIGFPE when dividing a huge number a negative number
+--echo #
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9999999999999999991 DIV -1;
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9223372036854775808 DIV -1;
+SELECT -9223372036854775808 MOD -1;
+SELECT -9223372036854775808999 MOD -1;
#
# Bug #8457: Precision math:
@@ -464,3 +472,11 @@ SELECT -9223372036854775808 MOD -1;
--echo #
SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
as foo;
+
+--echo #
+--echo # Bug #58137 char(0) column cause:
+--echo # my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
+--echo #
+CREATE TABLE t1(a char(0));
+INSERT INTO t1 (SELECT -pi());
+DROP TABLE t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index ec71e950ca7..1a5c5373841 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -504,4 +504,36 @@ SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
DROP TABLE t1;
---echo End of 5.1 tests
+
+#
+# Bug #57283: inet_ntoa() crashes
+#
+SELECT INET_NTOA(0);
+SELECT '1' IN ('1', INET_NTOA(0));
+
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
+
+
+--echo #
+--echo # Bug #58199: name_const in the having clause crashes
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+# NAME_CONST() would seg.fault when used wrongly in a HAVING clause
+--error ER_WRONG_ARGUMENTS
+SELECT 1 from t1 HAVING NAME_CONST('', a);
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # End of tests
+--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 08c09adb093..25600a2d583 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -832,6 +832,16 @@ INSERT INTO t1 VALUES (0),(9.216e-096);
SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
DROP TABLE t1;
+--echo #
+--echo # Bug #52160: crash and inconsistent results when grouping
+--echo # by a function and column
+--echo #
+
+CREATE TABLE t1(a CHAR(10) NOT NULL);
+INSERT INTO t1 VALUES (''),('');
+SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
+DROP TABLE t1;
+
--echo End of 5.1 tests
--echo #
@@ -842,5 +852,13 @@ INSERT INTO t1 VALUES ('2008-01-03 00:00:00'), ('2008-01-03 00:00:00');
SELECT * FROM t1 WHERE date_date >= subtime(now(), "00:30:00");
SELECT * FROM t1 WHERE date_date <= addtime(date_add("2000-1-1", INTERVAL "1:1:1" HOUR_SECOND), "00:20:00");
DROP TABLE t1;
+
+--echo #
+--echo # Bug#57512 str_to_date crash...
+--echo #
+
+SELECT WEEK(STR_TO_DATE(NULL,0));
+SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
+
--echo #
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index e73f45a6c53..4eefb9beded 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -1419,11 +1419,6 @@ GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
connect (connbug33464, localhost, userbug33464, , dbbug33464);
--source suite/funcs_1/include/show_connection.inc
---disable_warnings
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
---enable_warnings
-
delimiter //;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
@@ -1578,6 +1573,16 @@ DROP TABLE db2.t1;
DROP DATABASE db1;
DROP DATABASE db2;
+--echo #
+--echo # Bug #36742
+--echo #
+grant usage on Foo.* to myuser@Localhost identified by 'foo';
+grant select on Foo.* to myuser@localhost;
+select host,user from mysql.user where User='myuser';
+revoke select on Foo.* from myuser@localhost;
+delete from mysql.user where User='myuser';
+flush privileges;
+
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant3.test b/mysql-test/t/grant3.test
index 437fc9a278f..d24b2de17eb 100644
--- a/mysql-test/t/grant3.test
+++ b/mysql-test/t/grant3.test
@@ -64,6 +64,7 @@ SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
DROP USER CUser@localhost;
+--error ER_CANNOT_USER
DROP USER CUser@LOCALHOST;
#### table grants
@@ -88,6 +89,7 @@ SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
DROP USER CUser@localhost;
+--error ER_CANNOT_USER
DROP USER CUser@LOCALHOST;
### column grants
@@ -112,6 +114,7 @@ SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
DROP USER CUser@localhost;
+--error ER_CANNOT_USER
DROP USER CUser@LOCALHOST;
drop table t1;
@@ -131,6 +134,7 @@ flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
+--error ER_NONEXISTING_GRANT
REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
flush privileges;
@@ -138,6 +142,7 @@ SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
DROP USER CUser2@localhost;
+--error ER_CANNOT_USER
DROP USER CUser2@LOCALHOST;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 2fb73af0c99..282b286749a 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1236,6 +1236,17 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
DROP TABLE t1;
+--echo #
+--echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+--echo #
+
+CREATE TABLE t1(f1 INT NOT NULL);
+INSERT INTO t1 VALUES (16777214),(0);
+
+SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
+ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
+
+DROP TABLE t1;
--echo # End of 5.1 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index f5fab966bdd..bc73e8411ca 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1555,3 +1555,56 @@ WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
+--echo #
+--echo # A test case for Bug#56540 "Exception (crash) in sql_show.cc
+--echo # during rqg_info_schema test on Windows"
+--echo # Ensure that we never access memory of a closed table,
+--echo # in particular, never access table->field[] array.
+--echo # Before the fix, the below test case, produced
+--echo # valgrind errors.
+--echo #
+
+--disable_warnings
+drop table if exists t1;
+drop view if exists v1;
+--enable_warnings
+
+create table t1 (a int, b int);
+create view v1 as select t1.a, t1.b from t1;
+alter table t1 change b c int;
+lock table t1 read;
+connect(con1, localhost, root,,);
+--echo # --> connection con1
+connection con1;
+send flush tables;
+--echo # --> connection default
+connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush" and
+ info = "flush tables";
+--source include/wait_condition.inc
+--vertical_results
+select * from information_schema.views;
+--horizontal_results
+unlock tables;
+
+--echo #
+--echo # Cleanup.
+--echo #
+
+--echo # --> connection con1
+connection con1;
+--echo # Reaping 'flush tables'
+reap;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+--echo # --> connection default
+connection default;
+drop table t1;
+drop view v1;
+
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index cf881e6aaa2..3251ff292b6 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -981,4 +981,33 @@ EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
DROP TABLE t1;
+--echo #
+--echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+--echo #
+
+CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
+
+INSERT INTO t1 VALUES (4);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (7, 7);
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+
+DROP TABLE t1,t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt
index 66e19c18a8a..6398e3e0a26 100644
--- a/mysql-test/t/key_cache-master.opt
+++ b/mysql-test/t/key_cache-master.opt
@@ -1 +1,2 @@
--key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K
+--force-restart
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index 3080c4847b4..08016313ca7 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -62,5 +62,103 @@ call p1();
drop procedure p1;
drop table t1;
-
# End of 5.0 tests
+
+#
+# BUG#57899: Certain reserved words should not be reserved
+#
+
+#
+# We are looking for SYNTAX ERRORS here, so no need to
+# log the queries
+#
+
+CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO slow(slow, general) VALUES (1,2), (5,6);
+INSERT INTO slow(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow;
+SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow;
+SELECT slow, master_heartbeat_period FROM slow ORDER BY slow;
+SELECT slow FROM slow ORDER BY slow;
+DROP TABLE slow;
+CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO general(slow, general) VALUES (1,2), (5,6);
+INSERT INTO general(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow;
+SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow;
+SELECT slow, master_heartbeat_period FROM general ORDER BY slow;
+SELECT slow FROM general ORDER BY slow;
+DROP TABLE general;
+CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6);
+INSERT INTO master_heartbeat_period(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow;
+SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+SELECT slow FROM master_heartbeat_period ORDER BY slow;
+DROP TABLE master_heartbeat_period;
+CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6);
+INSERT INTO ignore_server_ids(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow;
+SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+SELECT slow FROM ignore_server_ids ORDER BY slow;
+DROP TABLE ignore_server_ids;
+
+CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT);
+INSERT INTO t1 VALUES (1,2,3,4);
+DELIMITER |;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE slow INT;
+ DECLARE general INT;
+ DECLARE ignore_server_ids INT;
+ DECLARE master_heartbeat_period INT;
+
+ SELECT max(t1.slow) INTO slow FROM t1;
+ SELECT max(t1.general) INTO general FROM t1;
+ SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1;
+ SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1;
+
+ SELECT slow, general, ignore_server_ids, master_heartbeat_period;
+END|
+
+CREATE PROCEDURE p2()
+BEGIN
+
+ DECLARE n INT DEFAULT 2;
+ general: WHILE n > 0 DO
+ SET n = n -1;
+ END WHILE general;
+
+ SET n = 2;
+ slow: WHILE n > 0 DO
+ SET n = n -1;
+ END WHILE slow;
+
+ SET n = 2;
+ ignore_server_ids: WHILE n > 0 DO
+ SET n = n -1;
+ END WHILE ignore_server_ids;
+
+ SET n = 2;
+ master_heartbeat_period: WHILE n > 0 DO
+ SET n = n -1;
+ END WHILE master_heartbeat_period;
+
+END|
+DELIMITER ;|
+CALL p1();
+call p2();
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP TABLE t1;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 706c2514d92..9e94bb44171 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -1,307 +1,326 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
#
+# Test KILL and KILL QUERY statements.
+#
+# Killing a connection in an embedded server does not work like in a normal
+# server, if it is waiting for a new statement. In an embedded server, the
+# connection does not read() from a socket, but returns control to the
+# application. 'mysqltest' does not handle the kill request.
+#
+
-- source include/not_embedded.inc
+-- source include/have_debug_sync.inc
-# Disable concurrent inserts to avoid test failures when reading the
-# connection id which was inserted into a table by another thread.
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
+--disable_warnings
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP FUNCTION IF EXISTS MY_KILL;
+--enable_warnings
+
+delimiter |;
+# Helper function used to repeatedly kill a session.
+CREATE FUNCTION MY_KILL(tid INT) RETURNS INT
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ KILL tid;
+ RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
+END|
+delimiter ;|
connect (con1, localhost, root,,);
connect (con2, localhost, root,,);
-#remember id of con1
+# Save id of con1
connection con1;
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
--disable_reconnect
-create table t1 (kill_id int);
-insert into t1 values(connection_id());
+let $ID= `SELECT @id := CONNECTION_ID()`;
+connection con2;
+let $ignore= `SELECT @id := $ID`;
+connection con1;
+# Signal when this connection is terminating.
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+# See if we can kill read().
+# Run into read() immediately after hitting 'before_do_command_net_read'.
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
-#kill con1
+# Kill con1
connection con2;
-select ((@id := kill_id) - kill_id) from t1;
-kill @id;
+SET DEBUG_SYNC='now WAIT_FOR con1_read';
+# At this point we have no way to figure out, when con1 is blocked in
+# reading from the socket. Sending KILL to early would not terminate
+# con1. So we repeat KILL until con1 terminates.
+let $wait_condition= SELECT MY_KILL(@id);
+--source include/wait_condition.inc
+# If KILL missed the read(), sync point wait will time out.
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
connection con1;
---sleep 2
-
---disable_query_log
---disable_result_log
-# One of the following statements should fail
---error 0,2006,2013
-select 1;
---error 0,2006,2013
-select 1;
---enable_query_log
---enable_result_log
+--error 1053,2006,2013
+SELECT 1;
--enable_reconnect
# this should work, and we should have a new connection_id()
-select ((@id := kill_id) - kill_id) from t1;
-select @id != connection_id();
+SELECT 1;
+let $ignore= `SELECT @id := $ID`;
+SELECT @id != CONNECTION_ID();
#make sure the server is still alive
connection con2;
-select 4;
-drop table t1;
+SELECT 4;
connection default;
--error ER_NOT_SUPPORTED_YET
-kill (select count(*) from mysql.user);
+KILL (SELECT COUNT(*) FROM mysql.user);
+
+connection con1;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+connection con2;
+let $ignore= `SELECT @id := $ID`;
+connection con1;
+disable_reconnect;
+# Signal when this connection is terminating.
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+# See if we can kill the sync point itself.
+# Wait in 'before_do_command_net_read' until killed.
+# It doesn't wait for a signal 'kill' but for to be killed.
+# The signal name doesn't matter here.
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
+# Repeat KILL until con1 terminates.
+let $wait_condition= SELECT MY_KILL(@id);
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
+
+connection con1;
+--error 1053,2006,2013
+SELECT 1;
+enable_reconnect;
+SELECT 1;
+let $ignore= `SELECT @id := $ID`;
+SELECT @id != CONNECTION_ID();
+connection con2;
+SELECT 4;
+connection default;
#
# BUG#14851: killing long running subquery processed via a temporary table.
#
-create table t1 (id int primary key);
-create table t2 (id int unsigned not null);
-connect (conn1, localhost, root,,);
-connection conn1;
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
--- disable_result_log
--- disable_query_log
-let $1 = 4096;
-while ($1)
-{
- eval insert into t1 values ($1);
- dec $1;
-}
--- enable_query_log
--- enable_result_log
+INSERT INTO t1 VALUES
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
+INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
-insert into t2 select id from t1;
+INSERT INTO t2 SELECT id FROM t1;
-create table t3 (kill_id int);
-insert into t3 values(connection_id());
-
-connect (conn2, localhost, root,,);
-connection conn2;
+connection con1;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+connection con2;
+let $ignore= `SELECT @id := $ID`;
-connection conn1;
--- disable_result_log
-# This is a very long running query. If this test start failing, it may
-# be necessary to change to an even longer query.
-send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
--- enable_result_log
+connection con1;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
+# This is a very long running query. If this test start failing,
+# it may be necessary to change to an even longer query.
+send SELECT id FROM t1 WHERE id IN
+ (SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
+ GROUP BY ACOS(1/a.id), b.id, c.id, d.id
+ HAVING a.id BETWEEN 10 AND 20);
-connection conn2;
-select ((@id := kill_id) - kill_id) from t3;
--- sleep 1
-kill @id;
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL @id;
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
-connection conn1;
--- error 1317,2013
+connection con1;
+--error 1317,1053,2006,2013
reap;
+SELECT 1;
connection default;
-
-drop table t1, t2, t3;
-
-# End of 4.1 tests
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
#
-# test of blocking of sending ERROR after OK or EOF
+# Test of blocking of sending ERROR after OK or EOF
#
connection con1;
-select get_lock("a", 10);
+let $ID= `SELECT @id := CONNECTION_ID()`;
connection con2;
-let $ID= `select connection_id()`;
-send select get_lock("a", 10);
-real_sleep 2;
+let $ignore= `SELECT @id := $ID`;
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
+send SELECT ACOS(0);
connection con2;
-reap;
-select 1;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
connection con1;
-select RELEASE_LOCK("a");
+reap;
+SELECT 1;
+SELECT @id = CONNECTION_ID();
+connection default;
+SET DEBUG_SYNC = 'RESET';
#
# Bug#27563: Stored functions and triggers wasn't throwing an error when killed.
#
-create table t1(f1 int);
+CREATE TABLE t1 (f1 INT);
delimiter |;
-create function bug27563() returns int(11)
-deterministic
-begin
- declare continue handler for sqlstate '70100' set @a:= 'killed';
- declare continue handler for sqlexception set @a:= 'exception';
- set @a= get_lock("lock27563", 10);
- return 1;
-end|
+CREATE FUNCTION bug27563() RETURNS INT(11)
+DETERMINISTIC
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+ RETURN 1;
+END|
delimiter ;|
# Test stored functions
# Test INSERT
connection con1;
-select get_lock("lock27563",10);
+let $ID= `SELECT @id := CONNECTION_ID()`;
connection con2;
-let $ID= `select connection_id()`;
-send insert into t1 values (bug27563());
-real_sleep 2;
+let $ignore= `SELECT @id := $ID`;
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+send INSERT INTO t1 VALUES (bug27563());
connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+connection con1;
--error 1317
reap;
-select @a;
-connection con1;
-select * from t1;
+SELECT * FROM t1;
+connection default;
+SET DEBUG_SYNC = 'RESET';
# Test UPDATE
-insert into t1 values(0);
-connection con2;
-send update t1 set f1= bug27563();
-real_sleep 2;
+INSERT INTO t1 VALUES(0);
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+send UPDATE t1 SET f1= bug27563();
connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+connection con1;
--error 1317
reap;
-select @a;
-connection con1;
-select * from t1;
+SELECT * FROM t1;
+connection default;
+SET DEBUG_SYNC = 'RESET';
# Test DELETE
-insert into t1 values(1);
-connection con2;
-send delete from t1 where bug27563() is null;
-real_sleep 2;
+INSERT INTO t1 VALUES(1);
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+send DELETE FROM t1 WHERE bug27563() IS NULL;
connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+connection con1;
--error 1317
reap;
-select @a;
-connection con1;
-select * from t1;
+SELECT * FROM t1;
+connection default;
+SET DEBUG_SYNC = 'RESET';
# Test SELECT
-connection con2;
-send select * from t1 where f1= bug27563();
-real_sleep 2;
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+send SELECT * FROM t1 WHERE f1= bug27563();
connection con2;
---error 1317
-reap;
-select @a;
-
-# Test PROCEDURE
-connection con2;
-delimiter |;
-create procedure proc27563()
-begin
- declare continue handler for sqlstate '70100' set @a:= 'killed';
- declare continue handler for sqlexception set @a:= 'exception';
- select get_lock("lock27563",10);
- select "shouldn't be selected";
-end|
-delimiter ;|
-send call proc27563();
-real_sleep 2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
-connection con2;
--error 1317
reap;
-select @a;
+SELECT * FROM t1;
+connection default;
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION bug27563;
# Test TRIGGERS
-connection con2;
-create table t2 (f2 int);
+CREATE TABLE t2 (f2 INT);
delimiter |;
-create trigger trg27563 before insert on t1 for each row
-begin
- declare continue handler for sqlstate '70100' set @a:= 'killed';
- declare continue handler for sqlexception set @a:= 'exception';
- set @a:= get_lock("lock27563",10);
- insert into t2 values(1);
-end|
+CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ INSERT INTO t2 VALUES(0);
+ SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+ INSERT INTO t2 VALUES(1);
+END|
delimiter ;|
-send insert into t1 values(2),(3);
-real_sleep 2;
connection con1;
-disable_query_log;
-eval kill query $ID;
-enable_query_log;
+send INSERT INTO t1 VALUES(2),(3);
connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+connection con1;
--error 1317
reap;
-select @a;
-connection con1;
-select * from t1;
-select * from t2;
-
-# Cleanup
-select release_lock("lock27563");
-drop table t1, t2;
-drop function bug27563;
-drop procedure proc27563;
+SELECT * FROM t1;
+SELECT * FROM t2;
+connection default;
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
#
# Bug#28598: mysqld crash when killing a long-running explain query.
#
---disable_query_log
connection con1;
-let $ID= `select connection_id()`;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+connection con2;
+let $ignore= `SELECT @id := $ID`;
+connection con1;
+--disable_query_log
let $tab_count= 40;
let $i= $tab_count;
while ($i)
{
- eval CREATE TABLE t$i (a$i int, KEY(a$i));
+ eval CREATE TABLE t$i (a$i INT, KEY(a$i));
eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7);
dec $i ;
}
-set session optimizer_search_depth=0;
+SET SESSION optimizer_search_depth=0;
let $i=$tab_count;
while ($i)
{
- let $a= a$i;
- let $t= t$i;
- dec $i;
- if ($i)
- {
- let $comma=,;
- let $from=$comma$t$from;
- let $where=a$i=$a $and $where;
- }
- if (!$i)
- {
- let $from=FROM $t$from;
- let $where=WHERE $where;
- }
- let $and=AND;
+ let $a= a$i;
+ let $t= t$i;
+ dec $i;
+ if ($i)
+ {
+ let $comma=,;
+ let $from=$comma$t$from;
+ let $where=a$i=$a $and $where;
+ }
+ if (!$i)
+ {
+ let $from=FROM $t$from;
+ let $where=WHERE $where;
+ }
+ let $and=AND;
}
--enable_query_log
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where';
send EXECUTE stmt;
---disable_query_log
connection con2;
-real_sleep 2;
-eval kill query $ID;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+connection con1;
+--error 1317
+reap;
+--disable_query_log
let $i= $tab_count;
while ($i)
{
@@ -309,8 +328,8 @@ while ($i)
dec $i ;
}
--enable_query_log
-
-###########################################################################
+connection default;
+SET DEBUG_SYNC = 'RESET';
--echo #
--echo # Bug#19723: kill of active connection yields different error code
@@ -318,16 +337,27 @@ while ($i)
--echo #
--echo
---echo # Connection: con2.
---connection con2
-
-KILL CONNECTION_ID();
+--echo # Connection: con1.
+--connection con1
+let $ID= `SELECT @id := CONNECTION_ID()`;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+--disable_reconnect
+--error ER_QUERY_INTERRUPTED
+KILL @id;
---echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing
---echo # of close of the connection socket
---error 2013, 2006
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+connection con1;
+--echo # ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
+--echo # depending on the timing of close of the connection socket
+--error 1053,2006,2013
+SELECT 1;
+--enable_reconnect
SELECT 1;
---connection default
+let $ignore= `SELECT @id := $ID`;
+SELECT @id != CONNECTION_ID();
+connection default;
+SET DEBUG_SYNC = 'RESET';
--echo #
--echo # Additional test for WL#3726 "DDL locking for all metadata objects"
@@ -489,28 +519,26 @@ connection ddl;
--echo # Switching to connection 'blocker'
connection blocker;
unlock tables;
-drop table t2;
-create table t2 (k int);
lock tables t1 read;
--echo # Switching to connection 'ddl'
connection ddl;
# Let us add pending exclusive metadata lock on t2
---send rename tables t1 to t3, t2 to t1
+--send truncate table t1
--echo # Switching to connection 'dml'
connection dml;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
- info = "rename tables t1 to t3, t2 to t1";
+ info = "truncate table t1";
--source include/wait_condition.inc
let $ID2= `select connection_id()`;
---send insert into t2 values (1)
+--send insert into t1 values (1)
--echo # Switching to connection 'default'
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
- info = "insert into t2 values (1)";
+ info = "insert into t1 values (1)";
--source include/wait_condition.inc
--replace_result $ID2 ID2
eval kill query $ID2;
@@ -564,10 +592,10 @@ connection ddl;
--echo # Cleanup.
--echo # Switching to connection 'default'
connection default;
-drop table t3;
drop table t1;
+drop table t2;
###########################################################################
-# Restore global concurrent_insert value. Keep in the end of the test file.
-set @@global.concurrent_insert= @old_concurrent_insert;
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION MY_KILL;
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 6bdb235903d..5bab5e647ab 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -228,7 +228,7 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock" and
+ where state = "Waiting for global read lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
# This must not block.
@@ -260,7 +260,7 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock" and
+ where state = "Waiting for global read lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
--error ER_TABLE_NOT_LOCKED
@@ -296,10 +296,11 @@ DROP DATABASE mysqltest_1;
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection con1;
-# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
+# Wait a bit so that the session con2 is in state
+# "Waiting for global read lock"
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for release of readlock"
+ where state = "Waiting for global read lock"
and info = "DROP DATABASE mysqltest_1";
--source include/wait_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
@@ -376,7 +377,7 @@ connection con5;
--echo # con5
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock" and
+ where state = "Waiting for global read lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
--echo # global read lock is taken
@@ -384,10 +385,11 @@ connection con3;
--echo # con3
send select * from t2 for update;
connection con5;
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "select * from t2 for update";
+--source include/wait_condition.inc
--echo # waiting for release of read lock
connection con4;
--echo # con4
@@ -433,10 +435,11 @@ connection con1;
send update t2 set a = 1;
connection default;
--echo # default
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "update t2 set a = 1";
+--source include/wait_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
--echo # con2
@@ -460,10 +463,11 @@ connection con1;
send lock tables t2 write;
connection default;
--echo # default
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for global read lock" and
+ info = "lock tables t2 write";
+--source include/wait_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
--echo # con2
@@ -571,7 +575,8 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock" and
+ info = "flush tables with read lock";
--source include/wait_condition.inc
alter table t1 add column j int;
connect (insert,localhost,root,,test,,);
@@ -579,14 +584,16 @@ connection insert;
--echo connection: insert
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock" and
+ info = "flush tables with read lock";
--source include/wait_condition.inc
--send insert into t1 values (1,2);
--echo connection: default
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for release of readlock";
+ where state = "Waiting for global read lock" and
+ info = "insert into t1 values (1,2)";
--source include/wait_condition.inc
unlock tables;
connection flush;
@@ -594,7 +601,8 @@ connection flush;
--reap
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for release of readlock";
+ where state = "Waiting for global read lock" and
+ info = "insert into t1 values (1,2)";
--source include/wait_condition.inc
select * from t1;
unlock tables;
@@ -629,12 +637,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock";
--source include/wait_condition.inc
unlock tables;
connection flush;
@@ -698,12 +706,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock";
--source include/wait_condition.inc
drop table t1;
connection flush;
diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test
index 49f8f59ec5a..d5ad7becd7d 100644
--- a/mysql-test/t/lock_sync.test
+++ b/mysql-test/t/lock_sync.test
@@ -1023,6 +1023,120 @@ DROP EVENT e2;
SET DEBUG_SYNC="RESET";
+--echo #
+--echo # Bug#55930 Assertion `thd->transaction.stmt.is_empty() ||
+--echo # thd->in_sub_stmt || (thd->state..
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT) engine=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+
+connect (con1, localhost, root);
+connect (con2, localhost, root);
+
+--echo # Connection con1
+connection con1;
+SET SESSION lock_wait_timeout= 1;
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
+--echo # Sending:
+--send OPTIMIZE TABLE t1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
+SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
+--echo # Sending:
+--send INSERT INTO t1 VALUES (3)
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
+SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: OPTIMIZE TABLE t1
+--reap
+SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: INSERT INTO t1 VALUES (3)
+--reap
+disconnect con2;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+
+
+--echo #
+--echo # Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+CREATE FUNCTION f1() RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1;
+DROP FUNCTION f1;
+connect(con2, localhost, root);
+
+--echo # Connection con1
+connect (con1, localhost, root);
+# Need to trigger this sync point at least twice in order to
+# get valgrind test failures without the patch
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
+--echo # Sending:
+--send SHOW CREATE VIEW v1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+--echo # Sending:
+--send FLUSH TABLES
+
+--echo # Connection default
+connection default;
+--echo # Waiting for FLUSH TABLES to be blocked.
+let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: SHOW CREATE VIEW v1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: FLUSH TABLES
+--reap
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'RESET';
+DROP VIEW v1;
+DROP TABLE t1;
+disconnect con1;
+disconnect con2;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 5275b8e7db3..5b6be217d9d 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -1034,6 +1034,25 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
+#
+# Bug #47924 main.log_tables times out sporadically
+#
+
+use mysql;
+# Should result in error
+--disable_warnings
+drop table if exists renamed_general_log;
+drop table if exists renamed_slow_log;
+--enable_warnings
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE general_log TO renamed_general_log;
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE slow_log TO renamed_slow_log;
+
+use test;
+flush tables with read lock;
+unlock tables;
+
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt
new file mode 100755
index 00000000000..c0a1981fa7c
--- /dev/null
+++ b/mysql-test/t/lowercase_table4-master.opt
@@ -0,0 +1 @@
+--lower-case-table-names=2
diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test
new file mode 100755
index 00000000000..93956047145
--- /dev/null
+++ b/mysql-test/t/lowercase_table4.test
@@ -0,0 +1,56 @@
+--source include/have_case_insensitive_file_system.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug#46941 crash with lower_case_table_names=2 and
+--echo # foreign data dictionary confusion
+--echo #
+
+CREATE DATABASE XY;
+USE XY;
+
+#
+# Logs are disabled, since the number of creates tables
+# and subsequent select statements may vary between
+# versions
+#
+--disable_query_log
+--disable_result_log
+
+let $tcs = `SELECT @@table_open_cache + 1`;
+
+let $i = $tcs;
+
+while ($i)
+{
+ eval CREATE TABLE XY.T_$i (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT,
+ primary key(a, b), unique(b)) ENGINE=InnoDB;
+ dec $i;
+}
+
+eval ALTER TABLE XY.T_$tcs ADD INDEX I1 (c, b),
+ ADD CONSTRAINT C1 FOREIGN KEY (c, b) REFERENCES XY.T_1 (a, b);
+
+eval ALTER TABLE XY.T_$tcs ADD INDEX I2 (b),
+ ADD CONSTRAINT C2 FOREIGN KEY (b) REFERENCES XY.T_1(a);
+
+let $i = $tcs;
+while ($i)
+{
+ eval SELECT * FROM XY.T_$i LIMIT 1;
+ dec $i;
+}
+
+DROP DATABASE XY;
+CREATE DATABASE XY;
+USE XY;
+eval CREATE TABLE XY.T_$tcs (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT,
+ PRIMARY KEY(a, b), UNIQUE(b)) ENGINE=InnoDB;
+#
+# The bug causes this SELECT to err
+eval SELECT * FROM XY.T_$tcs LIMIT 1;
+
+--enable_query_log
+--enable_result_log
+DROP DATABASE XY;
+
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 5c4fc20b428..197cad536e4 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -3661,7 +3661,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL
--echo # and let CREATE PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK
--echo # Connection 1
@@ -3689,15 +3689,22 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL
--echo # and let DROP PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK
--echo # Connection 1
connection default;
+--echo # Once FLUSH TABLES WITH READ LOCK starts waiting
+--echo # DROP PROCEDURE will be waked up and will drop
+--echo # procedure. Global read lock will be granted after
+--echo # this statement ends.
+--echo #
+--echo # Reaping DROP PROCEDURE.
--reap
--echo # Connection 2
connection con2;
+--echo # Reaping FTWRL.
--reap
UNLOCK TABLES;
@@ -4485,7 +4492,7 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for release of readlock'
+ WHERE state='Waiting for global read lock'
AND info='CREATE TABLE db1.t2(a INT)';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -4507,7 +4514,7 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for release of readlock'
+ WHERE state='Waiting for global read lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
UNLOCK TABLES;
diff --git a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt
index ac1a87c73b3..a9f4a6010d8 100644
--- a/mysql-test/t/mysqlbinlog-master.opt
+++ b/mysql-test/t/mysqlbinlog-master.opt
@@ -1 +1,2 @@
--max-binlog-size=4096
+--force-restart
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 3a9dae35476..76f6c63fc1d 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -487,3 +487,18 @@ diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbin
# Cleanup for this part of test
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
+
+#
+# WL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output
+#
+
+--echo # Expect deprecation warning.
+--exec $MYSQL_BINLOG --base64-output=always std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+
+--echo # Expect deprecation warning again.
+--exec $MYSQL_BINLOG --base64-output std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+
+# Clean up this part of the test.
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index feb87dfe850..427cfa598ae 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -331,7 +331,7 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
--exec illegal_command
--cat_file does_not_exist
--perl
- exit(1);
+ exit(2);
EOF
# ----------------------------------------------------------------------------
@@ -854,6 +854,13 @@ let $var2= `failing query`;
echo $var2;
EOF
+create table t1 (a varchar(100));
+insert into t1 values ('`select 42`');
+let $a= `select * from t1`;
+# This should output `select 42`, not evaluate it again to 42
+echo $a;
+drop table t1;
+
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
@@ -1134,6 +1141,11 @@ if (!$counter)
{
echo Counter is not 0, (counter=10);
}
+if (! $counter)
+{
+ let $counter=5;
+}
+echo Counter should still be 10, is $counter;
let $counter=0;
if($counter)
{
@@ -1143,6 +1155,10 @@ if (!$counter)
{
echo Counter is not 0, (counter=0);
}
+if (! $counter)
+{
+ echo Not space var works;
+}
# ----------------------------------------------------------------------------
# Test if with some non-numerics
@@ -1163,10 +1179,11 @@ if ($counter)
{
echo oops, -0 is true;
}
-if (beta)
-{
- echo Beta is true;
-}
+# This is no longer allowed, as a precaution against mistyped conditionals
+# if (beta)
+# {
+# echo Beta is true;
+# }
let $counter=gamma;
while ($counter)
{
@@ -1175,6 +1192,179 @@ while ($counter)
}
# ----------------------------------------------------------------------------
+# Test if with compare conditions
+# ----------------------------------------------------------------------------
+
+let $ifvar= 5;
+let $ifvar2= 6;
+
+if ($ifvar < 7)
+{
+ echo 5<7;
+}
+if ($ifvar< 7)
+{
+ echo 5<7 again;
+}
+if ($ifvar<7)
+{
+ echo 5<7 still;
+}
+if ($ifvar < $ifvar2)
+{
+ echo 5<6;
+}
+if ($ifvar <= 4)
+{
+ echo 5<=4;
+}
+if ($ifvar >= 5)
+{
+ echo 5>=5;
+}
+if ($ifvar>=5)
+{
+ echo 5>=5 again;
+}
+if ($ifvar > 3)
+{
+ echo 5>3;
+}
+if ($ifvar == 4)
+{
+ echo 5==4;
+}
+if ($ifvar == 5)
+{
+ echo 5==5;
+}
+if ($ifvar != 8)
+{
+ echo 5!=8;
+}
+# Any number should compare unequal to any string
+if ($ifvar != five)
+{
+ echo 5!=five;
+}
+if ($ifvar == `SELECT 3+2`)
+{
+ echo 5==3+2;
+}
+if ($ifvar == 5)
+{
+ echo 5 == 5;
+}
+let $ifvar= hello;
+if ($ifvar == hello there)
+{
+ echo hello == hello there;
+}
+if ($ifvar == hello)
+{
+ echo hello == hello;
+}
+if ($ifvar == hell)
+{
+ echo hello == hell;
+}
+if ($ifvar == hello)
+{
+ echo hello == hello;
+}
+if ($ifvar != goodbye)
+{
+ echo hello != goodbye;
+}
+
+let $ifvar= two words;
+if ($ifvar == two words)
+{
+ echo two words;
+}
+if ($ifvar == `SELECT 'two words'`)
+{
+ echo two words are two words;
+}
+if (42)
+{
+ echo right answer;
+}
+if (0)
+{
+ echo wrong answer;
+}
+# Non-empty string treated as 'true'
+if (`SELECT 'something'`)
+{
+ echo anything goes;
+}
+# Make sure 0 and string compare right
+let $ifvar= 0;
+if ($ifvar == string)
+{
+ echo 0 == string;
+}
+if ($ifvar != string)
+{
+ echo 0 != string;
+}
+--write_file $MYSQL_TMP_DIR/mysqltest.sql
+let $var= 5;
+if ($var >= four)
+{
+ echo 5>=four;
+}
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
+remove_file $MYSQL_TMP_DIR/mysqltest.sql;
+
+--write_file $MYSQL_TMP_DIR/mysqltest.sql
+let $var= 5;
+if ($var ~= 6)
+{
+ echo 5~=6;
+}
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
+remove_file $MYSQL_TMP_DIR/mysqltest.sql;
+
+--write_file $MYSQL_TMP_DIR/mysqltest.sql
+let $var= text;
+if (var == text)
+{
+ echo Oops I forgot the $;
+}
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
+remove_file $MYSQL_TMP_DIR/mysqltest.sql;
+
+# ----------------------------------------------------------------------------
+# Test while with compare conditions
+# ----------------------------------------------------------------------------
+
+let $counter= 2;
+
+while ($counter < 5)
+{
+ echo counter is $counter;
+ inc $counter;
+}
+let $ifvar=;
+while ($ifvar != stop)
+{
+ if ($counter >= 7)
+ {
+ let $ifvar= stop;
+ }
+ echo counter is $counter;
+ inc $counter;
+}
+
+# ----------------------------------------------------------------------------
# Test while, { and }
# ----------------------------------------------------------------------------
@@ -2438,15 +2628,15 @@ let $count= 0;
while ($run)
{
let $Field= query_get_value($show_statement, Field, $rowno);
- if (`SELECT '$Field' = 'No such row'`)
+ if ($Field == No such row)
{
let $run= 0;
}
- if (`SELECT '$Field' <> 'No such row'`)
+ if ($Field != No such row)
{
let $Type= query_get_value($show_statement, Type, $rowno);
let $Null= query_get_value($show_statement, Null, $rowno);
- if (`SELECT '$Null' = 'YES'`)
+ if ($Null == YES)
{
inc $count;
}
@@ -2499,6 +2689,8 @@ write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
hello
EOF
+# Verify that --replace_result also work on list_files
+--replace_result file REPLACED_FILE
list_files $MYSQLTEST_VARDIR/tmp/testdir;
# list_files gets the directory list before creating the new file
list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *;
@@ -2529,26 +2721,6 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--replace_result c:\\a.txt z
SELECT 'c:\\a.txt' AS col;
-#
-# Bug#32307 mysqltest - does not detect illegal if syntax
-#
-
-let $test= 1;
-if ($test){
- echo hej;
-}
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-if ($mysql_errno != 1436)
-{
- echo ^ Should not be allowed!
-}
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-
# ----------------------------------------------------------------------------
# Test that -- is not allowed as comment, only as mysqltest builtin command
# ----------------------------------------------------------------------------
diff --git a/mysql-test/t/named_pipe.test b/mysql-test/t/named_pipe.test
index e88fd8e1ef8..0e6c963024f 100644
--- a/mysql-test/t/named_pipe.test
+++ b/mysql-test/t/named_pipe.test
@@ -5,7 +5,7 @@
# Only run this test if named pipe is avaliable
let $nmp= query_get_value("SHOW VARIABLES LIKE 'named_pipe'", Value, 1);
-if (`SELECT '$nmp' != 'ON'`){
+if ($nmp != ON){
skip No named pipe support;
}
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test
index 917d5871682..3fea1f630e0 100644
--- a/mysql-test/t/not_embedded_server.test
+++ b/mysql-test/t/not_embedded_server.test
@@ -54,3 +54,57 @@ lock tables t1 read;
flush privileges;
unlock tables;
drop table t1;
+
+--echo #
+--echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
+--echo #
+
+CREATE USER nopriv_user@localhost;
+
+connection default;
+--echo connection: default
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP FUNCTION IF EXISTS f;
+--enable_warnings
+
+CREATE TABLE t1 (key1 INT PRIMARY KEY);
+CREATE TABLE t2 (key2 INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+
+GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
+
+FLUSH PRIVILEGES;
+
+connect (con1,localhost,nopriv_user,,);
+connection con1;
+--echo connection: con1
+
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+
+--error ER_PROCACCESS_DENIED_ERROR
+INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
+
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
+
+--error ER_PROCACCESS_DENIED_ERROR
+CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
+
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+connection default;
+--echo connection: default
+
+DROP TABLE t1,t2;
+DROP FUNCTION f;
+DROP USER nopriv_user@localhost;
+
+--echo #
+--echo # End Bug#54812
+--echo #
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 68239c06660..cf3dcfadb27 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -15,6 +15,24 @@ drop table if exists t1, t2;
--enable_warnings
--echo #
+--echo # Bug#57778: failed primary key add to partitioned innodb table
+--echo # inconsistent and crashes
+--echo #
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (0,1), (0,2);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SELECT * FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug#57113: ha_partition::extra(ha_extra_function):
--echo # Assertion `m_extra_cache' failed
CREATE TABLE t1
diff --git a/mysql-test/t/partition_debug_sync.test b/mysql-test/t/partition_debug_sync.test
index cde94856ae6..448cec652d7 100644
--- a/mysql-test/t/partition_debug_sync.test
+++ b/mysql-test/t/partition_debug_sync.test
@@ -38,7 +38,7 @@ connection default;
--echo # Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
--echo # Con 1
connection con1;
@@ -70,12 +70,12 @@ SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
--send ALTER TABLE t2 REMOVE PARTITIONING
connection default;
--echo # Con default
-SET SESSION debug= "+d,sleep_before_part2_delete_table";
+SET SESSION debug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
-SET SESSION debug= "-d,sleep_before_part2_delete_table";
+SET SESSION debug= "-d,sleep_before_no_locks_delete_table";
--echo # Con 1
connection con1;
--error ER_NO_SUCH_TABLE
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 3e9ac2ce2b5..86bbe359873 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -9,6 +9,31 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
+--echo # Bug#56287: crash when using Partition datetime in sub in query
+--echo #
+
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ c2 varchar(40) not null default '',
+ c3 datetime not NULL,
+ PRIMARY KEY (c1,c3),
+ KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+ PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+ PARTITION p201912 VALUES LESS THAN MAXVALUE);
+
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug#54747: Deadlock between REORGANIZE PARTITION and
--echo # SELECT is not detected
--echo #
@@ -552,6 +577,19 @@ connection default;
SELECT * FROM t1;
COMMIT;
DROP TABLE t1;
+
+#
+# Bug #55146 Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map
+#
+
+CREATE TABLE t1 (i1 int NOT NULL primary key, f1 int) ENGINE = InnoDB
+ PARTITION BY HASH(i1) PARTITIONS 2;
+
+INSERT INTO t1 VALUES (1,1), (2,2);
+
+SELECT * FROM t1 WHERE i1 = ( SELECT i1 FROM t1 WHERE f1=0 LIMIT 1 );
+DROP TABLE t1;
+
--enable_parsing
--echo #
@@ -569,3 +607,24 @@ SET SESSION sql_mode = 'NO_ZERO_DATE';
OPTIMIZE TABLE t1;
SET SESSION sql_mode = @old_mode;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
+--echo # table unusable".
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
+ ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 values (0,1), (1,2);
+--echo # The below ALTER should fail. It should leave the
+--echo # table in its original, non-corrupted, usable state.
+--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+ALTER TABLE t1 ADD UNIQUE KEY (b);
+--echo # The below statements should succeed, as ALTER should
+--echo # have left table intact.
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index 04c72127394..e8b73687177 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -1,6 +1,73 @@
--source include/have_partition.inc
--source include/have_innodb.inc
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal");
+--echo #
+--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
+--echo #
+SET @old_innodb_file_format_max = @@global.innodb_file_format_max;
+SET @old_innodb_file_format = @@global.innodb_file_format;
+SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
+SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
+SET @@global.innodb_file_format = Barracuda,
+@@global.innodb_file_per_table = ON,
+@@global.innodb_strict_mode = ON;
+
+--echo # Connection con1
+--connect(con1,localhost,root,,)
+
+CREATE TABLE t1 (id INT NOT NULL
+PRIMARY KEY,
+user_num CHAR(10)
+) ENGINE = InnoDB
+KEY_BLOCK_SIZE=4
+PARTITION BY HASH(id) PARTITIONS 1;
+
+--replace_result #p# #P#
+--list_files $MYSQLD_DATADIR/test
+SHOW CREATE TABLE t1;
+
+SET GLOBAL innodb_file_per_table = OFF;
+
+--disconnect con1
+--connect(con2,localhost,root,,)
+--echo # Connection con2
+
+LOCK TABLE t1 WRITE;
+
+--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
+--echo # are incompatible with innodb_file_per_table = OFF;
+
+--error ER_GET_ERRNO
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--replace_result #p# #P#
+--list_files $MYSQLD_DATADIR/test
+--echo # This SET is not needed to reproduce the bug,
+--echo # it is here just to make the test case more realistic
+SET innodb_strict_mode = OFF;
+
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--replace_result #p# #P#
+--list_files $MYSQLD_DATADIR/test
+
+# really bug#56172
+ALTER TABLE t1 REBUILD PARTITION p0;
+
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--disconnect con2
+--connection default
+--echo # Connection default
+SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
+SET @@global.innodb_file_format = @old_innodb_file_format;
+SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
+SET @@global.innodb_file_format_max = @old_innodb_file_format_max;
+
#
# Bug#32430 - show engine innodb status causes errors
#
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index 77dcd7add73..3b1dd93c4d1 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -1,5 +1,6 @@
--source include/have_plugin_auth.inc
--source include/not_embedded.inc
+--source include/mysql_upgrade_preparation.inc
query_vertical SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
@@ -16,6 +17,11 @@ connect(plug_con,localhost,plug,plug_dest);
--enable_query_log
GRANT PROXY ON plug_dest TO plug;
+--echo test proxies_priv columns
+--replace_column 1 xx 7 xx
+SELECT * FROM mysql.proxies_priv;
+--echo test mysql.proxies_priv;
+SHOW CREATE TABLE mysql.proxies_priv;
connect(plug_con,localhost,plug,plug_dest);
@@ -226,7 +232,7 @@ CREATE USER test_drop@localhost;
GRANT PROXY ON future_user TO test_drop@localhost;
SHOW GRANTS FOR test_drop@localhost;
DROP USER test_drop@localhost;
-SELECT * FROM mysql.proxy_priv WHERE Host = 'test_drop' AND User = 'localhost';
+SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost';
DROP USER proxy_admin;
@@ -330,3 +336,62 @@ GRANT PROXY ON standard_user TO ''@'';
DROP USER ''@'';
DROP USER standard_user;
DROP DATABASE shared;
+
+
+--echo #
+--echo # Bug #57551 : Live upgrade fails between 5.1.52 -> 5.5.7-rc
+--echo #
+
+CALL mtr.add_suppression("Missing system table mysql.proxies_priv.");
+
+DROP TABLE mysql.proxies_priv;
+
+--echo # Must come back with mysql.proxies_priv absent.
+--source include/restart_mysqld.inc
+
+--error ER_NO_SUCH_TABLE
+SELECT * FROM mysql.proxies_priv;
+
+CREATE USER u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+
+CREATE USER u2@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u2@localhost;
+
+--echo # access denied because of no privileges to root
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
+GRANT PROXY ON u2@localhost TO u1@localhost;
+
+--echo # access denied because of no privileges to root
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+
+--echo # go try graning proxy on itself, so that it will need the table
+connect(proxy_granter_con,localhost,u2,);
+connection proxy_granter_con;
+
+--error ER_NO_SUCH_TABLE
+GRANT PROXY ON u2@localhost TO u1@localhost;
+--error ER_NO_SUCH_TABLE
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+
+connection default;
+disconnect proxy_granter_con;
+
+--echo # test if REVOKE works without the proxies_priv table
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost, u2@localhost;
+
+--echo # test if DROP USER work without the proxies_priv table
+DROP USER u1@localhost,u2@localhost;
+
+--echo # test if FLUSH PRIVILEGES works without the proxies_priv table
+FLUSH PRIVILEGES;
+
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+--query_vertical SELECT Host,User,Proxied_host,Proxied_user,With_grant FROM mysql.proxies_priv
+
+FLUSH PRIVILEGES;
+
+--echo End of 5.5 tests
diff --git a/mysql-test/t/plugin_auth_qa-master.opt b/mysql-test/t/plugin_auth_qa-master.opt
new file mode 100644
index 00000000000..3536d102387
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa-master.opt
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD
diff --git a/mysql-test/t/plugin_auth_qa.test b/mysql-test/t/plugin_auth_qa.test
new file mode 100644
index 00000000000..0961c1dfef5
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa.test
@@ -0,0 +1,338 @@
+# The numbers represent test cases of the test plan.
+
+--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+CREATE DATABASE test_user_db;
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo ========== test 1.1 ======================================================
+# without '', without AS part
+CREATE USER plug IDENTIFIED WITH test_plugin_server;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# with '', without AS part
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# without '', AS part empty
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# with '', AS part empty without ''
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
+# without '', AS part without ''
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+--echo ========== test 1.1 syntax errors ========================================
+# without auth_name
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH AS plug_dest;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
+# without auth_name and AS part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
+# without auth_name but AS part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED AS '';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
+# with 2 auth_name parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug
+ IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+# with 2 AS parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
+# with 2 complete WITH parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ''
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+# with BY and WITH part
+--error ER_PARSE_ERROR
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'
+ IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
+ IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ plug_dest IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ plug_dest IDENTIFIED by 'plug_dest_pwd';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ IDENTIFIED by 'plug_dest_pwd';
+
+--echo ========== test 1.1 combinations ==========================
+# CREATE...WITH/CREATE...BY
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--echo ========== test 1.1.1.6/1.1.2.5 ============================
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+# GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+# CREATE...WITH/GRANT...BY
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error 1700
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error 1700
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+DROP USER plug;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+DROP USER plug;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
+DROP USER plug;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug,plug_dest;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug,plug_dest;
+#
+
+--echo ========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
+
+SET NAMES utf8;
+#
+CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg_dest;
+
+SET NAMES ascii;
+#
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+SET NAMES latin1;
+#
+--echo ========== test 1.1.1.5 ====================================
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plug';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+SET NAMES utf8;
+#
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg_dest;
+
+--echo ========== test 1.1.1.2/1.1.2.2=============================
+
+SET @auth_name= 'test_plugin_server';
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
+
+SET @auth_string= 'plug_dest';
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
+
+--echo ========== test 1.1.1.3/1.1.2.3=============================
+
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
+
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'hh''s_plug_dest';
+
+--echo ========== test 1.1.1.4 ====================================
+
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
+
+--echo ========== test 1.1.3.1 ====================================
+
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER grant_user,plug_dest;
+#
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest;
+DROP USER plug_dest;
+--error ER_PASSWORD_NO_MATCH
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+DROP USER grant_user;
+#
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER grant_user,plug_dest;
+set @@sql_mode= @save_sql_mode;
+#
+DROP DATABASE test_user_db;
+--exit
+
diff --git a/mysql-test/t/plugin_auth_qa_1-master.opt b/mysql-test/t/plugin_auth_qa_1-master.opt
new file mode 100644
index 00000000000..3536d102387
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_1-master.opt
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD
diff --git a/mysql-test/t/plugin_auth_qa_1.test b/mysql-test/t/plugin_auth_qa_1.test
new file mode 100644
index 00000000000..06908935b01
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_1.test
@@ -0,0 +1,340 @@
+# The numbers represent test cases of the test plan.
+
+--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+CREATE DATABASE test_user_db;
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE PROXY ON plug_dest FROM plug_user;
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+DROP USER plug_user,plug_dest;
+#
+# GRANT...WITH
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo 1)
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--echo 2)
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE PROXY ON plug_dest FROM plug_user;
+--echo 3)
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+DROP USER plug_user,plug_dest;
+#
+# GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--echo 1)
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+GRANT PROXY ON plug_dest TO plug_user;
+--echo 2)
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+#REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest'
+# IDENTIFIED BY 'plug_dest_passwd';
+DROP USER plug_user,plug_dest;
+
+--echo ========== test 1.2 ========================================
+
+# GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+RENAME USER plug_dest TO new_dest;
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON new_dest TO plug_user;
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_user,new_dest;
+
+# CREATE...WITH/CREATE...BY
+CREATE USER plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON plug_dest TO plug_user;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+RENAME USER plug_dest TO new_dest;
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON new_dest TO plug_user;
+--error 1
+--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_user,new_dest;
+# CREATE...WITH
+CREATE USER plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--echo connect(plug_user,localhost,plug_user,plug_dest);
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+RENAME USER plug_user TO new_user;
+--echo connect(plug_user,localhost,new_user,plug_dest);
+connect(plug_user,localhost,new_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo disconnect plug_user;
+disconnect plug_user;
+UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest,plug_user;
+--echo ========== test 1.3 ========================================
+
+#
+CREATE USER plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--echo connect(plug_user,localhost,plug_user,plug_dest);
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(plug_user,localhost,new_user,new_dest);
+--disable_query_log
+--error ER_PLUGIN_IS_NOT_LOADED
+connect(plug_user,localhost,new_user,new_dest);
+--enable_query_log
+UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
+UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
+FLUSH PRIVILEGES;
+GRANT PROXY ON new_dest TO new_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(plug_user,localhost,new_user,new_dest);
+connect(plug_user,localhost,new_user,new_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
+FLUSH PRIVILEGES;
+CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test.* TO new_user;
+--echo connect(plug_user,localhost,new_dest,new_dest_passwd);
+connect(plug_user,localhost,new_dest,new_dest_passwd);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+DROP USER new_user,new_dest,plug_dest;
+
+--echo ========== test 2, 2.1, 2.2 ================================
+
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo ========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+--disable_query_log
+--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
+connect(proxy_con,localhost,proxy_user,proxied_user);
+--enable_query_log
+GRANT PROXY ON proxied_user TO ''@'';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+--echo ========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@''
+ IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+--disable_query_log
+--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
+connect(proxy_con,localhost,proxy_user,proxied_user);
+--enable_query_log
+GRANT PROXY ON proxied_user TO ''@'';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+#
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
+CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
+CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
+CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
+CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
+GRANT PROXY ON proxied_user_1 TO ''@'';
+GRANT PROXY ON proxied_user_2 TO ''@'';
+GRANT PROXY ON proxied_user_3 TO ''@'';
+GRANT PROXY ON proxied_user_4 TO ''@'';
+GRANT PROXY ON proxied_user_5 TO ''@'';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+--echo connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+--echo connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+--echo connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+--echo connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+--echo connection proxy_con_1;
+connection proxy_con_1;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_2;
+connection proxy_con_2;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_3;
+connection proxy_con_3;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_4;
+connection proxy_con_4;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_5;
+connection proxy_con_5;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con_1;
+disconnect proxy_con_1;
+--echo disconnect proxy_con_2;
+disconnect proxy_con_2;
+--echo disconnect proxy_con_3;
+disconnect proxy_con_3;
+--echo disconnect proxy_con_4;
+disconnect proxy_con_4;
+--echo disconnect proxy_con_5;
+disconnect proxy_con_5;
+DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
+
+--echo ========== test 3 ==========================================
+
+GRANT ALL PRIVILEGES ON *.* TO plug_user
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+FLUSH PRIVILEGES;
+
+# Not working with the patch.
+
+#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
+#--exec $MYSQLADMIN $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_user --password=plug_dest ping 2>&1
+#--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT
+#--exec $MYSQL_CHECK $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test
+#--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT
+#--exec $MYSQL_DUMP -h localhost -P $MASTER_MYPORT $PLUGIN_AUTH_OPT -u plug_user --password=plug_dest test
+#--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT
+#--exec $MYSQL_SHOW $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth -u plug_user --password=plug_dest 2>&1
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+--exit
diff --git a/mysql-test/t/plugin_auth_qa_2-master.opt b/mysql-test/t/plugin_auth_qa_2-master.opt
new file mode 100644
index 00000000000..c29153ac95b
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_2-master.opt
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_INTERFACE
diff --git a/mysql-test/t/plugin_auth_qa_2.test b/mysql-test/t/plugin_auth_qa_2.test
new file mode 100644
index 00000000000..e265690dc7d
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_2.test
@@ -0,0 +1,153 @@
+# Horst Hunger
+# Created: 2010-10-06
+#
+# Test of the authentification interface. The plugin checks the expected values set
+# by this application and the application checks the values set the the plugin.
+--source include/have_plugin_interface.inc
+--source include/not_embedded.inc
+
+CREATE DATABASE test_user_db;
+
+--echo ========== test 1.1.3.2 ====================================
+--echo === check contens of components of info ====================
+
+CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
+CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+
+DROP USER qa_test_1_user;
+DROP USER qa_test_1_dest;
+
+--echo === Assign values to components of info ====================
+
+CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
+CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
+GRANT PROXY ON authenticated_as TO qa_test_2_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+
+DROP USER qa_test_2_user;
+DROP USER qa_test_2_dest;
+DROP USER authenticated_as;
+
+--echo === Assign too high values for *length, which should have no effect ====
+
+CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
+CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_3_user;
+DROP USER qa_test_3_dest;
+
+--echo === Assign too low values for *length, which should have no effect ====
+
+CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
+CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_4_user;
+DROP USER qa_test_4_dest;
+
+--echo === Assign empty string especially to authenticated_as (in plugin) ====
+
+CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
+CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
+GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
+GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
+
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_5_user;
+DROP USER qa_test_5_dest;
+DROP USER ''@'localhost';
+
+--echo === Assign 'root' especially to authenticated_as (in plugin) ====
+
+CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
+
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+REVOKE PROXY ON qa_test_6_dest FROM root;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_6_user;
+DROP USER qa_test_6_dest;
+DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+
+
+--echo === Test of the --default_auth option for clients ====
+
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
+CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
+
+--exit
diff --git a/mysql-test/t/plugin_auth_qa_3-master.opt b/mysql-test/t/plugin_auth_qa_3-master.opt
new file mode 100644
index 00000000000..5cc2af0a358
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_3-master.opt
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_SERVER
diff --git a/mysql-test/t/plugin_auth_qa_3.test b/mysql-test/t/plugin_auth_qa_3.test
new file mode 100644
index 00000000000..f7d90226332
--- /dev/null
+++ b/mysql-test/t/plugin_auth_qa_3.test
@@ -0,0 +1,25 @@
+# Horst Hunger
+# Created: 2010-10-06
+#
+# Test of the authentification interface. The plugin checks the expected values set
+# by this application and the application checks the values set the the plugin.
+--source include/have_plugin_server.inc
+--source include/not_embedded.inc
+
+CREATE DATABASE test_user_db;
+
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+
+--echo exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--exec $MYSQL $PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--echo exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+--error 1
+--exec $MYSQL $PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
+
+--exit
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index bf15648951b..eaef1cf3000 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3296,6 +3296,12 @@ SELECT @a;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
+###########################################################################
+
+--source t/wl4435_generated.inc
+
+###########################################################################
+
--echo
--echo # End of WL#4435.
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 87f36c452f2..3ed7213e8d7 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4147,3 +4147,22 @@ DROP VIEW view_t1;
DROP TABLE t1;
--echo # End of test BUG#54515
+
+--echo #
+--echo # Bug #57203 Assertion `field_length <= 255' failed.
+--echo #
+
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+UNION ALL
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+AS foo
+;
+
+CREATE table t1(a text);
+INSERT INTO t1 VALUES (''), ('');
+SELECT avg(distinct(t1.a)) FROM t1, t1 t2
+GROUP BY t2.a ORDER BY t1.a;
+
+DROP TABLE t1;
+
+--echo # End of test BUG#57203
diff --git a/mysql-test/t/shm.test b/mysql-test/t/shm.test
index 567caa4989a..0f880e58741 100644
--- a/mysql-test/t/shm.test
+++ b/mysql-test/t/shm.test
@@ -4,7 +4,7 @@
# Only run this test if shared memory is avaliable
let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1);
-if (`SELECT '$shm' != 'ON'`){
+if ($shm != ON){
skip No shm support;
}
let $shm_name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index fa9dc7472fe..fc3cfc76939 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -1328,3 +1328,30 @@ disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # Bug#57306 SHOW PROCESSLIST does not display string literals well.
+--echo #
+
+SET NAMES latin1;
+SELECT GET_LOCK('t', 1000);
+--connect (con1,localhost,root,,)
+--connection con1
+SET NAMES latin1;
+--send SELECT GET_LOCK('t',1000) AS 'óóóó';
+--connection default
+# Make sure con1 has switched from "SET NAMES" to "SELECT GET_LOCK"
+let $wait_timeout= 10;
+let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%GET_LOCK%' AND ID != CONNECTION_ID();
+--source include/wait_condition.inc
+--replace_column 1 ### 3 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+SET NAMES utf8;
+--replace_column 1 ### 3 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+SELECT RELEASE_LOCK('t');
+--connection con1
+--reap
+--disconnect con1
+--connection default
+SET NAMES latin1;
+
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
index 8aa0791e265..fe52632c784 100644
--- a/mysql-test/t/sp-bugs.test
+++ b/mysql-test/t/sp-bugs.test
@@ -101,4 +101,41 @@ CALL p1 ();
DROP TABLE t1;
DROP PROCEDURE p1;
+--echo #
+--echo # Bug#54375: Error in stored procedure leaves connection
+--echo # in different default schema
+--echo #
+
+--disable_warnings
+SET @@SQL_MODE = 'STRICT_ALL_TABLES';
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+USE db1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+DELIMITER $$;
+CREATE FUNCTION f1 (
+ some_value int
+)
+RETURNS smallint
+DETERMINISTIC
+BEGIN
+ INSERT INTO t1 SET c1 = some_value;
+ RETURN(LAST_INSERT_ID());
+END$$
+DELIMITER ;$$
+DROP DATABASE IF EXISTS db2;
+CREATE DATABASE db2;
+--enable_warnings
+USE db2;
+SELECT DATABASE();
+--error ER_DUP_ENTRY
+SELECT db1.f1(1);
+SELECT DATABASE();
+USE test;
+DROP FUNCTION db1.f1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
+DROP DATABASE db2;
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index a5c287e44a8..b4aa9ea1959 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -252,3 +252,30 @@ drop table mysql.proc;
--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
+
+
+--echo #
+--echo # Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS proc_backup;
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+--echo # Backup the proc table
+RENAME TABLE mysql.proc TO proc_backup;
+CREATE TABLE mysql.proc LIKE proc_backup;
+
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SET @foo = 10;
+
+--echo # Modify a field of the table.
+ALTER TABLE mysql.proc MODIFY comment CHAR (32);
+
+# This should not fail even if mysql.proc is invalid.
+DROP DATABASE db1;
+
+--echo # Restore mysql.proc
+DROP TABLE mysql.proc;
+RENAME TABLE proc_backup TO mysql.proc;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 13ca55a0127..6175fc53adf 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2719,10 +2719,6 @@ DROP PROCEDURE p1;
--echo # Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
--echo #
---echo
---echo # - Case 1
---echo
-
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
@@ -2747,36 +2743,6 @@ SELECT * FROM t1;
DROP TRIGGER t1_bu;
DROP TABLE t1;
---echo
---echo # - Case 2
---echo
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(b CHAR(1));
-
-delimiter |;
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- INSERT INTO t2 VALUES('ab'); # Produces a warning.
-
- INSERT INTO t2 VALUES('b'); # Does not produce a warning,
- # previous warning should be cleared.
-END|
-
-delimiter ;|
-
-INSERT INTO t1 VALUES(0);
-
-SHOW WARNINGS;
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-DROP TABLE t2;
-
--echo #
--echo # Bug#9857: Stored procedures: handler for sqlwarning ignored
--echo #
@@ -2813,3 +2779,83 @@ SHOW WARNINGS;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode = @sql_mode_saved;
+
+--echo #
+--echo # Bug#55850: Trigger warnings not cleared.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
+ d SMALLINT, e SMALLINT, f SMALLINT);
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+ INSERT INTO t2(a, b, c) VALUES(99999, 99999, 99999);
+
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+ INSERT INTO t2(d, e, f) VALUES(99999, 99999, 99999);
+
+CREATE PROCEDURE p1()
+ INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+# What happened before the patch was:
+# - INSERT INTO t1 added 3 warnings about overflow in 'x', 'y' and 'z' columns;
+# - t1_bi run and added 3 warnings about overflow in 'a', 'b' and 'c' columns;
+# - t1_ai run and added 3 warnings about overflow in 'd', 'e' and 'f' columns;
+# => we had 9 warnings.
+#
+# Now what happens is:
+# - INSERT INTO t1 adds 3 warnings about overflow in 'x', 'y' and 'z' columns;
+# - t1_bi adds 3 warnings about overflow in 'a', 'b' and 'c' columns;
+# - The warnings added by triggers are cleared;
+# - t1_ai run and added 3 warnings about overflow in 'd', 'e' and 'f' columns;
+# - The warnings added by triggers are cleared;
+# => we have 3 warnings.
+
+--echo
+CALL p1();
+
+--echo
+SHOW WARNINGS;
+
+--echo
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+
+--echo # ----------------------------------------------------------------------
+
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT NOT NULL);
+
+delimiter |;
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ INSERT INTO t2 VALUES(
+ CAST('111111 ' AS SIGNED),
+ CAST('222222 ' AS SIGNED),
+ NULL);
+END|
+
+delimiter ;|
+
+CREATE PROCEDURE p1()
+ INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+--echo
+--error ER_BAD_NULL_ERROR
+CALL p1();
+
+--echo
+SHOW WARNINGS;
+
+--echo
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test
index be8369d6994..6284169eb9b 100644
--- a/mysql-test/t/sp-lock.test
+++ b/mysql-test/t/sp-lock.test
@@ -972,5 +972,170 @@ DROP PROCEDURE p1;
--echo #
+--echo # Bug#57663 Concurrent statement using stored function and DROP DATABASE
+--echo # breaks SBR
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+connect(con1, localhost, root);
+connect(con2, localhost, root);
+
+--echo # Test 1: Check that DROP DATABASE block if a function is used
+--echo # by an active transaction.
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+SELECT db1.f1();
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection default
+connection default;
+--echo # Waiting for DROP DATABASE to be blocked by the lock on f1()
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+ WHERE state= 'Waiting for stored function metadata lock'
+ AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Test 2: Check that DROP DATABASE blocks if a procedure is
+--echo # used by an active transaction.
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() BEGIN END;
+delimiter |;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+ CALL db1.p1();
+ RETURN 1;
+END|
+delimiter ;|
+START TRANSACTION;
+SELECT f1();
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection default
+connection default;
+--echo # Waiting for DROP DATABASE to be blocked by the lock on p1()
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+ WHERE state= 'Waiting for stored procedure metadata lock'
+ AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Test 3: Check that DROP DATABASE is not selected as a victim if a
+--echo # deadlock is discovered with DML statements.
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+# DROP DATABASE will lock tables (t1) before functions (f1)
+SELECT db1.f1();
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection default
+connection default;
+--echo # Waiting for DROP DATABASE to be blocked by the lock on f1()
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+ WHERE state= 'Waiting for stored function metadata lock'
+ AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+--error ER_LOCK_DEADLOCK
+SELECT * FROM db1.t1;
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Test 4: Check that active DROP DATABASE blocks stored routine DDL.
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
+START TRANSACTION;
+SELECT db1.f2();
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+--echo # Waiting for DROP DATABASE to be blocked by the lock on f2()
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+ WHERE state= 'Waiting for stored function metadata lock'
+ AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+--echo # Sending:
+--send ALTER FUNCTION db1.f1 COMMENT "test"
+
+--echo # Connection default
+connection default;
+--echo # Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+ WHERE state= 'Waiting for schema metadata lock'
+ AND info='ALTER FUNCTION db1.f1 COMMENT "test"';
+--source include/wait_condition.inc
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP DATABASE db1
+--reap
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: ALTER FUNCTION f1 COMMENT 'test'
+--error ER_SP_DOES_NOT_EXIST
+--reap
+disconnect con2;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP FUNCTION f1;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index 96f82c92248..d7ea829bf50 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -82,7 +82,7 @@ select * from db1_secret.t1;
# ...and not this
--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error ER_SP_DOES_NOT_EXIST
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure db1_secret.dummy;
--error ER_PROCACCESS_DENIED_ERROR
drop procedure db1_secret.stamp;
@@ -106,7 +106,7 @@ select * from db1_secret.t1;
# ...and not this
--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error ER_SP_DOES_NOT_EXIST
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure db1_secret.dummy;
--error ER_PROCACCESS_DENIED_ERROR
drop procedure db1_secret.stamp;
@@ -926,6 +926,39 @@ DROP DATABASE B48872;
--echo End of 5.0 tests.
+
+--echo #
+--echo # Test for bug#57061 "User without privilege on routine can discover
+--echo # its existence."
+--echo #
+--disable_warnings
+drop database if exists mysqltest_db;
+--enable_warnings
+create database mysqltest_db;
+--echo # Create user with no privileges on mysqltest_db database.
+create user bug57061_user@localhost;
+create function mysqltest_db.f1() returns int return 0;
+create procedure mysqltest_db.p1() begin end;
+--echo # Connect as user 'bug57061_user@localhost'
+connect (conn1, localhost, bug57061_user,,);
+--echo # Attempt to drop routine on which user doesn't have privileges
+--echo # should result in the same 'access denied' type of error whether
+--echo # routine exists or not.
+--error ER_PROCACCESS_DENIED_ERROR
+drop function if exists mysqltest_db.f_does_not_exist;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure if exists mysqltest_db.p_does_not_exist;
+--error ER_PROCACCESS_DENIED_ERROR
+drop function if exists mysqltest_db.f1;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure if exists mysqltest_db.p1;
+--echo # Connection 'default'.
+connection default;
+disconnect conn1;
+drop user bug57061_user@localhost;
+drop database mysqltest_db;
+
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 2e442e7f897..d4a995ee181 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3946,3 +3946,21 @@ DROP TABLE t1,t2;
--enable_result_log
--echo End of 5.1 tests
+
+--echo #
+--echo # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
+--echo # Assertion `file' failed.
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--error ER_OPERAND_COLUMNS
+SELECT 1 FROM
+ (SELECT ROW(
+ (SELECT 1 FROM t1 RIGHT JOIN
+ (SELECT 1 FROM t1, t1 t2) AS d ON 1),
+ 1) FROM t1) AS e;
+
+DROP TABLE t1;
+
+
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
index d069271a02e..7a96f22e0d1 100644
--- a/mysql-test/t/system_mysql_db_fix40123.test
+++ b/mysql-test/t/system_mysql_db_fix40123.test
@@ -3,7 +3,7 @@
# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
# to the location of mysql_fix_privilege_tables.sql
-if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
+if (!$MYSQL_FIX_PRIVILEGE_TABLES)
{
skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
}
@@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL,
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
-- enable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
index 53166919f1c..8adf0a09b22 100644
--- a/mysql-test/t/system_mysql_db_fix50030.test
+++ b/mysql-test/t/system_mysql_db_fix50030.test
@@ -3,7 +3,7 @@
# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
# to the location of mysql_fix_privilege_tables.sql
-if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
+if (!$MYSQL_FIX_PRIVILEGE_TABLES)
{
skip Test needs MYSQL_FIX_PRIVILEGE_TABLES;
}
@@ -78,7 +78,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
-- enable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
index 872829ae79d..9aeb654716c 100644
--- a/mysql-test/t/system_mysql_db_fix50117.test
+++ b/mysql-test/t/system_mysql_db_fix50117.test
@@ -3,7 +3,7 @@
# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
# to the location of mysql_fix_privilege_tables.sql
-if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
+if (!$MYSQL_FIX_PRIVILEGE_TABLES)
{
skip Test needs MYSQL_FIX_PRIVILEGE_TABLES;
}
@@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL,
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
-- enable_query_log
diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test
index 89857063ebd..536b00308ab 100644
--- a/mysql-test/t/trigger_notembedded.test
+++ b/mysql-test/t/trigger_notembedded.test
@@ -896,7 +896,7 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global metadata lock";
+ where state = "Waiting for global read lock";
--source include/wait_condition.inc
create trigger t1_bi before insert on t1 for each row begin end;
unlock tables;
diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test
index c9c4bd90ca4..135935b53b3 100644
--- a/mysql-test/t/truncate_coverage.test
+++ b/mysql-test/t/truncate_coverage.test
@@ -172,3 +172,57 @@ UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
+--echo #
+--echo # Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE
+--echo #
+
+--echo # Note that this test case only reproduces the problem
+--echo # when it is run with valgrind.
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, m1;
+--enable_warnings
+
+CREATE TABLE t1(a INT) engine=memory;
+CREATE TABLE m1(a INT) engine=merge UNION(t1);
+connect(con2, localhost, root);
+
+--echo # Connection con1
+connect(con1, localhost, root);
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
+--echo # Sending:
+--send TRUNCATE TABLE m1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+--echo # Sending:
+--send FLUSH TABLES
+
+--echo # Connection default
+connection default;
+--echo # Waiting for FLUSH TABLES to be blocked.
+let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: TRUNCATE TABLE m1
+--error ER_WRONG_MRG_TABLE
+--reap
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: FLUSH TABLES
+--reap
+disconnect con2;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE m1, t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index c06d8ac97e0..fa67afa48e8 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -617,4 +617,17 @@ SELECT LENGTH(c) FROM t2;
DROP TABLE t1, t2;
+--echo # Bug #52160: crash and inconsistent results when grouping
+--echo # by a function and column
+
+CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
+
+CREATE TABLE t1(a CHAR(1));
+INSERT INTO t1 VALUES ('0'), ('0');
+
+SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
+
+DROP FUNCTION f1;
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 11f2b68804a..6dec86dacab 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -284,4 +284,12 @@ DROP TABLE t1;
--echo #
+--echo #
+--echo # Bug#57278: Crash on min/max + with date out of range.
+--echo #
+set @a=(select min(makedate('111','1'))) ;
+select @a;
+--echo #
+
+
--echo End of 6.0 tests
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 93dc4cad50c..596fc5f41ef 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1062,7 +1062,7 @@ SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1;
SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1;
DROP TABLE t1;
-
+remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*;
--echo #
--echo # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 06508c43766..b1a54495330 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -344,6 +344,13 @@ FROM t1 GROUP BY a LIMIT 1;
DROP TABLE t1;
+#
+# BUG#56138 "valgrind errors about overlapping memory when
+# double-assigning same variable"
+#
+
+select @v:=@v:=sum(1) from dual;
+
--echo End of 5.1 tests
#
diff --git a/mysql-test/t/variables-big.test b/mysql-test/t/variables-big.test
index fdb11ffa907..6c357bb6e54 100644
--- a/mysql-test/t/variables-big.test
+++ b/mysql-test/t/variables-big.test
@@ -37,19 +37,19 @@
--disable_warnings
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
--enable_warnings
diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test
index 6947e346675..eb86cf17ebb 100644
--- a/mysql-test/t/wait_timeout.test
+++ b/mysql-test/t/wait_timeout.test
@@ -53,7 +53,7 @@ while (!`select @aborted_clients`)
dec $retries;
if (!$retries)
{
- Failed to detect that client has been aborted;
+ die Failed to detect that client has been aborted;
}
}
--enable_query_log
@@ -108,7 +108,7 @@ while (!`select @aborted_clients`)
dec $retries;
if (!$retries)
{
- Failed to detect that client has been aborted;
+ die Failed to detect that client has been aborted;
}
}
--enable_query_log
diff --git a/mysql-test/t/wl4435_generated.inc b/mysql-test/t/wl4435_generated.inc
new file mode 100644
index 00000000000..5ea05a89402
--- /dev/null
+++ b/mysql-test/t/wl4435_generated.inc
@@ -0,0 +1,588 @@
+
+###########################################################################
+
+--echo
+--echo TINYINT
+--echo
+
+CREATE PROCEDURE p1(OUT v TINYINT)
+ SET v = 127;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 127;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo SMALLINT
+--echo
+
+CREATE PROCEDURE p1(OUT v SMALLINT)
+ SET v = 32767;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 32767;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo MEDIUMINT
+--echo
+
+CREATE PROCEDURE p1(OUT v MEDIUMINT)
+ SET v = 8388607;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 8388607;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo INT
+--echo
+
+CREATE PROCEDURE p1(OUT v INT)
+ SET v = 2147483647;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 2147483647;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo BIGINT
+--echo
+
+CREATE PROCEDURE p1(OUT v BIGINT)
+ SET v = 9223372036854775807;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 9223372036854775807;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo BIT(11)
+--echo
+
+CREATE PROCEDURE p1(OUT v BIT(11))
+ SET v = b'10100100101';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = b'10100100101';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo TIMESTAMP
+--echo
+
+CREATE PROCEDURE p1(OUT v TIMESTAMP)
+ SET v = '2007-11-18 15:01:02';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = '2007-11-18 15:01:02';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo DATETIME
+--echo
+
+CREATE PROCEDURE p1(OUT v DATETIME)
+ SET v = '1234-11-12 12:34:59';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = '1234-11-12 12:34:59';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo TIME
+--echo
+
+CREATE PROCEDURE p1(OUT v TIME)
+ SET v = '123:45:01';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = '123:45:01';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo DATE
+--echo
+
+CREATE PROCEDURE p1(OUT v DATE)
+ SET v = '1234-11-12';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = '1234-11-12';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo YEAR
+--echo
+
+CREATE PROCEDURE p1(OUT v YEAR)
+ SET v = 2010;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 2010;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo FLOAT(7, 4)
+--echo
+
+CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
+ SET v = 123.4567;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a - 123.4567 < 0.00001;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo DOUBLE(8, 5)
+--echo
+
+CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
+ SET v = 123.45678;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a - 123.45678 < 0.000001;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo DECIMAL(9, 6)
+--echo
+
+CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
+ SET v = 123.456789;
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 123.456789;
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo CHAR(32)
+--echo
+
+CREATE PROCEDURE p1(OUT v CHAR(32))
+ SET v = REPEAT('a', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('a', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo VARCHAR(32)
+--echo
+
+CREATE PROCEDURE p1(OUT v VARCHAR(32))
+ SET v = REPEAT('b', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('b', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo TINYTEXT
+--echo
+
+CREATE PROCEDURE p1(OUT v TINYTEXT)
+ SET v = REPEAT('c', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('c', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo TEXT
+--echo
+
+CREATE PROCEDURE p1(OUT v TEXT)
+ SET v = REPEAT('d', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('d', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo MEDIUMTEXT
+--echo
+
+CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
+ SET v = REPEAT('e', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('e', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo LONGTEXT
+--echo
+
+CREATE PROCEDURE p1(OUT v LONGTEXT)
+ SET v = REPEAT('f', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('f', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo BINARY(32)
+--echo
+
+CREATE PROCEDURE p1(OUT v BINARY(32))
+ SET v = REPEAT('g', 32);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('g', 32);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo VARBINARY(32)
+--echo
+
+CREATE PROCEDURE p1(OUT v VARBINARY(32))
+ SET v = REPEAT('h', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('h', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo TINYBLOB
+--echo
+
+CREATE PROCEDURE p1(OUT v TINYBLOB)
+ SET v = REPEAT('i', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('i', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo BLOB
+--echo
+
+CREATE PROCEDURE p1(OUT v BLOB)
+ SET v = REPEAT('j', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('j', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo MEDIUMBLOB
+--echo
+
+CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
+ SET v = REPEAT('k', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('k', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo LONGBLOB
+--echo
+
+CREATE PROCEDURE p1(OUT v LONGBLOB)
+ SET v = REPEAT('l', 16);
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = REPEAT('l', 16);
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo SET('aaa', 'bbb')
+--echo
+
+CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
+ SET v = 'aaa';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 'aaa';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+###########################################################################
+
+--echo
+--echo ENUM('aaa', 'bbb')
+--echo
+
+CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
+ SET v = 'aaa';
+
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+
+SHOW CREATE TABLE tmp1;
+
+SELECT @a, @a = 'aaa';
+
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index 6e7d38cdfca..1dc5eadbccc 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -617,4 +617,43 @@ FROM t1 ORDER BY t1.id;
DROP TABLE t1;
+
+--echo #
+--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+--echo #
+SET NAMES utf8;
+SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds','');
+
+
+--echo #
+--echo # Bug #57820 extractvalue crashes
+--echo #
+SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k')));
+
+
+--echo #
+--echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
+--echo #
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
+
+
--echo End of 5.1 tests
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#58175 xml functions read initialized bytes when conversions happen
+--echo #
+SET NAMES latin1;
+SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
deleted file mode 100644
index 357fa321da6..00000000000
--- a/mysys/Makefile.am
+++ /dev/null
@@ -1,158 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB, 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
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-INCLUDES = @ZLIB_INCLUDES@ @RDTSC_SPARC_ASSEMBLY@ \
- -I$(top_builddir)/include \
- -I$(top_srcdir)/include -I$(srcdir)
-pkglib_LIBRARIES = libmysys.a
-LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a
-noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h
-libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
- mf_path.c mf_loadpath.c my_file.c \
- my_open.c my_create.c my_seek.c my_read.c \
- my_pread.c my_write.c my_getpagesize.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_once.c mulalloc.c \
- my_alloc.c my_new.cc 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 \
- mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
- my_symlink.c my_symlink2.c \
- mf_pack.c mf_unixpath.c mf_arr_appstr.c \
- mf_wcomp.c my_gethwaddr.c \
- mf_qsort.c mf_qsort2.c mf_sort.c \
- ptr_cmp.c mf_radix.c queues.c my_getncpus.c \
- tree.c list.c hash.c array.c string.c typelib.c \
- my_copy.c my_lib.c \
- my_delete.c my_rename.c my_redel.c \
- my_chsize.c my_quick.c my_lockmem.c my_static.c \
- my_sync.c my_getopt.c my_mkdir.c \
- default.c my_compress.c checksum.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_largepage.c \
- my_memmem.c stacktrace.c \
- my_windac.c my_access.c base64.c my_libwrap.c \
- my_rdtsc.c
-
-if NEED_THREAD
-# mf_keycache is used only in the server, so it is safe to leave the file
-# out of the non-threaded library.
-# In fact, it will currently not compile without thread support.
-libmysys_a_SOURCES += mf_keycache.c
-endif
-
-EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
- thr_mutex.c thr_rwlock.c \
- CMakeLists.txt mf_soundex.c \
- my_conio.c my_wincond.c my_winthread.c my_winerr.c \
- my_winfile.c \
- my_timer_cycles.il
-libmysys_a_LIBADD = @THREAD_LOBJECTS@
-# test_dir_DEPENDENCIES= $(LIBRARIES)
-# testhash_DEPENDENCIES= $(LIBRARIES)
-# test_charset_DEPENDENCIES= $(LIBRARIES)
-# charset2html_DEPENDENCIES= $(LIBRARIES)
-DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
- -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
- -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
- -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
- -DDEFAULT_HOME_ENV=MYSQL_HOME \
- -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
- -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
- @DEFS@
-
-libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
-
-# I hope this always does the right thing. Otherwise this is only test programs
-FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
-
-#
-# The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc)
-# which automaticly removes the object files you use to compile a final program
-#
-
-test_bitmap$(EXEEXT): my_bitmap.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN ./my_bitmap.c $(LDADD) $(LIBS)
-
-test_priority_queue$(EXEEXT): queues.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN ./queues.c $(LDADD) $(LIBS)
-
-test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
- $(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
- $(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS)
- $(RM) -f ./test_thr_alarm.c
-
-test_thr_lock$(EXEEXT): thr_lock.c $(LIBRARIES)
- $(CP) $(srcdir)/thr_lock.c test_thr_lock.c
- $(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS)
- $(RM) -f ./test_thr_lock.c
-
-test_vsnprintf$(EXEEXT): my_vsnprintf.c $(LIBRARIES)
- $(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
- $(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
- $(RM) -f test_vsnprintf.c
-
-test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
- $(CP) $(srcdir)/mf_iocache.c test_io_cache.c
- $(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS)
- $(RM) -f test_io_cache.c
-
-test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
-
-test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
-
-testhash$(EXEEXT): testhash.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
-
-test_gethwaddr$(EXEEXT): my_gethwaddr.c $(LIBRARIES)
- $(CP) $(srcdir)/my_gethwaddr.c ./test_gethwaddr.c
- $(LINK) $(FLAGS) -DMAIN ./test_gethwaddr.c $(LDADD) $(LIBS)
- $(RM) -f ./test_gethwaddr.c
-
-test_base64$(EXEEXT): base64.c $(LIBRARIES)
- $(CP) $(srcdir)/base64.c ./test_base64.c
- $(LINK) $(FLAGS) -DMAIN ./test_base64.c $(LDADD) $(LIBS)
- $(RM) -f ./test_base64.c
-
-if HAVE_DTRACE_DASH_G
-libmysys_a_LIBADD += probes_mysql.o
-libmysys_a_DEPENDENCIES += probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = mf_keycache.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/mysys/default.c b/mysys/default.c
index 0e0883e1fcf..75eb4709e1e 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -66,7 +66,12 @@
const char *args_separator= "----args-separator----";
const char *my_defaults_file=0;
const char *my_defaults_group_suffix=0;
-char *my_defaults_extra_file=0;
+const char *my_defaults_extra_file=0;
+
+static char my_defaults_file_buffer[FN_REFLEN];
+static char my_defaults_extra_file_buffer[FN_REFLEN];
+
+static my_bool defaults_already_read= FALSE;
/* Which directories are searched for options (and in which order) */
@@ -140,6 +145,33 @@ static char *remove_end_comment(char *ptr);
/*
+ Expand a file name so that the current working directory is added if
+ the name is relative.
+
+ RETURNS
+ 0 All OK
+ 2 Out of memory or path to long
+ 3 Not able to get working directory
+ */
+
+static int
+fn_expand(const char *filename, char *result_buf)
+{
+ char dir[FN_REFLEN];
+ const int flags= MY_UNPACK_FILENAME | MY_SAFE_PATH | MY_RELATIVE_PATH;
+ DBUG_ENTER("fn_expand");
+ DBUG_PRINT("enter", ("filename: %s, result_buf: 0x%lx",
+ filename, (unsigned long) result_buf));
+ if (my_getwd(dir, sizeof(dir), MYF(0)))
+ DBUG_RETURN(3);
+ DBUG_PRINT("debug", ("dir: %s", dir));
+ if (fn_format(result_buf, filename, dir, NULL, flags) == NULL)
+ DBUG_RETURN(2);
+ DBUG_PRINT("return", ("result: %s", result_buf));
+ DBUG_RETURN(0);
+}
+
+/*
Process config files in default directories.
SYNOPSIS
@@ -167,6 +199,7 @@ static char *remove_end_comment(char *ptr);
0 ok
1 given cinf_file doesn't exist
2 out of memory
+ 3 Can't get current working directory
The global variable 'my_defaults_group_suffix' is updated with value for
--defaults_group_suffix
@@ -189,11 +222,23 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
if (! my_defaults_group_suffix)
my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
- if (forced_extra_defaults)
- my_defaults_extra_file= (char *) forced_extra_defaults;
-
- if (forced_default_file)
- my_defaults_file= forced_default_file;
+ if (forced_extra_defaults && !defaults_already_read)
+ {
+ int error= fn_expand(forced_extra_defaults, my_defaults_extra_file_buffer);
+ if (error)
+ DBUG_RETURN(error);
+ my_defaults_extra_file= my_defaults_extra_file_buffer;
+ }
+
+ if (forced_default_file && !defaults_already_read)
+ {
+ int error= fn_expand(forced_default_file, my_defaults_file_buffer);
+ if (error)
+ DBUG_RETURN(error);
+ my_defaults_file= my_defaults_file_buffer;
+ }
+
+ defaults_already_read= TRUE;
/*
We can only handle 'defaults-group-suffix' if we are called from
@@ -236,15 +281,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
group->type_names[group->count]= 0;
}
- if (forced_default_file)
+ if (my_defaults_file)
{
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
- forced_default_file, 0)) < 0)
+ my_defaults_file, 0)) < 0)
goto err;
if (error > 0)
{
fprintf(stderr, "Could not open required defaults file: %s\n",
- forced_default_file);
+ my_defaults_file);
goto err;
}
}
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 173b678cdd1..575581712d4 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -173,7 +173,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
if (file >= 0)
{
- pos= my_tell(file, MYF(0));
+ pos= mysql_file_tell(file, MYF(0));
if ((pos == (my_off_t) -1) && (my_errno == ESPIPE))
{
/*
@@ -205,7 +205,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
if (!(cache_myflags & MY_DONT_CHECK_FILESIZE))
{
/* Calculate end of file to avoid allocating oversized buffers */
- end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0));
+ end_of_file= mysql_file_seek(file, 0L, MY_SEEK_END, MYF(0));
/* Need to reset seek_not_done now that we just did a seek. */
info->seek_not_done= end_of_file == seek_offset ? 0 : 1;
if (end_of_file < seek_offset)
@@ -485,7 +485,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
*/
if (info->seek_not_done)
{
- if ((my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
+ if ((mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0))
!= MY_FILEPOS_ERROR))
{
/* No error, reset seek_not_done flag. */
@@ -529,7 +529,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
end aligned with a block.
*/
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
- if ((read_length= my_read(info->file,Buffer, length, info->myflags))
+ if ((read_length= mysql_file_read(info->file,Buffer, length, info->myflags))
!= length)
{
/*
@@ -572,7 +572,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
}
length=0; /* Didn't read any chars */
}
- else if ((length= my_read(info->file,info->buffer, max_length,
+ else if ((length= mysql_file_read(info->file,info->buffer, max_length,
info->myflags)) < Count ||
length == (size_t) -1)
{
@@ -1056,7 +1056,7 @@ int _my_b_read_r(register IO_CACHE *cache, uchar *Buffer, size_t Count)
*/
if (cache->seek_not_done)
{
- if (my_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0))
+ if (mysql_file_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0))
== MY_FILEPOS_ERROR)
{
cache->error= -1;
@@ -1064,7 +1064,7 @@ int _my_b_read_r(register IO_CACHE *cache, uchar *Buffer, size_t Count)
DBUG_RETURN(1);
}
}
- len= my_read(cache->file, cache->buffer, length, cache->myflags);
+ len= mysql_file_read(cache->file, cache->buffer, length, cache->myflags);
}
DBUG_PRINT("io_cache_share", ("read %lu bytes", (ulong) len));
@@ -1203,7 +1203,7 @@ int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
With read-append cache we must always do a seek before we read,
because the write could have moved the file pointer astray
*/
- if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR)
+ if (mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1220,8 +1220,8 @@ int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
size_t read_length;
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
- if ((read_length= my_read(info->file,Buffer, length,
- info->myflags)) == (size_t) -1)
+ if ((read_length= mysql_file_read(info->file,Buffer, length,
+ info->myflags)) == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1254,7 +1254,7 @@ int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
}
else
{
- length= my_read(info->file,info->buffer, max_length, info->myflags);
+ length= mysql_file_read(info->file,info->buffer, max_length, info->myflags);
if (length == (size_t) -1)
{
info->error= -1;
@@ -1431,7 +1431,7 @@ int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
return 1;
}
- if (my_seek(info->file,next_pos_in_file,MY_SEEK_SET,MYF(0))
+ if (mysql_file_seek(info->file, next_pos_in_file, MY_SEEK_SET, MYF(0))
== MY_FILEPOS_ERROR)
{
info->error= -1;
@@ -1441,8 +1441,8 @@ int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1));
if (Count < read_length)
{ /* Small block, read to cache */
- if ((read_length=my_read(info->file,info->request_pos,
- read_length, info->myflags)) == (size_t) -1)
+ if ((read_length=mysql_file_read(info->file,info->request_pos,
+ read_length, info->myflags)) == (size_t) -1)
return info->error= -1;
use_length=min(Count,read_length);
memcpy(Buffer,info->request_pos,(size_t) use_length);
@@ -1462,7 +1462,7 @@ int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
}
else
{ /* Big block, don't cache it */
- if ((read_length= my_read(info->file,Buffer, Count,info->myflags))
+ if ((read_length= mysql_file_read(info->file, Buffer, Count,info->myflags))
!= Count)
{
info->error= read_length == (size_t) -1 ? -1 : read_length+left_length;
@@ -1569,14 +1569,14 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
"seek_not_done" to indicate this to other functions operating
on the IO_CACHE.
*/
- if (my_seek(info->file,info->pos_in_file,MY_SEEK_SET,MYF(0)))
+ if (mysql_file_seek(info->file, info->pos_in_file, MY_SEEK_SET, MYF(0)))
{
info->error= -1;
return (1);
}
info->seek_not_done=0;
}
- if (my_write(info->file, Buffer, length, info->myflags | MY_NABP))
+ if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP))
return info->error= -1;
#ifdef THREAD
@@ -1639,7 +1639,7 @@ int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count)
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
length=Count & (size_t) ~(IO_SIZE-1);
- if (my_write(info->file,Buffer, length, info->myflags | MY_NABP))
+ if (mysql_file_write(info->file,Buffer, length, info->myflags | MY_NABP))
{
unlock_append_buffer(info);
return info->error= -1;
@@ -1695,11 +1695,11 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
{
/* Of no overlap, write everything without buffering */
if (pos + Count <= info->pos_in_file)
- return my_pwrite(info->file, Buffer, Count, pos,
- info->myflags | MY_NABP);
+ return mysql_file_pwrite(info->file, Buffer, Count, pos,
+ info->myflags | MY_NABP);
/* Write the part of the block that is before buffer */
length= (uint) (info->pos_in_file - pos);
- if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
+ if (mysql_file_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
info->error= error= -1;
Buffer+=length;
pos+= length;
@@ -1789,7 +1789,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
*/
if (!append_cache && info->seek_not_done)
{ /* File touched, do seek */
- if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
+ if (mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0)) ==
MY_FILEPOS_ERROR)
{
UNLOCK_APPEND_BUFFER;
@@ -1803,7 +1803,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
info->write_end= (info->write_buffer+info->buffer_length-
((pos_in_file+length) & (IO_SIZE-1)));
- if (my_write(info->file,info->write_buffer,length,
+ if (mysql_file_write(info->file,info->write_buffer,length,
info->myflags | MY_NABP))
info->error= -1;
else
@@ -1815,7 +1815,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
else
{
info->end_of_file+=(info->write_pos-info->append_read_pos);
- DBUG_ASSERT(info->end_of_file == my_tell(info->file,MYF(0)));
+ DBUG_ASSERT(info->end_of_file == mysql_file_tell(info->file, MYF(0)));
}
info->append_read_pos=info->write_pos=info->write_buffer;
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index fc62d3d8a8e..9993c636fb1 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -3963,11 +3963,11 @@ restart:
if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
BLOCK_REASSIGNED)))
{
- struct st_hash_link *next_hash_link;
- my_off_t next_diskpos;
- File next_file;
- uint next_status;
- uint hash_requests;
+ struct st_hash_link *UNINIT_VAR(next_hash_link);
+ my_off_t UNINIT_VAR(next_diskpos);
+ File UNINIT_VAR(next_file);
+ uint UNINIT_VAR(next_status);
+ uint UNINIT_VAR(hash_requests);
total_found++;
found++;
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index 4b7e9054d61..8a9c721c2fb 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -92,8 +92,10 @@ extern mysql_mutex_t LOCK_gethostbyname_r;
*/
struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
+ struct hostent *res __attribute__((unused)),
+ char *buffer __attribute__((unused)),
+ int buflen __attribute__((unused)),
+ int *h_errnop)
{
struct hostent *hp;
mysql_mutex_lock(&LOCK_gethostbyname_r);
diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c
index d14087d061e..ab44bac43d3 100644
--- a/mysys/my_gethwaddr.c
+++ b/mysys/my_gethwaddr.c
@@ -21,18 +21,6 @@
#ifndef MAIN
-#if defined(__FreeBSD__) || defined(__linux__)
-static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
-{
- uint i, res=1;
-
- for (i=0; i < len; i++)
- if ((*to++= *from++))
- res=0;
- return res;
-}
-#endif /* FreeBSD || linux */
-
#ifdef __FreeBSD__
#include <net/ethernet.h>
@@ -44,10 +32,11 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
my_bool my_gethwaddr(uchar *to)
{
size_t len;
- uchar *buf, *next, *end, *addr;
+ char *buf, *next, *end;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
+ char zero_array[ETHER_ADDR_LEN] = {0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err;
@@ -63,9 +52,9 @@ my_bool my_gethwaddr(uchar *to)
ifm = (struct if_msghdr *)next;
if (ifm->ifm_type == RTM_IFINFO)
{
- sdl = (struct sockaddr_dl *)(ifm + 1);
- addr=(uchar *)LLADDR(sdl);
- res=memcpy_and_test(to, addr, ETHER_ADDR_LEN);
+ sdl= (struct sockaddr_dl *)(ifm + 1);
+ memcpy(to, LLADDR(sdl), ETHER_ADDR_LEN);
+ res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
}
}
@@ -81,8 +70,9 @@ err:
my_bool my_gethwaddr(uchar *to)
{
- int fd, res=1;
+ int fd, res= 1;
struct ifreq ifr;
+ char zero_array[ETHER_ADDR_LEN] = {0};
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
@@ -91,9 +81,13 @@ my_bool my_gethwaddr(uchar *to)
bzero(&ifr, sizeof(ifr));
strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1);
- do {
+ do
+ {
if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0)
- res=memcpy_and_test(to, (uchar *)&ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+ {
+ memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+ res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
+ }
} while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6');
close(fd);
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 2ec2f8eb5c9..5e66d2fc189 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -360,14 +360,6 @@ int handle_options(int *argc, char ***argv,
}
return EXIT_OPTION_DISABLED;
}
- if (must_be_var && optp->arg_type == NO_ARG)
- {
- if (my_getopt_print_errors)
- my_getopt_error_reporter(ERROR_LEVEL,
- "%s: option '%s' cannot take an argument",
- my_progname, optp->name);
- return EXIT_NO_ARGUMENT_ALLOWED;
- }
error= 0;
value= optp->var_type & GET_ASK_ADDR ?
(*getopt_get_addr)(key_name, (uint) strlen(key_name), optp, &error) :
@@ -377,6 +369,11 @@ int handle_options(int *argc, char ***argv,
if (optp->arg_type == NO_ARG)
{
+ /*
+ Due to historical reasons GET_BOOL var_types still accepts arguments
+ despite the NO_ARG arg_type attribute. This can seems a bit unintuitive
+ and care should be taken when refactoring this code.
+ */
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
{
if (my_getopt_print_errors)
@@ -391,7 +388,7 @@ int handle_options(int *argc, char ***argv,
Set bool to 1 if no argument or if the user has used
--enable-'option-name'.
*optend was set to '0' if one used --disable-option
- */
+ */
(*argc)--;
if (!optend || *optend == '1' ||
!my_strcasecmp(&my_charset_latin1, optend, "true"))
@@ -418,10 +415,9 @@ int handle_options(int *argc, char ***argv,
else if (optp->arg_type == REQUIRED_ARG && !optend)
{
/* Check if there are more arguments after this one,
-
- Note: options loaded from config file that requires value
- should always be in the form '--option=value'.
- */
+ Note: options loaded from config file that requires value
+ should always be in the form '--option=value'.
+ */
if (!is_cmdline_arg || !*++pos)
{
if (my_getopt_print_errors)
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
index c8ef38efbdc..2afe3ec31dd 100644
--- a/mysys/my_rdtsc.c
+++ b/mysys/my_rdtsc.c
@@ -868,14 +868,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
clock() -- We don't use because it would overflow frequently.
- clock_gettime() -- Often we don't use this even when it exists.
- In configure.in, we use AC_CHECK_FUNCS(clock_gettime). Not
- AC_CHECK_LIB(rc,clock_gettime)
- AC_CHECK_FUNCS(clock_gettime)
- If we had the above lines in configure.in, we'd have to use
- /usr/lib/librt.so or /usr/lib64/librt.so when linking, and
- the size of librt.so is 40KB. In tests, clock_gettime often
- had resolution = 1000.
+ clock_gettime() -- In tests, clock_gettime often had
+ resolution = 1000.
ftime() -- A "man ftime" says: "This function is obsolete.
Don't use it." On every platform that we tested, if ftime()
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 258e227bb7b..b57edd2179a 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -113,7 +113,6 @@ int my_is_symlink(const char *filename __attribute__((unused)))
#endif
}
-
/*
Resolve all symbolic links in path
'to' may be equal to 'filename'
@@ -147,7 +146,23 @@ int my_realpath(char *to, const char *filename,
}
DBUG_RETURN(result);
#else
+#ifdef _WIN32
+ int ret= GetFullPathName(filename,FN_REFLEN,
+ to,
+ NULL);
+ if (ret == 0 || ret > FN_REFLEN)
+ {
+ if (ret > FN_REFLEN)
+ my_errno= ENAMETOOLONG;
+ else
+ my_errno= EACCES;
+ if (MyFlags & MY_WME)
+ my_error(EE_REALPATH, MYF(0), filename, my_errno);
+ return -1;
+ }
+#else
my_load_path(to, filename, NullS);
+#endif
return 0;
#endif
}
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index bc050922ffc..e33a9342afa 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -58,7 +58,7 @@ int my_sync(File fd, myf my_flags)
/* Some file systems don't support F_FULLFSYNC and fail above: */
DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
#endif
-#if defined(HAVE_FDATASYNC)
+#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
res= fdatasync(fd);
#elif defined(HAVE_FSYNC)
res= fsync(fd);
@@ -89,6 +89,8 @@ int my_sync(File fd, myf my_flags)
static const char cur_dir_name[]= {FN_CURLIB, 0};
+
+
/*
Force directory information to disk.
@@ -100,7 +102,9 @@ static const char cur_dir_name[]= {FN_CURLIB, 0};
RETURN
0 if ok, !=0 if error
*/
+
#ifdef NEED_EXPLICIT_SYNC_DIR
+
int my_sync_dir(const char *dir_name, myf my_flags)
{
File dir_fd;
@@ -125,12 +129,15 @@ int my_sync_dir(const char *dir_name, myf my_flags)
res= 1;
DBUG_RETURN(res);
}
+
#else /* NEED_EXPLICIT_SYNC_DIR */
+
int my_sync_dir(const char *dir_name __attribute__((unused)),
- myf my_flags __attribute__((unused)))
+ myf my_flags __attribute__((unused)))
{
return 0;
}
+
#endif /* NEED_EXPLICIT_SYNC_DIR */
@@ -145,7 +152,9 @@ int my_sync_dir(const char *dir_name __attribute__((unused)),
RETURN
0 if ok, !=0 if error
*/
+
#ifdef NEED_EXPLICIT_SYNC_DIR
+
int my_sync_dir_by_file(const char *file_name, myf my_flags)
{
char dir_name[FN_REFLEN];
@@ -153,10 +162,14 @@ int my_sync_dir_by_file(const char *file_name, myf my_flags)
dirname_part(dir_name, file_name, &dir_name_length);
return my_sync_dir(dir_name, my_flags);
}
+
#else /* NEED_EXPLICIT_SYNC_DIR */
+
int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
- myf my_flags __attribute__((unused)))
+ myf my_flags __attribute__((unused)))
{
return 0;
}
+
#endif /* NEED_EXPLICIT_SYNC_DIR */
+
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index ba62062ebc0..451a2c7d06a 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -315,6 +315,9 @@ end:
/* Produce a core for the thread */
void my_write_core(int sig)
{
+#ifdef HAVE_gcov
+ extern void __gcov_flush(void);
+#endif
signal(sig, SIG_DFL);
#ifdef HAVE_gcov
/*
@@ -322,7 +325,6 @@ void my_write_core(int sig)
information from this process, causing gcov output to be incomplete.
So we force the writing of coverage information here before terminating.
*/
- extern void __gcov_flush(void);
__gcov_flush();
#endif
pthread_kill(pthread_self(), sig);
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index db35d5a13a6..00890bc0425 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -262,8 +262,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime,
- const char *file, uint line)
+ const struct timespec *abstime,
+ const char *file, uint line)
{
int error;
pthread_mutex_lock(&mp->global);
diff --git a/packaging/Makefile.am b/packaging/Makefile.am
deleted file mode 100644
index 3e6a79367b6..00000000000
--- a/packaging/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-EXTRA_DIST = \
- WiX/AdminBackground.jpg \
- WiX/AdminHeader.jpg \
- WiX/CMakeLists.txt \
- WiX/extra.wxs.in \
- WiX/CPackWixConfig.cmake \
- WiX/create_msi.cmake.in \
- WiX/custom_ui.wxs \
- WiX/MySQLServer.ico \
- WiX/mysql_server.wxs.in \
- WiX/ca/CMakeLists.txt \
- WiX/ca/CustomAction.cpp \
- WiX/ca/CustomAction.def \
- WiX/ca/CustomAction.rc
diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt
index 052887f10a1..4048273fc03 100644
--- a/packaging/WiX/CMakeLists.txt
+++ b/packaging/WiX/CMakeLists.txt
@@ -63,7 +63,12 @@ FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
ELSE()
- FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS)
+ IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
+ SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
+ ELSE()
+ SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING")
+ ENDIF()
+ FILE(READ ${LICENSE_FILE} 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")
diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in
index adc3cf4c4dd..a1899b701fd 100644
--- a/packaging/WiX/create_msi.cmake.in
+++ b/packaging/WiX/create_msi.cmake.in
@@ -7,7 +7,7 @@ SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
SET(VERSION "@VERSION@")
SET(MAJOR_VERSION "@MAJOR_VERSION@")
SET(MINOR_VERSION "@MINOR_VERSION@")
-SET(PATCH "@PATCH@")
+SET(PATCH_VERSION "@PATCH_VERSION@")
SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
SET(MANUFACTURER "@MANUFACTURER@")
SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
@@ -27,6 +27,12 @@ ENDIF()
SET(ENV{VS_UNICODE_OUTPUT})
+# Switch off the monolithic install
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
+ OUTPUT_QUIET
+)
+
INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
IF(CPACK_WIX_CONFIG)
@@ -318,3 +324,9 @@ EXECUTE_PROCESS(
${EXTRA_LIGHT_ARGS}
)
+# Switch monolithic install on again
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
+ OUTPUT_QUIET
+)
+
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
index 59cc817a302..43a30538384 100644
--- a/packaging/WiX/mysql_server.wxs.in
+++ b/packaging/WiX/mysql_server.wxs.in
@@ -4,7 +4,7 @@
Id="*"
UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
- Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
Language="1033"
Manufacturer="@MANUFACTURER@">
@@ -25,12 +25,12 @@
<UpgradeVersion
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
IncludeMinimum="yes"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
Property="OLDERVERSIONBEINGUPGRADED"
MigrateFeatures="yes"
/>
<UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
</Upgrade>
@@ -128,10 +128,10 @@
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;4</Custom>
- <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And UILevel&lt;=4</Custom>
+ <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
+ <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
+ <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&gt;4</Custom>
+ <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&lt;=4</Custom>
</InstallExecuteSequence>
<!-- Installation root-->
@@ -160,4 +160,4 @@
@CPACK_WIX_INCLUDES@
</Product>
-</Wix> \ No newline at end of file
+</Wix>
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
deleted file mode 100644
index 4a84ce4915a..00000000000
--- a/plugin/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2005, 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
-
-# Process this file with automake to create Makefile.in
-
-AUTOMAKE_OPTIONS = foreign
-
-# extra plugin example files are listed here, to
-# keep its Makefile.am cleaner as a template
-EXTRA_DIST = fulltext/configure.in
-
-SUBDIRS = @mysql_pg_dirs@
-DIST_SUBDIRS = @mysql_pg_distdirs@
-
-# As of 5.5.3-m3, we want to include the plugin files of a debug build in the package
-install-exec-hook:
- $(mkinstalldirs) $(DESTDIR)$(pkglibdir) $(DESTDIR)$(pkglibdir)/plugin
- test ! -d debug || $(TAR) cf - debug | ( cd $(DESTDIR)$(pkglibdir)/plugin && $(TAR) xvf - )
diff --git a/plugin/audit_null/Makefile.am b/plugin/audit_null/Makefile.am
deleted file mode 100644
index 4408c3f7c47..00000000000
--- a/plugin/audit_null/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2007 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#Makefile.am example for a plugin
-
-pkgplugindir= $(pkglibdir)/plugin
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-
-EXTRA_LTLIBRARIES= adt_null.la
-pkgplugin_LTLIBRARIES= @plugin_audit_null_shared_target@
-adt_null_la_LDFLAGS= -module -rpath $(pkgplugindir)
-adt_null_la_CPPFLAGS= $(AM_CPPFLAGS) -DMYSQL_DYNAMIC_PLUGIN
-adt_null_la_SOURCES= audit_null.c
-
-EXTRA_LIBRARIES= libadtnull.a
-noinst_LIBRARIES= @plugin_audit_null_static_target@
-libadtnull_a_SOURCES= audit_null.c
-
-EXTRA_DIST= plug.in CMakeLists.txt
diff --git a/plugin/audit_null/plug.in b/plugin/audit_null/plug.in
deleted file mode 100644
index 15b1a48b408..00000000000
--- a/plugin/audit_null/plug.in
+++ /dev/null
@@ -1,4 +0,0 @@
-MYSQL_PLUGIN(audit_null, [NULL Audit Plug-in],
- [Simple black-hole Audit example plug-in])
-MYSQL_PLUGIN_DYNAMIC(audit_null, [adt_null.la])
-MYSQL_PLUGIN_STATIC(audit_null, [libadtnull.a])
diff --git a/plugin/auth/CMakeLists.txt b/plugin/auth/CMakeLists.txt
index 7d87e151143..6a9c31f82ce 100644
--- a/plugin/auth/CMakeLists.txt
+++ b/plugin/auth/CMakeLists.txt
@@ -18,6 +18,14 @@ MYSQL_ADD_PLUGIN(auth dialog.c
MODULE_ONLY)
MYSQL_ADD_PLUGIN(auth_test_plugin test_plugin.c
MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_auth_interface qa_auth_interface.c
+ MODULE_ONLY)
+
+MYSQL_ADD_PLUGIN(qa_auth_server qa_auth_server.c
+ MODULE_ONLY)
+
+MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
+ MODULE_ONLY)
CHECK_CXX_SOURCE_COMPILES(
"#define _GNU_SOURCE
diff --git a/plugin/auth/Makefile.am b/plugin/auth/Makefile.am
deleted file mode 100644
index ed459b7b2b1..00000000000
--- a/plugin/auth/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-pkgplugindir=$(pkglibdir)/plugin
-
-AM_LDFLAGS=-module -rpath $(pkgplugindir)
-AM_CPPFLAGS=-DMYSQL_DYNAMIC_PLUGIN -Wno-pointer-sign -I$(top_srcdir)/include
-
-pkgplugin_LTLIBRARIES= auth.la auth_test_plugin.la
-auth_la_SOURCES= dialog.c
-auth_test_plugin_la_SOURCES= test_plugin.c
-
-if HAVE_PEERCRED
-pkgplugin_LTLIBRARIES+= auth_socket.la
-auth_socket_la_SOURCES= auth_socket.c
-endif
-
-EXTRA_DIST= plug.in
-
diff --git a/plugin/auth/dialog.c b/plugin/auth/dialog.c
index 54f88dd9b4e..41312f95674 100644
--- a/plugin/auth/dialog.c
+++ b/plugin/auth/dialog.c
@@ -52,7 +52,7 @@
/**
first byte of the question string is the question "type".
- It can be a "ordinary" or a "password" question.
+ It can be an "ordinary" or a "password" question.
The last bit set marks a last question in the authentication exchange.
*/
#define ORDINARY_QUESTION "\2"
@@ -176,7 +176,7 @@ mysql_declare_plugin_end;
This plugin performs a dialog with the user, asking questions and
reading answers. Depending on the client it may be desirable to do it
using GUI, or console, with or without curses, or read answers
- from a smardcard, for example.
+ from a smartcard, for example.
To support all this variety, the dialog plugin has a callback function
"authentication_dialog_ask". If the client has a function of this name
@@ -256,7 +256,7 @@ static int perform_dialog(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
in mysql_change_user() the client sends the first packet, so
the first vio->read_packet() does nothing (pkt == 0).
- We send the "password", assuming the client knows what its doing.
+ We send the "password", assuming the client knows what it's doing.
(in other words, the dialog plugin should be only set as a default
authentication plugin on the client if the first question
asks for a password - which will be sent in clear text, by the way)
diff --git a/plugin/auth/plug.in b/plugin/auth/plug.in
deleted file mode 100644
index 776367652ab..00000000000
--- a/plugin/auth/plug.in
+++ /dev/null
@@ -1,12 +0,0 @@
-MYSQL_PLUGIN(auth, [Collection of Authentication Plugins],
- [Collection of Authentication Plugins])
-MYSQL_PLUGIN_DYNAMIC(auth, [dialog.la auth_test_plugin.la])
-AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <sys/socket.h>
-]],[
- struct ucred cred;
- getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, 0);
-])],have_peercred=yes)
-AM_CONDITIONAL(HAVE_PEERCRED, test x$have_peercred = xyes)
diff --git a/plugin/auth/qa_auth_client.c b/plugin/auth/qa_auth_client.c
new file mode 100644
index 00000000000..da7bfc14a73
--- /dev/null
+++ b/plugin/auth/qa_auth_client.c
@@ -0,0 +1,127 @@
+/* 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 <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/**
+ first byte of the question string is the question "type".
+ It can be a "ordinary" or a "password" question.
+ The last bit set marks a last question in the authentication exchange.
+*/
+#define ORDINARY_QUESTION "\2"
+#define LAST_QUESTION "\3"
+#define LAST_PASSWORD "\4"
+#define PASSWORD_QUESTION "\5"
+
+/********************* CLIENT SIDE ***************************************/
+/*
+ client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+/**
+ The main function of the test plugin.
+
+ Reads the prompt, check if the handshake is done and if the prompt is a
+ password request and returns the password. Otherwise return error.
+
+ @note
+ 1. this plugin shows how a client authentication plugin
+ may read a MySQL protocol OK packet internally - which is important
+ where a number of packets is not known in advance.
+ 2. the first byte of the prompt is special. it is not
+ shown to the user, but signals whether it is the last question
+ (prompt[0] & 1 == 1) or not last (prompt[0] & 1 == 0),
+ and whether the input is a password (not echoed).
+ 3. the prompt is expected to be sent zero-terminated
+*/
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+ unsigned char *pkt, cmd= 0;
+ int pkt_len, res;
+ char *reply;
+
+ do
+ {
+ /* read the prompt */
+ pkt_len= vio->read_packet(vio, &pkt);
+ if (pkt_len < 0)
+ return CR_ERROR;
+
+ if (pkt == 0)
+ {
+ /*
+ in mysql_change_user() the client sends the first packet, so
+ the first vio->read_packet() does nothing (pkt == 0).
+
+ We send the "password", assuming the client knows what its doing.
+ (in other words, the dialog plugin should be only set as a default
+ authentication plugin on the client if the first question
+ asks for a password - which will be sent in cleat text, by the way)
+ */
+ reply= mysql->passwd;
+ }
+ else
+ {
+ cmd= *pkt++;
+
+ /* is it MySQL protocol (0=OK or 254=need old password) packet ? */
+ if (cmd == 0 || cmd == 254)
+ return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+
+ /*
+ asking for a password with an empty prompt means mysql->password
+ otherwise return an error
+ */
+ if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+ reply= mysql->passwd;
+ else
+ return CR_ERROR;
+ }
+ if (!reply)
+ return CR_ERROR;
+ /* send the reply to the server */
+ res= vio->write_packet(vio, (const unsigned char *) reply,
+ strlen(reply) + 1);
+
+ if (res)
+ return CR_ERROR;
+
+ /* repeat unless it was the last question */
+ } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+
+ /* the job of reading the ok/error packet is left to the server */
+ return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+ "qa_auth_client",
+ "Horst Hunger",
+ "Dialog Client Authentication Plugin",
+ {0,1,0},
+ "GPL",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ test_plugin_client
+mysql_end_client_plugin;
diff --git a/plugin/auth/qa_auth_interface.c b/plugin/auth/qa_auth_interface.c
new file mode 100644
index 00000000000..0aa6c9ce20c
--- /dev/null
+++ b/plugin/auth/qa_auth_interface.c
@@ -0,0 +1,262 @@
+/* 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 <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/**
+ first byte of the question string is the question "type".
+ It can be a "ordinary" or a "password" question.
+ The last bit set marks a last question in the authentication exchange.
+*/
+#define ORDINARY_QUESTION "\2"
+#define LAST_QUESTION "\3"
+#define LAST_PASSWORD "\4"
+#define PASSWORD_QUESTION "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int qa_auth_interface (MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+ unsigned char *pkt;
+ int pkt_len, err= CR_OK;
+
+ /* send a password question */
+ if (vio->write_packet(vio, (const unsigned char *) PASSWORD_QUESTION, 1))
+ return CR_ERROR;
+
+ /* read the answer */
+ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+ return CR_ERROR;
+
+ info->password_used= PASSWORD_USED_YES;
+
+ /* fail if the password is wrong */
+ if (strcmp((const char *) pkt, info->auth_string))
+ return CR_ERROR;
+
+/* Check the contens of components of info */
+ if (strcmp(info->user_name, "qa_test_1_user")== 0)
+ {
+ if (info->user_name_length != 14)
+ err= CR_ERROR;
+ if (strcmp(info->auth_string, "qa_test_1_dest"))
+ err= CR_ERROR;
+ if (info->auth_string_length != 14)
+ err= CR_ERROR;
+/* To be set by the plugin */
+// if (strcmp(info->authenticated_as, "qa_test_1_user"))
+// err= CR_ERROR;
+/* To be set by the plugin */
+// if (strcmp(info->external_user, ""))
+// err= CR_ERROR;
+ if (info->password_used != PASSWORD_USED_YES)
+ err= CR_ERROR;
+ if (strcmp(info->host_or_ip, "localhost"))
+ err= CR_ERROR;
+ if (info->host_or_ip_length != 9)
+ err= CR_ERROR;
+ }
+/* Assign values to the components of info even if not intended and watch the effect */
+ else if (strcmp(info->user_name, "qa_test_2_user")== 0)
+ {
+ /* Overwriting not intended, but with effect on USER() */
+ strcpy(info->user_name, "user_name");
+ info->user_name_length= 9;
+ /* Overwriting not intended, effect not visible */
+ strcpy((char *)info->auth_string, "auth_string");
+ info->auth_string_length= 11;
+ /* Assign with account for authorization, effect on CURRENT_USER() */
+ strcpy(info->authenticated_as, "authenticated_as");
+ /* Assign with an external account, effect on @@local.EXTERNAL_USER */
+ strcpy(info->external_user, "externaluser");
+ /* Overwriting will cause a core dump */
+// strcpy(info->host_or_ip, "host_or_ip");
+// info->host_or_ip_length= 10;
+ }
+/* Invalid, means too high values for length */
+ else if (strcmp(info->user_name, "qa_test_3_user")== 0)
+ {
+/* Original value is 14. Test runs also with higher value. Changes have no effect.*/
+ info->user_name_length= 28;
+ strcpy((char *)info->auth_string, "qa_test_3_dest");
+/* Original value is 14. Test runs also with higher value. Changes have no effect.*/
+ info->auth_string_length= 28;
+ strcpy(info->authenticated_as, info->auth_string);
+ strcpy(info->external_user, info->auth_string);
+ }
+/* Invalid, means too low values for length */
+ else if (strcmp(info->user_name, "qa_test_4_user")== 0)
+ {
+/* Original value is 14. Test runs also with lower value. Changes have no effect.*/
+ info->user_name_length= 8;
+ strcpy((char *)info->auth_string, "qa_test_4_dest");
+/* Original value is 14. Test runs also with lower value. Changes have no effect.*/
+ info->auth_string_length= 8;
+ strcpy(info->authenticated_as, info->auth_string);
+ strcpy(info->external_user, info->auth_string);
+ }
+/* Overwrite with empty values */
+ else if (strcmp(info->user_name, "qa_test_5_user")== 0)
+ {
+/* This assignment has no effect.*/
+ strcpy(info->user_name, "");
+ info->user_name_length= 0;
+/* This assignment has no effect.*/
+ strcpy((char *)info->auth_string, "");
+ info->auth_string_length= 0;
+/* This assignment caused an error or an "empty" user */
+ strcpy(info->authenticated_as, "");
+/* This assignment has no effect.*/
+ strcpy(info->external_user, "");
+ /* Overwriting will cause a core dump */
+// strcpy(info->host_or_ip, "");
+// info->host_or_ip_length= 0;
+ }
+/* Set to 'root' */
+ else if (strcmp(info->user_name, "qa_test_6_user")== 0)
+ {
+ strcpy(info->authenticated_as, "root");
+ }
+ else
+ {
+ err= CR_ERROR;
+ }
+ return err;
+}
+
+static struct st_mysql_auth qa_auth_test_handler=
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+ "qa_auth_interface", /* requires test_plugin client's plugin */
+ qa_auth_interface
+};
+
+mysql_declare_plugin(test_plugin)
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &qa_auth_test_handler,
+ "qa_auth_interface",
+ "Horst Hunger",
+ "plugin API test plugin",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+ client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+/**
+ The main function of the test plugin.
+
+ Reads the prompt, check if the handshake is done and if the prompt is a
+ password request and returns the password. Otherwise return error.
+
+ @note
+ 1. this plugin shows how a client authentication plugin
+ may read a MySQL protocol OK packet internally - which is important
+ where a number of packets is not known in advance.
+ 2. the first byte of the prompt is special. it is not
+ shown to the user, but signals whether it is the last question
+ (prompt[0] & 1 == 1) or not last (prompt[0] & 1 == 0),
+ and whether the input is a password (not echoed).
+ 3. the prompt is expected to be sent zero-terminated
+*/
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+ unsigned char *pkt, cmd= 0;
+ int pkt_len, res;
+ char *reply;
+
+ do
+ {
+ /* read the prompt */
+ pkt_len= vio->read_packet(vio, &pkt);
+ if (pkt_len < 0)
+ return CR_ERROR;
+
+ if (pkt == 0)
+ {
+ /*
+ in mysql_change_user() the client sends the first packet, so
+ the first vio->read_packet() does nothing (pkt == 0).
+
+ We send the "password", assuming the client knows what its doing.
+ (in other words, the dialog plugin should be only set as a default
+ authentication plugin on the client if the first question
+ asks for a password - which will be sent in cleat text, by the way)
+ */
+ reply= mysql->passwd;
+ }
+ else
+ {
+ cmd= *pkt++;
+
+ /* is it MySQL protocol (0=OK or 254=need old password) packet ? */
+ if (cmd == 0 || cmd == 254)
+ return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+
+ /*
+ asking for a password with an empty prompt means mysql->password
+ otherwise return an error
+ */
+ if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+ reply= mysql->passwd;
+ else
+ return CR_ERROR;
+ }
+ if (!reply)
+ return CR_ERROR;
+ /* send the reply to the server */
+ res= vio->write_packet(vio, (const unsigned char *) reply,
+ strlen(reply) + 1);
+
+ if (res)
+ return CR_ERROR;
+
+ /* repeat unless it was the last question */
+ } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+
+ /* the job of reading the ok/error packet is left to the server */
+ return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+ "qa_auth_interface",
+ "Horst Hunger",
+ "Dialog Client Authentication Plugin",
+ {0,1,0},
+ "GPL",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ test_plugin_client
+mysql_end_client_plugin;
diff --git a/plugin/auth/qa_auth_server.c b/plugin/auth/qa_auth_server.c
new file mode 100644
index 00000000000..17171610200
--- /dev/null
+++ b/plugin/auth/qa_auth_server.c
@@ -0,0 +1,87 @@
+/* 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 <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/**
+ first byte of the question string is the question "type".
+ It can be a "ordinary" or a "password" question.
+ The last bit set marks a last question in the authentication exchange.
+*/
+#define ORDINARY_QUESTION "\2"
+#define LAST_QUESTION "\3"
+#define LAST_PASSWORD "\4"
+#define PASSWORD_QUESTION "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int qa_auth_interface (MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+ unsigned char *pkt;
+ int pkt_len, err= CR_OK;
+
+ /* send a password question */
+ if (vio->write_packet(vio, (const unsigned char *) PASSWORD_QUESTION, 1))
+ return CR_ERROR;
+
+ /* read the answer */
+ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+ return CR_ERROR;
+
+ info->password_used= PASSWORD_USED_YES;
+
+ /* fail if the password is wrong */
+ if (strcmp((const char *) pkt, info->auth_string))
+ return CR_ERROR;
+
+/* Test of default_auth */
+ if (strcmp(info->user_name, "qa_test_11_user")== 0)
+ {
+ strcpy(info->authenticated_as, "qa_test_11_dest");
+ }
+ else
+ err= CR_ERROR;
+ return err;
+}
+
+static struct st_mysql_auth qa_auth_test_handler=
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+ "qa_auth_interface", /* requires test_plugin client's plugin */
+ qa_auth_interface
+};
+
+mysql_declare_plugin(test_plugin)
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &qa_auth_test_handler,
+ "qa_auth_server",
+ "Horst Hunger",
+ "plugin API test plugin",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ NULL
+}
+mysql_declare_plugin_end;
diff --git a/plugin/auth/test_plugin.c b/plugin/auth/test_plugin.c
index caea7795833..161062d5b6c 100644
--- a/plugin/auth/test_plugin.c
+++ b/plugin/auth/test_plugin.c
@@ -17,22 +17,12 @@
/**
@file
- dialog client authentication plugin with examples
-
- dialog is a general purpose client authentication plugin, it simply
- asks the user the question, as provided by the server and reports
- the answer back to the server. No encryption is involved,
- the answers are sent in clear text.
-
- Two examples are provided: two_questions server plugin, that asks
- the password and an "Are you sure?" question with a reply "yes, of course".
- It demonstrates the usage of "password" (input is hidden) and "ordinary"
- (input can be echoed) questions, and how to mark the last question,
- to avoid an extra roundtrip.
-
- And three_attempts plugin that gives the user three attempts to enter
- a correct password. It shows the situation when a number of questions
- is not known in advance.
+ Test driver for the mysql-test/t/plugin_auth.test
+
+ This is a set of test plugins used to test the external authentication
+ implementation.
+ See the above test file for more details.
+ This test plugin is based on the dialog plugin example.
*/
#include <my_global.h>
@@ -55,7 +45,7 @@
/********************* SERVER SIDE ****************************************/
/**
- dialog test plugin mimicing the ordinary auth mechanism. Used to test the auth plugin API
+ dialog test plugin mimicking the ordinary auth mechanism. Used to test the auth plugin API
*/
static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
{
@@ -150,10 +140,10 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
in mysql_change_user() the client sends the first packet, so
the first vio->read_packet() does nothing (pkt == 0).
- We send the "password", assuming the client knows what its doing.
+ We send the "password", assuming the client knows what it's doing.
(in other words, the dialog plugin should be only set as a default
authentication plugin on the client if the first question
- asks for a password - which will be sent in cleat text, by the way)
+ asks for a password - which will be sent in clear text, by the way)
*/
reply= mysql->passwd;
}
diff --git a/plugin/daemon_example/Makefile.am b/plugin/daemon_example/Makefile.am
deleted file mode 100644
index d60271521b3..00000000000
--- a/plugin/daemon_example/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#Makefile.am example for a daemon
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir) @ZLIB_INCLUDES@
-
-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_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_CXXFLAGS)
-libdaemon_example_a_CFLAGS = $(AM_CFLAGS)
-libdaemon_example_a_SOURCES= daemon_example.cc
-EXTRA_DIST = CMakeLists.txt
diff --git a/plugin/daemon_example/configure.in b/plugin/daemon_example/configure.in
deleted file mode 100644
index 8924b7f5bc4..00000000000
--- a/plugin/daemon_example/configure.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# configure.in example for a daemon
-
-AC_INIT(daemon_example, 0.1)
-AM_INIT_AUTOMAKE
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-
diff --git a/plugin/daemon_example/plug.in b/plugin/daemon_example/plug.in
deleted file mode 100644
index 72e87a70f59..00000000000
--- a/plugin/daemon_example/plug.in
+++ /dev/null
@@ -1,3 +0,0 @@
-MYSQL_PLUGIN(daemon_example,[Daemon Example Plugin],
- [This is an example plugin daemon.])
-MYSQL_PLUGIN_DYNAMIC(daemon_example, [libdaemon_example.la])
diff --git a/plugin/fulltext/Makefile.am b/plugin/fulltext/Makefile.am
deleted file mode 100644
index 80a8753b332..00000000000
--- a/plugin/fulltext/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#Makefile.am example for a plugin
-
-pkgplugindir=$(pkglibdir)/plugin
-INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include
-#noinst_LTLIBRARIES= mypluglib.la
-pkgplugin_LTLIBRARIES= mypluglib.la
-mypluglib_la_SOURCES= plugin_example.c
-mypluglib_la_LDFLAGS= -module -rpath $(pkgplugindir)
-mypluglib_la_CFLAGS= -DMYSQL_DYNAMIC_PLUGIN
-EXTRA_DIST= CMakeLists.txt
diff --git a/plugin/fulltext/configure.in b/plugin/fulltext/configure.in
deleted file mode 100644
index 2fefa68727c..00000000000
--- a/plugin/fulltext/configure.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# configure.in example for a plugin
-
-AC_INIT(plugin_example, 0.1)
-AM_INIT_AUTOMAKE
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-
diff --git a/plugin/fulltext/plug.in b/plugin/fulltext/plug.in
deleted file mode 100644
index 5bfc401f805..00000000000
--- a/plugin/fulltext/plug.in
+++ /dev/null
@@ -1,3 +0,0 @@
-MYSQL_PLUGIN(ftexample, [Simple Parser],
- [Simple full-text parser plugin])
-MYSQL_PLUGIN_DYNAMIC(ftexample, [mypluglib.la])
diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am
deleted file mode 100644
index ec1ecee46a2..00000000000
--- a/plugin/semisync/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-## Makefile.am for semi-synchronous replication
-
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_srcdir)/sql \
- -I$(top_srcdir)/regex \
- -I$(srcdir)
-
-noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h
-
-pkgplugin_LTLIBRARIES = semisync_master.la semisync_slave.la
-
-semisync_master_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
-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_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
-
-EXTRA_DIST= CMakeLists.txt plug.in
diff --git a/plugin/semisync/configure.in b/plugin/semisync/configure.in
deleted file mode 100644
index 894251258db..00000000000
--- a/plugin/semisync/configure.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# configure.in for semi-synchronous replication
-
-AC_INIT(mysql-semi-sync-plugin, 0.2)
-AM_INIT_AUTOMAKE
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-
diff --git a/plugin/semisync/plug.in b/plugin/semisync/plug.in
deleted file mode 100644
index 82bd9772644..00000000000
--- a/plugin/semisync/plug.in
+++ /dev/null
@@ -1,3 +0,0 @@
-MYSQL_PLUGIN(semisync,[Semi-synchronous Replication Plugin],
- [Semi-synchronous replication plugin.])
-MYSQL_PLUGIN_DYNAMIC(semisync, [semisync_master.la semisync_slave.la])
diff --git a/regex/Makefile.am b/regex/Makefile.am
deleted file mode 100644
index 0fd62a777f6..00000000000
--- a/regex/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2000-2003, 2005-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-noinst_LIBRARIES = libregex.a
-LDADD= libregex.a $(top_builddir)/strings/libmystrings.a
-noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c my_regex.h
-libregex_a_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c
-noinst_PROGRAMS = re
-re_SOURCES = split.c debug.c main.c
-re_LDFLAGS= @NOINST_LDFLAGS@
-EXTRA_DIST = tests CHANGES COPYRIGHT WHATSNEW regexp.c \
- debug.ih engine.ih main.ih regcomp.ih regerror.ih \
- regex.3 regex.7 CMakeLists.txt
-
-test: re tests
- ./re < tests
- ./re -el < tests
- ./re -er < tests
diff --git a/regex/main.c b/regex/main.c
index fa97ca89047..f5b591907cf 100644
--- a/regex/main.c
+++ b/regex/main.c
@@ -17,8 +17,8 @@ regoff_t startoff = 0;
regoff_t endoff = 0;
-extern int split();
-extern void regprint();
+extern int split(char *string, char *fields[], int nfields, char *sep);
+extern void regprint(my_regex_t *r, FILE *d);
/*
- main - do the simple case, hand off to regress() for regression
@@ -145,7 +145,7 @@ FILE *in;
inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
if (debug)
fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
+ nf = split(inbuf, f, MAXF, (char*) "\t\t");
if (nf < 3) {
fprintf(stderr, "bad input, line %d\n", line);
exit(1);
@@ -288,7 +288,7 @@ int opts; /* may not match f1 */
for (i = 1; i < NSHOULD; i++)
should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
+ nshould = split(f4, should+1, NSHOULD-1, (char*) ",");
if (nshould == 0) {
nshould = 1;
should[1] = (char*) "";
diff --git a/regex/regexec.c b/regex/regexec.c
index 338c1bfa7fe..c0d03335b41 100644
--- a/regex/regexec.c
+++ b/regex/regexec.c
@@ -117,6 +117,7 @@ size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
+ char *pstr = (char *) str;
register struct re_guts *g = preg->re_g;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
@@ -133,7 +134,7 @@ int eflags;
if ((size_t) g->nstates <= CHAR_BIT*sizeof(states1) &&
!(eflags&REG_LARGE))
- return(smatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(smatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
else
- return(lmatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(lmatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
}
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 0a8d4f9658d..56b7f779bb0 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -310,7 +310,7 @@ IF(WIN32)
FOREACH(file ${SH_FILES})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
- INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT ${${file}_COMPONENT})
+ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT Server_Scripts)
ENDFOREACH()
ELSE()
# On Unix, most of the files end up in the bin directory
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index 0200410fd8f..00000000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1,192 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-## Process this file with automake to create Makefile.in
-
-BUILT_SOURCES = mysql_fix_privilege_tables.sql \
- mysql_fix_privilege_tables_sql.c
-
-EXTRA_PROGRAMS = comp_sql
-
-bin_SCRIPTS = @server_scripts@ \
- msql2mysql \
- mysql_config \
- mysql_fix_extensions \
- mysql_setpermission \
- mysql_secure_installation \
- mysql_zap \
- mysqlaccess \
- mysqlbug \
- mysql_convert_table_format \
- mysql_find_rows \
- mysqlhotcopy \
- mysqldumpslow \
- mysqld_multi
-
-noinst_SCRIPTS = make_binary_distribution \
- make_sharedlib_distribution \
- dheadgen.pl
-
-EXTRA_SCRIPTS = make_binary_distribution.sh \
- make_sharedlib_distribution.sh \
- msql2mysql.sh \
- mysql_config.sh \
- mysql_config.pl.in \
- mysql_fix_extensions.sh \
- mysql_install_db.sh \
- mysql_install_db.pl.in \
- mysql_setpermission.sh \
- mysql_secure_installation.sh \
- mysql_secure_installation.pl.in \
- mysql_zap.sh \
- mysqlaccess.sh \
- mysqlbug.sh \
- mysql_convert_table_format.sh \
- mysql_find_rows.sh \
- mysqlhotcopy.sh \
- mysqldumpslow.sh \
- mysqld_multi.sh \
- mysqld_safe.sh \
- dheadgen.pl
-
-EXTRA_DIST = $(EXTRA_SCRIPTS) \
- mysqlaccess.conf \
- mysqlbug \
- make_win_bin_dist \
- mysql_fix_privilege_tables_sql.c \
- mysql_system_tables_fix.sql \
- CMakeLists.txt
-
-dist_pkgdata_DATA = fill_help_tables.sql \
- mysql_fix_privilege_tables.sql \
- mysql_system_tables.sql \
- mysql_system_tables_data.sql \
- mysql_test_data_timezone.sql
-
-CLEANFILES = @server_scripts@ \
- make_binary_distribution \
- make_sharedlib_distribution \
- msql2mysql \
- mysql_config \
- mysql_fix_extensions \
- mysql_setpermission \
- mysql_secure_installation \
- mysql_zap \
- mysqlaccess \
- mysql_convert_table_format \
- mysql_find_rows \
- mysqlhotcopy \
- mysqldumpslow \
- mysqld_multi
-
-pkgplugindir = $(pkglibdir)/plugin
-
-# Default same as 'pkgdatadir', but we can override it
-pkgsuppdir = $(datadir)/@PACKAGE@
-
-# mysqlbug should be distributed built so that people can report build
-# failures with it.
-DISTCLEANFILES = $(BUILT_SOURCES) mysqlbug
-
-# We want the right version and configure comand line in mysqlbug
-mysqlbug: ${top_builddir}/config.status mysqlbug.sh
-
-# Build mysql_fix_privilege_tables.sql from the files that contain
-# the system tables for this version of MySQL plus any commands
-# needed to upgrade the system tables from an older version
-mysql_fix_privilege_tables.sql: mysql_system_tables.sql \
- mysql_system_tables_fix.sql
- @echo "Building $@";
- @cat mysql_system_tables.sql mysql_system_tables_fix.sql > $@
-
-#
-# Build mysql_fix_privilege_tables_sql.c from
-# mysql_fix_privileges_tables.sql using comp_sql
-# The "sleep" ensures the generated file has a younger timestamp than its source
-# (which may have been generated in this very same "make" run).
-#
-mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql
- $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT)
- sleep 2
- $(top_builddir)/scripts/comp_sql$(EXEEXT) \
- mysql_fix_privilege_tables \
- $(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@
-
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''sbindir''@!$(sbindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''pkglibdir''@!$(pkglibdir)!g' \
- -e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
- -e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
- -e 's!@''pkgplugindir''@!$(pkgplugindir)!g' \
- -e 's!@''pkgsuppdir''@!$(pkgsuppdir)!g' \
- -e 's!@''sysconfdir''@!$(sysconfdir)!g' \
- -e 's!@''mandir''@!$(mandir)!g' \
- -e 's!@''infodir''@!$(infodir)!g' \
- -e 's!@''CC''@!@CC@!'\
- -e 's!@''CXX''@!@CXX@!'\
- -e 's!@''GXX''@!@GXX@!'\
- -e 's!@''SAVE_CC''@!@SAVE_CC@!'\
- -e 's!@''SAVE_CXX''@!@SAVE_CXX@!'\
- -e 's!@''CC_VERSION''@!@CC_VERSION@!'\
- -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''SAVE_ASFLAGS''@!@SAVE_ASFLAGS@!'\
- -e 's!@''SAVE_CFLAGS''@!@SAVE_CFLAGS@!'\
- -e 's!@''SAVE_CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
- -e 's!@''SAVE_LDFLAGS''@!@SAVE_LDFLAGS@!'\
- -e 's!@''ASFLAGS''@!@ASFLAGS@!'\
- -e 's!@''CFLAGS''@!@CFLAGS@!'\
- -e 's!@''CXXFLAGS''@!@CXXFLAGS@!'\
- -e 's!@''LDFLAGS''@!@LDFLAGS@!'\
- -e 's!@''LIBDL''@!@LIBDL@!'\
- -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
- -e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \
- -e 's!@''LIBS''@!@LIBS@!' \
- -e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
- -e 's!@''openssl_libs''@!@openssl_libs@!' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
- -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
- -e 's!@''HOSTNAME''@!@HOSTNAME@!' \
- -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \
- -e 's!@''CHECK_PID''@!@CHECK_PID@!' \
- -e 's!@''FIND_PROC''@!@FIND_PROC@!' \
- -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_TCP_PORT_DEFAULT''@!@MYSQL_TCP_PORT_DEFAULT@!' \
- -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
- -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- -e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \
- -e 's!@''NON_THREADED_LIBS''@!@NON_THREADED_LIBS@!' \
- -e 's!@''ZLIB_DEPS''@!@ZLIB_DEPS@!' \
- -e "s!@MAKE@!$(MAKE)!" \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 951699317fd..455bc93e642 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -304,8 +304,8 @@ mv $DEST/bin/mysql_install_db $DEST/scripts/
# Copy readme and license files
cp README Docs/INSTALL-BINARY $DEST/
-if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then
- cp COPYING EXCEPTIONS-CLIENT $DEST/
+if [ -f COPYING ] ; then
+ cp COPYING $DEST/
elif [ -f LICENSE.mysql ] ; then
cp LICENSE.mysql $DEST/
else
diff --git a/scripts/make_sharedlib_distribution.sh b/scripts/make_sharedlib_distribution.sh
deleted file mode 100644
index f6669788233..00000000000
--- a/scripts/make_sharedlib_distribution.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2003-2004, 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# The default path should be /usr/local
-
-# Get some info from configure
-# chmod +x ./scripts/setsomevars
-
-machine=@MACHINE_TYPE@
-system=@SYSTEM_TYPE@
-version=@VERSION@
-export machine system version
-SOURCE=`pwd`
-CP="cp -p"
-MV="mv"
-
-STRIP=1
-DEBUG=0
-SILENT=0
-TMP=/tmp
-SUFFIX=""
-
-parse_arguments() {
- for arg do
- case "$arg" in
- --debug) DEBUG=1;;
- --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
- --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
- --no-strip) STRIP=0 ;;
- --silent) SILENT=1 ;;
- *)
- echo "Unknown argument '$arg'"
- exit 1
- ;;
- esac
- done
-}
-
-parse_arguments "$@"
-
-BASE=$TMP/my_dist$SUFFIX
-
-if [ -d $BASE ] ; then
- rm -r -f $BASE
-fi
-
-mkdir -p $BASE/lib
-
-for i in \
- libmysql/.libs/libmysqlclient.so* \
- libmysql/.libs/libmysqlclient.sl* \
- libmysql/.libs/libmysqlclient*.dylib \
- libmysql_r/.libs/libmysqlclient_r.so* \
- libmysql_r/.libs/libmysqlclient_r.sl* \
- libmysql_r/.libs/libmysqlclient_r*.dylib
-do
- if [ -f $i ]
- then
- $CP $i $BASE/lib
- fi
-done
-
-# Change the distribution to a long descriptive name
-NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX
-BASE2=$TMP/$NEW_NAME
-rm -r -f $BASE2
-mv $BASE $BASE2
-BASE=$BASE2
-
-#if we are debugging, do not do tar/gz
-if [ x$DEBUG = x1 ] ; then
- exit
-fi
-
-# This is needed to prefer GNU tar instead of tar because tar can't
-# always handle long filenames
-
-PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
-which_1 ()
-{
- for cmd
- do
- for d in $PATH_DIRS
- do
- for file in $d/$cmd
- do
- if test -x $file -a ! -d $file
- then
- echo $file
- exit 0
- fi
- done
- done
- done
- exit 1
-}
-
-#
-# Create the result tar file
-#
-
-tar=`which_1 gnutar gtar`
-if test "$?" = "1" -o "$tar" = ""
-then
- tar=tar
-fi
-
-echo "Using $tar to create archive"
-cd $TMP
-
-OPT=cvf
-if [ x$SILENT = x1 ] ; then
- OPT=cf
-fi
-
-$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
-cd $SOURCE
-echo "Compressing archive"
-gzip -9 $NEW_NAME.tar
-echo "Removing temporary directory"
-rm -r -f $BASE
-
-echo "$NEW_NAME.tar.gz created"
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index aa106a3dfc4..3174d61792a 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -183,8 +183,8 @@ cp ChangeLog $DESTDIR/Docs/ || /bin/true
cp support-files/my-*.ini $DESTDIR/
if [ -f COPYING ] ; then
- cp COPYING EXCEPTIONS-CLIENT $DESTDIR/
- cp COPYING $DESTDIR/Docs/
+ cp COPYING $DESTDIR/
+ cp COPYING $DESTDIR/Docs/
fi
# ----------------------------------------------------------------------
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 977907c9c14..70e1d4fcdce 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -171,7 +171,7 @@ set @have_pfs= (select count(engine) from information_schema.engines where engin
-- TABLE COND_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.COND_INSTANCES(";
+SET @l1="CREATE TABLE performance_schema.cond_instances(";
SET @l2="NAME VARCHAR(128) not null,";
SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
@@ -187,7 +187,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_CURRENT
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT(";
+SET @l1="CREATE TABLE performance_schema.events_waits_current(";
SET @l2="THREAD_ID INTEGER not null,";
SET @l3="EVENT_ID BIGINT unsigned not null,";
SET @l4="EVENT_NAME VARCHAR(128) not null,";
@@ -217,7 +217,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_HISTORY
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY(";
+SET @l1="CREATE TABLE performance_schema.events_waits_history(";
-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
@@ -231,7 +231,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_HISTORY_LONG
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG(";
+SET @l1="CREATE TABLE performance_schema.events_waits_history_long(";
-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
@@ -245,7 +245,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(";
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance(";
SET @l2="EVENT_NAME VARCHAR(128) not null,";
SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
SET @l4="COUNT_STAR BIGINT unsigned not null,";
@@ -266,7 +266,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(";
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(";
SET @l2="THREAD_ID INTEGER not null,";
SET @l3="EVENT_NAME VARCHAR(128) not null,";
SET @l4="COUNT_STAR BIGINT unsigned not null,";
@@ -287,7 +287,7 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(";
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(";
SET @l2="EVENT_NAME VARCHAR(128) not null,";
SET @l3="COUNT_STAR BIGINT unsigned not null,";
SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
@@ -307,7 +307,7 @@ DROP PREPARE stmt;
-- TABLE FILE_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.FILE_INSTANCES(";
+SET @l1="CREATE TABLE performance_schema.file_instances(";
SET @l2="FILE_NAME VARCHAR(512) not null,";
SET @l3="EVENT_NAME VARCHAR(128) not null,";
SET @l4="OPEN_COUNT INTEGER unsigned not null";
@@ -324,7 +324,7 @@ DROP PREPARE stmt;
-- TABLE FILE_SUMMARY_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME(";
+SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name(";
SET @l2="EVENT_NAME VARCHAR(128) not null,";
SET @l3="COUNT_READ BIGINT unsigned not null,";
SET @l4="COUNT_WRITE BIGINT unsigned not null,";
@@ -343,7 +343,7 @@ DROP PREPARE stmt;
-- TABLE FILE_SUMMARY_BY_INSTANCE
--
-SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE(";
+SET @l1="CREATE TABLE performance_schema.file_summary_by_instance(";
SET @l2="FILE_NAME VARCHAR(512) not null,";
SET @l3="EVENT_NAME VARCHAR(128) not null,";
SET @l4="COUNT_READ BIGINT unsigned not null,";
@@ -363,7 +363,7 @@ DROP PREPARE stmt;
-- TABLE MUTEX_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.MUTEX_INSTANCES(";
+SET @l1="CREATE TABLE performance_schema.mutex_instances(";
SET @l2="NAME VARCHAR(128) not null,";
SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
SET @l4="LOCKED_BY_THREAD_ID INTEGER";
@@ -380,7 +380,7 @@ DROP PREPARE stmt;
-- TABLE PERFORMANCE_TIMERS
--
-SET @l1="CREATE TABLE performance_schema.PERFORMANCE_TIMERS(";
+SET @l1="CREATE TABLE performance_schema.performance_timers(";
SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
SET @l3="TIMER_FREQUENCY BIGINT,";
SET @l4="TIMER_RESOLUTION BIGINT,";
@@ -398,7 +398,7 @@ DROP PREPARE stmt;
-- TABLE RWLOCK_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.RWLOCK_INSTANCES(";
+SET @l1="CREATE TABLE performance_schema.rwlock_instances(";
SET @l2="NAME VARCHAR(128) not null,";
SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
@@ -416,7 +416,7 @@ DROP PREPARE stmt;
-- TABLE SETUP_CONSUMERS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_CONSUMERS(";
+SET @l1="CREATE TABLE performance_schema.setup_consumers(";
SET @l2="NAME VARCHAR(64) not null,";
SET @l3="ENABLED ENUM ('YES', 'NO') not null";
SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
@@ -432,7 +432,7 @@ DROP PREPARE stmt;
-- TABLE SETUP_INSTRUMENTS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_INSTRUMENTS(";
+SET @l1="CREATE TABLE performance_schema.setup_instruments(";
SET @l2="NAME VARCHAR(128) not null,";
SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
SET @l4="TIMED ENUM ('YES', 'NO') not null";
@@ -449,7 +449,7 @@ DROP PREPARE stmt;
-- TABLE SETUP_TIMERS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
+SET @l1="CREATE TABLE performance_schema.setup_timers(";
SET @l2="NAME VARCHAR(64) not null,";
SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
@@ -465,10 +465,10 @@ DROP PREPARE stmt;
-- TABLE THREADS
--
-SET @l1="CREATE TABLE performance_schema.THREADS(";
+SET @l1="CREATE TABLE performance_schema.threads(";
SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
+SET @l3="PROCESSLIST_ID INTEGER,";
+SET @l4="NAME VARCHAR(128) not null";
SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
@@ -478,7 +478,7 @@ PREPARE stmt FROM @str;
EXECUTE stmt;
DROP PREPARE stmt;
-CREATE TABLE IF NOT EXISTS proxy_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_Host char(16) binary DEFAULT '' NOT NULL, Proxied_User char(60) binary DEFAULT '' NOT NULL, With_Grant BOOL DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User,Proxied_Host,Proxied_User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
+CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
--- Remember for later if proxy_priv table already existed
-set @had_proxy_priv_table= @@warning_count != 0;
+-- Remember for later if proxies_priv table already existed
+set @had_proxies_priv_table= @@warning_count != 0;
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index 293baa46523..bc5ffae2063 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -30,8 +30,8 @@ INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOW
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
DROP TABLE tmp_user;
-CREATE TEMPORARY TABLE tmp_proxy_priv LIKE proxy_priv;
-INSERT INTO tmp_proxy_priv VALUES ('localhost', 'root', '', '', TRUE);
-REPLACE INTO tmp_proxy_priv SELECT @current_hostname, 'root', '', '', TRUE FROM DUAL WHERE LOWER (@current_hostname) != 'localhost';
-INSERT INTO proxy_priv SELECT * FROM tmp_proxy_priv WHERE @had_proxy_priv_table=0;
-DROP TABLE tmp_proxy_priv;
+CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
+INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
+REPLACE INTO tmp_proxies_priv SELECT @current_hostname, 'root', '', '', TRUE, '', now() FROM DUAL WHERE LOWER (@current_hostname) != 'localhost';
+INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
+DROP TABLE tmp_proxies_priv;
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index ceb910676ab..399c42b1b2d 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -643,7 +643,14 @@ drop procedure mysql.die;
ALTER TABLE user ADD plugin char(60) DEFAULT '' NOT NULL, ADD authentication_string TEXT NOT NULL;
ALTER TABLE user MODIFY plugin char(60) DEFAULT '' NOT NULL;
-CREATE TABLE IF NOT EXISTS proxy_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_User char(60) binary DEFAULT '' NOT NULL, Proxied_Host char(16) binary DEFAULT '' NOT NULL, With_Grant BOOL DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User,Proxied_Host,Proxied_User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+-- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
+-- older versions
+
+CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
+INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
+INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
+DROP TABLE tmp_proxies_priv;
+
# Activate the new, possible modified privilege tables
# This should not be needed, but gives us some extra testing that the above
diff --git a/sql-bench/CMakeLists.txt b/sql-bench/CMakeLists.txt
index f8be18c6653..ae05d30530d 100644
--- a/sql-bench/CMakeLists.txt
+++ b/sql-bench/CMakeLists.txt
@@ -26,13 +26,13 @@ ELSE()
ENDIF()
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/ATIS
- DESTINATION ${prefix}sql-bench/Data)
+ DESTINATION ${prefix}sql-bench/Data COMPONENT SqlBench)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/Wisconsin
- DESTINATION ${prefix}sql-bench/Data)
+ DESTINATION ${prefix}sql-bench/Data COMPONENT SqlBench)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/limits
- DESTINATION ${prefix}sql-bench)
+ DESTINATION ${prefix}sql-bench COMPONENT SqlBench)
FILE(GLOB all_files ${CMAKE_CURRENT_SOURCE_DIR}/*)
@@ -54,10 +54,10 @@ FOREACH(file ${all_files})
CONFIGURE_FILE(${file} ${target} COPYONLY)
IF (ext MATCHES ".bat")
IF(WIN32)
- INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
+ INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench COMPONENT SqlBench)
ENDIF()
ELSE()
- INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
+ INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench COMPONENT SqlBench)
ENDIF()
ENDIF()
ENDFOREACH()
diff --git a/sql-bench/Makefile.am b/sql-bench/Makefile.am
deleted file mode 100644
index a7a2975ea87..00000000000
--- a/sql-bench/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (C) 2000-2003, 2005 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-benchdir_root= $(prefix)
-benchdir = $(benchdir_root)/sql-bench
-bench_SCRIPTS = test-ATIS test-connect test-create test-insert \
- test-big-tables test-select test-wisconsin \
- test-alter-table test-transactions \
- graph-compare-results \
- bench-init.pl compare-results run-all-tests \
- server-cfg crash-me copy-db innotest1 innotest1a \
- innotest1b innotest2 innotest2a innotest2b \
- bench-count-distinct
-CLEANFILES = $(bench_SCRIPTS)
-EXTRA_SCRIPTS = test-ATIS.sh test-connect.sh test-create.sh \
- test-insert.sh test-big-tables.sh test-select.sh \
- test-alter-table.sh test-wisconsin.sh \
- test-transactions.sh \
- bench-init.pl.sh compare-results.sh server-cfg.sh \
- run-all-tests.sh crash-me.sh copy-db.sh \
- graph-compare-results.sh innotest1.sh innotest1a.sh \
- innotest1b.sh innotest2.sh innotest2a.sh innotest2b.sh \
- bench-count-distinct.sh
-EXTRA_DIST = $(EXTRA_SCRIPTS) CMakeLists.txt
-
-dist-hook:
- mkdir -p $(distdir)/Data/ATIS $(distdir)/Data/Wisconsin \
- $(distdir)/limits $(distdir)/Comments
- for i in $(srcdir)/Data/ATIS/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Data/ATIS ; done
- for i in $(srcdir)/Data/Wisconsin/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Data/Wisconsin ; done
- for i in $(srcdir)/limits/*.* ; do $(INSTALL_DATA) $$i $(distdir)/limits; done
- for i in $(srcdir)/Comments/*.* ; do $(INSTALL_DATA) $$i $(distdir)/Comments; done
-
-install-data-local:
- $(mkinstalldirs) \
- $(DESTDIR)$(benchdir)/Data \
- $(DESTDIR)$(benchdir)/Data/ATIS \
- $(DESTDIR)$(benchdir)/Data/Wisconsin \
- $(DESTDIR)$(benchdir)/limits \
- $(DESTDIR)$(benchdir)/Comments
- $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(benchdir)
- for i in $(srcdir)/Data/ATIS/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Data/ATIS ; done
- for i in $(srcdir)/Data/Wisconsin/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Data/Wisconsin ; done
- for i in $(srcdir)/limits/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/limits; done
- for i in $(srcdir)/Comments/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Comments; done
-
-uninstall-local:
- @RM@ -f -r $(DESTDIR)$(benchdir)
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''benchdir''@!$(benchdir)!g' \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
diff --git a/sql-common/Makefile.am b/sql-common/Makefile.am
deleted file mode 100644
index 2f5a049085f..00000000000
--- a/sql-common/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2003-2004, 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-## Process this file with automake to create Makefile.in
-EXTRA_DIST = client.c pack.c my_time.c my_user.c client_plugin.c
diff --git a/sql-common/client.c b/sql-common/client.c
index e8ca74eba37..3bb626e824a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -4197,7 +4197,7 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
int pkt_len;
uchar *pkt;
- DBUG_ENTER ("native_password_auth_client");
+ DBUG_ENTER("native_password_auth_client");
if (((MCPVIO_EXT *)vio)->mysql_change_user)
@@ -4213,10 +4213,10 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
{
/* read the scramble */
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
- return CR_ERROR;
+ DBUG_RETURN(CR_ERROR);
if (pkt_len != SCRAMBLE_LENGTH + 1)
- DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR);
+ DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR);
/* save it in MYSQL */
memcpy(mysql->scramble, pkt, SCRAMBLE_LENGTH);
@@ -4226,19 +4226,19 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
if (mysql->passwd[0])
{
char scrambled[SCRAMBLE_LENGTH + 1];
- DBUG_PRINT ("info", ("sending scramble"));
+ DBUG_PRINT("info", ("sending scramble"));
scramble(scrambled, (char*)pkt, mysql->passwd);
if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH))
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
else
{
- DBUG_PRINT ("info", ("no password"));
+ DBUG_PRINT("info", ("no password"));
if (vio->write_packet(vio, 0, 0)) /* no password */
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
- DBUG_RETURN (CR_OK);
+ DBUG_RETURN(CR_OK);
}
/**
@@ -4250,7 +4250,7 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
uchar *pkt;
int pkt_len;
- DBUG_ENTER ("old_password_auth_client");
+ DBUG_ENTER("old_password_auth_client");
if (((MCPVIO_EXT *)vio)->mysql_change_user)
{
@@ -4265,11 +4265,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
{
/* read the scramble */
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
- return CR_ERROR;
+ DBUG_RETURN(CR_ERROR);
if (pkt_len != SCRAMBLE_LENGTH_323 + 1 &&
pkt_len != SCRAMBLE_LENGTH + 1)
- DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR);
+ DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR);
/* save it in MYSQL */
memcpy(mysql->scramble, pkt, pkt_len);
@@ -4281,11 +4281,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
char scrambled[SCRAMBLE_LENGTH_323 + 1];
scramble_323(scrambled, (char*)pkt, mysql->passwd);
if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH_323 + 1))
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
else
if (vio->write_packet(vio, 0, 0)) /* no password */
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
- DBUG_RETURN (CR_OK);
+ DBUG_RETURN(CR_OK);
}
diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c
index bfeea40b401..6114d95cd73 100644
--- a/sql-common/client_plugin.c
+++ b/sql-common/client_plugin.c
@@ -176,11 +176,11 @@ err2:
if (plugin->deinit)
plugin->deinit();
err1:
- if (dlhandle)
- dlclose(dlhandle);
set_mysql_extended_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, unknown_sqlstate,
ER(CR_AUTH_PLUGIN_CANNOT_LOAD), plugin->name,
errmsg);
+ if (dlhandle)
+ dlclose(dlhandle);
return NULL;
}
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index ac6c2ace890..38384600fc1 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1127,7 +1127,12 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
nr= (nr+19000000L)*1000000L; /* YYMMDD, year: 1970-1999 */
goto ok;
}
- if (nr < 10000101L)
+ /*
+ Though officially we support DATE values from 1000-01-01 only, one can
+ easily insert a value like 1-1-1. So, for consistency reasons such dates
+ are allowed when TIME_FUZZY_DATE is set.
+ */
+ if (nr < 10000101L && !(flags & TIME_FUZZY_DATE))
goto err;
if (nr <= 99991231L)
{
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 0860adde652..1bec2d7b082 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -283,7 +283,11 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
ELSE()
# Not windows or cross compiling, just install an empty directory
- INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql)
+ INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
ENDIF()
ENDIF()
+ADD_CUSTOM_TARGET(show-dist-name
+ COMMAND ${CMAKE_COMMAND} -E echo "${CPACK_PACKAGE_FILE_NAME}"
+)
+
diff --git a/sql/Makefile.am b/sql/Makefile.am
deleted file mode 100644
index 16161798078..00000000000
--- a/sql/Makefile.am
+++ /dev/null
@@ -1,280 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = @ZLIB_INCLUDES@ \
- -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/regex -I$(srcdir) $(openssl_includes)
-WRAPLIBS= @WRAPLIBS@
-SUBDIRS = share
-libexec_PROGRAMS = mysqld
-EXTRA_PROGRAMS = gen_lex_hash
-bin_PROGRAMS = mysql_tzinfo_to_sql
-DTRACEFILES = filesort.o \
- .libs/libndb_la-ha_ndbcluster.o \
- handler.o \
- mysqld.o \
- net_serv.o \
- scheduler.o \
- sp_head.o \
- sql_cache.o \
- sql_connect.o \
- sql_cursor.o \
- sql_delete.o \
- sql_truncate.o \
- sql_reload.o \
- sql_insert.o \
- datadict.o \
- sql_parse.o \
- sql_prepare.o \
- sql_select.o \
- sql_update.o
-
-DTRACEFILES_DEPEND = filesort.o \
- libndb_la-ha_ndbcluster.lo \
- handler.o \
- mysqld.o \
- net_serv.o \
- scheduler.o \
- sp_head.o \
- sql_cache.o \
- sql_connect.o \
- sql_cursor.o \
- sql_delete.o \
- sql_truncate.o \
- sql_reload.o \
- sql_insert.o \
- datadict.o \
- sql_parse.o \
- sql_prepare.o \
- sql_select.o \
- sql_update.o
-
-
-noinst_LTLIBRARIES= libndb.la \
- udf_example.la
-
-SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/regex/libregex.a \
- $(top_builddir)/strings/libmystrings.a
-mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la
-LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
-mysqld_LDADD = libndb.la \
- @MYSQLD_EXTRA_LDFLAGS@ \
- @mysql_plugin_libs@ \
- $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
- $(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@
-
-noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
- item_strfunc.h item_timefunc.h \
- item_xmlfunc.h sql_plugin_services.h \
- item_create.h item_subselect.h item_row.h \
- sql_priv.h item_geofunc.h sql_bitmap.h \
- procedure.h sql_class.h sql_lex.h sql_list.h \
- sql_string.h unireg.h \
- sql_error.h field.h handler.h mysqld_suffix.h \
- sql_profile.h mysqld.h sql_help.h frm_crypt.h \
- ha_ndbcluster.h ha_ndbcluster_cond.h \
- ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
- ha_partition.h rpl_constants.h \
- debug_sync.h \
- opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
- rpl_reporting.h sql_locale.h sql_parse.h \
- log.h sql_show.h rpl_rli.h rpl_mi.h \
- sql_select.h structs.h table.h sql_udf.h hash_filo.h \
- lex.h lex_symbol.h sql_acl.h sql_crypt.h sql_base.h \
- sql_table.h key.h lock.h thr_malloc.h strfunc.h \
- sql_delete.h sql_insert.h sql_update.h sql_db.h \
- sql_connect.h sql_rename.h sql_time.h sql_tablespace.h \
- hostname.h sql_test.h records.h filesort.h \
- sql_derived.h sql_load.h sql_handler.h init.h \
- derror.h sql_union.h des_key_file.h sql_binlog.h \
- discover.h sql_manager.h sql_do.h \
- sql_repl.h slave.h rpl_filter.h rpl_injector.h \
- log_event.h rpl_record.h sql_const.h \
- log_event_old.h rpl_record_old.h \
- sql_sort.h sql_cache.h set_var.h sys_vars_shared.h \
- spatial.h gstream.h client_settings.h tzfile.h \
- tztime.h my_decimal.h keycaches.h \
- sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
- parse_file.h sql_view.h sql_trigger.h \
- sql_array.h sql_cursor.h events.h scheduler.h \
- event_db_repository.h event_queue.h \
- sql_plugin.h authors.h event_parse_data.h \
- event_data_objects.h event_scheduler.h \
- sql_partition.h partition_info.h partition_element.h \
- sql_audit.h sql_alter.h sql_partition_admin.h \
- contributors.h sql_servers.h sql_signal.h records.h \
- sql_prepare.h rpl_handler.h replication.h mdl.h \
- sql_plist.h transaction.h sys_vars.h sql_truncate.h \
- sql_admin.h sql_reload.h datadict.h
-
-mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
- item.cc item_sum.cc item_buff.cc item_func.cc \
- item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
- thr_malloc.cc item_create.cc item_subselect.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 sql_string.cc sql_manager.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_reload.cc datadict.cc sql_profile.cc \
- sql_prepare.cc sql_error.cc sql_locale.cc \
- sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
- procedure.cc sql_test.cc sql_admin.cc \
- sql_truncate.cc \
- log.cc init.cc derror.cc sql_acl.cc \
- unireg.cc des_key_file.cc \
- log_event.cc rpl_record.cc \
- log_event_old.cc rpl_record_old.cc \
- discover.cc sql_time.cc opt_range.cc opt_sum.cc \
- records.cc filesort.cc handler.cc \
- ha_partition.cc \
- debug_sync.cc \
- sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
- sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
- sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
- slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
- rpl_utility.cc rpl_injector.cc rpl_rli.cc rpl_mi.cc \
- rpl_reporting.cc \
- sql_union.cc sql_derived.cc \
- sql_client.cc \
- repl_failsafe.h repl_failsafe.cc sql_view.cc \
- gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
- tztime.cc my_decimal.cc\
- sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
- sp_cache.cc parse_file.cc sql_trigger.cc \
- event_scheduler.cc event_data_objects.cc \
- event_queue.cc event_db_repository.cc events.cc \
- sql_plugin.cc sql_binlog.cc \
- sql_builtin.cc sql_tablespace.cc partition_info.cc \
- sql_servers.cc event_parse_data.cc sql_signal.cc \
- rpl_handler.cc mdl.cc transaction.cc sql_audit.cc \
- sql_alter.cc sql_partition_admin.cc sha2.cc
-
-nodist_mysqld_SOURCES = mini_client_errors.c pack.c client.c my_time.c my_user.c client_plugin.c
-
-libndb_la_CPPFLAGS= @ndbcluster_includes@
-libndb_la_SOURCES= ha_ndbcluster.cc \
- ha_ndbcluster_binlog.cc \
- ha_ndbcluster_cond.cc
-
-gen_lex_hash_SOURCES = gen_lex_hash.cc
-gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
-
-mysql_tzinfo_to_sql_SOURCES = tztime.cc
-mysql_tzinfo_to_sql_CXXFLAGS= -DTZINFO2SQL
-
-DEFS = -DMYSQL_SERVER \
- -DDEFAULT_MYSQL_HOME='"$(MYSQLBASEdir)"' \
- -DMYSQL_DATADIR='"$(MYSQLDATAdir)"' \
- -DSHAREDIR='"$(MYSQLSHAREdir)"' \
- -DPLUGINDIR='"$(pkgplugindir)"' \
- -DHAVE_EVENT_SCHEDULER \
- @DEFS@
-
-BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
-BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
-EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
- nt_servc.cc nt_servc.h \
- message.mc message.h message.rc MSG00001.bin \
- CMakeLists.txt
-
-CLEANFILES = lex_hash.h sql_yacc.output link_sources
-DISTCLEANFILES = $(EXTRA_PROGRAMS)
-MAINTAINERCLEANFILES = $(BUILT_MAINT_SRC)
-AM_YFLAGS = -d --verbose
-
-# These are listed in 'nodist_mysqld_SOURCES'
-link_sources:
- rm -f mini_client_errors.c
- @LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c mini_client_errors.c
- rm -f pack.c
- @LN_CP_F@ $(top_srcdir)/sql-common/pack.c pack.c
- rm -f client.c
- @LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c
- rm -f client_plugin.c
- @LN_CP_F@ $(top_srcdir)/sql-common/client_plugin.c client_plugin.c
- rm -f my_time.c
- @LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c
- rm -f my_user.c
- @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c
- echo timestamp > link_sources
-
-# This generates lex_hash.h
-# NOTE Built sources should depend on their sources not the tool
-# this avoid the rebuild of the built files in a source dist
-lex_hash.h: gen_lex_hash.cc lex.h
- $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
- ./gen_lex_hash$(EXEEXT) > $@-t
- $(MV) $@-t $@
-
-# For testing of udf_example.so
-udf_example_la_SOURCES= udf_example.c
-udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
-
-# We might have some stuff not built in this build, but that we want to install
-install-exec-hook:
- $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkglibdir)
- test ! -x mysqld-debug$(EXEEXT) || $(INSTALL_PROGRAM) mysqld-debug$(EXEEXT) $(DESTDIR)$(libexecdir)
- test ! -f mysqld-debug.sym.gz || $(INSTALL_DATA) mysqld-debug.sym.gz $(DESTDIR)$(pkglibdir)
- test ! -f mysqld.sym.gz || $(INSTALL_DATA) mysqld.sym.gz $(DESTDIR)$(pkglibdir)
-
-if HAVE_DTRACE_DASH_G
-libndb_la_LIBADD = probes_libndb.o
-libndb_la_DEPENDENCIES = dtrace_files dtrace_providers probes_libndb.o
-mysqld_LDADD += probes_all.o
-mysqld_DEPENDENCIES += dtrace_files dtrace_providers probes_all.o
-CLEANFILES += dtrace_files dtrace_providers probes_all.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER)
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
-
-DTRACEDIRS = . ../mysys $(patsubst %,$(top_builddir)/storage/%,@mysql_se_dirs@)
-
-probes_all.o: probes_mysql.d $(DTRACEFILES_DEPEND)
- providers=`(for i in $(DTRACEDIRS); do cat $$i/dtrace_providers 2>/dev/null; done) | tr " " "\n" | sort | uniq | sed -e '/^$$/d' -e 's/^/-s /'`; \
- objects=`for i in $(DTRACEDIRS); do f=\`cat $$i/dtrace_files 2>/dev/null\`; for j in $$f; do test -f $$i/$$j && echo "$$i/$$j "; done; done`; \
- $(DTRACE) $(DTRACEFLAGS) -G $$providers $$objects -o $@
-
-# Can't depend directly on .libs/*.o, because there is no generated rule for
-# that in the Makefile; it is a byproduct of *.lo
-probes_libndb.o: probes_mysql.d libndb_la-ha_ndbcluster.lo
- if test -f .libs/libndb_la-ha_ndbcluster.o ; then \
- $(DTRACE) $(DTRACEFLAGS) -G -s probes_mysql.d .libs/libndb_la-ha_ndbcluster.o -o $@; \
- fi; \
- if test -f libndb_la-ha_ndbcluster.o ; then \
- $(DTRACE) $(DTRACEFLAGS) -G -s probes_mysql.d libndb_la-ha_ndbcluster.o -o $@; \
- fi
-
-endif
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index 74e5b2c70f3..4f353597d6d 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1691,7 +1691,7 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
if (action->execute)
{
- const char *old_proc_info;
+ const char *UNINIT_VAR(old_proc_info);
action->execute--;
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 52c509621ac..ef14a061677 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -290,7 +290,6 @@ Event_basic::load_time_zone(THD *thd, const LEX_STRING tz_name)
*/
Event_queue_element::Event_queue_element():
- status_changed(FALSE), last_executed_changed(FALSE),
on_completion(Event_parse_data::ON_COMPLETION_DROP),
status(Event_parse_data::ENABLED), expression(0), dropped(FALSE),
execution_count(0)
@@ -539,7 +538,6 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
TIME_NO_ZERO_DATE);
last_executed= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
- last_executed_changed= FALSE;
if ((ptr= get_field(&mem_root, table->field[ET_FIELD_STATUS])) == NullS)
DBUG_RETURN(TRUE);
@@ -935,7 +933,6 @@ Event_queue_element::compute_next_execution_time()
DBUG_PRINT("info",("One-time event will be dropped: %d.", dropped));
status= Event_parse_data::DISABLED;
- status_changed= TRUE;
}
goto ret;
}
@@ -955,7 +952,6 @@ Event_queue_element::compute_next_execution_time()
dropped= TRUE;
DBUG_PRINT("info", ("Dropped: %d", dropped));
status= Event_parse_data::DISABLED;
- status_changed= TRUE;
goto ret;
}
@@ -1018,7 +1014,6 @@ Event_queue_element::compute_next_execution_time()
if (on_completion == Event_parse_data::ON_COMPLETION_DROP)
dropped= TRUE;
status= Event_parse_data::DISABLED;
- status_changed= TRUE;
}
else
{
@@ -1108,7 +1103,6 @@ Event_queue_element::compute_next_execution_time()
execute_at= 0;
execute_at_null= TRUE;
status= Event_parse_data::DISABLED;
- status_changed= TRUE;
if (on_completion == Event_parse_data::ON_COMPLETION_DROP)
dropped= TRUE;
}
@@ -1144,50 +1138,11 @@ void
Event_queue_element::mark_last_executed(THD *thd)
{
last_executed= (my_time_t) thd->query_start();
- last_executed_changed= TRUE;
execution_count++;
}
-/*
- Saves status and last_executed_at to the disk if changed.
-
- SYNOPSIS
- Event_queue_element::update_timing_fields()
- thd - thread context
-
- RETURN VALUE
- FALSE OK
- TRUE Error while opening mysql.event for writing or during
- write on disk
-*/
-
-bool
-Event_queue_element::update_timing_fields(THD *thd)
-{
- Event_db_repository *db_repository= Events::get_db_repository();
- int ret;
-
- DBUG_ENTER("Event_queue_element::update_timing_fields");
-
- DBUG_PRINT("enter", ("name: %*s", (int) name.length, name.str));
-
- /* No need to update if nothing has changed */
- if (!(status_changed || last_executed_changed))
- DBUG_RETURN(0);
-
- ret= db_repository->update_timing_fields_for_event(thd,
- dbname, name,
- last_executed_changed,
- last_executed,
- status_changed,
- (ulonglong) status);
- last_executed_changed= status_changed= FALSE;
- DBUG_RETURN(ret);
-}
-
-
static
void
append_datetime(String *buf, Time_zone *time_zone, my_time_t secs,
@@ -1526,7 +1481,7 @@ end:
thd->end_statement();
thd->cleanup_after_query();
/* Avoid races with SHOW PROCESSLIST */
- thd->set_query(NULL, 0);
+ thd->reset_query();
DBUG_PRINT("info", ("EXECUTED %s.%s ret: %d", dbname.str, name.str, ret));
diff --git a/sql/event_data_objects.h b/sql/event_data_objects.h
index 9d17213bcb8..46740812d31 100644
--- a/sql/event_data_objects.h
+++ b/sql/event_data_objects.h
@@ -82,10 +82,6 @@ protected:
class Event_queue_element : public Event_basic
{
-protected:
- bool status_changed;
- bool last_executed_changed;
-
public:
int on_completion;
int status;
@@ -117,9 +113,6 @@ public:
void
mark_last_executed(THD *thd);
-
- bool
- update_timing_fields(THD *thd);
};
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index db508e4ea41..053558aa0c3 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -622,6 +622,12 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
TABLE *table= NULL;
sp_head *sp= thd->lex->sphead;
ulong saved_mode= thd->variables.sql_mode;
+ /*
+ Take a savepoint to release only the lock on mysql.event
+ table at the end but keep the global read lock and
+ possible other locks taken by the caller.
+ */
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("Event_db_repository::create_event");
@@ -699,8 +705,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
ret= 0;
end:
- if (table)
- close_mysql_tables(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode;
DBUG_RETURN(test(ret));
@@ -734,6 +740,12 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
TABLE *table= NULL;
sp_head *sp= thd->lex->sphead;
ulong saved_mode= thd->variables.sql_mode;
+ /*
+ Take a savepoint to release only the lock on mysql.event
+ table at the end but keep the global read lock and
+ possible other locks taken by the caller.
+ */
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
int ret= 1;
DBUG_ENTER("Event_db_repository::update_event");
@@ -811,8 +823,8 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
ret= 0;
end:
- if (table)
- close_mysql_tables(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode;
DBUG_RETURN(test(ret));
@@ -838,6 +850,12 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
bool drop_if_exists)
{
TABLE *table= NULL;
+ /*
+ Take a savepoint to release only the lock on mysql.event
+ table at the end but keep the global read lock and
+ possible other locks taken by the caller.
+ */
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
int ret= 1;
DBUG_ENTER("Event_db_repository::drop_event");
@@ -866,8 +884,8 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
ret= 0;
end:
- if (table)
- close_mysql_tables(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
DBUG_RETURN(test(ret));
}
@@ -940,7 +958,7 @@ Event_db_repository::drop_schema_events(THD *thd, LEX_STRING schema)
TABLE *table= NULL;
READ_RECORD read_record_info;
enum enum_events_table_field field= ET_FIELD_DB;
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("Event_db_repository::drop_schema_events");
DBUG_PRINT("enter", ("field=%d schema=%s", field, schema.str));
@@ -1042,15 +1060,14 @@ Event_db_repository::
update_timing_fields_for_event(THD *thd,
LEX_STRING event_db_name,
LEX_STRING event_name,
- bool update_last_executed,
my_time_t last_executed,
- bool update_status,
ulonglong status)
{
TABLE *table= NULL;
Field **fields;
int ret= 1;
bool save_binlog_row_based;
+ MYSQL_TIME time;
DBUG_ENTER("Event_db_repository::update_timing_fields_for_event");
@@ -1075,20 +1092,12 @@ update_timing_fields_for_event(THD *thd,
/* Don't update create on row update. */
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
- if (update_last_executed)
- {
- MYSQL_TIME time;
- my_tz_OFFSET0->gmt_sec_to_TIME(&time, last_executed);
+ my_tz_OFFSET0->gmt_sec_to_TIME(&time, last_executed);
+ fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
+ fields[ET_FIELD_LAST_EXECUTED]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
- fields[ET_FIELD_LAST_EXECUTED]->store_time(&time,
- MYSQL_TIMESTAMP_DATETIME);
- }
- if (update_status)
- {
- fields[ET_FIELD_STATUS]->set_notnull();
- fields[ET_FIELD_STATUS]->store(status, TRUE);
- }
+ fields[ET_FIELD_STATUS]->set_notnull();
+ fields[ET_FIELD_STATUS]->store(status, TRUE);
if ((ret= table->file->ha_update_row(table->record[1], table->record[0])))
{
diff --git a/sql/event_db_repository.h b/sql/event_db_repository.h
index ea7f3bbac0e..58484d17f06 100644
--- a/sql/event_db_repository.h
+++ b/sql/event_db_repository.h
@@ -101,9 +101,7 @@ public:
update_timing_fields_for_event(THD *thd,
LEX_STRING event_db_name,
LEX_STRING event_name,
- bool update_last_executed,
my_time_t last_executed,
- bool update_status,
ulonglong status);
public:
static bool
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index f0310c676d1..bdc8fa258a8 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -17,6 +17,8 @@
#include "unireg.h"
#include "event_queue.h"
#include "event_data_objects.h"
+#include "event_db_repository.h"
+#include "events.h"
#include "sql_audit.h"
#include "tztime.h" // my_tz_find, my_tz_OFFSET0, struct Time_zone
#include "log.h" // sql_print_error
@@ -444,7 +446,6 @@ Event_queue::recalculate_activation_times(THD *thd)
for (i= 0; i < queue.elements; i++)
{
((Event_queue_element*)queue_element(&queue, i))->compute_next_execution_time();
- ((Event_queue_element*)queue_element(&queue, i))->update_timing_fields(thd);
}
queue_fix(&queue);
/*
@@ -567,6 +568,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
{
bool ret= FALSE;
*event_name= NULL;
+ my_time_t UNINIT_VAR(last_executed);
+ int UNINIT_VAR(status);
DBUG_ENTER("Event_queue::get_top_for_execution_if_time");
LOCK_QUEUE_DATA();
@@ -632,8 +635,14 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
top->execution_count++;
(*event_name)->dropped= top->dropped;
+ /*
+ Save new values of last_executed timestamp and event status on stack
+ in order to be able to update event description in system table once
+ QUEUE_DATA lock is released.
+ */
+ last_executed= top->last_executed;
+ status= top->status;
- top->update_timing_fields(thd);
if (top->status == Event_parse_data::DISABLED)
{
DBUG_PRINT("info", ("removing from the queue"));
@@ -656,9 +665,16 @@ end:
ret, (long) *event_name));
if (*event_name)
+ {
DBUG_PRINT("info", ("db: %s name: %s",
(*event_name)->dbname.str, (*event_name)->name.str));
+ Event_db_repository *db_repository= Events::get_db_repository();
+ (void) db_repository->update_timing_fields_for_event(thd,
+ (*event_name)->dbname, (*event_name)->name,
+ last_executed, (ulonglong) status);
+ }
+
DBUG_RETURN(ret);
}
@@ -741,11 +757,13 @@ Event_queue::cond_wait(THD *thd, struct timespec *abstime, const char* msg,
thd->enter_cond(&COND_queue_state, &LOCK_event_queue, msg);
- DBUG_PRINT("info", ("mysql_cond_%swait", abstime? "timed":""));
- if (!abstime)
- mysql_cond_wait(&COND_queue_state, &LOCK_event_queue);
- else
- mysql_cond_timedwait(&COND_queue_state, &LOCK_event_queue, abstime);
+ if (!thd->killed)
+ {
+ if (!abstime)
+ mysql_cond_wait(&COND_queue_state, &LOCK_event_queue);
+ else
+ mysql_cond_timedwait(&COND_queue_state, &LOCK_event_queue, abstime);
+ }
mutex_last_locked_in_func= func;
mutex_last_locked_at_line= line;
diff --git a/sql/events.cc b/sql/events.cc
index e7e47801586..23a0dc9eb52 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -30,6 +30,7 @@
#include "event_scheduler.h"
#include "sp_head.h" // for Stored_program_creation_ctx
#include "set_var.h"
+#include "lock.h" // lock_object_name
/**
@addtogroup Event_Scheduler
@@ -77,7 +78,6 @@ Event_queue *Events::event_queue;
Event_scheduler *Events::scheduler;
Event_db_repository *Events::db_repository;
ulong Events::opt_event_scheduler= Events::EVENTS_OFF;
-mysql_mutex_t Events::LOCK_event_metadata;
bool Events::check_system_tables_error= FALSE;
@@ -340,7 +340,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row();
- mysql_mutex_lock(&LOCK_event_metadata);
+ if (lock_object_name(thd, MDL_key::EVENT,
+ parse_data->dbname.str, parse_data->name.str))
+ DBUG_RETURN(TRUE);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)))
@@ -388,7 +390,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
}
}
}
- mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -472,7 +473,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row();
- mysql_mutex_lock(&LOCK_event_metadata);
+ if (lock_object_name(thd, MDL_key::EVENT,
+ parse_data->dbname.str, parse_data->name.str))
+ DBUG_RETURN(TRUE);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->update_event(thd, parse_data,
@@ -502,7 +505,6 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
ret= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
}
- mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -556,7 +558,9 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row();
- mysql_mutex_lock(&LOCK_event_metadata);
+ if (lock_object_name(thd, MDL_key::EVENT,
+ dbname.str, name.str))
+ DBUG_RETURN(TRUE);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists)))
{
@@ -566,7 +570,6 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
DBUG_ASSERT(thd->query() && thd->query_length());
ret= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
- mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -595,15 +598,12 @@ Events::drop_schema_events(THD *thd, char *db)
DBUG_PRINT("enter", ("dropping events from %s", db));
/*
- sic: no check if the scheduler is disabled or system tables
+ Sic: no check if the scheduler is disabled or system tables
are damaged, as intended.
*/
-
- mysql_mutex_lock(&LOCK_event_metadata);
if (event_queue)
event_queue->drop_schema_events(thd, db_lex);
db_repository->drop_schema_events(thd, db_lex);
- mysql_mutex_unlock(&LOCK_event_metadata);
DBUG_VOID_RETURN;
}
@@ -915,12 +915,11 @@ Events::deinit()
}
#ifdef HAVE_PSI_INTERFACE
-PSI_mutex_key key_LOCK_event_metadata, key_LOCK_event_queue,
+PSI_mutex_key key_LOCK_event_queue,
key_event_scheduler_LOCK_scheduler_state;
static PSI_mutex_info all_events_mutexes[]=
{
- { &key_LOCK_event_metadata, "LOCK_event_metadata", PSI_FLAG_GLOBAL},
{ &key_LOCK_event_queue, "LOCK_event_queue", PSI_FLAG_GLOBAL},
{ &key_event_scheduler_LOCK_scheduler_state, "Event_scheduler::LOCK_scheduler_state", PSI_FLAG_GLOBAL}
};
@@ -974,23 +973,6 @@ Events::init_mutexes()
#ifdef HAVE_PSI_INTERFACE
init_events_psi_keys();
#endif
-
- mysql_mutex_init(key_LOCK_event_metadata,
- &LOCK_event_metadata, MY_MUTEX_INIT_FAST);
-}
-
-
-/*
- Destroys Events mutexes
-
- SYNOPSIS
- Events::destroy_mutexes()
-*/
-
-void
-Events::destroy_mutexes()
-{
- mysql_mutex_destroy(&LOCK_event_metadata);
}
diff --git a/sql/events.h b/sql/events.h
index f3ebc6da4ad..a337b29049a 100644
--- a/sql/events.h
+++ b/sql/events.h
@@ -26,8 +26,7 @@
*/
#ifdef HAVE_PSI_INTERFACE
-extern PSI_mutex_key key_LOCK_event_metadata,
- key_event_scheduler_LOCK_scheduler_state;
+extern PSI_mutex_key key_event_scheduler_LOCK_scheduler_state;
extern PSI_cond_key key_event_scheduler_COND_state;
extern PSI_thread_key key_thread_event_scheduler, key_thread_event_worker;
#endif /* HAVE_PSI_INTERFACE */
@@ -79,7 +78,6 @@ public:
enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED };
/* Protected using LOCK_global_system_variables only. */
static ulong opt_event_scheduler;
- static mysql_mutex_t LOCK_event_metadata;
static bool check_if_system_tables_error();
static bool start();
static bool stop();
diff --git a/sql/field.cc b/sql/field.cc
index be7441f6bfd..e5cae9ea8e3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4189,7 +4189,7 @@ String *Field_float::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
ASSERT_COLUMN_MARKED_FOR_READ;
- DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH);
+ DBUG_ASSERT(!zerofill || field_length <= MAX_FIELD_CHARLENGTH);
float nr;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@@ -4512,7 +4512,7 @@ String *Field_double::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
ASSERT_COLUMN_MARKED_FOR_READ;
- DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH);
+ DBUG_ASSERT(!zerofill || field_length <= MAX_FIELD_CHARLENGTH);
double nr;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@@ -6327,10 +6327,13 @@ int Field_str::store(double nr)
ASSERT_COLUMN_MARKED_FOR_WRITE;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint local_char_length= field_length / charset()->mbmaxlen;
- size_t length;
- my_bool error;
+ size_t length= 0;
+ my_bool error= (local_char_length == 0);
+
+ // my_gcvt() requires width > 0, and we may have a CHAR(0) column.
+ if (!error)
+ length= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error);
- length= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error);
if (error)
{
if (table->in_use->abort_on_warning)
@@ -7725,12 +7728,6 @@ void Field_blob::sql_type(String &res) const
uchar *Field_blob::pack(uchar *to, const uchar *from,
uint max_length, bool low_byte_first)
{
- DBUG_ENTER("Field_blob::pack");
- DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx;"
- " max_length: %u; low_byte_first: %d",
- (ulong) to, (ulong) from,
- max_length, low_byte_first));
- DBUG_DUMP("record", from, table->s->reclength);
uchar *save= ptr;
ptr= (uchar*) from;
uint32 length=get_length(); // Length of from string
@@ -7751,8 +7748,7 @@ uchar *Field_blob::pack(uchar *to, const uchar *from,
memcpy(to+packlength, from,length);
}
ptr=save; // Restore org row pointer
- DBUG_DUMP("packed", to, packlength + length);
- DBUG_RETURN(to+packlength+length);
+ return to+packlength+length;
}
@@ -8396,6 +8392,54 @@ uint Field_enum::is_equal(Create_field *new_field)
}
+uchar *Field_enum::pack(uchar *to, const uchar *from,
+ uint max_length, bool low_byte_first)
+{
+ DBUG_ENTER("Field_enum::pack");
+ DBUG_PRINT("debug", ("packlength: %d", packlength));
+ DBUG_DUMP("from", from, packlength);
+
+ switch (packlength)
+ {
+ case 1:
+ *to = *from;
+ DBUG_RETURN(to + 1);
+ case 2: DBUG_RETURN(pack_int16(to, from, low_byte_first));
+ case 3: DBUG_RETURN(pack_int24(to, from, low_byte_first));
+ case 4: DBUG_RETURN(pack_int32(to, from, low_byte_first));
+ case 8: DBUG_RETURN(pack_int64(to, from, low_byte_first));
+ default:
+ DBUG_ASSERT(0);
+ }
+ MY_ASSERT_UNREACHABLE();
+ DBUG_RETURN(NULL);
+}
+
+const uchar *Field_enum::unpack(uchar *to, const uchar *from,
+ uint param_data, bool low_byte_first)
+{
+ DBUG_ENTER("Field_enum::unpack");
+ DBUG_PRINT("debug", ("packlength: %d", packlength));
+ DBUG_DUMP("from", from, packlength);
+
+ switch (packlength)
+ {
+ case 1:
+ *to = *from;
+ DBUG_RETURN(from + 1);
+
+ case 2: DBUG_RETURN(unpack_int16(to, from, low_byte_first));
+ case 3: DBUG_RETURN(unpack_int24(to, from, low_byte_first));
+ case 4: DBUG_RETURN(unpack_int32(to, from, low_byte_first));
+ case 8: DBUG_RETURN(unpack_int64(to, from, low_byte_first));
+ default:
+ DBUG_ASSERT(0);
+ }
+ MY_ASSERT_UNREACHABLE();
+ DBUG_RETURN(NULL);
+}
+
+
/**
@return
returns 1 if the fields are equally defined
diff --git a/sql/field.h b/sql/field.h
index 7b250c34fe4..e3db95260c3 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -554,6 +554,48 @@ private:
{ return 0; }
protected:
+ static void handle_int16(uchar *to, const uchar *from,
+ bool low_byte_first_from, bool low_byte_first_to)
+ {
+ int16 val;
+#ifdef WORDS_BIGENDIAN
+ if (low_byte_first_from)
+ val = sint2korr(from);
+ else
+#endif
+ shortget(val, from);
+
+#ifdef WORDS_BIGENDIAN
+ if (low_byte_first_to)
+ int2store(to, val);
+ else
+#endif
+ shortstore(to, val);
+ }
+
+ static void handle_int24(uchar *to, const uchar *from,
+ bool low_byte_first_from, bool low_byte_first_to)
+ {
+ int32 val;
+#ifdef WORDS_BIGENDIAN
+ if (low_byte_first_from)
+ val = sint3korr(from);
+ else
+#endif
+ val= (from[0] << 16) + (from[1] << 8) + from[2];
+
+#ifdef WORDS_BIGENDIAN
+ if (low_byte_first_to)
+ int2store(to, val);
+ else
+#endif
+ {
+ to[0]= 0xFF & (val >> 16);
+ to[1]= 0xFF & (val >> 8);
+ to[2]= 0xFF & val;
+ }
+ }
+
/*
Helper function to pack()/unpack() int32 values
*/
@@ -598,6 +640,32 @@ protected:
longlongstore(to, val);
}
+ uchar *pack_int16(uchar *to, const uchar *from, bool low_byte_first_to)
+ {
+ handle_int16(to, from, table->s->db_low_byte_first, low_byte_first_to);
+ return to + sizeof(int16);
+ }
+
+ const uchar *unpack_int16(uchar* to, const uchar *from,
+ bool low_byte_first_from)
+ {
+ handle_int16(to, from, low_byte_first_from, table->s->db_low_byte_first);
+ return from + sizeof(int16);
+ }
+
+ uchar *pack_int24(uchar *to, const uchar *from, bool low_byte_first_to)
+ {
+ handle_int24(to, from, table->s->db_low_byte_first, low_byte_first_to);
+ return to + 3;
+ }
+
+ const uchar *unpack_int24(uchar* to, const uchar *from,
+ bool low_byte_first_from)
+ {
+ handle_int24(to, from, low_byte_first_from, table->s->db_low_byte_first);
+ return from + 3;
+ }
+
uchar *pack_int32(uchar *to, const uchar *from, bool low_byte_first_to)
{
handle_int32(to, from, table->s->db_low_byte_first, low_byte_first_to);
@@ -678,6 +746,17 @@ public:
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset);
Item_result result_type () const { return STRING_RESULT; }
+ /*
+ match_collation_to_optimize_range() is to distinguish in
+ range optimizer (see opt_range.cc) between real string types:
+ CHAR, VARCHAR, TEXT
+ and the other string-alike types with result_type() == STRING_RESULT:
+ DATE, TIME, DATETIME, TIMESTAMP
+ We need it to decide whether to test if collation of the operation
+ matches collation of the field (needed only for real string types).
+ QQ: shouldn't DATE/TIME types have their own XXX_RESULT types eventually?
+ */
+ virtual bool match_collation_to_optimize_range() const=0;
uint decimals() const { return NOT_FIXED_DEC; }
int store(double nr);
int store(longlong nr, bool unsigned_val)=0;
@@ -918,41 +997,13 @@ public:
virtual uchar *pack(uchar* to, const uchar *from,
uint max_length, bool low_byte_first)
{
- int16 val;
-#ifdef WORDS_BIGENDIAN
- if (table->s->db_low_byte_first)
- val = sint2korr(from);
- else
-#endif
- shortget(val, from);
-
-#ifdef WORDS_BIGENDIAN
- if (low_byte_first)
- int2store(to, val);
- else
-#endif
- shortstore(to, val);
- return to + sizeof(val);
+ return pack_int16(to, from, low_byte_first);
}
virtual const uchar *unpack(uchar* to, const uchar *from,
uint param_data, bool low_byte_first)
{
- int16 val;
-#ifdef WORDS_BIGENDIAN
- if (low_byte_first)
- val = sint2korr(from);
- else
-#endif
- shortget(val, from);
-
-#ifdef WORDS_BIGENDIAN
- if (table->s->db_low_byte_first)
- int2store(to, val);
- else
-#endif
- shortstore(to, val);
- return from + sizeof(val);
+ return unpack_int16(to, from, low_byte_first);
}
};
@@ -1187,6 +1238,7 @@ public:
unireg_check_arg, field_name_arg, cs)
{}
enum_field_types type() const { return MYSQL_TYPE_NULL;}
+ bool match_collation_to_optimize_range() const { return FALSE; }
int store(const char *to, uint length, CHARSET_INFO *cs)
{ null[0]=1; return 0; }
int store(double nr) { null[0]=1; return 0; }
@@ -1216,6 +1268,7 @@ public:
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs);
enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
+ bool match_collation_to_optimize_range() const { return FALSE; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
@@ -1320,6 +1373,7 @@ public:
:Field_str((uchar*) 0, MAX_DATE_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
enum_field_types type() const { return MYSQL_TYPE_DATE;}
+ bool match_collation_to_optimize_range() const { return FALSE; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
@@ -1369,6 +1423,7 @@ public:
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
enum_field_types type() const { return MYSQL_TYPE_DATE;}
enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
+ bool match_collation_to_optimize_range() const { return FALSE; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
@@ -1408,6 +1463,7 @@ public:
:Field_str((uchar*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
enum_field_types type() const { return MYSQL_TYPE_TIME;}
+ bool match_collation_to_optimize_range() const { return FALSE; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
@@ -1447,6 +1503,7 @@ public:
:Field_str((uchar*) 0, MAX_DATETIME_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
+ bool match_collation_to_optimize_range() const { return FALSE; }
#ifdef HAVE_LONG_LONG
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
#endif
@@ -1515,6 +1572,7 @@ public:
orig_table->s->frm_version < FRM_VER_TRUE_VARCHAR ?
MYSQL_TYPE_VAR_STRING : MYSQL_TYPE_STRING);
}
+ bool match_collation_to_optimize_range() const { return TRUE; }
enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; }
bool zero_pack() const { return 0; }
@@ -1595,6 +1653,7 @@ public:
}
enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
+ bool match_collation_to_optimize_range() const { return TRUE; }
enum ha_base_keytype key_type() const;
uint row_pack_length() { return field_length; }
bool zero_pack() const { return 0; }
@@ -1690,6 +1749,7 @@ public:
:Field_longstr((uchar*) 0, 0, (uchar*) "", 0, NONE, "temp", system_charset_info),
packlength(packlength_arg) {}
enum_field_types type() const { return MYSQL_TYPE_BLOB;}
+ bool match_collation_to_optimize_range() const { return TRUE; }
enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
int store(const char *to,uint length,CHARSET_INFO *charset);
@@ -1839,6 +1899,7 @@ public:
{ geom_type= geom_type_arg; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; }
+ bool match_collation_to_optimize_range() const { return FALSE; }
void sql_type(String &str) const;
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr);
@@ -1870,6 +1931,7 @@ public:
}
Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
enum_field_types type() const { return MYSQL_TYPE_STRING; }
+ bool match_collation_to_optimize_range() const { return FALSE; }
enum Item_result cmp_type () const { return INT_RESULT; }
enum Item_result cast_to_int_type () const { return INT_RESULT; }
enum ha_base_keytype key_type() const;
@@ -1895,6 +1957,12 @@ public:
bool has_charset(void) const { return TRUE; }
/* enum and set are sorted as integers */
CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
+
+ virtual uchar *pack(uchar *to, const uchar *from,
+ uint max_length, bool low_byte_first);
+ virtual const uchar *unpack(uchar *to, const uchar *from,
+ uint param_data, bool low_byte_first);
+
private:
int do_save_field_metadata(uchar *first_byte);
uint is_equal(Create_field *new_field);
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index ea6ff82e0aa..20c647ccc00 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -787,11 +787,8 @@ int field_conv(Field *to,Field *from)
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes))
{ // Identical fields
-#ifdef HAVE_purify
- /* This may happen if one does 'UPDATE ... SET x=x' */
- if (to->ptr != from->ptr)
-#endif
- memcpy(to->ptr,from->ptr,to->pack_length());
+ // to->ptr==from->ptr may happen if one does 'UPDATE ... SET x=x'
+ memmove(to->ptr, from->ptr, to->pack_length());
return 0;
}
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index bc0f2258a0a..20745db9ce9 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -6435,8 +6435,8 @@ void ha_ndbcluster::get_auto_increment(ulonglong offset, ulonglong increment,
for (;;)
{
Ndb_tuple_id_range_guard g(m_share);
- if (m_skip_auto_increment &&
- ndb->readAutoIncrementValue(m_table, g.range, auto_value) ||
+ if ((m_skip_auto_increment &&
+ ndb->readAutoIncrementValue(m_table, g.range, auto_value)) ||
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size, increment, offset))
{
if (--retries &&
@@ -7382,38 +7382,35 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
}
/*
+ Delete old files.
+
ndbcluster_find_files() may be called from I_S code and ndbcluster_binlog
thread in situations when some tables are already open. This means that
code below will try to obtain exclusive metadata lock on some table
- while holding shared meta-data lock on other tables. This might lead to
- a deadlock, and therefore is disallowed by assertions of the metadata
- locking subsystem. This is violation of metadata
- locking protocol which has to be closed ASAP.
+ while holding shared meta-data lock on other tables. This might lead to a
+ deadlock but such a deadlock should be detected by MDL deadlock detector.
+
XXX: the scenario described above is not covered with any test.
*/
- if (!global_read_lock)
- {
- // Delete old files
- List_iterator_fast<char> it3(delete_list);
- while ((file_name_str= it3++))
- {
- DBUG_PRINT("info", ("Remove table %s/%s", db, file_name_str));
- // Delete the table and all related files
- TABLE_LIST table_list;
- 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 */
- FALSE, /* drop_view */
- TRUE /* dont_log_query*/);
- trans_commit_implicit(thd); /* Safety, should be unnecessary. */
- thd->mdl_context.release_transactional_locks();
- /* Clear error message that is returned when table is deleted */
- thd->clear_error();
- }
+ List_iterator_fast<char> it3(delete_list);
+ while ((file_name_str= it3++))
+ {
+ DBUG_PRINT("info", ("Remove table %s/%s", db, file_name_str));
+ /* Delete the table and all related files. */
+ TABLE_LIST table_list;
+ 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 */
+ FALSE, /* drop_view */
+ TRUE /* dont_log_query*/);
+ trans_commit_implicit(thd); /* Safety, should be unnecessary. */
+ thd->mdl_context.release_transactional_locks();
+ /* Clear error message that is returned when table is deleted */
+ thd->clear_error();
}
/* Lock mutex before creating .FRM files. */
@@ -10271,8 +10268,8 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
{
Field *field= table->field[i];
const NDBCOL *col= tab->getColumn(i);
- if (col->getStorageType() == NDB_STORAGETYPE_MEMORY && create_info->storage_media != HA_SM_MEMORY ||
- col->getStorageType() == NDB_STORAGETYPE_DISK && create_info->storage_media != HA_SM_DISK)
+ if ((col->getStorageType() == NDB_STORAGETYPE_MEMORY && create_info->storage_media != HA_SM_MEMORY) ||
+ (col->getStorageType() == NDB_STORAGETYPE_DISK && create_info->storage_media != HA_SM_DISK))
{
DBUG_PRINT("info", ("Column storage media is changed"));
DBUG_RETURN(COMPATIBLE_DATA_NO);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 3d8d5ae9eb8..f4e240e5cc1 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3093,7 +3093,9 @@ int ha_partition::write_row(uchar * buf)
bool have_auto_increment= table->next_number_field && buf == table->record[0];
my_bitmap_map *old_map;
THD *thd= ha_thd();
- timestamp_auto_set_type orig_timestamp_type= table->timestamp_field_type;
+ timestamp_auto_set_type saved_timestamp_type= table->timestamp_field_type;
+ ulong saved_sql_mode= thd->variables.sql_mode;
+ bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null;
#ifdef NOT_NEEDED
uchar *rec0= m_rec0;
#endif
@@ -3129,6 +3131,22 @@ int ha_partition::write_row(uchar * buf)
*/
if (error)
goto exit;
+
+ /*
+ Don't allow generation of auto_increment value the partitions handler.
+ If a partitions handler would change the value, then it might not
+ match the partition any longer.
+ This can occur if 'SET INSERT_ID = 0; INSERT (NULL)',
+ So allow this by adding 'MODE_NO_AUTO_VALUE_ON_ZERO' to sql_mode.
+ The partitions handler::next_insert_id must always be 0. Otherwise
+ we need to forward release_auto_increment, or reset it for all
+ partitions.
+ */
+ if (table->next_number_field->val_int() == 0)
+ {
+ table->auto_increment_field_not_null= TRUE;
+ thd->variables.sql_mode|= MODE_NO_AUTO_VALUE_ON_ZERO;
+ }
}
old_map= dbug_tmp_use_all_columns(table, table->read_set);
@@ -3162,7 +3180,9 @@ int ha_partition::write_row(uchar * buf)
set_auto_increment_if_higher(table->next_number_field);
reenable_binlog(thd);
exit:
- table->timestamp_field_type= orig_timestamp_type;
+ thd->variables.sql_mode= saved_sql_mode;
+ table->auto_increment_field_not_null= saved_auto_inc_field_not_null;
+ table->timestamp_field_type= saved_timestamp_type;
DBUG_RETURN(error);
}
@@ -3229,11 +3249,24 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
}
else
{
+ Field *saved_next_number_field= table->next_number_field;
+ /*
+ Don't allow generation of auto_increment value for update.
+ table->next_number_field is never set on UPDATE.
+ But is set for INSERT ... ON DUPLICATE KEY UPDATE,
+ and since update_row() does not generate or update an auto_inc value,
+ we cannot have next_number_field set when moving a row
+ to another partition with write_row(), since that could
+ generate/update the auto_inc value.
+ This gives the same behavior for partitioned vs non partitioned tables.
+ */
+ table->next_number_field= NULL;
DBUG_PRINT("info", ("Update from partition %d to partition %d",
old_part_id, new_part_id));
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
error= m_file[new_part_id]->ha_write_row(new_data);
reenable_binlog(thd);
+ table->next_number_field= saved_next_number_field;
if (error)
goto exit;
@@ -4392,8 +4425,12 @@ int ha_partition::index_read_idx_map(uchar *buf, uint index,
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);
+ /*
+ We have either found exactly 1 partition
+ (in which case start_part == end_part)
+ or no matching partitions (start_part > end_part)
+ */
+ 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++)
{
@@ -4628,6 +4665,7 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
key not found.
*/
DBUG_PRINT("info", ("scan with no partition to scan"));
+ table->status= STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
if (m_part_spec.start_part == m_part_spec.end_part)
@@ -4652,6 +4690,7 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
if (start_part == MY_BIT_NONE)
{
DBUG_PRINT("info", ("scan with no partition to scan"));
+ table->status= STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
if (start_part > m_part_spec.start_part)
@@ -6375,9 +6414,42 @@ bool ha_partition::get_error_message(int error, String *buf)
*/
uint ha_partition::alter_table_flags(uint flags)
{
+ uint flags_to_return, flags_to_check;
DBUG_ENTER("ha_partition::alter_table_flags");
- DBUG_RETURN(ht->alter_table_flags(flags) |
- m_file[0]->alter_table_flags(flags));
+
+ flags_to_return= ht->alter_table_flags(flags);
+ flags_to_return|= m_file[0]->alter_table_flags(flags);
+
+ /*
+ If one partition fails we must be able to revert the change for the other,
+ already altered, partitions. So both ADD and DROP can only be supported in
+ pairs.
+ */
+ flags_to_check= HA_ONLINE_ADD_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_PK_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_PK_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ DBUG_RETURN(flags_to_return);
}
@@ -6412,6 +6484,7 @@ int ha_partition::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)
handler **file;
int ret= 0;
+ DBUG_ENTER("ha_partition::add_index");
/*
There has already been a check in fix_partition_func in mysql_alter_table
before this call, which checks for unique/primary key violations of the
@@ -6419,8 +6492,28 @@ int ha_partition::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)
*/
for (file= m_file; *file; file++)
if ((ret= (*file)->add_index(table_arg, key_info, num_of_keys)))
- break;
- return ret;
+ goto err;
+ DBUG_RETURN(ret);
+err:
+ if (file > m_file)
+ {
+ uint *key_numbers= (uint*) ha_thd()->alloc(sizeof(uint) * num_of_keys);
+ uint old_num_of_keys= table_arg->s->keys;
+ uint i;
+ /* The newly created keys have the last id's */
+ for (i= 0; i < num_of_keys; i++)
+ key_numbers[i]= i + old_num_of_keys;
+ if (!table_arg->key_info)
+ table_arg->key_info= key_info;
+ while (--file >= m_file)
+ {
+ (void) (*file)->prepare_drop_index(table_arg, key_numbers, num_of_keys);
+ (void) (*file)->final_drop_index(table_arg);
+ }
+ if (table_arg->key_info == key_info)
+ table_arg->key_info= NULL;
+ }
+ DBUG_RETURN(ret);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index 1542dd99ec6..38b57c16ee0 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -29,8 +29,6 @@
#include "sql_cache.h" // query_cache, query_cache_*
#include "key.h" // key_copy, key_unpack, key_cmp_if_same, key_cmp
#include "sql_table.h" // build_table_filename
-#include "lock.h" // wait_if_global_read_lock,
- // start_waiting_global_read_lock
#include "sql_parse.h" // check_stack_overrun
#include "sql_acl.h" // SUPER_ACL
#include "sql_base.h" // free_io_cache
@@ -41,6 +39,7 @@
#include "transaction.h"
#include <errno.h>
#include "probes_mysql.h"
+#include "debug_sync.h" // DEBUG_SYNC
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
@@ -1155,8 +1154,9 @@ int ha_commit_trans(THD *thd, bool all)
{
uint rw_ha_count;
bool rw_trans;
+ MDL_request mdl_request;
- DBUG_EXECUTE_IF("crash_commit_before", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_commit_before", DBUG_SUICIDE(););
/* Close all cursors that can not survive COMMIT */
if (is_real_trans) /* not a statement commit */
@@ -1166,11 +1166,27 @@ int ha_commit_trans(THD *thd, bool all)
/* rw_trans is TRUE when we in a transaction changing data */
rw_trans= is_real_trans && (rw_ha_count > 0);
- if (rw_trans &&
- thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, FALSE))
+ if (rw_trans)
{
- ha_rollback_trans(thd, all);
- DBUG_RETURN(1);
+ /*
+ Acquire a metadata lock which will ensure that COMMIT is blocked
+ by an active FLUSH TABLES WITH READ LOCK (and vice versa:
+ COMMIT in progress blocks FTWRL).
+
+ We allow the owner of FTWRL to COMMIT; we assume that it knows
+ what it does.
+ */
+ mdl_request.init(MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_EXPLICIT);
+
+ if (thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout))
+ {
+ ha_rollback_trans(thd, all);
+ DBUG_RETURN(1);
+ }
+
+ DEBUG_SYNC(thd, "ha_commit_trans_after_acquire_commit_lock");
}
if (rw_trans &&
@@ -1208,7 +1224,7 @@ int ha_commit_trans(THD *thd, bool all)
}
status_var_increment(thd->status_var.ha_prepare_count);
}
- DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
if (error || (is_real_trans && xid &&
(error= !(cookie= tc_log->log_xid(thd, xid)))))
{
@@ -1216,17 +1232,25 @@ int ha_commit_trans(THD *thd, bool all)
error= 1;
goto end;
}
- DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_SUICIDE(););
}
error=ha_commit_one_phase(thd, all) ? (cookie ? 2 : 1) : 0;
- DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_SUICIDE(););
if (cookie)
tc_log->unlog(cookie, xid);
- DBUG_EXECUTE_IF("crash_commit_after", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
RUN_HOOK(transaction, after_commit, (thd, FALSE));
end:
- if (rw_trans)
- thd->global_read_lock.start_waiting_global_read_lock(thd);
+ if (rw_trans && mdl_request.ticket)
+ {
+ /*
+ We do not always immediately release transactional locks
+ after ha_commit_trans() (see uses of ha_enable_transaction()),
+ thus we release the commit blocker lock as soon as it's
+ not needed.
+ */
+ thd->mdl_context.release_lock(mdl_request.ticket);
+ }
}
/* Free resources and perform other cleanup even for 'empty' transactions. */
else if (is_real_trans)
@@ -4160,7 +4184,7 @@ int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
*/
int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
{
- int result;
+ int UNINIT_VAR(result);
DBUG_ENTER("handler::read_multi_range_next");
/* We should not be called after the last call returned EOF. */
diff --git a/sql/handler.h b/sql/handler.h
index 325df003215..0e03ea17dde 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -174,6 +174,8 @@
/*
These bits are set if different kinds of indexes can be created
off-line without re-create of the table (but with a table lock).
+ Partitioning needs both ADD and DROP to be supported by its underlying
+ handlers, due to error handling, see bug#57778.
*/
#define HA_ONLINE_ADD_INDEX_NO_WRITES (1L << 0) /*add index w/lock*/
#define HA_ONLINE_DROP_INDEX_NO_WRITES (1L << 1) /*drop index w/lock*/
diff --git a/sql/item.cc b/sql/item.cc
index b166f3e645f..8957e6e7133 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -226,8 +226,6 @@ bool Item::val_bool()
*/
String *Item::val_str_ascii(String *str)
{
- DBUG_ASSERT(fixed == 1);
-
if (!(collation.collation->state & MY_CS_NONASCII))
return val_str(str);
@@ -1853,11 +1851,12 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
*arg= conv;
else
thd->change_item_tree(arg, conv);
- /*
- We do not check conv->fixed, because Item_func_conv_charset which can
- be return by safe_charset_converter can't be fixed at creation
- */
- conv->fix_fields(thd, arg);
+
+ if (conv->fix_fields(thd, arg))
+ {
+ res= TRUE;
+ break; // we cannot return here, we need to restore "arena".
+ }
}
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -3458,19 +3457,16 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
str_value.charset());
collation.set(str_value.charset(), DERIVATION_COERCIBLE);
decimals= 0;
- param_type= MYSQL_TYPE_STRING;
break;
}
case REAL_RESULT:
set_double(arg->val_real());
- param_type= MYSQL_TYPE_DOUBLE;
break;
case INT_RESULT:
set_int(arg->val_int(), arg->max_length);
- param_type= MYSQL_TYPE_LONG;
break;
case DECIMAL_RESULT:
@@ -3482,8 +3478,6 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
return TRUE;
set_decimal(dv);
- param_type= MYSQL_TYPE_NEWDECIMAL;
-
break;
}
@@ -3515,6 +3509,7 @@ void
Item_param::set_out_param_info(Send_field *info)
{
m_out_param_info= info;
+ param_type= m_out_param_info->type;
}
@@ -3560,6 +3555,7 @@ void Item_param::make_field(Send_field *field)
field->org_table_name= m_out_param_info->org_table_name;
field->col_name= m_out_param_info->col_name;
field->org_col_name= m_out_param_info->org_col_name;
+
field->length= m_out_param_info->length;
field->charsetnr= m_out_param_info->charsetnr;
field->flags= m_out_param_info->flags;
@@ -5531,17 +5527,43 @@ static uint nr_of_decimals(const char *str, const char *end)
break;
}
decimal_point= str;
- for (; my_isdigit(system_charset_info, *str) ; str++)
+ for ( ; str < end && my_isdigit(system_charset_info, *str) ; str++)
;
- if (*str == 'e' || *str == 'E')
+ if (str < end && (*str == 'e' || *str == 'E'))
return NOT_FIXED_DEC;
+ /*
+ QQ:
+ The number of decimal digist in fact should be (str - decimal_point - 1).
+ But it seems the result of nr_of_decimals() is never used!
+
+ In case of 'e' and 'E' nr_of_decimals returns NOT_FIXED_DEC.
+ In case if there is no 'e' or 'E' parser code in sql_yacc.yy
+ never calls Item_float::Item_float() - it creates Item_decimal instead.
+
+ The only piece of code where we call Item_float::Item_float(str, len)
+ without having 'e' or 'E' is item_xmlfunc.cc, but this Item_float
+ never appears in metadata itself. Changing the code to return
+ (str - decimal_point - 1) does not make any changes in the test results.
+
+ This should be addressed somehow.
+ Looks like a reminder from before real DECIMAL times.
+ */
return (uint) (str - decimal_point);
}
/**
- This function is only called during parsing. We will signal an error if
- value is not a true double value (overflow)
+ This function is only called during parsing:
+ - when parsing SQL query from sql_yacc.yy
+ - when parsing XPath query from item_xmlfunc.cc
+ We will signal an error if value is not a true double value (overflow):
+ eng: Illegal %s '%-.192s' value found during parsing
+
+ Note: the string is NOT null terminated when called from item_xmlfunc.cc,
+ so this->name will contain some SQL query tail behind the "length" bytes.
+ This is Ok for now, as this Item is never seen in SHOW,
+ or EXPLAIN, or anywhere else in metadata.
+ Item->name should be fixed to use LEX_STRING eventually.
*/
Item_float::Item_float(const char *str_arg, uint length)
@@ -5552,12 +5574,9 @@ Item_float::Item_float(const char *str_arg, uint length)
&error);
if (error)
{
- /*
- Note that we depend on that str_arg is null terminated, which is true
- when we are in the parser
- */
- DBUG_ASSERT(str_arg[length] == 0);
- my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", (char*) str_arg);
+ char tmp[NAME_LEN + 1];
+ my_snprintf(tmp, sizeof(tmp), "%.*s", length, str_arg);
+ my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", tmp);
}
presentation= name=(char*) str_arg;
decimals=(uint8) nr_of_decimals(str_arg, str_arg+length);
@@ -7493,9 +7512,19 @@ void Item_cache_datetime::store(Item *item, longlong val_arg)
}
+void Item_cache_datetime::store(Item *item)
+{
+ Item_cache::store(item);
+ str_value_cached= FALSE;
+}
+
String *Item_cache_datetime::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
+
+ if ((value_cached || str_value_cached) && null_value)
+ return NULL;
+
if (!str_value_cached)
{
/*
@@ -7509,6 +7538,8 @@ String *Item_cache_datetime::val_str(String *str)
if (value_cached)
{
MYSQL_TIME ltime;
+ /* Return NULL in case of OOM/conversion error. */
+ null_value= TRUE;
if (str_value.alloc(MAX_DATE_STRING_REP_LENGTH))
return NULL;
if (cached_field_type == MYSQL_TYPE_TIME)
@@ -7531,13 +7562,14 @@ String *Item_cache_datetime::val_str(String *str)
{
int was_cut;
longlong res;
- res= number_to_datetime(val_int(), &ltime, TIME_FUZZY_DATE, &was_cut);
+ res= number_to_datetime(int_value, &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;
+ null_value= FALSE;
}
else if (!cache_value())
return NULL;
@@ -7558,7 +7590,7 @@ my_decimal *Item_cache_datetime::val_decimal(my_decimal *decimal_val)
double Item_cache_datetime::val_real()
{
DBUG_ASSERT(fixed == 1);
- if (!value_cached && !cache_value_int())
+ if ((!value_cached && !cache_value_int()) || null_value)
return 0.0;
return (double) int_value;
}
@@ -7566,7 +7598,7 @@ double Item_cache_datetime::val_real()
longlong Item_cache_datetime::val_int()
{
DBUG_ASSERT(fixed == 1);
- if (!value_cached && !cache_value_int())
+ if ((!value_cached && !cache_value_int()) || null_value)
return 0;
return int_value;
}
diff --git a/sql/item.h b/sql/item.h
index 8e8199ecac8..2249cc9dd4a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2572,7 +2572,7 @@ public:
DBUG_ASSERT(fixed);
return (*ref)->get_time(ltime);
}
- virtual bool basic_const_item() const { return (*ref)->basic_const_item(); }
+ virtual bool basic_const_item() const { return ref && (*ref)->basic_const_item(); }
bool is_outer_field() const
{
DBUG_ASSERT(fixed);
@@ -3451,8 +3451,8 @@ public:
cmp_context= STRING_RESULT;
}
- virtual void store(Item *item) { Item_cache::store(item); }
void store(Item *item, longlong val_arg);
+ void store(Item *item);
double val_real();
longlong val_int();
String* val_str(String *str);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b04ec105468..f89eabaa868 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4720,6 +4720,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
String *escape_str= escape_item->val_str(&cmp.value1);
if (escape_str)
{
+ const char *escape_str_ptr= escape_str->ptr();
if (escape_used_in_parsing && (
(((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
escape_str->numchars() != 1) ||
@@ -4734,9 +4735,9 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
CHARSET_INFO *cs= escape_str->charset();
my_wc_t wc;
int rc= cs->cset->mb_wc(cs, &wc,
- (const uchar*) escape_str->ptr(),
- (const uchar*) escape_str->ptr() +
- escape_str->length());
+ (const uchar*) escape_str_ptr,
+ (const uchar*) escape_str_ptr +
+ escape_str->length());
escape= (int) (rc > 0 ? wc : '\\');
}
else
@@ -4753,13 +4754,13 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
{
char ch;
uint errors;
- uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str->ptr(),
+ uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str_ptr,
escape_str->length(),
escape_str->charset(), &errors);
escape= cnvlen ? ch : '\\';
}
else
- escape= *(escape_str->ptr());
+ escape= escape_str_ptr ? *escape_str_ptr : '\\';
}
}
else
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7906ed71bc7..92b80e274f4 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -178,7 +178,14 @@ Item_func::fix_fields(THD *thd, Item **ref)
used_tables_cache= not_null_tables_cache= 0;
const_item_cache=1;
- if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
+ /*
+ Use stack limit of STACK_MIN_SIZE * 2 since
+ on some platforms a recursive call to fix_fields
+ requires more than STACK_MIN_SIZE bytes (e.g. for
+ MIPS, it takes about 22kB to make one recursive
+ call to Item_func::fix_fields())
+ */
+ if (check_stack_overrun(thd, STACK_MIN_SIZE * 2, buff))
return TRUE; // Fatal error if flag is set!
if (arg_count)
{ // Print purify happy
@@ -3691,48 +3698,92 @@ longlong Item_master_pos_wait::val_int()
}
+/**
+ Enables a session to wait on a condition until a timeout or a network
+ disconnect occurs.
+
+ @remark The connection is polled every m_interrupt_interval nanoseconds.
+*/
+
+class Interruptible_wait
+{
+ THD *m_thd;
+ struct timespec m_abs_timeout;
+ static const ulonglong m_interrupt_interval;
+
+ public:
+ Interruptible_wait(THD *thd)
+ : m_thd(thd) {}
+
+ ~Interruptible_wait() {}
+
+ public:
+ /**
+ Set the absolute timeout.
+
+ @param timeout The amount of time in nanoseconds to wait
+ */
+ void set_timeout(ulonglong timeout)
+ {
+ /*
+ Calculate the absolute system time at the start so it can
+ be controlled in slices. It relies on the fact that once
+ the absolute time passes, the timed wait call will fail
+ automatically with a timeout error.
+ */
+ set_timespec_nsec(m_abs_timeout, timeout);
+ }
+
+ /** The timed wait. */
+ int wait(mysql_cond_t *, mysql_mutex_t *);
+};
+
+
+/** Time to wait before polling the connection status. */
+const ulonglong Interruptible_wait::m_interrupt_interval= 5 * ULL(1000000000);
+
/**
- Wait for a given condition to be signaled within the specified timeout.
+ Wait for a given condition to be signaled.
+
+ @param cond The condition variable to wait on.
+ @param mutex The associated mutex.
- @param cond the condition variable to wait on
- @param lock the associated mutex
- @param abstime the amount of time in seconds to wait
+ @remark The absolute timeout is preserved across calls.
@retval return value from mysql_cond_timedwait
*/
-#define INTERRUPT_INTERVAL (5 * ULL(1000000000))
-
-static int interruptible_wait(THD *thd, mysql_cond_t *cond,
- mysql_mutex_t *lock, double time)
+int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex)
{
int error;
- struct timespec abstime;
- ulonglong slice, timeout= (ulonglong) (time * 1000000000.0);
+ struct timespec timeout;
- do
+ while (1)
{
/* Wait for a fixed interval. */
- if (timeout > INTERRUPT_INTERVAL)
- slice= INTERRUPT_INTERVAL;
- else
- slice= timeout;
+ set_timespec_nsec(timeout, m_interrupt_interval);
- timeout-= slice;
- set_timespec_nsec(abstime, slice);
- error= mysql_cond_timedwait(cond, lock, &abstime);
+ /* But only if not past the absolute timeout. */
+ if (cmp_timespec(timeout, m_abs_timeout) > 0)
+ timeout= m_abs_timeout;
+
+ error= mysql_cond_timedwait(cond, mutex, &timeout);
if (error == ETIMEDOUT || error == ETIME)
{
/* Return error if timed out or connection is broken. */
- if (!timeout || !thd->is_connected())
+ if (!cmp_timespec(timeout, m_abs_timeout) || !m_thd->is_connected())
break;
}
- } while (error && timeout);
+ /* Otherwise, propagate status to the caller. */
+ else
+ break;
+ }
return error;
}
+
/**
Get a user level lock. If the thread has an old lock this is first released.
@@ -3748,10 +3799,11 @@ longlong Item_func_get_lock::val_int()
{
DBUG_ASSERT(fixed == 1);
String *res=args[0]->val_str(&value);
- double timeout= args[1]->val_real();
+ ulonglong timeout= args[1]->val_int();
THD *thd=current_thd;
User_level_lock *ull;
int error;
+ Interruptible_wait timed_cond(thd);
DBUG_ENTER("Item_func_get_lock::val_int");
/*
@@ -3812,11 +3864,13 @@ longlong Item_func_get_lock::val_int()
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &ull->cond;
+ timed_cond.set_timeout(timeout * ULL(1000000000));
+
error= 0;
while (ull->locked && !thd->killed)
{
DBUG_PRINT("info", ("waiting on lock"));
- error= interruptible_wait(thd, &ull->cond, &LOCK_user_locks, timeout);
+ error= timed_cond.wait(&ull->cond, &LOCK_user_locks);
if (error == ETIMEDOUT || error == ETIME)
{
DBUG_PRINT("info", ("lock wait timeout"));
@@ -4011,6 +4065,7 @@ void Item_func_benchmark::print(String *str, enum_query_type query_type)
longlong Item_func_sleep::val_int()
{
THD *thd= current_thd;
+ Interruptible_wait timed_cond(thd);
mysql_cond_t cond;
double timeout;
int error;
@@ -4030,6 +4085,8 @@ longlong Item_func_sleep::val_int()
if (timeout < 0.00001)
return 0;
+ timed_cond.set_timeout((ulonglong) (timeout * 1000000000.0));
+
mysql_cond_init(key_item_func_sleep_cond, &cond, NULL);
mysql_mutex_lock(&LOCK_user_locks);
@@ -4040,7 +4097,7 @@ longlong Item_func_sleep::val_int()
error= 0;
while (!thd->killed)
{
- error= interruptible_wait(thd, &cond, &LOCK_user_locks, timeout);
+ error= timed_cond.wait(&cond, &LOCK_user_locks);
if (error == ETIMEDOUT || error == ETIME)
break;
error= 0;
@@ -4274,7 +4331,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
length--; // Fix length change above
entry->value[length]= 0; // Store end \0
}
- memcpy(entry->value,ptr,length);
+ memmove(entry->value, ptr, length);
if (type == DECIMAL_RESULT)
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
@@ -5677,7 +5734,17 @@ void Item_func_match::init_search(bool no_order)
/* Check if init_search() has been called before */
if (ft_handler)
+ {
+ /*
+ We should reset ft_handler as it is cleaned up
+ on destruction of FT_SELECT object
+ (necessary in case of re-execution of subquery).
+ TODO: FT_SELECT should not clean up ft_handler.
+ */
+ if (join_key)
+ table->file->ft_handler= ft_handler;
DBUG_VOID_RETURN;
+ }
if (key == NO_SUCH_KEY)
{
diff --git a/sql/item_func.h b/sql/item_func.h
index 15730516c71..63662d97019 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1595,7 +1595,7 @@ public:
join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { }
void cleanup()
{
- DBUG_ENTER("Item_func_match");
+ DBUG_ENTER("Item_func_match::cleanup");
Item_real_func::cleanup();
if (!master && ft_handler)
ft_handler->please->close_search(ft_handler);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 89c1e785c71..c71d8226f77 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1080,9 +1080,15 @@ String *Item_func_replace::val_str(String *str)
search=res2->ptr();
search_end=search+from_length;
redo:
+ DBUG_ASSERT(res->ptr() || !offset);
ptr=res->ptr()+offset;
strend=res->ptr()+res->length();
- end=strend-from_length+1;
+ /*
+ In some cases val_str() can return empty string
+ with ptr() == NULL and length() == 0.
+ Let's check strend to avoid overflow.
+ */
+ end= strend ? strend - from_length + 1 : NULL;
while (ptr < end)
{
if (*ptr == *search)
@@ -1184,6 +1190,20 @@ String *Item_func_insert::val_str(String *str)
if ((length < 0) || (length > res->length()))
length= res->length();
+ /*
+ There is one exception not handled (intentionaly) by the character set
+ aggregation code. If one string is strong side and is binary, and
+ another one is weak side and is a multi-byte character string,
+ then we need to operate on the second string in terms on bytes when
+ calling ::numchars() and ::charpos(), rather than in terms of characters.
+ Lets substitute its character set to binary.
+ */
+ if (collation.collation == &my_charset_bin)
+ {
+ res->set_charset(&my_charset_bin);
+ res2->set_charset(&my_charset_bin);
+ }
+
/* start and length are now sufficiently valid to pass to charpos function */
start= res->charpos((int) start);
length= res->charpos((int) length, (uint32) start);
@@ -2725,6 +2745,20 @@ String *Item_func_rpad::val_str(String *str)
/* Set here so that rest of code sees out-of-bound value as such. */
if ((ulonglong) count > INT_MAX32)
count= INT_MAX32;
+ /*
+ There is one exception not handled (intentionaly) by the character set
+ aggregation code. If one string is strong side and is binary, and
+ another one is weak side and is a multi-byte character string,
+ then we need to operate on the second string in terms on bytes when
+ calling ::numchars() and ::charpos(), rather than in terms of characters.
+ Lets substitute its character set to binary.
+ */
+ if (collation.collation == &my_charset_bin)
+ {
+ res->set_charset(&my_charset_bin);
+ rpad->set_charset(&my_charset_bin);
+ }
+
if (count <= (res_char_length= res->numchars()))
{ // String to pad is big enough
res->length(res->charpos((int) count)); // Shorten result if longer
@@ -2814,6 +2848,20 @@ String *Item_func_lpad::val_str(String *str)
if ((ulonglong) count > INT_MAX32)
count= INT_MAX32;
+ /*
+ There is one exception not handled (intentionaly) by the character set
+ aggregation code. If one string is strong side and is binary, and
+ another one is weak side and is a multi-byte character string,
+ then we need to operate on the second string in terms on bytes when
+ calling ::numchars() and ::charpos(), rather than in terms of characters.
+ Lets substitute its character set to binary.
+ */
+ if (collation.collation == &my_charset_bin)
+ {
+ res->set_charset(&my_charset_bin);
+ pad->set_charset(&my_charset_bin);
+ }
+
res_char_length= res->numchars();
if (count <= res_char_length)
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 5cf585e1a56..c1b1f47e5e9 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1910,21 +1910,26 @@ int subselect_single_select_engine::exec()
DBUG_RETURN(join->error ? join->error : 1);
}
if (!select_lex->uncacheable && thd->lex->describe &&
- !(join->select_options & SELECT_DESCRIBE) &&
- join->need_tmp)
+ !(join->select_options & SELECT_DESCRIBE))
{
item->update_used_tables();
if (item->const_item())
{
/*
+ It's necessary to keep original JOIN table because
+ create_sort_index() function may overwrite original
+ JOIN_TAB::type and wrong optimization method can be
+ selected on re-execution.
+ */
+ select_lex->uncacheable|= UNCACHEABLE_EXPLAIN;
+ select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN;
+ /*
Force join->join_tmp creation, because this subquery will be replaced
by a simple select from the materialization temp table by optimize()
called by EXPLAIN and we need to preserve the initial query structure
so we can display it.
*/
- select_lex->uncacheable|= UNCACHEABLE_EXPLAIN;
- select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN;
- if (join->init_save_join_tab())
+ if (join->need_tmp && join->init_save_join_tab())
DBUG_RETURN(1); /* purecov: inspected */
}
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index b6e5d6d3182..8cd8e1bb222 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3395,8 +3395,6 @@ String* Item_func_group_concat::val_str(String* str)
void Item_func_group_concat::print(String *str, enum_query_type query_type)
{
- /* orig_args is not filled with valid values until fix_fields() */
- Item **pargs= fixed ? orig_args : args;
str->append(STRING_WITH_LEN("group_concat("));
if (distinct)
str->append(STRING_WITH_LEN("distinct "));
@@ -3404,7 +3402,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
{
if (i)
str->append(',');
- pargs[i]->print(str, query_type);
+ orig_args[i]->print(str, query_type);
}
if (arg_count_order)
{
@@ -3413,7 +3411,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
{
if (i)
str->append(',');
- pargs[i + arg_count_field]->print(str, query_type);
+ orig_args[i + arg_count_field]->print(str, query_type);
if (order[i]->asc)
str->append(STRING_WITH_LEN(" ASC"));
else
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 49336b04e16..73b8b6047e0 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2526,14 +2526,14 @@ String *Item_char_typecast::val_str(String *str)
{
// Convert character set if differ
uint dummy_errors;
- if (!(res= args[0]->val_str(&tmp_value)) ||
- str->copy(res->ptr(), res->length(), from_cs,
- cast_cs, &dummy_errors))
+ if (!(res= args[0]->val_str(str)) ||
+ tmp_value.copy(res->ptr(), res->length(), from_cs,
+ cast_cs, &dummy_errors))
{
null_value= 1;
return 0;
}
- res= str;
+ res= &tmp_value;
}
res->set_charset(cast_cs);
@@ -2568,9 +2568,9 @@ String *Item_char_typecast::val_str(String *str)
{
if (res->alloced_length() < (uint) cast_length)
{
- str->alloc(cast_length);
- str->copy(*res);
- res= str;
+ str_value.alloc(cast_length);
+ str_value.copy(*res);
+ res= &str_value;
}
bzero((char*) res->ptr() + res->length(),
(uint) cast_length - res->length());
@@ -3465,7 +3465,7 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return 0;
null_date:
- if (fuzzy_date & TIME_NO_ZERO_DATE)
+ if (val && (fuzzy_date & TIME_NO_ZERO_DATE))
{
char buff[128];
strmake(buff, val->ptr(), min(val->length(), sizeof(buff)-1));
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 004eb83cbeb..72a5aa0c296 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -361,6 +361,7 @@ public:
const char *func_name() const { return "time_to_sec"; }
void fix_length_and_dec()
{
+ maybe_null= TRUE;
decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
}
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index f124c37f0eb..49d18b1bb0f 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2798,12 +2798,12 @@ String *Item_func_xml_extractvalue::val_str(String *str)
null_value= 0;
if (!nodeset_func ||
!(res= args[0]->val_str(str)) ||
- !parse_xml(res, &pxml))
+ !parse_xml(res, &pxml) ||
+ !(res= nodeset_func->val_str(&tmp_value)))
{
null_value= 1;
return 0;
}
- res= nodeset_func->val_str(&tmp_value);
return res;
}
diff --git a/sql/key.cc b/sql/key.cc
index 582334620ad..288afd034a9 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -361,12 +361,10 @@ void key_unpack(String *to,TABLE *table,uint idx)
if (field->binary() && field->type() == MYSQL_TYPE_STRING && tmp.length())
{
const char *tmp_end= tmp.ptr() + tmp.length();
- while (tmp_end > tmp.ptr() && !*--tmp_end);
+ while (tmp_end > tmp.ptr() && !*--tmp_end) ;
tmp.length(tmp_end - tmp.ptr() + 1);
}
- if (cs->mbmaxlen > 1 &&
- table->field[key_part->fieldnr - 1]->field_length !=
- key_part->length)
+ if (cs->mbmaxlen > 1 && (key_part->key_part_flag & HA_PART_KEY_SEG))
{
/*
Prefix key, multi-byte charset.
diff --git a/sql/lock.cc b/sql/lock.cc
index 0181a544824..2e141e1c9fb 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -777,8 +777,11 @@ bool lock_schema_name(THD *thd, const char *db)
return TRUE;
}
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
- mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE);
+ if (thd->global_read_lock.can_acquire_protection())
+ return TRUE;
+ global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_STATEMENT);
+ mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE, MDL_TRANSACTION);
mdl_requests.push_front(&mdl_request);
mdl_requests.push_front(&global_request);
@@ -793,13 +796,13 @@ bool lock_schema_name(THD *thd, const char *db)
/**
- Obtain an exclusive metadata lock on the stored routine name.
+ Obtain an exclusive metadata lock on an object name.
@param thd Thread handle.
- @param is_function Stored routine type (only functions or procedures
- are name-locked.
- @param db The schema the routine belongs to.
- @param name Routine name.
+ @param mdl_type Object type (currently functions, procedures
+ and events can be name-locked).
+ @param db The schema the object belongs to.
+ @param name Object name in the schema.
This function assumes that no metadata locks were acquired
before calling it. Additionally, it cannot be called while
@@ -815,12 +818,9 @@ bool lock_schema_name(THD *thd, const char *db)
or this connection was killed.
*/
-bool lock_routine_name(THD *thd, bool is_function,
+bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
const char *db, const char *name)
{
- MDL_key::enum_mdl_namespace mdl_type= (is_function ?
- MDL_key::FUNCTION :
- MDL_key::PROCEDURE);
MDL_request_list mdl_requests;
MDL_request global_request;
MDL_request schema_request;
@@ -836,9 +836,13 @@ bool lock_routine_name(THD *thd, bool is_function,
DBUG_ASSERT(name);
DEBUG_SYNC(thd, "before_wait_locked_pname");
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
- schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE);
- mdl_request.init(mdl_type, db, name, MDL_EXCLUSIVE);
+ if (thd->global_read_lock.can_acquire_protection())
+ return TRUE;
+ global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_STATEMENT);
+ schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE,
+ MDL_TRANSACTION);
+ mdl_request.init(mdl_type, db, name, MDL_EXCLUSIVE, MDL_TRANSACTION);
mdl_requests.push_front(&mdl_request);
mdl_requests.push_front(&schema_request);
@@ -888,45 +892,24 @@ static void print_lock_error(int error, const char *table)
/****************************************************************************
Handling of global read locks
+ Global read lock is implemented using metadata lock infrastructure.
+
Taking the global read lock is TWO steps (2nd step is optional; without
it, COMMIT of existing transactions will be allowed):
lock_global_read_lock() THEN make_global_read_lock_block_commit().
- The global locks are handled through the global variables:
- global_read_lock
- count of threads which have the global read lock (i.e. have completed at
- least the first step above)
- global_read_lock_blocks_commit
- count of threads which have the global read lock and block
- commits (i.e. are in or have completed the second step above)
- waiting_for_read_lock
- count of threads which want to take a global read lock but cannot
- protect_against_global_read_lock
- count of threads which have set protection against global read lock.
-
- access to them is protected with a mutex LOCK_global_read_lock
-
- (XXX: one should never take LOCK_open if LOCK_global_read_lock is
- taken, otherwise a deadlock may occur. Other mutexes could be a
- problem too - grep the code for global_read_lock if you want to use
- any other mutex here) Also one must not hold LOCK_open when calling
- wait_if_global_read_lock(). When the thread with the global read lock
- tries to close its tables, it needs to take LOCK_open in
- close_thread_table().
-
How blocking of threads by global read lock is achieved: that's
- advisory. Any piece of code which should be blocked by global read lock must
- be designed like this:
- - call to wait_if_global_read_lock(). When this returns 0, no global read
- lock is owned; if argument abort_on_refresh was 0, none can be obtained.
- - job
- - if abort_on_refresh was 0, call to start_waiting_global_read_lock() to
- allow other threads to get the global read lock. I.e. removal of the
- protection.
- (Note: it's a bit like an implementation of rwlock).
-
- [ I am sorry to mention some SQL syntaxes below I know I shouldn't but found
- no better descriptive way ]
+ semi-automatic. We assume that any statement which should be blocked
+ by global read lock will either open and acquires write-lock on tables
+ or acquires metadata locks on objects it is going to modify. For any
+ such statement global IX metadata lock is automatically acquired for
+ its duration (in case of LOCK TABLES until end of LOCK TABLES mode).
+ And lock_global_read_lock() simply acquires global S metadata lock
+ and thus prohibits execution of statements which modify data (unless
+ they modify only temporary tables). If deadlock happens it is detected
+ by MDL subsystem and resolved in the standard fashion (by backing-off
+ metadata locks acquired so far and restarting open tables process
+ if possible).
Why does FLUSH TABLES WITH READ LOCK need to block COMMIT: because it's used
to read a non-moving SHOW MASTER STATUS, and a COMMIT writes to the binary
@@ -960,11 +943,6 @@ static void print_lock_error(int error, const char *table)
****************************************************************************/
-volatile uint global_read_lock=0;
-volatile uint global_read_lock_blocks_commit=0;
-static volatile uint protect_against_global_read_lock=0;
-static volatile uint waiting_for_read_lock=0;
-
/**
Take global read lock, wait if there is protection against lock.
@@ -985,85 +963,17 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
if (!m_state)
{
MDL_request mdl_request;
- const char *old_message;
- const char *new_message= "Waiting to get readlock";
- (void) mysql_mutex_lock(&LOCK_global_read_lock);
-
-#if defined(ENABLED_DEBUG_SYNC)
- /*
- The below sync point fires if we have to wait for
- protect_against_global_read_lock.
-
- WARNING: Beware to use WAIT_FOR with this sync point. We hold
- LOCK_global_read_lock here.
-
- Call the sync point before calling enter_cond() as it does use
- enter_cond() and exit_cond() itself if a WAIT_FOR action is
- executed in spite of the above warning.
-
- Pre-set proc_info so that it is available immediately after the
- sync point sends a SIGNAL. This makes tests more reliable.
- */
- if (protect_against_global_read_lock)
- {
- thd_proc_info(thd, new_message);
- DEBUG_SYNC(thd, "wait_lock_global_read_lock");
- }
-#endif /* defined(ENABLED_DEBUG_SYNC) */
-
- old_message=thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
- new_message);
- DBUG_PRINT("info",
- ("waiting_for: %d protect_against: %d",
- waiting_for_read_lock, protect_against_global_read_lock));
-
- waiting_for_read_lock++;
- while (protect_against_global_read_lock && !thd->killed)
- mysql_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
- waiting_for_read_lock--;
- if (thd->killed)
- {
- thd->exit_cond(old_message);
- DBUG_RETURN(1);
- }
- m_state= GRL_ACQUIRED;
- global_read_lock++;
- thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
- /*
- When we perform FLUSH TABLES or ALTER TABLE under LOCK TABLES,
- tables being reopened are protected only by meta-data locks at
- some point. To avoid sneaking in with our global read lock at
- this moment we have to take global shared meta data lock.
-
- TODO: We should change this code to acquire global shared metadata
- lock before acquiring global read lock. But in order to do
- this we have to get rid of all those places in which
- wait_if_global_read_lock() is called before acquiring
- metadata locks first. Also long-term we should get rid of
- redundancy between metadata locks, global read lock and DDL
- blocker (see WL#4399 and WL#4400).
- */
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
MDL_SHARED));
- mdl_request.init(MDL_key::GLOBAL, "", "", MDL_SHARED);
+ mdl_request.init(MDL_key::GLOBAL, "", "", MDL_SHARED, MDL_EXPLICIT);
if (thd->mdl_context.acquire_lock(&mdl_request,
thd->variables.lock_wait_timeout))
- {
- /* Our thread was killed -- return back to initial state. */
- mysql_mutex_lock(&LOCK_global_read_lock);
- if (!(--global_read_lock))
- {
- DBUG_PRINT("signal", ("Broadcasting COND_global_read_lock"));
- mysql_cond_broadcast(&COND_global_read_lock);
- }
- mysql_mutex_unlock(&LOCK_global_read_lock);
- m_state= GRL_NONE;
DBUG_RETURN(1);
- }
- thd->mdl_context.move_ticket_after_trans_sentinel(mdl_request.ticket);
+
m_mdl_global_shared_lock= mdl_request.ticket;
+ m_state= GRL_ACQUIRED;
}
/*
We DON'T set global_read_lock_blocks_commit now, it will be set after
@@ -1089,166 +999,22 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
void Global_read_lock::unlock_global_read_lock(THD *thd)
{
- uint tmp;
DBUG_ENTER("unlock_global_read_lock");
- DBUG_PRINT("info",
- ("global_read_lock: %u global_read_lock_blocks_commit: %u",
- global_read_lock, global_read_lock_blocks_commit));
DBUG_ASSERT(m_mdl_global_shared_lock && m_state);
- thd->mdl_context.release_lock(m_mdl_global_shared_lock);
- m_mdl_global_shared_lock= NULL;
-
- mysql_mutex_lock(&LOCK_global_read_lock);
- tmp= --global_read_lock;
- if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT)
- --global_read_lock_blocks_commit;
- mysql_mutex_unlock(&LOCK_global_read_lock);
- /* Send the signal outside the mutex to avoid a context switch */
- if (!tmp)
+ if (m_mdl_blocks_commits_lock)
{
- DBUG_PRINT("signal", ("Broadcasting COND_global_read_lock"));
- mysql_cond_broadcast(&COND_global_read_lock);
+ thd->mdl_context.release_lock(m_mdl_blocks_commits_lock);
+ m_mdl_blocks_commits_lock= NULL;
}
+ thd->mdl_context.release_lock(m_mdl_global_shared_lock);
+ m_mdl_global_shared_lock= NULL;
m_state= GRL_NONE;
DBUG_VOID_RETURN;
}
-/**
- Wait if the global read lock is set, and optionally seek protection against
- global read lock.
-
- See also "Handling of global read locks" above.
-
- @param thd Reference to thread.
- @param abort_on_refresh If True, abort waiting if a refresh occurs,
- do NOT seek protection against GRL.
- If False, wait until the GRL is released and seek
- protection against GRL.
- @param is_not_commit If False, called from a commit operation,
- wait only if commit blocking is also enabled.
-
- @retval False Success, protection against global read lock is set
- (if !abort_on_refresh)
- @retval True Failure, wait was aborted or thread was killed.
-*/
-
-#define must_wait (global_read_lock && \
- (is_not_commit || \
- global_read_lock_blocks_commit))
-
-bool Global_read_lock::
-wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
- bool is_not_commit)
-{
- const char *UNINIT_VAR(old_message);
- bool result= 0, need_exit_cond;
- DBUG_ENTER("wait_if_global_read_lock");
-
- /*
- If we already have protection against global read lock,
- just increment the counter.
- */
- if (unlikely(m_protection_count > 0))
- {
- if (!abort_on_refresh)
- m_protection_count++;
- DBUG_RETURN(FALSE);
- }
- /*
- Assert that we do not own LOCK_open. If we would own it, other
- threads could not close their tables. This would make a pretty
- deadlock.
- */
- mysql_mutex_assert_not_owner(&LOCK_open);
-
- mysql_mutex_lock(&LOCK_global_read_lock);
- if ((need_exit_cond= must_wait))
- {
- if (m_state) // This thread had the read locks
- {
- if (is_not_commit)
- my_message(ER_CANT_UPDATE_WITH_READLOCK,
- ER(ER_CANT_UPDATE_WITH_READLOCK), MYF(0));
- mysql_mutex_unlock(&LOCK_global_read_lock);
- /*
- We allow FLUSHer to COMMIT; we assume FLUSHer knows what it does.
- This allowance is needed to not break existing versions of innobackup
- which do a BEGIN; INSERT; FLUSH TABLES WITH READ LOCK; COMMIT.
- */
- DBUG_RETURN(is_not_commit);
- }
- 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->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);
- DBUG_PRINT("signal", ("Got COND_global_read_lock"));
- }
- if (thd->killed)
- result=1;
- }
- if (!abort_on_refresh && !result)
- {
- m_protection_count++;
- protect_against_global_read_lock++;
- DBUG_PRINT("sql_lock", ("protect_against_global_read_lock incr: %u",
- protect_against_global_read_lock));
- }
- /*
- The following is only true in case of a global read locks (which is rare)
- and if old_message is set
- */
- if (unlikely(need_exit_cond))
- thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
- else
- mysql_mutex_unlock(&LOCK_global_read_lock);
- DBUG_RETURN(result);
-}
-
-
-/**
- Release protection against global read lock and restart
- global read lock waiters.
-
- Should only be called if we have protection against global read lock.
-
- See also "Handling of global read locks" above.
-
- @param thd Reference to thread.
-*/
-
-void Global_read_lock::start_waiting_global_read_lock(THD *thd)
-{
- bool tmp;
- DBUG_ENTER("start_waiting_global_read_lock");
- /*
- Ignore request if we do not have protection against global read lock.
- (Note that this is a violation of the interface contract, hence the assert).
- */
- DBUG_ASSERT(m_protection_count > 0);
- if (unlikely(m_protection_count == 0))
- DBUG_VOID_RETURN;
- /* Decrement local read lock protection counter, return if we still have it */
- if (unlikely(--m_protection_count > 0))
- DBUG_VOID_RETURN;
- if (unlikely(m_state))
- DBUG_VOID_RETURN;
- mysql_mutex_lock(&LOCK_global_read_lock);
- DBUG_ASSERT(protect_against_global_read_lock);
- tmp= (!--protect_against_global_read_lock &&
- (waiting_for_read_lock || global_read_lock_blocks_commit));
- mysql_mutex_unlock(&LOCK_global_read_lock);
- if (tmp)
- mysql_cond_broadcast(&COND_global_read_lock);
- DBUG_VOID_RETURN;
-}
-
/**
Make global read lock also block commits.
@@ -1267,8 +1033,7 @@ void Global_read_lock::start_waiting_global_read_lock(THD *thd)
bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
{
- bool error;
- const char *old_message;
+ MDL_request mdl_request;
DBUG_ENTER("make_global_read_lock_block_commit");
/*
If we didn't succeed lock_global_read_lock(), or if we already suceeded
@@ -1276,42 +1041,32 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
*/
if (m_state != GRL_ACQUIRED)
DBUG_RETURN(0);
- mysql_mutex_lock(&LOCK_global_read_lock);
- /* increment this BEFORE waiting on cond (otherwise race cond) */
- global_read_lock_blocks_commit++;
- /* For testing we set up some blocking, to see if we can be killed */
- DBUG_EXECUTE_IF("make_global_read_lock_block_commit_loop",
- protect_against_global_read_lock++;);
- old_message= thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
- "Waiting for all running commits to finish");
- while (protect_against_global_read_lock && !thd->killed)
- mysql_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
- DBUG_EXECUTE_IF("make_global_read_lock_block_commit_loop",
- protect_against_global_read_lock--;);
- if ((error= test(thd->killed)))
- global_read_lock_blocks_commit--; // undo what we did
- else
- m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT;
- thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
- DBUG_RETURN(error);
+
+ mdl_request.init(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT);
+
+ if (thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(TRUE);
+
+ m_mdl_blocks_commits_lock= mdl_request.ticket;
+ m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT;
+
+ DBUG_RETURN(FALSE);
}
/**
- Broadcast COND_global_read_lock.
-
- TODO/FIXME: Dmitry thinks that we broadcast on COND_global_read_lock
- when old instance of table is closed to avoid races
- between incrementing refresh_version and
- wait_if_global_read_lock(thd, TRUE, FALSE) call.
- Once global read lock implementation starts using MDL
- infrastructure this will became unnecessary and should
- be removed.
+ Set explicit duration for metadata locks which are used to implement GRL.
+
+ @param thd Reference to thread.
*/
-void broadcast_refresh(void)
+void Global_read_lock::set_explicit_lock_duration(THD *thd)
{
- mysql_cond_broadcast(&COND_global_read_lock);
+ if (m_mdl_global_shared_lock)
+ thd->mdl_context.set_lock_duration(m_mdl_global_shared_lock, MDL_EXPLICIT);
+ if (m_mdl_blocks_commits_lock)
+ thd->mdl_context.set_lock_duration(m_mdl_blocks_commits_lock, MDL_EXPLICIT);
}
/**
diff --git a/sql/lock.h b/sql/lock.h
index c097c8d269e..6f779595af8 100644
--- a/sql/lock.h
+++ b/sql/lock.h
@@ -2,6 +2,7 @@
#define LOCK_INCLUDED
#include "thr_lock.h" /* thr_lock_type */
+#include "mdl.h"
// Forward declarations
struct TABLE;
@@ -18,11 +19,10 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
-void broadcast_refresh(void);
/* Lock based on name */
bool lock_schema_name(THD *thd, const char *db);
/* Lock based on stored routine name */
-bool lock_routine_name(THD *thd, bool is_function, const char *db,
- const char *name);
+bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
+ const char *db, const char *name);
#endif /* LOCK_INCLUDED */
diff --git a/sql/log.cc b/sql/log.cc
index 0e15c3b8e79..bfc5018b556 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1362,7 +1362,7 @@ void LOGGER::deactivate_log_handler(THD *thd, uint log_type)
file_log= file_log_handler->get_mysql_log();
break;
default:
- assert(0); // Impossible
+ MY_ASSERT_UNREACHABLE();
}
if (!(*tmp_opt))
@@ -2177,7 +2177,11 @@ bool MYSQL_LOG::init_and_set_log_file_name(const char *log_name,
1 error
*/
-bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
+bool MYSQL_LOG::open(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_file_key log_file_key,
+#endif
+ const char *log_name, enum_log_type log_type_arg,
const char *new_name, enum cache_type io_cache_type_arg)
{
char buff[FN_REFLEN];
@@ -2205,7 +2209,12 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
db[0]= 0;
- if ((file= mysql_file_open(key_file_MYSQL_LOG,
+#ifdef HAVE_PSI_INTERFACE
+ /* Keep the key for reopen */
+ m_log_file_key= log_file_key;
+#endif
+
+ if ((file= mysql_file_open(log_file_key,
log_file_name, open_flags,
MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
@@ -2389,7 +2398,11 @@ void MYSQL_QUERY_LOG::reopen_file()
Note that at this point, log_state != LOG_CLOSED (important for is_open()).
*/
- open(save_name, log_type, 0, io_cache_type);
+ open(
+#ifdef HAVE_PSI_INTERFACE
+ m_log_file_key,
+#endif
+ save_name, log_type, 0, io_cache_type);
my_free(save_name);
mysql_mutex_unlock(&LOCK_log);
@@ -2849,14 +2862,14 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file.");
DBUG_RETURN(1);
}
- DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_SUICIDE(););
#endif
write_error= 0;
/* open the main log file */
- if (MYSQL_LOG::open(log_name, log_type_arg, new_name,
- io_cache_type_arg))
+ if (MYSQL_LOG::open(key_file_binlog,
+ log_name, log_type_arg, new_name, io_cache_type_arg))
{
#ifdef HAVE_REPLICATION
close_purge_index_file();
@@ -2946,7 +2959,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
if (write_file_name_to_index_file)
{
#ifdef HAVE_REPLICATION
- DBUG_EXECUTE_IF("crash_create_critical_before_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_create_critical_before_update_index", DBUG_SUICIDE(););
#endif
DBUG_ASSERT(my_b_inited(&index_file) != 0);
@@ -2965,7 +2978,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
goto err;
#ifdef HAVE_REPLICATION
- DBUG_EXECUTE_IF("crash_create_after_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_create_after_update_index", DBUG_SUICIDE(););
#endif
}
}
@@ -3428,7 +3441,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
/* Store where we are in the new file for the execution thread */
flush_relay_log_info(rli);
- DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE(););
mysql_mutex_lock(&rli->log_space_lock);
rli->relay_log.purge_logs(to_purge_if_included, included,
@@ -3556,7 +3569,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
break;
}
- DBUG_EXECUTE_IF("crash_purge_before_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_purge_before_update_index", DBUG_SUICIDE(););
if ((error= sync_purge_index_file()))
{
@@ -3571,7 +3584,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
goto err;
}
- DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", DBUG_SUICIDE(););
err:
/* Read each entry from purge_index_file and delete the file. */
@@ -3581,7 +3594,7 @@ err:
" that would be purged.");
close_purge_index_file();
- DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", DBUG_SUICIDE(););
if (need_mutex)
mysql_mutex_unlock(&LOCK_index);
@@ -5177,7 +5190,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
DBUG_PRINT("info", ("error writing binlog cache: %d",
write_error));
DBUG_PRINT("info", ("crashing before writing xid"));
- DBUG_ABORT();
+ DBUG_SUICIDE();
});
if ((write_error= write_cache(cache, false, false)))
@@ -5192,7 +5205,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
bool synced= 0;
if (flush_and_sync(&synced))
goto err;
- DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_ABORT(););
+ DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_SUICIDE(););
if (cache->error) // Error on read
{
sql_print_error(ER(ER_ERROR_ON_READ), cache->file_name, errno);
diff --git a/sql/log.h b/sql/log.h
index 89b3594cd1e..d824d3afa26 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -196,7 +196,11 @@ public:
MYSQL_LOG();
void init_pthread_objects();
void cleanup();
- bool open(const char *log_name,
+ bool open(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_file_key log_file_key,
+#endif
+ const char *log_name,
enum_log_type log_type,
const char *new_name,
enum cache_type io_cache_type_arg);
@@ -223,6 +227,10 @@ public:
volatile enum_log_state log_state;
enum cache_type io_cache_type;
friend class Log_event;
+#ifdef HAVE_PSI_INTERFACE
+ /** Instrumentation key to use for file io in @c log_file */
+ PSI_file_key m_log_file_key;
+#endif
};
class MYSQL_QUERY_LOG: public MYSQL_LOG
@@ -241,14 +249,22 @@ public:
bool open_slow_log(const char *log_name)
{
char buf[FN_REFLEN];
- return open(generate_name(log_name, "-slow.log", 0, buf), LOG_NORMAL, 0,
- WRITE_CACHE);
+ return open(
+#ifdef HAVE_PSI_INTERFACE
+ key_file_slow_log,
+#endif
+ generate_name(log_name, "-slow.log", 0, buf),
+ LOG_NORMAL, 0, WRITE_CACHE);
}
bool open_query_log(const char *log_name)
{
char buf[FN_REFLEN];
- return open(generate_name(log_name, ".log", 0, buf), LOG_NORMAL, 0,
- WRITE_CACHE);
+ return open(
+#ifdef HAVE_PSI_INTERFACE
+ key_file_query_log,
+#endif
+ generate_name(log_name, ".log", 0, buf),
+ LOG_NORMAL, 0, WRITE_CACHE);
}
private:
diff --git a/sql/log_event.cc b/sql/log_event.cc
index bfcac10e138..537865197da 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1244,7 +1244,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
break;
#ifdef HAVE_REPLICATION
case SLAVE_EVENT: /* can never happen (unused event) */
- ev = new Slave_log_event(buf, event_len);
+ ev = new Slave_log_event(buf, event_len, description_event);
break;
#endif /* HAVE_REPLICATION */
case CREATE_FILE_EVENT:
@@ -1332,8 +1332,10 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
(because constructor is "void") ; so instead we leave the pointer we
wanted to allocate (e.g. 'query') to 0 and we test it in is_valid().
Same for Format_description_log_event, member 'post_header_len'.
+
+ SLAVE_EVENT is never used, so it should not be read ever.
*/
- if (!ev || !ev->is_valid())
+ if (!ev || !ev->is_valid() || (event_type == SLAVE_EVENT))
{
DBUG_PRINT("error",("Found invalid event in binary log"));
@@ -2330,7 +2332,7 @@ bool Query_log_event::write(IO_CACHE* file)
start+= 4;
}
- if (thd && thd->is_current_user_used())
+ if (thd && thd->need_binlog_invoker())
{
LEX_STRING user;
LEX_STRING host;
@@ -3239,7 +3241,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
if (is_trans_keyword() || rpl_filter->db_ok(thd->db))
{
thd->set_time((time_t)when);
- thd->set_query_and_id((char*)query_arg, q_len_arg, next_query_id());
+ thd->set_query_and_id((char*)query_arg, q_len_arg,
+ thd->charset(), next_query_id());
thd->variables.pseudo_thread_id= thread_id; // for temp tables
DBUG_PRINT("query",("%s", thd->query()));
@@ -3291,6 +3294,18 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
goto compare_errors;
}
thd->update_charset(); // for the charset change to take effect
+ /*
+ Reset thd->query_string.cs to the newly set value.
+ Note, there is a small flaw here. For a very short time frame
+ if the new charset is different from the old charset and
+ if another thread executes "SHOW PROCESSLIST" after
+ the above thd->set_query_and_id() and before this thd->set_query(),
+ and if the current query has some non-ASCII characters,
+ the another thread may see some '?' marks in the PROCESSLIST
+ result. This should be acceptable now. This is a reminder
+ to fix this if any refactoring happens here sometime.
+ */
+ thd->set_query((char*) query_arg, q_len_arg, thd->charset());
}
}
if (time_zone_len)
@@ -3351,6 +3366,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
if (!parser_state.init(thd, thd->query(), thd->query_length()))
{
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
+ /* Finalize server status flags after executing a statement. */
+ thd->update_server_status();
log_slow_statement(thd);
}
@@ -3511,7 +3528,7 @@ end:
*/
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
- thd->set_query(NULL, 0);
+ thd->reset_query();
DBUG_PRINT("info", ("end: query= 0"));
/*
As a disk space optimization, future masters will not log an event for
@@ -4748,7 +4765,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query() == 0);
- thd->set_query_inner(NULL, 0); // Should not be needed
+ thd->reset_query_inner(); // Should not be needed
thd->is_slave_error= 0;
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
@@ -4942,7 +4959,7 @@ error:
const char *remember_db= thd->db;
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
- thd->set_query(NULL, 0);
+ thd->reset_query();
thd->stmt_da->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
thd->stmt_da->can_overwrite_status= FALSE;
@@ -4959,6 +4976,8 @@ error:
*/
if (! thd->in_multi_stmt_transaction_mode())
thd->mdl_context.release_transactional_locks();
+ else
+ thd->mdl_context.release_statement_locks();
DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",
thd->is_slave_error= 0; thd->is_fatal_error= 1;);
@@ -6117,8 +6136,12 @@ void Slave_log_event::init_from_mem_pool(int data_size)
/** This code is not used, so has not been updated to be format-tolerant. */
-Slave_log_event::Slave_log_event(const char* buf, uint event_len)
- :Log_event(buf,0) /*unused event*/ ,mem_pool(0),master_host(0)
+/* We are using description_event so that slave does not crash on Log_event
+ constructor */
+Slave_log_event::Slave_log_event(const char* buf,
+ uint event_len,
+ const Format_description_log_event* description_event)
+ :Log_event(buf,description_event),mem_pool(0),master_host(0)
{
if (event_len < LOG_EVENT_HEADER_LEN)
return;
@@ -8399,6 +8422,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
m_field_metadata, m_field_metadata_size,
m_null_bits, m_flags);
table_list->m_tabledef_valid= TRUE;
+ table_list->open_type= OT_BASE_ONLY;
/*
We record in the slave's information that the table should be
@@ -8503,7 +8527,7 @@ void Table_map_log_event::pack_info(Protocol *protocol)
#ifdef MYSQL_CLIENT
-void Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
+void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info)
{
if (!print_event_info->short_form)
{
diff --git a/sql/log_event.h b/sql/log_event.h
index 5d7250d8ebd..1841420ed86 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1032,7 +1032,7 @@ public:
return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
}
- static void operator delete(void *ptr, size_t size)
+ static void operator delete(void *ptr, size_t)
{
my_free(ptr);
}
@@ -1846,7 +1846,9 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- Slave_log_event(const char* buf, uint event_len);
+ Slave_log_event(const char* buf,
+ uint event_len,
+ const Format_description_log_event *description_event);
~Slave_log_event();
int get_data_size();
bool is_valid() const { return master_host != 0; }
diff --git a/sql/mdl.cc b/sql/mdl.cc
index d53ddcee0c8..3aed54ce12d 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -68,8 +68,6 @@ static void init_mdl_psi_keys(void)
}
#endif /* HAVE_PSI_INTERFACE */
-void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket);
-
/**
Thread state names to be used in case when we have to wait on resource
@@ -78,12 +76,14 @@ void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket);
const char *MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
{
- "Waiting for global metadata lock",
+ "Waiting for global read lock",
"Waiting for schema metadata lock",
"Waiting for table metadata lock",
"Waiting for stored function metadata lock",
"Waiting for stored procedure metadata lock",
- NULL
+ "Waiting for trigger metadata lock",
+ "Waiting for event metadata lock",
+ "Waiting for commit lock"
};
static bool mdl_initialized= 0;
@@ -100,7 +100,6 @@ class MDL_map
public:
void init();
void destroy();
- MDL_lock *find(const MDL_key *key);
MDL_lock *find_or_insert(const MDL_key *key);
void remove(MDL_lock *lock);
private:
@@ -110,6 +109,10 @@ private:
HASH m_locks;
/* Protects access to m_locks hash. */
mysql_mutex_t m_mutex;
+ /** Pre-allocated MDL_lock object for GLOBAL namespace. */
+ MDL_lock *m_global_lock;
+ /** Pre-allocated MDL_lock object for COMMIT namespace. */
+ MDL_lock *m_commit_lock;
};
@@ -354,18 +357,6 @@ public:
inline static MDL_lock *create(const MDL_key *key);
- void notify_shared_locks(MDL_context *ctx)
- {
- Ticket_iterator it(m_granted);
- MDL_ticket *conflicting_ticket;
-
- while ((conflicting_ticket= it++))
- {
- if (conflicting_ticket->get_ctx() != ctx)
- notify_shared_lock(ctx->get_thd(), conflicting_ticket);
- }
- }
-
void reschedule_waiters();
void remove_ticket(Ticket_list MDL_lock::*queue, MDL_ticket *ticket);
@@ -373,6 +364,9 @@ public:
bool visit_subgraph(MDL_ticket *waiting_ticket,
MDL_wait_for_graph_visitor *gvisitor);
+ virtual bool needs_notification(const MDL_ticket *ticket) const = 0;
+ virtual void notify_conflicting_locks(MDL_context *ctx) = 0;
+
/** List of granted tickets for this lock. */
Ticket_list m_granted;
/** Tickets for contexts waiting to acquire a lock. */
@@ -442,6 +436,11 @@ public:
{
return m_waiting_incompatible;
}
+ virtual bool needs_notification(const MDL_ticket *ticket) const
+ {
+ return (ticket->get_type() == MDL_SHARED);
+ }
+ virtual void notify_conflicting_locks(MDL_context *ctx);
private:
static const bitmap_t m_granted_incompatible[MDL_TYPE_END];
@@ -469,6 +468,11 @@ public:
{
return m_waiting_incompatible;
}
+ virtual bool needs_notification(const MDL_ticket *ticket) const
+ {
+ return ticket->is_upgradable_or_exclusive();
+ }
+ virtual void notify_conflicting_locks(MDL_context *ctx);
private:
static const bitmap_t m_granted_incompatible[MDL_TYPE_END];
@@ -536,9 +540,14 @@ void mdl_destroy()
void MDL_map::init()
{
+ MDL_key global_lock_key(MDL_key::GLOBAL, "", "");
+ MDL_key commit_lock_key(MDL_key::COMMIT, "", "");
+
mysql_mutex_init(key_MDL_map_mutex, &m_mutex, NULL);
my_hash_init(&m_locks, &my_charset_bin, 16 /* FIXME */, 0, 0,
mdl_locks_key, 0, 0);
+ m_global_lock= MDL_lock::create(&global_lock_key);
+ m_commit_lock= MDL_lock::create(&commit_lock_key);
}
@@ -552,6 +561,8 @@ void MDL_map::destroy()
DBUG_ASSERT(!m_locks.records);
mysql_mutex_destroy(&m_mutex);
my_hash_free(&m_locks);
+ MDL_lock::destroy(m_global_lock);
+ MDL_lock::destroy(m_commit_lock);
}
@@ -569,43 +580,28 @@ MDL_lock* MDL_map::find_or_insert(const MDL_key *mdl_key)
MDL_lock *lock;
my_hash_value_type hash_value;
- hash_value= my_calc_hash(&m_locks, mdl_key->ptr(), mdl_key->length());
-
-retry:
- mysql_mutex_lock(&m_mutex);
- if (!(lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks,
- hash_value,
- mdl_key->ptr(),
- mdl_key->length())))
+ if (mdl_key->mdl_namespace() == MDL_key::GLOBAL ||
+ mdl_key->mdl_namespace() == MDL_key::COMMIT)
{
- lock= MDL_lock::create(mdl_key);
- if (!lock || my_hash_insert(&m_locks, (uchar*)lock))
- {
- mysql_mutex_unlock(&m_mutex);
- MDL_lock::destroy(lock);
- return NULL;
- }
- }
-
- if (move_from_hash_to_lock_mutex(lock))
- goto retry;
+ /*
+ Avoid locking m_mutex when lock for GLOBAL or COMMIT namespace is
+ requested. Return pointer to pre-allocated MDL_lock instance instead.
+ Such an optimization allows to save one mutex lock/unlock for any
+ statement changing data.
- return lock;
-}
+ It works since these namespaces contain only one element so keys
+ for them look like '<namespace-id>\0\0'.
+ */
+ DBUG_ASSERT(mdl_key->length() == 3);
+ lock= (mdl_key->mdl_namespace() == MDL_key::GLOBAL) ? m_global_lock :
+ m_commit_lock;
-/**
- Find MDL_lock object corresponding to the key.
+ mysql_prlock_wrlock(&lock->m_rwlock);
- @retval non-NULL - MDL_lock instance for the key with locked
- MDL_lock::m_rwlock.
- @retval NULL - There was no MDL_lock for the key.
-*/
+ return lock;
+ }
-MDL_lock* MDL_map::find(const MDL_key *mdl_key)
-{
- MDL_lock *lock;
- my_hash_value_type hash_value;
hash_value= my_calc_hash(&m_locks, mdl_key->ptr(), mdl_key->length());
@@ -616,8 +612,13 @@ retry:
mdl_key->ptr(),
mdl_key->length())))
{
- mysql_mutex_unlock(&m_mutex);
- return NULL;
+ lock= MDL_lock::create(mdl_key);
+ if (!lock || my_hash_insert(&m_locks, (uchar*)lock))
+ {
+ mysql_mutex_unlock(&m_mutex);
+ MDL_lock::destroy(lock);
+ return NULL;
+ }
}
if (move_from_hash_to_lock_mutex(lock))
@@ -684,6 +685,17 @@ void MDL_map::remove(MDL_lock *lock)
{
uint ref_usage, ref_release;
+ if (lock->key.mdl_namespace() == MDL_key::GLOBAL ||
+ lock->key.mdl_namespace() == MDL_key::COMMIT)
+ {
+ /*
+ Never destroy pre-allocated MDL_lock objects for GLOBAL and
+ COMMIT namespaces.
+ */
+ mysql_prlock_unlock(&lock->m_rwlock);
+ return;
+ }
+
/*
Destroy the MDL_lock object, but ensure that anyone that is
holding a reference to the object is not remaining, if so he
@@ -719,8 +731,7 @@ void MDL_map::remove(MDL_lock *lock)
*/
MDL_context::MDL_context()
- :m_trans_sentinel(NULL),
- m_thd(NULL),
+ : m_thd(NULL),
m_needs_thr_lock_abort(FALSE),
m_waiting_for(NULL)
{
@@ -742,7 +753,9 @@ MDL_context::MDL_context()
void MDL_context::destroy()
{
- DBUG_ASSERT(m_tickets.is_empty());
+ DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty() &&
+ m_tickets[MDL_TRANSACTION].is_empty() &&
+ m_tickets[MDL_EXPLICIT].is_empty());
mysql_prlock_destroy(&m_LOCK_waiting_for);
}
@@ -771,10 +784,12 @@ void MDL_context::destroy()
void MDL_request::init(MDL_key::enum_mdl_namespace mdl_namespace,
const char *db_arg,
const char *name_arg,
- enum enum_mdl_type mdl_type_arg)
+ enum_mdl_type mdl_type_arg,
+ enum_mdl_duration mdl_duration_arg)
{
key.mdl_key_init(mdl_namespace, db_arg, name_arg);
type= mdl_type_arg;
+ duration= mdl_duration_arg;
ticket= NULL;
}
@@ -789,49 +804,17 @@ void MDL_request::init(MDL_key::enum_mdl_namespace mdl_namespace,
*/
void MDL_request::init(const MDL_key *key_arg,
- enum enum_mdl_type mdl_type_arg)
+ enum_mdl_type mdl_type_arg,
+ enum_mdl_duration mdl_duration_arg)
{
key.mdl_key_init(key_arg);
type= mdl_type_arg;
+ duration= mdl_duration_arg;
ticket= NULL;
}
/**
- Allocate and initialize one lock request.
-
- Same as mdl_init_lock(), but allocates the lock and the key buffer
- on a memory root. Necessary to lock ad-hoc tables, e.g.
- mysql.* tables of grant and data dictionary subsystems.
-
- @param mdl_namespace Id of namespace of object to be locked
- @param db Name of database to which object belongs
- @param name Name of of object
- @param root MEM_ROOT on which object should be allocated
-
- @note The allocated lock request will have MDL_SHARED type.
-
- @retval 0 Error if out of memory
- @retval non-0 Pointer to an object representing a lock request
-*/
-
-MDL_request *
-MDL_request::create(MDL_key::enum_mdl_namespace mdl_namespace, const char *db,
- const char *name, enum_mdl_type mdl_type,
- MEM_ROOT *root)
-{
- MDL_request *mdl_request;
-
- if (!(mdl_request= (MDL_request*) alloc_root(root, sizeof(MDL_request))))
- return NULL;
-
- mdl_request->init(mdl_namespace, db, name, mdl_type);
-
- return mdl_request;
-}
-
-
-/**
Auxiliary functions needed for creation/destruction of MDL_lock objects.
@note Also chooses an MDL_lock descendant appropriate for object namespace.
@@ -846,6 +829,7 @@ inline MDL_lock *MDL_lock::create(const MDL_key *mdl_key)
{
case MDL_key::GLOBAL:
case MDL_key::SCHEMA:
+ case MDL_key::COMMIT:
return new MDL_scoped_lock(mdl_key);
default:
return new MDL_object_lock(mdl_key);
@@ -867,9 +851,17 @@ void MDL_lock::destroy(MDL_lock *lock)
on memory allocation by reusing released objects.
*/
-MDL_ticket *MDL_ticket::create(MDL_context *ctx_arg, enum_mdl_type type_arg)
+MDL_ticket *MDL_ticket::create(MDL_context *ctx_arg, enum_mdl_type type_arg
+#ifndef DBUG_OFF
+ , enum_mdl_duration duration_arg
+#endif
+ )
{
- return new MDL_ticket(ctx_arg, type_arg);
+ return new MDL_ticket(ctx_arg, type_arg
+#ifndef DBUG_OFF
+ , duration_arg
+#endif
+ );
}
@@ -1438,13 +1430,11 @@ bool MDL_ticket::is_incompatible_when_waiting(enum_mdl_type type) const
/**
Check whether the context already holds a compatible lock ticket
on an object.
- Start searching the transactional locks. If not
- found in the list of transactional locks, look at LOCK TABLES
- and HANDLER locks.
+ Start searching from list of locks for the same duration as lock
+ being requested. If not look at lists for other durations.
@param mdl_request Lock request object for lock to be acquired
- @param[out] is_transactional FALSE if we pass beyond m_trans_sentinel
- while searching for ticket, otherwise TRUE.
+ @param[out] result_duration Duration of lock which was found.
@note Tickets which correspond to lock types "stronger" than one
being requested are also considered compatible.
@@ -1454,24 +1444,28 @@ bool MDL_ticket::is_incompatible_when_waiting(enum_mdl_type type) const
MDL_ticket *
MDL_context::find_ticket(MDL_request *mdl_request,
- bool *is_transactional)
+ enum_mdl_duration *result_duration)
{
MDL_ticket *ticket;
- Ticket_iterator it(m_tickets);
-
- *is_transactional= TRUE;
+ int i;
- while ((ticket= it++))
+ for (i= 0; i < MDL_DURATION_END; i++)
{
- if (ticket == m_trans_sentinel)
- *is_transactional= FALSE;
+ enum_mdl_duration duration= (enum_mdl_duration)((mdl_request->duration+i) %
+ MDL_DURATION_END);
+ Ticket_iterator it(m_tickets[duration]);
- if (mdl_request->key.is_equal(&ticket->m_lock->key) &&
- ticket->has_stronger_or_equal_type(mdl_request->type))
- break;
+ while ((ticket= it++))
+ {
+ if (mdl_request->key.is_equal(&ticket->m_lock->key) &&
+ ticket->has_stronger_or_equal_type(mdl_request->type))
+ {
+ *result_duration= duration;
+ return ticket;
+ }
+ }
}
-
- return ticket;
+ return NULL;
}
@@ -1549,7 +1543,7 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
MDL_lock *lock;
MDL_key *key= &mdl_request->key;
MDL_ticket *ticket;
- bool is_transactional;
+ enum_mdl_duration found_duration;
DBUG_ASSERT(mdl_request->type != MDL_EXCLUSIVE ||
is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE));
@@ -1563,7 +1557,7 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
Check whether the context already holds a shared lock on the object,
and if so, grant the request.
*/
- if ((ticket= find_ticket(mdl_request, &is_transactional)))
+ if ((ticket= find_ticket(mdl_request, &found_duration)))
{
DBUG_ASSERT(ticket->m_lock);
DBUG_ASSERT(ticket->has_stronger_or_equal_type(mdl_request->type));
@@ -1585,7 +1579,9 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
a different alias.
*/
mdl_request->ticket= ticket;
- if (!is_transactional && clone_ticket(mdl_request))
+ if ((found_duration != mdl_request->duration ||
+ mdl_request->duration == MDL_EXPLICIT) &&
+ clone_ticket(mdl_request))
{
/* Clone failed. */
mdl_request->ticket= NULL;
@@ -1594,7 +1590,11 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
return FALSE;
}
- if (!(ticket= MDL_ticket::create(this, mdl_request->type)))
+ if (!(ticket= MDL_ticket::create(this, mdl_request->type
+#ifndef DBUG_OFF
+ , mdl_request->duration
+#endif
+ )))
return TRUE;
/* The below call implicitly locks MDL_lock::m_rwlock on success. */
@@ -1612,7 +1612,7 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
mysql_prlock_unlock(&lock->m_rwlock);
- m_tickets.push_front(ticket);
+ m_tickets[mdl_request->duration].push_front(ticket);
mdl_request->ticket= ticket;
}
@@ -1647,7 +1647,11 @@ MDL_context::clone_ticket(MDL_request *mdl_request)
we effectively downgrade the cloned lock to the level of
the request.
*/
- if (!(ticket= MDL_ticket::create(this, mdl_request->type)))
+ if (!(ticket= MDL_ticket::create(this, mdl_request->type
+#ifndef DBUG_OFF
+ , mdl_request->duration
+#endif
+ )))
return TRUE;
/* clone() is not supposed to be used to get a stronger lock. */
@@ -1660,36 +1664,74 @@ MDL_context::clone_ticket(MDL_request *mdl_request)
ticket->m_lock->m_granted.add_ticket(ticket);
mysql_prlock_unlock(&ticket->m_lock->m_rwlock);
- m_tickets.push_front(ticket);
+ m_tickets[mdl_request->duration].push_front(ticket);
return FALSE;
}
/**
- Notify a thread holding a shared metadata lock which
- conflicts with a pending exclusive lock.
+ Notify threads holding a shared metadata locks on object which
+ conflict with a pending X, SNW or SNRW lock.
- @param thd Current thread context
- @param conflicting_ticket Conflicting metadata lock
+ @param ctx MDL_context for current thread.
*/
-void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket)
+void MDL_object_lock::notify_conflicting_locks(MDL_context *ctx)
{
- /* Only try to abort locks on which we back off. */
- if (conflicting_ticket->get_type() < MDL_SHARED_NO_WRITE)
+ Ticket_iterator it(m_granted);
+ MDL_ticket *conflicting_ticket;
+
+ while ((conflicting_ticket= it++))
{
- MDL_context *conflicting_ctx= conflicting_ticket->get_ctx();
- THD *conflicting_thd= conflicting_ctx->get_thd();
- DBUG_ASSERT(thd != conflicting_thd); /* Self-deadlock */
+ /* Only try to abort locks on which we back off. */
+ if (conflicting_ticket->get_ctx() != ctx &&
+ conflicting_ticket->get_type() < MDL_SHARED_NO_WRITE)
- /*
- If thread which holds conflicting lock is waiting on table-level
- lock or some other non-MDL resource we might need to wake it up
- by calling code outside of MDL.
- */
- mysql_notify_thread_having_shared_lock(thd, conflicting_thd,
- conflicting_ctx->get_needs_thr_lock_abort());
+ {
+ MDL_context *conflicting_ctx= conflicting_ticket->get_ctx();
+
+ /*
+ If thread which holds conflicting lock is waiting on table-level
+ lock or some other non-MDL resource we might need to wake it up
+ by calling code outside of MDL.
+ */
+ mysql_notify_thread_having_shared_lock(ctx->get_thd(),
+ conflicting_ctx->get_thd(),
+ conflicting_ctx->get_needs_thr_lock_abort());
+ }
+ }
+}
+
+
+/**
+ Notify threads holding scoped IX locks which conflict with a pending S lock.
+
+ @param ctx MDL_context for current thread.
+*/
+
+void MDL_scoped_lock::notify_conflicting_locks(MDL_context *ctx)
+{
+ Ticket_iterator it(m_granted);
+ MDL_ticket *conflicting_ticket;
+
+ while ((conflicting_ticket= it++))
+ {
+ if (conflicting_ticket->get_ctx() != ctx &&
+ conflicting_ticket->get_type() == MDL_INTENTION_EXCLUSIVE)
+
+ {
+ MDL_context *conflicting_ctx= conflicting_ticket->get_ctx();
+
+ /*
+ Thread which holds global IX lock can be a handler thread for
+ insert delayed. We need to kill such threads in order to get
+ global shared lock. We do this my calling code outside of MDL.
+ */
+ mysql_notify_thread_having_shared_lock(ctx->get_thd(),
+ conflicting_ctx->get_thd(),
+ conflicting_ctx->get_needs_thr_lock_abort());
+ }
}
}
@@ -1747,8 +1789,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
*/
m_wait.reset_status();
- if (ticket->is_upgradable_or_exclusive())
- lock->notify_shared_locks(this);
+ if (lock->needs_notification(ticket))
+ lock->notify_conflicting_locks(this);
mysql_prlock_unlock(&lock->m_rwlock);
@@ -1759,7 +1801,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
find_deadlock();
- if (ticket->is_upgradable_or_exclusive())
+ if (lock->needs_notification(ticket))
{
struct timespec abs_shortwait;
set_timespec(abs_shortwait, 1);
@@ -1775,7 +1817,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
break;
mysql_prlock_wrlock(&lock->m_rwlock);
- lock->notify_shared_locks(this);
+ lock->notify_conflicting_locks(this);
mysql_prlock_unlock(&lock->m_rwlock);
set_timespec(abs_shortwait, 1);
}
@@ -1818,7 +1860,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
*/
DBUG_ASSERT(wait_status == MDL_wait::GRANTED);
- m_tickets.push_front(ticket);
+ m_tickets[mdl_request->duration].push_front(ticket);
mdl_request->ticket= ticket;
@@ -1859,7 +1901,7 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests,
{
MDL_request_list::Iterator it(*mdl_requests);
MDL_request **sort_buf, **p_req;
- MDL_ticket *mdl_svp= mdl_savepoint();
+ MDL_savepoint mdl_svp= mdl_savepoint();
ssize_t req_count= static_cast<ssize_t>(mdl_requests->elements());
if (req_count == 0)
@@ -1928,7 +1970,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
ulong lock_wait_timeout)
{
MDL_request mdl_xlock_request;
- MDL_ticket *mdl_svp= mdl_savepoint();
+ MDL_savepoint mdl_svp= mdl_savepoint();
bool is_new_ticket;
DBUG_ENTER("MDL_ticket::upgrade_shared_lock_to_exclusive");
@@ -1945,7 +1987,8 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
DBUG_ASSERT(mdl_ticket->m_type == MDL_SHARED_NO_WRITE ||
mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE);
- mdl_xlock_request.init(&mdl_ticket->m_lock->key, MDL_EXCLUSIVE);
+ mdl_xlock_request.init(&mdl_ticket->m_lock->key, MDL_EXCLUSIVE,
+ MDL_TRANSACTION);
if (acquire_lock(&mdl_xlock_request, lock_wait_timeout))
DBUG_RETURN(TRUE);
@@ -1969,7 +2012,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
if (is_new_ticket)
{
- m_tickets.remove(mdl_xlock_request.ticket);
+ m_tickets[MDL_TRANSACTION].remove(mdl_xlock_request.ticket);
MDL_ticket::destroy(mdl_xlock_request.ticket);
}
@@ -2230,10 +2273,12 @@ void MDL_context::find_deadlock()
/**
Release lock.
- @param ticket Ticket for lock to be released.
+ @param duration Lock duration.
+ @param ticket Ticket for lock to be released.
+
*/
-void MDL_context::release_lock(MDL_ticket *ticket)
+void MDL_context::release_lock(enum_mdl_duration duration, MDL_ticket *ticket)
{
MDL_lock *lock= ticket->m_lock;
DBUG_ENTER("MDL_context::release_lock");
@@ -2243,12 +2288,9 @@ void MDL_context::release_lock(MDL_ticket *ticket)
DBUG_ASSERT(this == ticket->get_ctx());
mysql_mutex_assert_not_owner(&LOCK_open);
- if (ticket == m_trans_sentinel)
- m_trans_sentinel= ++Ticket_list::Iterator(m_tickets, ticket);
-
lock->remove_ticket(&MDL_lock::m_granted, ticket);
- m_tickets.remove(ticket);
+ m_tickets[duration].remove(ticket);
MDL_ticket::destroy(ticket);
DBUG_VOID_RETURN;
@@ -2256,50 +2298,56 @@ void MDL_context::release_lock(MDL_ticket *ticket)
/**
+ Release lock with explicit duration.
+
+ @param ticket Ticket for lock to be released.
+
+*/
+
+void MDL_context::release_lock(MDL_ticket *ticket)
+{
+ DBUG_ASSERT(ticket->m_duration == MDL_EXPLICIT);
+
+ release_lock(MDL_EXPLICIT, ticket);
+}
+
+
+/**
Release all locks associated with the context. If the sentinel
is not NULL, do not release locks stored in the list after and
including the sentinel.
- Transactional locks are added to the beginning of the list, i.e.
- stored in reverse temporal order. This allows to employ this
- function to:
+ Statement and transactional locks are added to the beginning of
+ the corresponding lists, i.e. stored in reverse temporal order.
+ This allows to employ this function to:
- back off in case of a lock conflict.
- - release all locks in the end of a transaction
+ - release all locks in the end of a statment or transaction
- rollback to a savepoint.
-
- The sentinel semantics is used to support LOCK TABLES
- mode and HANDLER statements: locks taken by these statements
- survive COMMIT, ROLLBACK, ROLLBACK TO SAVEPOINT.
*/
-void MDL_context::release_locks_stored_before(MDL_ticket *sentinel)
+void MDL_context::release_locks_stored_before(enum_mdl_duration duration,
+ MDL_ticket *sentinel)
{
MDL_ticket *ticket;
- Ticket_iterator it(m_tickets);
+ Ticket_iterator it(m_tickets[duration]);
DBUG_ENTER("MDL_context::release_locks_stored_before");
- if (m_tickets.is_empty())
+ if (m_tickets[duration].is_empty())
DBUG_VOID_RETURN;
while ((ticket= it++) && ticket != sentinel)
{
DBUG_PRINT("info", ("found lock to release ticket=%p", ticket));
- release_lock(ticket);
+ release_lock(duration, ticket);
}
- /*
- If all locks were released, then the sentinel was not present
- in the list. It must never happen because the sentinel was
- bogus, i.e. pointed to a ticket that no longer exists.
- */
- DBUG_ASSERT(! m_tickets.is_empty() || sentinel == NULL);
DBUG_VOID_RETURN;
}
/**
- Release all locks in the context which correspond to the same name/
- object as this lock request.
+ Release all explicit locks in the context which correspond to the
+ same name/object as this lock request.
@param ticket One of the locks for the name/object for which all
locks should be released.
@@ -2312,17 +2360,13 @@ void MDL_context::release_all_locks_for_name(MDL_ticket *name)
/* Remove matching lock tickets from the context. */
MDL_ticket *ticket;
- Ticket_iterator it_ticket(m_tickets);
+ Ticket_iterator it_ticket(m_tickets[MDL_EXPLICIT]);
while ((ticket= it_ticket++))
{
DBUG_ASSERT(ticket->m_lock);
- /*
- We rarely have more than one ticket in this loop,
- let's not bother saving on pthread_cond_broadcast().
- */
if (ticket->m_lock == lock)
- release_lock(ticket);
+ release_lock(MDL_EXPLICIT, ticket);
}
}
@@ -2377,9 +2421,10 @@ MDL_context::is_lock_owner(MDL_key::enum_mdl_namespace mdl_namespace,
enum_mdl_type mdl_type)
{
MDL_request mdl_request;
- bool is_transactional_unused;
- mdl_request.init(mdl_namespace, db, name, mdl_type);
- MDL_ticket *ticket= find_ticket(&mdl_request, &is_transactional_unused);
+ enum_mdl_duration not_unused;
+ /* We don't care about exact duration of lock here. */
+ mdl_request.init(mdl_namespace, db, name, mdl_type, MDL_TRANSACTION);
+ MDL_ticket *ticket= find_ticket(&mdl_request, &not_unused);
DBUG_ASSERT(ticket == NULL || ticket->m_lock);
@@ -2408,18 +2453,15 @@ bool MDL_ticket::has_pending_conflicting_lock() const
@note It's safe to iterate and unlock any locks after taken after this
savepoint because other statements that take other special locks
cause a implicit commit (ie LOCK TABLES).
-
- @param mdl_savepont The last acquired MDL lock when the
- savepoint was set.
*/
-void MDL_context::rollback_to_savepoint(MDL_ticket *mdl_savepoint)
+void MDL_context::rollback_to_savepoint(const MDL_savepoint &mdl_savepoint)
{
DBUG_ENTER("MDL_context::rollback_to_savepoint");
/* If savepoint is NULL, it is from the start of the transaction. */
- release_locks_stored_before(mdl_savepoint ?
- mdl_savepoint : m_trans_sentinel);
+ release_locks_stored_before(MDL_STATEMENT, mdl_savepoint.m_stmt_ticket);
+ release_locks_stored_before(MDL_TRANSACTION, mdl_savepoint.m_trans_ticket);
DBUG_VOID_RETURN;
}
@@ -2437,65 +2479,150 @@ void MDL_context::rollback_to_savepoint(MDL_ticket *mdl_savepoint)
void MDL_context::release_transactional_locks()
{
DBUG_ENTER("MDL_context::release_transactional_locks");
- release_locks_stored_before(m_trans_sentinel);
+ release_locks_stored_before(MDL_STATEMENT, NULL);
+ release_locks_stored_before(MDL_TRANSACTION, NULL);
+ DBUG_VOID_RETURN;
+}
+
+
+void MDL_context::release_statement_locks()
+{
+ DBUG_ENTER("MDL_context::release_transactional_locks");
+ release_locks_stored_before(MDL_STATEMENT, NULL);
DBUG_VOID_RETURN;
}
/**
Does this savepoint have this lock?
-
- @retval TRUE The ticket is older than the savepoint and
- is not LT, HA or GLR ticket. Thus it belongs
- to the savepoint.
- @retval FALSE The ticket is newer than the savepoint
- or is an LT, HA or GLR ticket.
+
+ @retval TRUE The ticket is older than the savepoint or
+ is an LT, HA or GLR ticket. Thus it belongs
+ to the savepoint or has explicit duration.
+ @retval FALSE The ticket is newer than the savepoint.
+ and is not an LT, HA or GLR ticket.
*/
-bool MDL_context::has_lock(MDL_ticket *mdl_savepoint,
+bool MDL_context::has_lock(const MDL_savepoint &mdl_savepoint,
MDL_ticket *mdl_ticket)
{
MDL_ticket *ticket;
/* Start from the beginning, most likely mdl_ticket's been just acquired. */
- MDL_context::Ticket_iterator it(m_tickets);
- bool found_savepoint= FALSE;
+ MDL_context::Ticket_iterator s_it(m_tickets[MDL_STATEMENT]);
+ MDL_context::Ticket_iterator t_it(m_tickets[MDL_TRANSACTION]);
- while ((ticket= it++) && ticket != m_trans_sentinel)
+ while ((ticket= s_it++) && ticket != mdl_savepoint.m_stmt_ticket)
{
- /*
- First met the savepoint. The ticket must be
- somewhere after it.
- */
- if (ticket == mdl_savepoint)
- found_savepoint= TRUE;
- /*
- Met the ticket. If we haven't yet met the savepoint,
- the ticket is newer than the savepoint.
- */
if (ticket == mdl_ticket)
- return found_savepoint;
+ return FALSE;
}
- /* Reached m_trans_sentinel. The ticket must be LT, HA or GRL ticket. */
- return FALSE;
+
+ while ((ticket= t_it++) && ticket != mdl_savepoint.m_trans_ticket)
+ {
+ if (ticket == mdl_ticket)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+/**
+ Change lock duration for transactional lock.
+
+ @param ticket Ticket representing lock.
+ @param duration Lock duration to be set.
+
+ @note This method only supports changing duration of
+ transactional lock to some other duration.
+*/
+
+void MDL_context::set_lock_duration(MDL_ticket *mdl_ticket,
+ enum_mdl_duration duration)
+{
+ DBUG_ASSERT(mdl_ticket->m_duration == MDL_TRANSACTION &&
+ duration != MDL_TRANSACTION);
+
+ m_tickets[MDL_TRANSACTION].remove(mdl_ticket);
+ m_tickets[duration].push_front(mdl_ticket);
+#ifndef DBUG_OFF
+ mdl_ticket->m_duration= duration;
+#endif
}
/**
- Rearrange the ticket to reside in the part of the list that's
- beyond m_trans_sentinel. This effectively changes the ticket
- life cycle, from automatic to manual: i.e. the ticket is no
- longer released by MDL_context::release_transactional_locks() or
- MDL_context::rollback_to_savepoint(), it must be released manually.
+ Set explicit duration for all locks in the context.
*/
-void MDL_context::move_ticket_after_trans_sentinel(MDL_ticket *mdl_ticket)
+void MDL_context::set_explicit_duration_for_all_locks()
{
- m_tickets.remove(mdl_ticket);
- if (m_trans_sentinel == NULL)
+ int i;
+ MDL_ticket *ticket;
+
+ /*
+ In the most common case when this function is called list
+ of transactional locks is bigger than list of locks with
+ explicit duration. So we start by swapping these two lists
+ and then move elements from new list of transactional
+ locks and list of statement locks to list of locks with
+ explicit duration.
+ */
+
+ m_tickets[MDL_EXPLICIT].swap(m_tickets[MDL_TRANSACTION]);
+
+ for (i= 0; i < MDL_EXPLICIT; i++)
{
- m_trans_sentinel= mdl_ticket;
- m_tickets.push_back(mdl_ticket);
+ Ticket_iterator it_ticket(m_tickets[i]);
+
+ while ((ticket= it_ticket++))
+ {
+ m_tickets[i].remove(ticket);
+ m_tickets[MDL_EXPLICIT].push_front(ticket);
+ }
}
- else
- m_tickets.insert_after(m_trans_sentinel, mdl_ticket);
+
+#ifndef DBUG_OFF
+ Ticket_iterator exp_it(m_tickets[MDL_EXPLICIT]);
+
+ while ((ticket= exp_it++))
+ ticket->m_duration= MDL_EXPLICIT;
+#endif
+}
+
+
+/**
+ Set transactional duration for all locks in the context.
+*/
+
+void MDL_context::set_transaction_duration_for_all_locks()
+{
+ MDL_ticket *ticket;
+
+ /*
+ In the most common case when this function is called list
+ of explicit locks is bigger than two other lists (in fact,
+ list of statement locks is always empty). So we start by
+ swapping list of explicit and transactional locks and then
+ move contents of new list of explicit locks to list of
+ locks with transactional duration.
+ */
+
+ DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty());
+
+ m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
+
+ Ticket_iterator it_ticket(m_tickets[MDL_EXPLICIT]);
+
+ while ((ticket= it_ticket++))
+ {
+ m_tickets[MDL_EXPLICIT].remove(ticket);
+ m_tickets[MDL_TRANSACTION].push_front(ticket);
+ }
+
+#ifndef DBUG_OFF
+ Ticket_iterator trans_it(m_tickets[MDL_TRANSACTION]);
+
+ while ((ticket= trans_it++))
+ ticket->m_duration= MDL_TRANSACTION;
+#endif
}
diff --git a/sql/mdl.h b/sql/mdl.h
index 7938d833eac..4a9397fe215 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -150,6 +150,15 @@ enum enum_mdl_type {
MDL_TYPE_END};
+/** Duration of metadata lock. */
+
+enum enum_mdl_duration { MDL_STATEMENT= 0,
+ MDL_TRANSACTION,
+ MDL_EXPLICIT,
+ /* This should be the last ! */
+ MDL_DURATION_END };
+
+
/** Maximal length of key for metadata locking subsystem. */
#define MAX_MDLKEY_LENGTH (1 + NAME_LEN + 1 + NAME_LEN + 1)
@@ -167,13 +176,16 @@ class MDL_key
{
public:
/**
- Object namespaces
+ Object namespaces.
+ Sic: when adding a new member to this enum make sure to
+ update m_namespace_to_wait_state_name array in mdl.cc!
Different types of objects exist in different namespaces
- TABLE is for tables and views.
- FUNCTION is for stored functions.
- PROCEDURE is for stored procedures.
- TRIGGER is for triggers.
+ - EVENT is for event scheduler events
Note that although there isn't metadata locking on triggers,
it's necessary to have a separate namespace for them since
MDL_key is also used outside of the MDL subsystem.
@@ -184,6 +196,8 @@ public:
FUNCTION,
PROCEDURE,
TRIGGER,
+ EVENT,
+ COMMIT,
/* This should be the last ! */
NAMESPACE_END };
@@ -238,7 +252,7 @@ public:
character set is utf-8, we can safely assume that no
character starts with a zero byte.
*/
- return memcmp(m_ptr, rhs->m_ptr, min(m_length, rhs->m_length)+1);
+ return memcmp(m_ptr, rhs->m_ptr, min(m_length, rhs->m_length));
}
MDL_key(const MDL_key *rhs)
@@ -305,6 +319,8 @@ class MDL_request
public:
/** Type of metadata lock. */
enum enum_mdl_type type;
+ /** Duration for requested lock. */
+ enum enum_mdl_duration duration;
/**
Pointers for participating in the list of lock requests for this context.
@@ -327,17 +343,16 @@ public:
void init(MDL_key::enum_mdl_namespace namespace_arg,
const char *db_arg, const char *name_arg,
- enum_mdl_type mdl_type_arg);
- void init(const MDL_key *key_arg, enum_mdl_type mdl_type_arg);
+ enum_mdl_type mdl_type_arg,
+ enum_mdl_duration mdl_duration_arg);
+ void init(const MDL_key *key_arg, enum_mdl_type mdl_type_arg,
+ enum_mdl_duration mdl_duration_arg);
/** Set type of lock request. Can be only applied to pending locks. */
inline void set_type(enum_mdl_type type_arg)
{
DBUG_ASSERT(ticket == NULL);
type= type_arg;
}
- 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);
/*
This is to work around the ugliness of TABLE_LIST
@@ -363,6 +378,7 @@ public:
MDL_request(const MDL_request *rhs)
:type(rhs->type),
+ duration(rhs->duration),
ticket(NULL),
key(&rhs->key)
{}
@@ -484,17 +500,35 @@ public:
private:
friend class MDL_context;
- MDL_ticket(MDL_context *ctx_arg, enum_mdl_type type_arg)
+ MDL_ticket(MDL_context *ctx_arg, enum_mdl_type type_arg
+#ifndef DBUG_OFF
+ , enum_mdl_duration duration_arg
+#endif
+ )
: m_type(type_arg),
+#ifndef DBUG_OFF
+ m_duration(duration_arg),
+#endif
m_ctx(ctx_arg),
m_lock(NULL)
{}
- static MDL_ticket *create(MDL_context *ctx_arg, enum_mdl_type type_arg);
+ static MDL_ticket *create(MDL_context *ctx_arg, enum_mdl_type type_arg
+#ifndef DBUG_OFF
+ , enum_mdl_duration duration_arg
+#endif
+ );
static void destroy(MDL_ticket *ticket);
private:
/** Type of metadata lock. Externally accessible. */
enum enum_mdl_type m_type;
+#ifndef DBUG_OFF
+ /**
+ Duration of lock represented by this ticket.
+ Context private. Debug-only.
+ */
+ enum_mdl_duration m_duration;
+#endif
/**
Context of the owner of the metadata lock ticket. Externally accessible.
*/
@@ -512,6 +546,39 @@ private:
/**
+ Savepoint for MDL context.
+
+ Doesn't include metadata locks with explicit duration as
+ they are not released during rollback to savepoint.
+*/
+
+class MDL_savepoint
+{
+public:
+ MDL_savepoint() {};
+
+private:
+ MDL_savepoint(MDL_ticket *stmt_ticket, MDL_ticket *trans_ticket)
+ : m_stmt_ticket(stmt_ticket), m_trans_ticket(trans_ticket)
+ {}
+
+ friend class MDL_context;
+
+private:
+ /**
+ Pointer to last lock with statement duration which was taken
+ before creation of savepoint.
+ */
+ MDL_ticket *m_stmt_ticket;
+ /**
+ Pointer to last lock with transaction duration which was taken
+ before creation of savepoint.
+ */
+ MDL_ticket *m_trans_ticket;
+};
+
+
+/**
A reliable way to wait on an MDL lock.
*/
@@ -559,9 +626,7 @@ public:
typedef I_P_List<MDL_ticket,
I_P_List_adapter<MDL_ticket,
&MDL_ticket::next_in_context,
- &MDL_ticket::prev_in_context>,
- I_P_List_null_counter,
- I_P_List_fast_push_back<MDL_ticket> >
+ &MDL_ticket::prev_in_context> >
Ticket_list;
typedef Ticket_list::Iterator Ticket_iterator;
@@ -584,37 +649,28 @@ public:
const char *db, const char *name,
enum_mdl_type mdl_type);
- bool has_lock(MDL_ticket *mdl_savepoint, MDL_ticket *mdl_ticket);
+ bool has_lock(const MDL_savepoint &mdl_savepoint, MDL_ticket *mdl_ticket);
inline bool has_locks() const
{
- return !m_tickets.is_empty();
- }
-
- MDL_ticket *mdl_savepoint()
- {
- /*
- NULL savepoint represents the start of the transaction.
- Checking for m_trans_sentinel also makes sure we never
- return a pointer to HANDLER ticket as a savepoint.
- */
- return m_tickets.front() == m_trans_sentinel ? NULL : m_tickets.front();
+ return !(m_tickets[MDL_STATEMENT].is_empty() &&
+ m_tickets[MDL_TRANSACTION].is_empty() &&
+ m_tickets[MDL_EXPLICIT].is_empty());
}
- void set_trans_sentinel()
+ MDL_savepoint mdl_savepoint()
{
- m_trans_sentinel= m_tickets.front();
+ return MDL_savepoint(m_tickets[MDL_STATEMENT].front(),
+ m_tickets[MDL_TRANSACTION].front());
}
- MDL_ticket *trans_sentinel() const { return m_trans_sentinel; }
- void reset_trans_sentinel(MDL_ticket *sentinel_arg)
- {
- m_trans_sentinel= sentinel_arg;
- }
- void move_ticket_after_trans_sentinel(MDL_ticket *mdl_ticket);
+ void set_explicit_duration_for_all_locks();
+ void set_transaction_duration_for_all_locks();
+ void set_lock_duration(MDL_ticket *mdl_ticket, enum_mdl_duration duration);
+ void release_statement_locks();
void release_transactional_locks();
- void rollback_to_savepoint(MDL_ticket *mdl_savepoint);
+ void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint);
inline THD *get_thd() const { return m_thd; }
@@ -655,46 +711,43 @@ public:
MDL_wait m_wait;
private:
/**
- All MDL tickets acquired by this connection.
-
- The order of tickets in m_tickets list.
- ---------------------------------------
- The entire set of locks acquired by a connection
- can be separated in two subsets: transactional and
- non-transactional locks.
-
- Transactional locks are locks with automatic scope. They
- are accumulated in the course of a transaction, and
- released only on COMMIT, ROLLBACK or ROLLBACK TO SAVEPOINT.
- They must not be (and never are) released manually,
+ Lists of all MDL tickets acquired by this connection.
+
+ Lists of MDL tickets:
+ ---------------------
+ The entire set of locks acquired by a connection can be separated
+ in three subsets according to their: locks released at the end of
+ statement, at the end of transaction and locks are released
+ explicitly.
+
+ Statement and transactional locks are locks with automatic scope.
+ They are accumulated in the course of a transaction, and released
+ either at the end of uppermost statement (for statement locks) or
+ on COMMIT, ROLLBACK or ROLLBACK TO SAVEPOINT (for transactional
+ locks). They must not be (and never are) released manually,
i.e. with release_lock() call.
- Non-transactional locks are taken for locks that span
+ Locks with explicit duration are taken for locks that span
multiple transactions or savepoints.
These are: HANDLER SQL locks (HANDLER SQL is
transaction-agnostic), LOCK TABLES locks (you can COMMIT/etc
under LOCK TABLES, and the locked tables stay locked), and
- SET GLOBAL READ_ONLY=1 global shared lock.
+ locks implementing "global read lock".
- Transactional locks are always prepended to the beginning
- of the list. In other words, they are stored in reverse
- temporal order. Thus, when we rollback to a savepoint,
- we start popping and releasing tickets from the front
- until we reach the last ticket acquired after the
- savepoint.
+ Statement/transactional locks are always prepended to the
+ beginning of the appropriate list. In other words, they are
+ stored in reverse temporal order. Thus, when we rollback to
+ a savepoint, we start popping and releasing tickets from the
+ front until we reach the last ticket acquired after the savepoint.
- Non-transactional locks are always stored after
- transactional ones, and among each other can be
- split into three sets:
+ Locks with explicit duration stored are not stored in any
+ particular order, and among each other can be split into
+ three sets:
[LOCK TABLES locks] [HANDLER locks] [GLOBAL READ LOCK locks]
The following is known about these sets:
- * we can never have both HANDLER and LOCK TABLES locks
- together -- HANDLER statements are prohibited under LOCK
- TABLES, entering LOCK TABLES implicitly closes all open
- HANDLERs.
* GLOBAL READ LOCK locks are always stored after LOCK TABLES
locks and after HANDLER locks. This is because one can't say
SET GLOBAL read_only=1 or FLUSH TABLES WITH READ LOCK
@@ -709,14 +762,9 @@ private:
However, one can open a few HANDLERs after entering the
read only mode.
* LOCK TABLES locks include intention exclusive locks on
- involved schemas.
- */
- Ticket_list m_tickets;
- /**
- Separates transactional and non-transactional locks
- in m_tickets list, @sa m_tickets.
+ involved schemas and global intention exclusive lock.
*/
- MDL_ticket *m_trans_sentinel;
+ Ticket_list m_tickets[MDL_DURATION_END];
THD *m_thd;
/**
TRUE - if for this context we will break protocol and try to
@@ -747,8 +795,9 @@ private:
MDL_wait_for_subgraph *m_waiting_for;
private:
MDL_ticket *find_ticket(MDL_request *mdl_req,
- bool *is_transactional);
- void release_locks_stored_before(MDL_ticket *sentinel);
+ enum_mdl_duration *duration);
+ void release_locks_stored_before(enum_mdl_duration duration, MDL_ticket *sentinel);
+ void release_lock(enum_mdl_duration duration, MDL_ticket *ticket);
bool try_acquire_lock_impl(MDL_request *mdl_request,
MDL_ticket **out_ticket);
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index abf4b178422..e5b1573608a 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -328,7 +328,7 @@ int my_decimal2int(uint mask, const my_decimal *d, my_bool unsigned_flag,
inline
-int my_decimal2double(uint mask, const my_decimal *d, double *result)
+int my_decimal2double(uint, const my_decimal *d, double *result)
{
/* No need to call check_result as this will always succeed */
return decimal2double((decimal_t*) d, result);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 99754e8b7f6..09c17d600a8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -324,7 +324,8 @@ static PSI_rwlock_key key_rwlock_openssl;
/* the default log output is log tables */
static bool lower_case_table_names_used= 0;
static bool volatile select_thread_in_use, signal_thread_in_use;
-static bool volatile ready_to_exit;
+/* See Bug#56666 and Bug#56760 */;
+volatile bool ready_to_exit;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_short_log_format= 0;
static uint kill_cached_threads, wake_thread;
@@ -409,7 +410,8 @@ handlerton *heap_hton;
handlerton *myisam_hton;
handlerton *partition_hton;
-my_bool opt_readonly= 0, use_temp_pool, relay_log_purge;
+my_bool read_only= 0, opt_readonly= 0;
+my_bool use_temp_pool, relay_log_purge;
my_bool relay_log_recovery;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
@@ -604,8 +606,7 @@ pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
mysql_mutex_t LOCK_thread_count;
mysql_mutex_t
- LOCK_status, LOCK_global_read_lock,
- LOCK_error_log, LOCK_uuid_generator,
+ LOCK_status, LOCK_error_log, LOCK_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
LOCK_crypt,
LOCK_global_system_variables,
@@ -625,7 +626,6 @@ mysql_mutex_t LOCK_des_key_file;
mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
mysql_rwlock_t LOCK_system_variables_hash;
mysql_cond_t COND_thread_count;
-mysql_cond_t COND_global_read_lock;
pthread_t signal_thread;
pthread_attr_t connection_attrib;
mysql_mutex_t LOCK_server_started;
@@ -1542,7 +1542,6 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_crypt);
mysql_mutex_destroy(&LOCK_user_conn);
mysql_mutex_destroy(&LOCK_connection_count);
- Events::destroy_mutexes();
#ifdef HAVE_OPENSSL
mysql_mutex_destroy(&LOCK_des_key_file);
#ifndef HAVE_YASSL
@@ -1560,12 +1559,10 @@ static void clean_up_mutexes()
mysql_rwlock_destroy(&LOCK_sys_init_slave);
mysql_mutex_destroy(&LOCK_global_system_variables);
mysql_rwlock_destroy(&LOCK_system_variables_hash);
- mysql_mutex_destroy(&LOCK_global_read_lock);
mysql_mutex_destroy(&LOCK_uuid_generator);
mysql_mutex_destroy(&LOCK_prepared_stmt_count);
mysql_mutex_destroy(&LOCK_error_messages);
mysql_cond_destroy(&COND_thread_count);
- mysql_cond_destroy(&COND_global_read_lock);
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
mysql_cond_destroy(&COND_manager);
@@ -3524,8 +3521,6 @@ static int init_thread_environment()
&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
mysql_rwlock_init(key_rwlock_LOCK_system_variables_hash,
&LOCK_system_variables_hash);
- mysql_mutex_init(key_LOCK_global_read_lock,
- &LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_prepared_stmt_count,
&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_error_messages,
@@ -3553,7 +3548,6 @@ static int init_thread_environment()
mysql_rwlock_init(key_rwlock_LOCK_sys_init_slave, &LOCK_sys_init_slave);
mysql_rwlock_init(key_rwlock_LOCK_grant, &LOCK_grant);
mysql_cond_init(key_COND_thread_count, &COND_thread_count, NULL);
- mysql_cond_init(key_COND_global_read_lock, &COND_global_read_lock, NULL);
mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, NULL);
mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, NULL);
mysql_cond_init(key_COND_manager, &COND_manager, NULL);
@@ -3778,12 +3772,12 @@ static int init_server_components()
unireg_abort(1);
}
- /* initialize delegates for extension observers */
+ /*
+ initialize delegates for extension observers, errors have already
+ been reported in the function
+ */
if (delegates_init())
- {
- sql_print_error("Initialize extension delegates failed");
unireg_abort(1);
- }
/* need to configure logging before initializing storage engines */
if (opt_log_slave_updates && !opt_bin_log)
@@ -4949,7 +4943,7 @@ void create_thread_to_handle_connection(THD *thd)
statistic_increment(aborted_connects,&LOCK_status);
/* Can't use my_error() since store_globals has not been called. */
my_snprintf(error_message_buff, sizeof(error_message_buff),
- ER(ER_CANT_CREATE_THREAD), error);
+ ER_THD(thd, ER_CANT_CREATE_THREAD), error);
net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL);
mysql_mutex_lock(&LOCK_thread_count);
close_connection(thd,0,0);
@@ -5662,6 +5656,12 @@ struct my_option my_long_options[]=
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode "
"will also set transaction isolation level 'serializable'.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ /*
+ Because Sys_var_bit does not support command-line options, we need to
+ explicitely add one for --autocommit
+ */
+ {"autocommit", OPT_AUTOCOMMIT, "Set default value for autocommit (0 or 1)",
+ NULL, NULL, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, NULL},
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
&my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -7114,6 +7114,13 @@ mysqld_get_one_option(int optid,
if (argument == NULL) /* no argument */
log_error_file_ptr= const_cast<char*>("");
break;
+ case OPT_AUTOCOMMIT:
+ const ulonglong turn_bit_on= (argument && (atoi(argument) == 0)) ?
+ OPTION_NOT_AUTOCOMMIT : OPTION_AUTOCOMMIT;
+ global_system_variables.option_bits=
+ (global_system_variables.option_bits &
+ ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on;
+ break;
}
return 0;
}
@@ -7336,6 +7343,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
test(global_system_variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
+ opt_readonly= read_only;
+
return 0;
}
@@ -7656,7 +7665,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
- key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
+ key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_manager,
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
@@ -7694,7 +7703,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
{ &key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
{ &key_LOCK_gdl, "LOCK_gdl", PSI_FLAG_GLOBAL},
- { &key_LOCK_global_read_lock, "LOCK_global_read_lock", PSI_FLAG_GLOBAL},
{ &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
{ &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
@@ -7743,7 +7751,7 @@ PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
#endif /* HAVE_MMAP */
PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
- key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
+ key_COND_cache_status_changed, key_COND_manager,
key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
@@ -7766,7 +7774,6 @@ static PSI_cond_info all_server_conds[]=
{ &key_BINLOG_COND_prep_xids, "MYSQL_BIN_LOG::COND_prep_xids", 0},
{ &key_BINLOG_update_cond, "MYSQL_BIN_LOG::update_cond", 0},
{ &key_COND_cache_status_changed, "Query_cache::COND_cache_status_changed", 0},
- { &key_COND_global_read_lock, "COND_global_read_lock", PSI_FLAG_GLOBAL},
{ &key_COND_manager, "COND_manager", PSI_FLAG_GLOBAL},
{ &key_COND_rpl_status, "COND_rpl_status", PSI_FLAG_GLOBAL},
{ &key_COND_server_started, "COND_server_started", PSI_FLAG_GLOBAL},
@@ -7825,9 +7832,10 @@ PSI_file_key key_file_binlog, key_file_binlog_index, key_file_casetest,
key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
+ key_file_master_info, key_file_misc, key_file_partition,
key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
key_file_trg, key_file_trn, key_file_init;
+PSI_file_key key_file_query_log, key_file_slow_log;
static PSI_file_info all_server_files[]=
{
@@ -7850,11 +7858,12 @@ static PSI_file_info all_server_files[]=
{ &key_file_log_event_info, "log_event_info", 0},
{ &key_file_master_info, "master_info", 0},
{ &key_file_misc, "misc", 0},
- { &key_file_MYSQL_LOG, "MYSQL_LOG", 0},
{ &key_file_partition, "partition", 0},
{ &key_file_pid, "pid", 0},
+ { &key_file_query_log, "query_log", 0},
{ &key_file_relay_log_info, "relay_log_info", 0},
{ &key_file_send_file, "send_file", 0},
+ { &key_file_slow_log, "slow_log", 0},
{ &key_file_tclog, "tclog", 0},
{ &key_file_trg, "trigger_name", 0},
{ &key_file_trn, "trigger", 0},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 6e81c240f7d..7fe4dc7258a 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -100,14 +100,15 @@ extern bool opt_ignore_builtin_innodb;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop;
extern bool in_bootstrap;
-extern uint volatile thread_count, global_read_lock;
+extern uint volatile thread_count;
extern uint connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern ulong slave_exec_mode_options;
extern ulonglong slave_type_conversions_options;
-extern my_bool opt_readonly, lower_case_file_system;
+extern my_bool read_only, opt_readonly;
+extern my_bool lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
extern char* opt_secure_file_priv;
@@ -227,7 +228,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
- key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
+ key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_logger, key_LOCK_manager,
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
@@ -248,7 +249,7 @@ extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
#endif /* HAVE_MMAP */
extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
- key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
+ key_COND_cache_status_changed, key_COND_manager,
key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
@@ -270,9 +271,10 @@ extern PSI_file_key key_file_binlog, key_file_binlog_index, key_file_casetest,
key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
+ key_file_master_info, key_file_misc, key_file_partition,
key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
key_file_trg, key_file_trn, key_file_init;
+extern PSI_file_key key_file_query_log, key_file_slow_log;
void init_server_psi_keys();
#endif /* HAVE_PSI_INTERFACE */
@@ -320,7 +322,7 @@ extern mysql_mutex_t
LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
- LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
+ LOCK_slave_list, LOCK_active_mi, LOCK_manager,
LOCK_global_system_variables, LOCK_user_conn,
LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
@@ -333,7 +335,6 @@ extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern mysql_rwlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count;
extern mysql_cond_t COND_manager;
-extern mysql_cond_t COND_global_read_lock;
extern int32 thread_running;
extern my_atomic_rwlock_t thread_running_lock;
@@ -391,7 +392,8 @@ enum options_mysqld
OPT_UPDATE_LOG,
OPT_WANT_CORE,
OPT_ENGINE_CONDITION_PUSHDOWN,
- OPT_LOG_ERROR
+ OPT_LOG_ERROR,
+ OPT_AUTOCOMMIT
};
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ffff9e3f6c8..2ac860d25e3 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -5796,6 +5796,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
*/
if (field->result_type() == STRING_RESULT &&
+ ((Field_str*) field)->match_collation_to_optimize_range() &&
value->result_type() == STRING_RESULT &&
key_part->image_type == Field::itRAW &&
((Field_str*)field)->charset() != conf_func->compare_collation() &&
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 33b3d561ad8..6da4d1c2776 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -279,6 +279,7 @@ public:
virtual bool reverse_sorted() = 0;
virtual bool unique_key_range() { return false; }
+ virtual bool clustered_pk_range() { return false; }
enum {
QS_TYPE_RANGE = 0,
@@ -553,6 +554,8 @@ public:
THD *thd;
int read_keys_and_merge();
+ bool clustered_pk_range() { return test(pk_quick_select); }
+
/* used to get rows collected in Unique */
READ_RECORD read_record;
};
diff --git a/sql/protocol.cc b/sql/protocol.cc
index dd3a5d92a87..03b151e4346 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -505,11 +505,11 @@ void Protocol::end_statement()
thd->stmt_da->get_sqlstate());
break;
case Diagnostics_area::DA_EOF:
- error= send_eof(thd->stmt_da->server_status(),
+ error= send_eof(thd->server_status,
thd->stmt_da->statement_warn_count());
break;
case Diagnostics_area::DA_OK:
- error= send_ok(thd->stmt_da->server_status(),
+ error= send_ok(thd->server_status,
thd->stmt_da->statement_warn_count(),
thd->stmt_da->affected_rows(),
thd->stmt_da->last_insert_id(),
diff --git a/sql/records.cc b/sql/records.cc
index ccacdc33b36..d713c34dffe 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -206,6 +206,15 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
if (select && my_b_inited(&select->file))
tempfile= &select->file;
+ else if (select && select->quick && select->quick->clustered_pk_range())
+ {
+ /*
+ In case of QUICK_INDEX_MERGE_SELECT with clustered pk range we have to
+ use its own access method(i.e QUICK_INDEX_MERGE_SELECT::get_next()) as
+ sort file does not contain rowids which satisfy clustered pk range.
+ */
+ tempfile= 0;
+ }
else
tempfile= table->sort.io_cache;
if (tempfile && my_b_inited(tempfile)) // Test if ref-records was used
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
index 5f16544d855..4355942e47f 100644
--- a/sql/rpl_handler.cc
+++ b/sql/rpl_handler.cc
@@ -105,12 +105,20 @@ int delegates_init()
transaction_delegate= new (place_trans_mem) Trans_delegate;
if (!transaction_delegate->is_inited())
+ {
+ sql_print_error("Initialization of transaction delegates failed. "
+ "Please report a bug.");
return 1;
+ }
binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate;
if (!binlog_storage_delegate->is_inited())
+ {
+ sql_print_error("Initialization binlog storage delegates failed. "
+ "Please report a bug.");
return 1;
+ }
#ifdef HAVE_REPLICATION
void *place_transmit_mem= transmit_mem.data;
@@ -119,16 +127,29 @@ int delegates_init()
binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate;
if (!binlog_transmit_delegate->is_inited())
+ {
+ sql_print_error("Initialization of binlog transmit delegates failed. "
+ "Please report a bug.");
return 1;
+ }
binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate;
if (!binlog_relay_io_delegate->is_inited())
+ {
+ sql_print_error("Initialization binlog relay IO delegates failed. "
+ "Please report a bug.");
return 1;
+ }
#endif
if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
+ {
+ sql_print_error("Error while creating pthread specific data key for replication. "
+ "Please report a bug.");
return 1;
+ }
+
return 0;
}
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 8219f70727e..dd16318303d 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -78,8 +78,6 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
unsigned int null_mask= 1U;
for ( ; (field= *p_field) ; p_field++)
{
- DBUG_PRINT("debug", ("null_mask=%d; null_ptr=%p; row_data=%p; null_byte_count=%d",
- null_mask, null_ptr, row_data, null_byte_count));
if (bitmap_is_set(cols, p_field - table->field))
{
my_ptrdiff_t offset;
@@ -110,6 +108,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
field->field_name, field->real_type(),
(ulong) old_pack_ptr, (ulong) pack_ptr,
(int) (pack_ptr - old_pack_ptr)));
+ DBUG_DUMP("packed_data", old_pack_ptr, pack_ptr - old_pack_ptr);
}
null_mask <<= 1;
@@ -380,8 +379,11 @@ unpack_row(Relay_log_info const *rli,
}
DBUG_ASSERT(null_mask & 0xFF); // One of the 8 LSB should be set
- if (!((null_bits & null_mask) && tabledef->maybe_null(i)))
- pack_ptr+= tabledef->calc_field_size(i, (uchar *) pack_ptr);
+ if (!((null_bits & null_mask) && tabledef->maybe_null(i))) {
+ uint32 len= tabledef->calc_field_size(i, (uchar *) pack_ptr);
+ DBUG_DUMP("field_data", pack_ptr, len);
+ pack_ptr+= len;
+ }
null_mask <<= 1;
}
}
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index af9b452acd8..a35e7bb1612 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1274,6 +1274,9 @@ void Relay_log_info::slave_close_thread_tables(THD *thd)
*/
if (! thd->in_multi_stmt_transaction_mode())
thd->mdl_context.release_transactional_locks();
+ else
+ thd->mdl_context.release_statement_locks();
+
clear_tables_to_lock();
}
#endif
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index bf8381933c0..09b58d4f3a0 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -97,6 +97,16 @@ public:
*/
MYSQL_BIN_LOG relay_log;
LOG_INFO linfo;
+
+ /*
+ cur_log
+ Pointer that either points at relay_log.get_log_file() or
+ &rli->cache_buf, depending on whether the log is hot or there was
+ the need to open a cold relay_log.
+
+ cache_buf
+ IO_CACHE used when opening cold relay logs.
+ */
IO_CACHE cache_buf,*cur_log;
/*
diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am
deleted file mode 100644
index 73f2ca13bb6..00000000000
--- a/sql/share/Makefile.am
+++ /dev/null
@@ -1,60 +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
-
-## Process this file with automake to create Makefile.in
-
-EXTRA_DIST= errmsg-utf8.txt \
- CMakeLists.txt
-
-dist-hook:
- for dir in charsets @AVAILABLE_LANGUAGES@; do \
- test -d $(distdir)/$$dir || mkdir $(distdir)/$$dir; \
- $(INSTALL_DATA) $(srcdir)/$$dir/*.* $(distdir)/$$dir; \
- done; \
- sleep 1 ; touch $(srcdir)/*/errmsg.sys
- $(INSTALL_DATA) $(srcdir)/charsets/README $(distdir)/charsets
- $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(distdir)/charsets
-
-all-local: english/errmsg.sys
-
-# Use the english errmsg.sys as a flag that all errmsg.sys needs to be
-# created. Normally these are created by extra/Makefile
-
-english/errmsg.sys: errmsg-utf8.txt
- rm -f $(top_builddir)/include/mysqld_error.h
- (cd $(top_builddir)/extra && $(MAKE))
-
-install-data-local:
- for lang in @AVAILABLE_LANGUAGES@; \
- do \
- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$$lang; \
- $(INSTALL_DATA) $(srcdir)/$$lang/errmsg.sys \
- $(DESTDIR)$(pkgdatadir)/$$lang/errmsg.sys; \
- done
- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets
- $(INSTALL_DATA) $(srcdir)/errmsg-utf8.txt \
- $(DESTDIR)$(pkgdatadir)/errmsg-utf8.txt; \
- $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README
- $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets
-
-# FIXME maybe shouldn't remove, could be needed by other installation?
-uninstall-local:
- @RM@ -f -r $(DESTDIR)$(pkgdatadir)
-
-distclean-local:
- @RM@ -f */errmsg.sys
-
-# Do nothing
-link_sources:
diff --git a/sql/slave.cc b/sql/slave.cc
index 3e77a5e7516..c4be7c7a6f7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -721,9 +721,17 @@ int start_slave_thread(
while (start_id == *slave_run_id)
{
DBUG_PRINT("sleep",("Waiting for slave thread to start"));
- const char* old_msg = thd->enter_cond(start_cond,cond_lock,
- "Waiting for slave thread to start");
- mysql_cond_wait(start_cond, cond_lock);
+ const char *old_msg= thd->enter_cond(start_cond, cond_lock,
+ "Waiting for slave thread to start");
+ /*
+ It is not sufficient to test this at loop bottom. We must test
+ it after registering the mutex in enter_cond(). If the kill
+ happens after testing of thd->killed and before the mutex is
+ registered, we could otherwise go waiting though thd->killed is
+ set.
+ */
+ if (!thd->killed)
+ mysql_cond_wait(start_cond, cond_lock);
thd->exit_cond(old_msg);
mysql_mutex_lock(cond_lock); // re-acquire it as exit_cond() released
if (thd->killed)
@@ -881,7 +889,17 @@ static bool sql_slave_killed(THD* thd, Relay_log_info* rli)
DBUG_ASSERT(rli->slave_running == 1);// tracking buffer overrun
if (abort_loop || thd->killed || rli->abort_slave)
{
- if (thd->transaction.all.modified_non_trans_table && rli->is_in_group())
+ /*
+ The transaction should always be binlogged if OPTION_KEEP_LOG is set
+ (it implies that something can not be rolled back). And such case
+ should be regarded similarly as modifing a non-transactional table
+ because retrying of the transaction will lead to an error or inconsistency
+ as well.
+ Example: OPTION_KEEP_LOG is set if a temporary table is created or dropped.
+ */
+ if ((thd->transaction.all.modified_non_trans_table ||
+ (thd->variables.option_bits & OPTION_KEEP_LOG))
+ && rli->is_in_group())
{
char msg_stopped[]=
"... The slave SQL is stopped, leaving the current group "
@@ -2503,7 +2521,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
if (slave_trans_retries)
{
- int temp_err;
+ int UNINIT_VAR(temp_err);
if (exec_res && (temp_err= has_temporary_error(thd)))
{
const char *errmsg;
@@ -3001,7 +3019,7 @@ err:
sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s",
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
- thd->set_query(NULL, 0);
+ thd->reset_query();
thd->reset_db(NULL, 0);
if (mysql)
{
@@ -3391,7 +3409,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
variables is supposed to set them to 0 before terminating)).
*/
thd->catalog= 0;
- thd->set_query(NULL, 0);
+ thd->reset_query();
thd->reset_db(NULL, 0);
thd_proc_info(thd, "Waiting for slave mutex on exit");
mysql_mutex_lock(&rli->run_lock);
@@ -4726,12 +4744,66 @@ static Log_event* next_event(Relay_log_info* rli)
DBUG_ASSERT(rli->cur_log_fd == -1);
/*
- Read pointer has to be at the start since we are the only
- reader.
- We must keep the LOCK_log to read the 4 first bytes, as this is a hot
- log (same as when we call read_log_event() above: for a hot log we
- take the mutex).
+ When the SQL thread is [stopped and] (re)started the
+ following may happen:
+
+ 1. Log was hot at stop time and remains hot at restart
+
+ SQL thread reads again from hot_log (SQL thread was
+ reading from the active log when it was stopped and the
+ very same log is still active on SQL thread restart).
+
+ In this case, my_b_seek is performed on cur_log, while
+ cur_log points to relay_log.get_log_file();
+
+ 2. Log was hot at stop time but got cold before restart
+
+ The log was hot when SQL thread stopped, but it is not
+ anymore when the SQL thread restarts.
+
+ In this case, the SQL thread reopens the log, using
+ cache_buf, ie, cur_log points to &cache_buf, and thence
+ its coordinates are reset.
+
+ 3. Log was already cold at stop time
+
+ The log was not hot when the SQL thread stopped, and, of
+ course, it will not be hot when it restarts.
+
+ In this case, the SQL thread opens the cold log again,
+ using cache_buf, ie, cur_log points to &cache_buf, and
+ thence its coordinates are reset.
+
+ 4. Log was hot at stop time, DBA changes to previous cold
+ log and restarts SQL thread
+
+ The log was hot when the SQL thread was stopped, but the
+ user changed the coordinates of the SQL thread to
+ restart from a previous cold log.
+
+ In this case, at start time, cur_log points to a cold
+ log, opened using &cache_buf as cache, and coordinates
+ are reset. However, as it moves on to the next logs, it
+ will eventually reach the hot log. If the hot log is the
+ same at the time the SQL thread was stopped, then
+ coordinates were not reset - the cur_log will point to
+ relay_log.get_log_file(), and not a freshly opened
+ IO_CACHE through cache_buf. For this reason we need to
+ deploy a my_b_seek before calling check_binlog_magic at
+ this point of the code (see: BUG#55263 for more
+ details).
+
+ NOTES:
+ - We must keep the LOCK_log to read the 4 first bytes, as
+ this is a hot log (same as when we call read_log_event()
+ above: for a hot log we take the mutex).
+
+ - Because of scenario #4 above, we need to have a
+ my_b_seek here. Otherwise, we might hit the assertion
+ inside check_binlog_magic.
*/
+
+ my_b_seek(cur_log, (my_off_t) 0);
if (check_binlog_magic(cur_log,&errmsg))
{
if (!hot_log)
diff --git a/sql/sp.cc b/sql/sp.cc
index 8821dc9365d..ae11c2ad14c 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -27,7 +27,7 @@
#include "sql_acl.h" // SUPER_ACL
#include "sp_head.h"
#include "sp_cache.h"
-#include "lock.h" // lock_routine_name
+#include "lock.h" // lock_object_name
#include <my_user.h>
@@ -440,7 +440,7 @@ static TABLE *open_proc_table_for_update(THD *thd)
{
TABLE_LIST table_list;
TABLE *table;
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_proc_table_for_update");
table_list.init_one_table("mysql", 5, "proc", 4, "proc", TL_WRITE);
@@ -922,6 +922,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
TABLE *table;
char definer[USER_HOST_BUFF_SIZE];
ulong saved_mode= thd->variables.sql_mode;
+ MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
+ MDL_key::FUNCTION : MDL_key::PROCEDURE;
CHARSET_INFO *db_cs= get_default_db_collation(thd, sp->m_db.str);
@@ -941,8 +943,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
type == TYPE_ENUM_FUNCTION);
/* Grab an exclusive MDL lock. */
- if (lock_routine_name(thd, type == TYPE_ENUM_FUNCTION,
- sp->m_db.str, sp->m_name.str))
+ if (lock_object_name(thd, mdl_type, sp->m_db.str, sp->m_name.str))
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
/* Reset sql_mode during data dictionary operations. */
@@ -1190,6 +1191,8 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
TABLE *table;
int ret;
bool save_binlog_row_based;
+ MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
+ MDL_key::FUNCTION : MDL_key::PROCEDURE;
DBUG_ENTER("sp_drop_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",
type, (int) name->m_name.length, name->m_name.str));
@@ -1198,8 +1201,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
type == TYPE_ENUM_FUNCTION);
/* Grab an exclusive MDL lock. */
- if (lock_routine_name(thd, type == TYPE_ENUM_FUNCTION,
- name->m_db.str, name->m_name.str))
+ if (lock_object_name(thd, mdl_type, name->m_db.str, name->m_name.str))
DBUG_RETURN(SP_DELETE_ROW_FAILED);
if (!(table= open_proc_table_for_update(thd)))
@@ -1270,6 +1272,8 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
TABLE *table;
int ret;
bool save_binlog_row_based;
+ MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
+ MDL_key::FUNCTION : MDL_key::PROCEDURE;
DBUG_ENTER("sp_update_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",
type, (int) name->m_name.length, name->m_name.str));
@@ -1278,8 +1282,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
type == TYPE_ENUM_FUNCTION);
/* Grab an exclusive MDL lock. */
- if (lock_routine_name(thd, type == TYPE_ENUM_FUNCTION,
- name->m_db.str, name->m_name.str))
+ if (lock_object_name(thd, mdl_type, name->m_db.str, name->m_name.str))
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
if (!(table= open_proc_table_for_update(thd)))
@@ -1355,6 +1358,108 @@ err:
/**
+ This internal handler is used to trap errors from opening mysql.proc.
+*/
+
+class Lock_db_routines_error_handler : public Internal_error_handler
+{
+public:
+ bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl)
+ {
+ if (sql_errno == ER_NO_SUCH_TABLE ||
+ sql_errno == ER_CANNOT_LOAD_FROM_TABLE ||
+ sql_errno == ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE ||
+ sql_errno == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED)
+ return true;
+ return false;
+ }
+};
+
+
+/**
+ Acquires exclusive metadata lock on all stored routines in the
+ given database.
+
+ @note Will also return false (=success) if mysql.proc can't be opened
+ or is outdated. This allows DROP DATABASE to continue in these
+ cases.
+ */
+
+bool lock_db_routines(THD *thd, char *db)
+{
+ TABLE *table;
+ uint key_len;
+ int nxtres= 0;
+ Open_tables_backup open_tables_state_backup;
+ MDL_request_list mdl_requests;
+ Lock_db_routines_error_handler err_handler;
+ DBUG_ENTER("lock_db_routines");
+
+ /*
+ mysql.proc will be re-opened during deletion, so we can ignore
+ errors when opening the table here. The error handler is
+ used to avoid getting the same warning twice.
+ */
+ thd->push_internal_handler(&err_handler);
+ table= open_proc_table_for_read(thd, &open_tables_state_backup);
+ thd->pop_internal_handler();
+ if (!table)
+ {
+ /*
+ DROP DATABASE should not fail even if mysql.proc does not exist
+ or is outdated. We therefore only abort mysql_rm_db() if we
+ have errors not handled by the error handler.
+ */
+ DBUG_RETURN(thd->is_error() || thd->killed);
+ }
+
+ table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info);
+ key_len= table->key_info->key_part[0].store_length;
+ table->file->ha_index_init(0, 1);
+
+ if (! table->file->index_read_map(table->record[0],
+ table->field[MYSQL_PROC_FIELD_DB]->ptr,
+ (key_part_map)1, HA_READ_KEY_EXACT))
+ {
+ do
+ {
+ char *sp_name= get_field(thd->mem_root,
+ table->field[MYSQL_PROC_FIELD_NAME]);
+ longlong sp_type= table->field[MYSQL_PROC_MYSQL_TYPE]->val_int();
+ MDL_request *mdl_request= new (thd->mem_root) MDL_request;
+ mdl_request->init(sp_type == TYPE_ENUM_FUNCTION ?
+ MDL_key::FUNCTION : MDL_key::PROCEDURE,
+ db, sp_name, MDL_EXCLUSIVE, MDL_TRANSACTION);
+ mdl_requests.push_front(mdl_request);
+ } while (! (nxtres= table->file->index_next_same(table->record[0],
+ table->field[MYSQL_PROC_FIELD_DB]->ptr,
+ key_len)));
+ }
+ table->file->ha_index_end();
+ if (nxtres != 0 && nxtres != HA_ERR_END_OF_FILE)
+ {
+ table->file->print_error(nxtres, MYF(0));
+ close_system_tables(thd, &open_tables_state_backup);
+ DBUG_RETURN(true);
+ }
+ close_system_tables(thd, &open_tables_state_backup);
+
+ /* We should already hold a global IX lock and a schema X lock. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
+ MDL_INTENTION_EXCLUSIVE) &&
+ thd->mdl_context.is_lock_owner(MDL_key::SCHEMA, db, "",
+ MDL_EXCLUSIVE));
+ DBUG_RETURN(thd->mdl_context.acquire_locks(&mdl_requests,
+ thd->variables.lock_wait_timeout));
+}
+
+
+/**
Drop all routines in database 'db'
@note Close the thread tables, the calling code might want to
@@ -1367,7 +1472,7 @@ sp_drop_db_routines(THD *thd, char *db)
TABLE *table;
int ret;
uint key_len;
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("sp_drop_db_routines");
DBUG_PRINT("enter", ("db: %s", db));
@@ -1636,38 +1741,6 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
}
-/**
- Check if a routine exists in the mysql.proc table, without actually
- parsing the definition. (Used for dropping).
-
- @param thd thread context
- @param name name of procedure
-
- @retval
- 0 Success
- @retval
- non-0 Error; SP_OPEN_TABLE_FAILED or SP_KEY_NOT_FOUND
-*/
-
-int
-sp_routine_exists_in_table(THD *thd, int type, sp_name *name)
-{
- TABLE *table;
- int ret;
- Open_tables_backup open_tables_state_backup;
-
- if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
- ret= SP_OPEN_TABLE_FAILED;
- else
- {
- if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
- ret= SP_KEY_NOT_FOUND;
- close_system_tables(thd, &open_tables_state_backup);
- }
- return ret;
-}
-
-
extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
my_bool first)
{
@@ -1723,7 +1796,7 @@ bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
(Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry));
if (!rn) // OOM. Error will be reported using fatal_error().
return FALSE;
- rn->mdl_request.init(key, MDL_SHARED);
+ rn->mdl_request.init(key, MDL_SHARED, MDL_TRANSACTION);
if (my_hash_insert(&prelocking_ctx->sroutines, (uchar *)rn))
return FALSE;
prelocking_ctx->sroutines_list.link_in_list(rn, &rn->next);
diff --git a/sql/sp.h b/sql/sp.h
index 10e70261b86..68c45768857 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -84,6 +84,18 @@ enum
int
sp_drop_db_routines(THD *thd, char *db);
+/**
+ Acquires exclusive metadata lock on all stored routines in the
+ given database.
+
+ @param thd Thread handler
+ @param db Database name
+
+ @retval false Success
+ @retval true Failure
+ */
+bool lock_db_routines(THD *thd, char *db);
+
sp_head *
sp_find_routine(THD *thd, int type, sp_name *name,
sp_cache **cp, bool cache_only);
@@ -100,9 +112,6 @@ sp_cache_routine(THD *thd, int type, sp_name *name,
bool
sp_exist_routines(THD *thd, TABLE_LIST *procs, bool any);
-int
-sp_routine_exists_in_table(THD *thd, int type, sp_name *name);
-
bool
sp_show_create_routine(THD *thd, int type, sp_name *name);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 1fd4e9302c4..54e32b67c65 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1176,10 +1176,17 @@ find_handler_after_execution(THD *thd, sp_rcontext *ctx)
/**
Execute the routine. The main instruction jump loop is there.
Assume the parameters already set.
+
+ @param thd Thread context.
+ @param merge_da_on_success Flag specifying if Warning Info should be
+ propagated to the caller on Completion
+ Condition or not.
+
@todo
- Will write this SP statement into binlog separately
(TODO: consider changing the condition to "not inside event union")
+ @return Error status.
@retval
FALSE on success
@retval
@@ -1187,7 +1194,7 @@ find_handler_after_execution(THD *thd, sp_rcontext *ctx)
*/
bool
-sp_head::execute(THD *thd)
+sp_head::execute(THD *thd, bool merge_da_on_success)
{
DBUG_ENTER("sp_head::execute");
char saved_cur_db_name_buf[NAME_LEN+1];
@@ -1484,8 +1491,15 @@ sp_head::execute(THD *thd)
thd->stmt_arena= old_arena;
state= EXECUTED;
- /* Restore the caller's original warning information area. */
- saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
+ /*
+ Restore the caller's original warning information area:
+ - warnings generated during trigger execution should not be
+ propagated to the caller on success;
+ - if there was an exception during execution, warning info should be
+ propagated to the caller in any case.
+ */
+ if (err_status || merge_da_on_success)
+ saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
thd->warning_info= saved_warning_info;
done:
@@ -1499,7 +1513,7 @@ sp_head::execute(THD *thd)
If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed
*/
- if (cur_db_changed && !thd->killed)
+ if (cur_db_changed && thd->killed != THD::KILL_CONNECTION)
{
/*
Force switching back to the saved current database, because it may be
@@ -1707,7 +1721,7 @@ sp_head::execute_trigger(THD *thd,
thd->spcont= nctx;
- err_status= execute(thd);
+ err_status= execute(thd, FALSE);
err_with_cleanup:
thd->restore_active_arena(&call_arena, &backup_arena);
@@ -1924,7 +1938,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
*/
thd->set_n_backup_active_arena(&call_arena, &backup_arena);
- err_status= execute(thd);
+ err_status= execute(thd, TRUE);
thd->restore_active_arena(&call_arena, &backup_arena);
@@ -2129,6 +2143,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
thd->mdl_context.release_transactional_locks();
+ else if (! thd->in_sub_stmt)
+ thd->mdl_context.release_statement_locks();
thd->rollback_item_tree_changes();
@@ -2157,7 +2173,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
#endif
if (!err_status)
- err_status= execute(thd);
+ err_status= execute(thd, TRUE);
if (save_log_general)
thd->variables.option_bits &= ~OPTION_LOG_OFF;
@@ -2964,6 +2980,8 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
thd->mdl_context.release_transactional_locks();
+ else if (! thd->in_sub_stmt)
+ thd->mdl_context.release_statement_locks();
}
if (m_lex->query_tables_own_last)
@@ -3051,14 +3069,11 @@ int sp_instr::exec_core(THD *thd, uint *nextp)
int
sp_instr_stmt::execute(THD *thd, uint *nextp)
{
- char *query;
- uint32 query_length;
int res;
DBUG_ENTER("sp_instr_stmt::execute");
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
- query= thd->query();
- query_length= thd->query_length();
+ const CSET_STRING query_backup= thd->query_string;
#if defined(ENABLED_PROFILING)
/* This s-p instr is profilable and will be captured. */
thd->profiling.set_query_source(m_query.str, m_query.length);
@@ -3079,7 +3094,12 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
if (thd->stmt_da->is_eof())
+ {
+ /* Finalize server status flags after executing a statement. */
+ thd->update_server_status();
+
thd->protocol->end_statement();
+ }
query_cache_end_of_result(thd);
@@ -3088,7 +3108,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
}
else
*nextp= m_ip+1;
- thd->set_query(query, query_length);
+ thd->set_query(query_backup);
thd->query_name_consts= 0;
if (!thd->is_error())
@@ -4159,7 +4179,8 @@ sp_head::add_used_tables_to_table_list(THD *thd,
*/
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_SHARED_WRITE : MDL_SHARED_READ,
+ MDL_TRANSACTION);
/* Everyting else should be zeroed */
@@ -4203,7 +4224,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,
- mdl_type);
+ mdl_type, MDL_TRANSACTION);
lex->add_to_query_tables(table);
return table;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index e72ce6455f6..5efd48fc7c6 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -527,7 +527,7 @@ private:
HASH m_sptabs;
bool
- execute(THD *thd);
+ execute(THD *thd, bool merge_da_on_success);
/**
Perform a forward flow analysis in the generated code.
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 1af758ed0af..ec8d82063e4 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -220,6 +220,7 @@ private:
during execution.
*/
bool m_return_value_set;
+
/**
TRUE if the context is created for a sub-statement.
*/
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 5583e9a29f1..5ac31d1f578 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -268,11 +268,13 @@ class ACL_PROXY_USER :public ACL_ACCESS
bool with_grant;
typedef enum {
- MYSQL_PROXY_PRIV_HOST,
- MYSQL_PROXY_PRIV_USER,
- MYSQL_PROXY_PRIV_PROXIED_HOST,
- MYSQL_PROXY_PRIV_PROXIED_USER,
- MYSQL_PROXY_PRIV_WITH_GRANT } old_acl_proxy_users;
+ MYSQL_PROXIES_PRIV_HOST,
+ MYSQL_PROXIES_PRIV_USER,
+ MYSQL_PROXIES_PRIV_PROXIED_HOST,
+ MYSQL_PROXIES_PRIV_PROXIED_USER,
+ MYSQL_PROXIES_PRIV_WITH_GRANT,
+ MYSQL_PROXIES_PRIV_GRANTOR,
+ MYSQL_PROXIES_PRIV_TIMESTAMP } old_acl_proxy_users;
public:
ACL_PROXY_USER () {};
@@ -308,11 +310,11 @@ public:
void init(TABLE *table, MEM_ROOT *mem)
{
- init (get_field(mem, table->field[MYSQL_PROXY_PRIV_HOST]),
- get_field(mem, table->field[MYSQL_PROXY_PRIV_USER]),
- get_field(mem, table->field[MYSQL_PROXY_PRIV_PROXIED_HOST]),
- get_field(mem, table->field[MYSQL_PROXY_PRIV_PROXIED_USER]),
- table->field[MYSQL_PROXY_PRIV_WITH_GRANT]->val_int() != 0);
+ init (get_field(mem, table->field[MYSQL_PROXIES_PRIV_HOST]),
+ get_field(mem, table->field[MYSQL_PROXIES_PRIV_USER]),
+ get_field(mem, table->field[MYSQL_PROXIES_PRIV_PROXIED_HOST]),
+ get_field(mem, table->field[MYSQL_PROXIES_PRIV_PROXIED_USER]),
+ table->field[MYSQL_PROXIES_PRIV_WITH_GRANT]->val_int() != 0);
}
bool get_with_grant() { return with_grant; }
@@ -337,7 +339,7 @@ public:
(hostname_requires_resolving(host.hostname) ||
hostname_requires_resolving(proxied_host.hostname)))
{
- sql_print_warning("'proxy_priv' entry '%s@%s %s@%s' "
+ sql_print_warning("'proxies_priv' entry '%s@%s %s@%s' "
"ignored in --skip-name-resolve mode.",
proxied_user ? proxied_user : "",
proxied_host.hostname ? proxied_host.hostname : "",
@@ -452,19 +454,19 @@ public:
user->str ? user->str : "<NULL>",
proxied_host->str ? proxied_host->str : "<NULL>",
proxied_user->str ? proxied_user->str : "<NULL>"));
- if (table->field[MYSQL_PROXY_PRIV_HOST]->store(host->str,
+ if (table->field[MYSQL_PROXIES_PRIV_HOST]->store(host->str,
host->length,
system_charset_info))
DBUG_RETURN(TRUE);
- if (table->field[MYSQL_PROXY_PRIV_USER]->store(user->str,
+ if (table->field[MYSQL_PROXIES_PRIV_USER]->store(user->str,
user->length,
system_charset_info))
DBUG_RETURN(TRUE);
- if (table->field[MYSQL_PROXY_PRIV_PROXIED_HOST]->store(proxied_host->str,
+ if (table->field[MYSQL_PROXIES_PRIV_PROXIED_HOST]->store(proxied_host->str,
proxied_host->length,
system_charset_info))
DBUG_RETURN(TRUE);
- if (table->field[MYSQL_PROXY_PRIV_PROXIED_USER]->store(proxied_user->str,
+ if (table->field[MYSQL_PROXIES_PRIV_PROXIED_USER]->store(proxied_user->str,
proxied_user->length,
system_charset_info))
DBUG_RETURN(TRUE);
@@ -472,20 +474,25 @@ public:
DBUG_RETURN(FALSE);
}
- static int store_data_record(TABLE *table,
- const LEX_STRING *host,
+ static int store_data_record(TABLE *table,
+ const LEX_STRING *host,
const LEX_STRING *user,
- const LEX_STRING *proxied_host,
+ const LEX_STRING *proxied_host,
const LEX_STRING *proxied_user,
- bool with_grant)
+ bool with_grant,
+ const char *grantor)
{
- DBUG_ENTER ("ACL_PROXY_USER::store_pk");
- if (store_pk (table, host, user, proxied_host, proxied_user))
+ DBUG_ENTER("ACL_PROXY_USER::store_pk");
+ if (store_pk(table, host, user, proxied_host, proxied_user))
DBUG_RETURN(TRUE);
- DBUG_PRINT ("info", ("with_grant=%s", with_grant ? "TRUE" : "FALSE"));
- if (table->field[MYSQL_PROXY_PRIV_WITH_GRANT]->store(with_grant ? 1 : 0,
+ DBUG_PRINT("info", ("with_grant=%s", with_grant ? "TRUE" : "FALSE"));
+ if (table->field[MYSQL_PROXIES_PRIV_WITH_GRANT]->store(with_grant ? 1 : 0,
TRUE))
DBUG_RETURN(TRUE);
+ if (table->field[MYSQL_PROXIES_PRIV_GRANTOR]->store(grantor,
+ strlen(grantor),
+ system_charset_info))
+ DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE);
}
@@ -1022,24 +1029,35 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
end_read_record(&read_record_info);
freeze_size(&acl_dbs);
- init_read_record(&read_record_info, thd, table= tables[3].table, NULL, 1,
- 0, FALSE);
- table->use_all_columns();
(void) my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER),
50, 100);
- while (!(read_record_info.read_record(&read_record_info)))
+ if (tables[3].table)
{
- ACL_PROXY_USER proxy;
- proxy.init(table, &mem);
- if (proxy.check_validity(check_no_resolve))
- continue;
- if (push_dynamic(&acl_proxy_users, (uchar*) &proxy))
- return TRUE;
+ init_read_record(&read_record_info, thd, table= tables[3].table, NULL, 1,
+ 0, FALSE);
+ table->use_all_columns();
+ while (!(read_record_info.read_record(&read_record_info)))
+ {
+ ACL_PROXY_USER proxy;
+ proxy.init(table, &mem);
+ if (proxy.check_validity(check_no_resolve))
+ continue;
+ if (push_dynamic(&acl_proxy_users, (uchar*) &proxy))
+ {
+ end_read_record(&read_record_info);
+ goto end;
+ }
+ }
+ my_qsort((uchar*) dynamic_element(&acl_proxy_users, 0, ACL_PROXY_USER*),
+ acl_proxy_users.elements,
+ sizeof(ACL_PROXY_USER), (qsort_cmp) acl_compare);
+ end_read_record(&read_record_info);
+ }
+ else
+ {
+ sql_print_error("Missing system table mysql.proxies_priv; "
+ "please run mysql_upgrade to create it");
}
- my_qsort((uchar*) dynamic_element(&acl_proxy_users, 0, ACL_PROXY_USER*),
- acl_proxy_users.elements,
- sizeof(ACL_PROXY_USER), (qsort_cmp) acl_compare);
- end_read_record(&read_record_info);
freeze_size(&acl_proxy_users);
init_check_host();
@@ -1113,13 +1131,14 @@ my_bool acl_reload(THD *thd)
tables[2].init_one_table(C_STRING_WITH_LEN("mysql"),
C_STRING_WITH_LEN("db"), "db", TL_READ);
tables[3].init_one_table(C_STRING_WITH_LEN("mysql"),
- C_STRING_WITH_LEN("proxy_priv"),
- "proxy_priv", TL_READ);
+ C_STRING_WITH_LEN("proxies_priv"),
+ "proxies_priv", TL_READ);
tables[0].next_local= tables[0].next_global= tables + 1;
tables[1].next_local= tables[1].next_global= tables + 2;
tables[2].next_local= tables[2].next_global= tables + 3;
tables[0].open_type= tables[1].open_type= tables[2].open_type=
tables[3].open_type= OT_BASE_ONLY;
+ tables[3].open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{
@@ -2608,7 +2627,7 @@ acl_insert_proxy_user(ACL_PROXY_USER *new_value)
static int
-replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
+replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
const LEX_USER *proxied_user, bool with_grant_arg,
bool revoke_grant)
{
@@ -2616,8 +2635,9 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
int error;
uchar user_key[MAX_KEY_LENGTH];
ACL_PROXY_USER new_grant;
+ char grantor[USER_HOST_BUFF_SIZE];
- DBUG_ENTER("replace_proxy_priv_table");
+ DBUG_ENTER("replace_proxies_priv_table");
if (!initialized)
{
@@ -2639,6 +2659,8 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
+ get_grantor(thd, grantor);
+
table->file->ha_index_init(0, 1);
if (table->file->index_read_map(table->record[0], user_key,
HA_WHOLE_KEY,
@@ -2655,7 +2677,8 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
ACL_PROXY_USER::store_data_record(table, &user->host, &user->user,
&proxied_user->host,
&proxied_user->user,
- with_grant_arg);
+ with_grant_arg,
+ grantor);
}
else
{
@@ -2712,7 +2735,7 @@ table_error:
table->file->print_error(error, MYF(0)); /* purecov: inspected */
abort:
- DBUG_PRINT("info", ("aborting replace_proxy_priv_table"));
+ DBUG_PRINT("info", ("aborting replace_proxies_priv_table"));
table->file->ha_index_end();
DBUG_RETURN(-1);
}
@@ -3962,14 +3985,14 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
proxied_user= str_list++;
}
- /* open the mysql.user and mysql.db or mysql.proxy_priv tables */
+ /* open the mysql.user and mysql.db or mysql.proxies_priv tables */
tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
C_STRING_WITH_LEN("user"), "user", TL_WRITE);
if (is_proxy)
tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
- C_STRING_WITH_LEN("proxy_priv"),
- "proxy_priv",
+ C_STRING_WITH_LEN("proxies_priv"),
+ "proxies_priv",
TL_WRITE);
else
tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
@@ -4063,7 +4086,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
else if (is_proxy)
{
- if (replace_proxy_priv_table (thd, tables[1].table, Str, proxied_user,
+ if (replace_proxies_priv_table (thd, tables[1].table, Str, proxied_user,
rights & GRANT_ACL ? TRUE : FALSE,
revoke_grant))
result= -1;
@@ -5690,8 +5713,10 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
C_STRING_WITH_LEN("procs_priv"),
"procs_priv", TL_WRITE);
(tables+5)->init_one_table(C_STRING_WITH_LEN("mysql"),
- C_STRING_WITH_LEN("proxy_priv"),
- "proxy_priv", TL_WRITE);
+ C_STRING_WITH_LEN("proxies_priv"),
+ "proxies_priv", TL_WRITE);
+ tables[5].open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
+
tables->next_local= tables->next_global= tables + 1;
(tables+1)->next_local= (tables+1)->next_global= tables + 2;
(tables+2)->next_local= (tables+2)->next_global= tables + 3;
@@ -6068,7 +6093,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
host= acl_proxy_user->get_host();
break;
default:
- assert(0);
+ MY_ASSERT_UNREACHABLE();
}
if (! user)
user= "";
@@ -6283,18 +6308,21 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
}
- /* Handle proxy_priv table. */
- if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0)
- {
- /* Handle of table failed, don't touch the in-memory array. */
- result= -1;
- }
- else
+ /* Handle proxies_priv table. */
+ if (tables[5].table)
{
- /* Handle proxy_priv array. */
- if ((handle_grant_struct(5, drop, user_from, user_to) && !result) ||
- found)
- result= 1; /* At least one record/element found. */
+ if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0)
+ {
+ /* Handle of table failed, don't touch the in-memory array. */
+ result= -1;
+ }
+ else
+ {
+ /* Handle proxies_priv array. */
+ if ((handle_grant_struct(5, drop, user_from, user_to) && !result) ||
+ found)
+ result= 1; /* At least one record/element found. */
+ }
}
end:
DBUG_RETURN(result);
@@ -8091,6 +8119,24 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
DBUG_RETURN (1);
}
+ /*
+ If we're dealing with an older client we can't just send a change plugin
+ packet to re-initiate the authentication handshake, because the client
+ won't understand it. The good thing is that we don't need to : the old client
+ expects us to just check the user credentials here, which we can do by just reading
+ the cached data that are placed there by parse_com_change_user_packet()
+ In this case we just do nothing and behave as if normal authentication
+ should continue.
+ */
+ if (!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH))
+ {
+ DBUG_PRINT("info", ("old client sent a COM_CHANGE_USER"));
+ DBUG_ASSERT(mpvio->cached_client_reply.pkt);
+ /* get the status back so the read can process the cached result */
+ mpvio->status= MPVIO_EXT::RESTART;
+ DBUG_RETURN(0);
+ }
+
DBUG_PRINT("info", ("requesting client to use the %s plugin",
client_auth_plugin));
DBUG_RETURN(net_write_command(net, switch_plugin_request_buf[0],
@@ -8574,8 +8620,16 @@ static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param,
int res;
DBUG_ENTER("server_mpvio_write_packet");
- /* reset cached_client_reply */
- mpvio->cached_client_reply.pkt= 0;
+ /*
+ Reset cached_client_reply if not an old client doing mysql_change_user,
+ as this is where the password from COM_CHANGE_USER is stored.
+ */
+ if (!((!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)) &&
+ mpvio->status == MPVIO_EXT::RESTART &&
+ mpvio->cached_client_reply.plugin ==
+ ((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin
+ ))
+ mpvio->cached_client_reply.pkt= 0;
/* for the 1st packet we wrap plugin data into the handshake packet */
if (mpvio->packets_written == 0)
res= send_server_handshake_packet(mpvio, (char*) packet, packet_len);
@@ -8641,6 +8695,15 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
mpvio->packets_read++;
DBUG_RETURN ((int) mpvio->cached_client_reply.pkt_len);
}
+
+ /* older clients don't support change of client plugin request */
+ if (!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH))
+ {
+ mpvio->status= MPVIO_EXT::FAILURE;
+ pkt_len= packet_error;
+ goto err;
+ }
+
/*
But if the client has used the wrong plugin, the cached data are
useless. Furthermore, we have to send a "change plugin" request
@@ -9188,8 +9251,8 @@ acl_authenticate(THD *thd, uint connect_errors, uint com_change_user_pkt_len)
2. client sends the encrypted password back to the server
3. the server checks the password.
*/
-static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
- MYSQL_SERVER_AUTH_INFO *info)
+static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
+ MYSQL_SERVER_AUTH_INFO *info)
{
uchar *pkt;
int pkt_len;
@@ -9203,7 +9266,7 @@ static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
/* send it to the client */
if (mpvio->write_packet(mpvio, (uchar*) mpvio->scramble, SCRAMBLE_LENGTH + 1))
- return CR_ERROR;
+ DBUG_RETURN(CR_ERROR);
/* reply and authenticate */
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 21a05a5baca..f648d219fac 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -85,7 +85,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
key_length= create_table_def_key(thd, key, table_list, 0);
table_list->mdl_request.init(MDL_key::TABLE,
table_list->db, table_list->table_name,
- MDL_EXCLUSIVE);
+ MDL_EXCLUSIVE, MDL_TRANSACTION);
if (lock_table_names(thd, table_list, table_list->next_global,
thd->variables.lock_wait_timeout,
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index 7cb40181bd7..cbc4c7a7232 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -99,32 +99,29 @@ void mysql_audit_general(THD *thd, uint event_subtype,
{
time_t time= my_time(0);
uint msglen= msg ? strlen(msg) : 0;
- const char *query, *user;
- uint querylen, userlen;
+ const char *user;
+ uint userlen;
char user_buff[MAX_USER_HOST_SIZE];
- CHARSET_INFO *clientcs;
+ CSET_STRING query;
ha_rows rows;
if (thd)
{
- query= thd->query();
- querylen= thd->query_length();
+ query= thd->query_string;
user= user_buff;
userlen= make_user_name(thd, user_buff);
- clientcs= thd->variables.character_set_client;
rows= thd->warning_info->current_row_for_warning();
}
else
{
- query= user= 0;
- querylen= userlen= 0;
- clientcs= global_system_variables.character_set_client;
+ user= 0;
+ userlen= 0;
rows= 0;
}
mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, event_subtype,
error_code, time, user, userlen, msg, msglen,
- query, querylen, clientcs, rows);
+ query.str(), query.length(), query.charset(), rows);
}
#endif
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 8305283cd17..60c32a1a376 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -21,7 +21,7 @@
#include "sql_priv.h"
#include "unireg.h"
#include "debug_sync.h"
-#include "lock.h" // broadcast_refresh, mysql_lock_remove,
+#include "lock.h" // mysql_lock_remove,
// mysql_unlock_tables,
// mysql_lock_have_duplicate
#include "sql_show.h" // append_identifier
@@ -1285,20 +1285,12 @@ static void mark_used_tables_as_free_for_reuse(THD *thd, TABLE *table)
static void close_open_tables(THD *thd)
{
- bool found_old_table= 0;
-
mysql_mutex_assert_not_owner(&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);
-
- if (found_old_table)
- {
- /* Tell threads waiting for refresh that something has happened */
- broadcast_refresh();
- }
+ (void) close_thread_table(thd, &thd->open_tables);
}
@@ -1364,11 +1356,6 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
/* Remove the table share from the cache. */
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db, table_name,
FALSE);
- /*
- There could be a FLUSH thread waiting
- on the table to go away. Wake it up.
- */
- broadcast_refresh();
}
@@ -2463,7 +2450,8 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
mdl_request_shared.init(&mdl_request->key,
(flags & MYSQL_OPEN_FORCE_SHARED_MDL) ?
- MDL_SHARED : MDL_SHARED_HIGH_PRIO);
+ MDL_SHARED : MDL_SHARED_HIGH_PRIO,
+ MDL_TRANSACTION);
mdl_request= &mdl_request_shared;
}
@@ -2628,32 +2616,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
TMP_TABLE_KEY_EXTRA);
/*
- We need this to work for all tables, including temporary
- tables, for backwards compatibility. But not under LOCK
- TABLES, since under LOCK TABLES one can't use a non-prelocked
- table. This code only works for updates done inside DO/SELECT
- f1() statements, normal DML is handled by means of
- sql_command_flags.
- */
- if (global_read_lock && table_list->lock_type >= TL_WRITE_ALLOW_WRITE &&
- ! (flags & MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK) &&
- ! thd->locked_tables_mode)
- {
- /*
- Someone has issued FLUSH TABLES WITH READ LOCK and we want
- a write lock. Wait until the lock is gone.
- */
- if (thd->global_read_lock.wait_if_global_read_lock(thd, 1, 1))
- DBUG_RETURN(TRUE);
-
- if (thd->open_tables && thd->open_tables->s->version != refresh_version)
- {
- (void)ot_ctx->request_backoff_action(Open_table_context::OT_REOPEN_TABLES,
- NULL);
- DBUG_RETURN(TRUE);
- }
- }
- /*
Unless requested otherwise, try to resolve this table in the list
of temporary tables of this thread. In MySQL temporary tables
are always thread-local and "shadow" possible base tables with the
@@ -2824,6 +2786,59 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
{
+ /*
+ We are not under LOCK TABLES and going to acquire write-lock/
+ modify the base table. We need to acquire protection against
+ global read lock until end of this statement in order to have
+ this statement blocked by active FLUSH TABLES WITH READ LOCK.
+
+ We don't block acquire this protection under LOCK TABLES as
+ such protection already acquired at LOCK TABLES time and
+ not released until UNLOCK TABLES.
+
+ We don't block statements which modify only temporary tables
+ as these tables are not preserved by backup by any form of
+ backup which uses FLUSH TABLES WITH READ LOCK.
+
+ TODO: The fact that we sometimes acquire protection against
+ GRL only when we encounter table to be write-locked
+ slightly increases probability of deadlock.
+ This problem will be solved once Alik pushes his
+ temporary table refactoring patch and we can start
+ pre-acquiring metadata locks at the beggining of
+ open_tables() call.
+ */
+ if (table_list->mdl_request.type >= MDL_SHARED_WRITE &&
+ ! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
+ MYSQL_OPEN_FORCE_SHARED_MDL |
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
+ MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) &&
+ ! ot_ctx->has_protection_against_grl())
+ {
+ MDL_request protection_request;
+ MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
+
+ if (thd->global_read_lock.can_acquire_protection())
+ DBUG_RETURN(TRUE);
+
+ protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_STATEMENT);
+
+ /*
+ Install error handler which if possible will convert deadlock error
+ into request to back-off and restart process of opening tables.
+ */
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ bool result= thd->mdl_context.acquire_lock(&protection_request,
+ ot_ctx->get_timeout());
+ thd->pop_internal_handler();
+
+ if (result)
+ DBUG_RETURN(TRUE);
+
+ ot_ctx->set_has_protection_against_grl();
+ }
+
if (open_table_get_mdl_lock(thd, ot_ctx, &table_list->mdl_request,
flags, &mdl_ticket) ||
mdl_ticket == NULL)
@@ -2902,8 +2917,12 @@ retry_share:
*/
if (check_and_update_table_version(thd, table_list, share))
goto err_unlock;
- if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
+ if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
+ table_list->table_name);
goto err_unlock;
+ }
/* Open view */
if (open_new_frm(thd, share, alias,
@@ -2931,7 +2950,11 @@ retry_share:
*/
if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
+ table_list->table_name);
goto err_unlock;
+ }
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
{
@@ -3371,7 +3394,6 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
close_thread_table(thd, &thd->open_tables);
}
- broadcast_refresh();
}
/* Exclude all closed tables from the LOCK TABLES list. */
for (TABLE_LIST *table_list= m_locked_tables; table_list; table_list=
@@ -3848,7 +3870,8 @@ Open_table_context::Open_table_context(THD *thd, uint flags)
LONG_TIMEOUT : thd->variables.lock_wait_timeout),
m_flags(flags),
m_action(OT_NO_ACTION),
- m_has_locks(thd->mdl_context.has_locks())
+ m_has_locks(thd->mdl_context.has_locks()),
+ m_has_protection_against_grl(FALSE)
{}
@@ -4005,6 +4028,12 @@ recover_from_failed_open(THD *thd)
for safety.
*/
m_failed_table= NULL;
+ /*
+ Reset flag indicating that we have already acquired protection
+ against GRL. It is no longer valid as the corresponding lock was
+ released by close_tables_for_reopen().
+ */
+ m_has_protection_against_grl= FALSE;
/* Prepare for possible another back-off. */
m_action= OT_NO_ACTION;
return result;
@@ -4543,11 +4572,20 @@ lock_table_names(THD *thd,
if (schema_request == NULL)
return TRUE;
schema_request->init(MDL_key::SCHEMA, table->db, "",
- MDL_INTENTION_EXCLUSIVE);
+ MDL_INTENTION_EXCLUSIVE,
+ MDL_TRANSACTION);
mdl_requests.push_front(schema_request);
}
- /* Take the global intention exclusive lock. */
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
+
+ /*
+ Protect this statement against concurrent global read lock
+ by acquiring global intention exclusive lock with statement
+ duration.
+ */
+ if (thd->global_read_lock.can_acquire_protection())
+ return TRUE;
+ global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_STATEMENT);
mdl_requests.push_front(&global_request);
}
@@ -5319,7 +5357,11 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
end:
if (table == NULL)
+ {
+ if (!thd->in_sub_stmt)
+ trans_rollback_stmt(thd);
close_thread_tables(thd);
+ }
thd_proc_info(thd, 0);
DBUG_RETURN(table);
}
@@ -5350,7 +5392,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
Prelocking_strategy *prelocking_strategy)
{
uint counter;
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_and_lock_tables");
DBUG_PRINT("enter", ("derived handling: %d", derived));
@@ -5407,7 +5449,7 @@ bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
{
DML_prelocking_strategy prelocking_strategy;
uint counter;
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_normal_and_derived_tables");
DBUG_ASSERT(!thd->fill_derived_tables());
if (open_tables(thd, &tables, &counter, flags, &prelocking_strategy) ||
@@ -5664,7 +5706,7 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
*/
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
- MDL_ticket *start_of_statement_svp)
+ const MDL_savepoint &start_of_statement_svp)
{
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
TABLE_LIST *tmp;
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 7ae3971942b..35fa04b3674 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -159,7 +159,7 @@ thr_lock_type read_lock_type_for_table(THD *thd,
my_bool mysql_rm_tmp_tables(void);
bool rm_temporary_table(handlerton *base, char *path);
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
- MDL_ticket *start_of_statement_svp);
+ const MDL_savepoint &start_of_statement_svp);
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
TABLE_LIST *TABLE_LIST::*link,
const char *db_name,
@@ -243,7 +243,6 @@ bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
bool derived, uint flags,
Prelocking_strategy *prelocking_strategy);
-int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived);
/* simple open_and_lock_tables without derived handling for single table */
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
thr_lock_type lock_type, uint flags,
@@ -508,7 +507,7 @@ public:
the statement, so that we can rollback to it before waiting on
locks.
*/
- MDL_ticket *start_of_statement_svp() const
+ const MDL_savepoint &start_of_statement_svp() const
{
return m_start_of_statement_svp;
}
@@ -519,6 +518,21 @@ public:
}
uint get_flags() const { return m_flags; }
+
+ /**
+ Set flag indicating that we have already acquired metadata lock
+ protecting this statement against GRL while opening tables.
+ */
+ void set_has_protection_against_grl()
+ {
+ m_has_protection_against_grl= TRUE;
+ }
+
+ bool has_protection_against_grl() const
+ {
+ return m_has_protection_against_grl;
+ }
+
private:
/**
For OT_DISCOVER and OT_REPAIR actions, the table list element for
@@ -526,7 +540,7 @@ private:
should be repaired.
*/
TABLE_LIST *m_failed_table;
- MDL_ticket *m_start_of_statement_svp;
+ MDL_savepoint m_start_of_statement_svp;
/**
Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system
tables or to the "lock_wait_timeout" system variable for regular tables.
@@ -542,6 +556,11 @@ private:
and we can't safely do back-off (and release them).
*/
bool m_has_locks;
+ /**
+ Indicates that in the process of opening tables we have acquired
+ protection against global read lock.
+ */
+ bool m_has_protection_against_grl;
};
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 15fbc6a1480..2df7a2c8572 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -631,7 +631,7 @@ THD::THD()
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
m_internal_handler= NULL;
- current_user_used= FALSE;
+ m_binlog_invoker= FALSE;
memset(&invoker_user, 0, sizeof(invoker_user));
memset(&invoker_host, 0, sizeof(invoker_host));
}
@@ -1179,36 +1179,70 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
}
+/**
+ Awake a thread.
+
+ @param[in] state_to_set value for THD::killed
+
+ This is normally called from another thread's THD object.
+
+ @note Do always call this while holding LOCK_thd_data.
+*/
+
void THD::awake(THD::killed_state state_to_set)
{
DBUG_ENTER("THD::awake");
- DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
+ DBUG_PRINT("enter", ("this: %p current_thd: %p", this, current_thd));
THD_CHECK_SENTRY(this);
mysql_mutex_assert_owner(&LOCK_thd_data);
+ /* Set the 'killed' flag of 'this', which is the target THD object. */
killed= state_to_set;
+
if (state_to_set != THD::KILL_QUERY)
{
- thr_alarm_kill(thread_id);
- if (!slave_thread)
- MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (this));
#ifdef SIGNAL_WITH_VIO_CLOSE
if (this != current_thd)
{
/*
- In addition to a signal, let's close the socket of the thread that
- is being killed. This is to make sure it does not block if the
- signal is lost. This needs to be done only on platforms where
- signals are not a reliable interruption mechanism.
-
- If we're killing ourselves, we know that we're not blocked, so this
- hack is not used.
+ Before sending a signal, let's close the socket of the thread
+ that is being killed ("this", which is not the current thread).
+ This is to make sure it does not block if the signal is lost.
+ This needs to be done only on platforms where signals are not
+ a reliable interruption mechanism.
+
+ Note that the downside of this mechanism is that we could close
+ the connection while "this" target thread is in the middle of
+ sending a result to the application, thus violating the client-
+ server protocol.
+
+ On the other hand, without closing the socket we have a race
+ condition. If "this" target thread passes the check of
+ thd->killed, and then the current thread runs through
+ THD::awake(), sets the 'killed' flag and completes the
+ signaling, and then the target thread runs into read(), it will
+ block on the socket. As a result of the discussions around
+ Bug#37780, it has been decided that we accept the race
+ condition. A second KILL awakes the target from read().
+
+ If we are killing ourselves, we know that we are not blocked.
+ We also know that we will check thd->killed before we go for
+ reading the next statement.
*/
close_active_vio();
}
-#endif
+#endif
+
+ /* Mark the target thread's alarm request expired, and signal alarm. */
+ thr_alarm_kill(thread_id);
+
+ /* Send an event to the scheduler that a thread should be killed. */
+ if (!slave_thread)
+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (this));
}
+
+ /* Broadcast a condition to kick the target if it is waiting on it. */
if (mysys_var)
{
mysql_mutex_lock(&mysys_var->mutex);
@@ -1232,6 +1266,11 @@ void THD::awake(THD::killed_state state_to_set)
we issue a second KILL or the status it's waiting for happens).
It's true that we have set its thd->killed but it may not
see it immediately and so may have time to reach the cond_wait().
+
+ However, where possible, we test for killed once again after
+ enter_cond(). This should make the signaling as safe as possible.
+ However, there is still a small chance of failure on platforms with
+ instruction or memory write reordering.
*/
if (mysys_var->current_cond && mysys_var->current_mutex)
{
@@ -1336,7 +1375,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();
+ m_binlog_invoker= FALSE;
}
@@ -1842,8 +1881,9 @@ void select_to_file::send_error(uint errcode,const char *err)
bool select_to_file::send_eof()
{
int error= test(end_io_cache(&cache));
- if (mysql_file_close(file, MYF(MY_WME)))
- error= 1;
+ if (mysql_file_close(file, MYF(MY_WME)) || thd->is_error())
+ error= true;
+
if (!error)
{
::my_ok(thd,row_count);
@@ -2585,8 +2625,6 @@ Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
db(NULL),
db_length(0)
{
- query_string.length= 0;
- query_string.str= NULL;
name.str= NULL;
}
@@ -2625,15 +2663,6 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
}
-/** Assign a new value to thd->query. */
-
-void Statement::set_query_inner(char *query_arg, uint32 query_length_arg)
-{
- query_string.str= query_arg;
- query_string.length= query_length_arg;
-}
-
-
void THD::end_statement()
{
/* Cleanup SQL processing state to reuse this statement in next query. */
@@ -2884,6 +2913,13 @@ bool select_dumpvar::send_eof()
if (! row_count)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
+ /*
+ Don't send EOF if we're in error condition (which implies we've already
+ sent or are sending an error)
+ */
+ if (thd->is_error())
+ return true;
+
::my_ok(thd,row_count);
return 0;
}
@@ -3159,7 +3195,7 @@ extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd)
*/
extern "C" char **thd_query(MYSQL_THD thd)
{
- return(&thd->query_string.str);
+ return (&thd->query_string.string.str);
}
/**
@@ -3170,7 +3206,7 @@ extern "C" char **thd_query(MYSQL_THD thd)
*/
extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd)
{
- return(&thd->query_string);
+ return(&thd->query_string.string);
}
extern "C" int thd_slave_thread(const MYSQL_THD thd)
@@ -3415,20 +3451,21 @@ void THD::set_statement(Statement *stmt)
/** Assign a new value to thd->query. */
-void THD::set_query(char *query_arg, uint32 query_length_arg)
+void THD::set_query(const CSET_STRING &string_arg)
{
mysql_mutex_lock(&LOCK_thd_data);
- set_query_inner(query_arg, query_length_arg);
+ set_query_inner(string_arg);
mysql_mutex_unlock(&LOCK_thd_data);
}
/** Assign a new value to thd->query and thd->query_id. */
void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
+ CHARSET_INFO *cs,
query_id_t new_query_id)
{
mysql_mutex_lock(&LOCK_thd_data);
- set_query_inner(query_arg, query_length_arg);
+ set_query_inner(query_arg, query_length_arg, cs);
query_id= new_query_id;
mysql_mutex_unlock(&LOCK_thd_data);
}
@@ -3458,16 +3495,20 @@ void THD::set_mysys_var(struct st_my_thread_var *new_mysys_var)
void THD::leave_locked_tables_mode()
{
locked_tables_mode= LTM_NONE;
- /* Make sure we don't release the global read lock when leaving LTM. */
- mdl_context.reset_trans_sentinel(global_read_lock.global_shared_lock());
+ mdl_context.set_transaction_duration_for_all_locks();
+ /*
+ Make sure we don't release the global read lock and commit blocker
+ when leaving LTM.
+ */
+ global_read_lock.set_explicit_lock_duration(this);
/* Also ensure that we don't release metadata locks for open HANDLERs. */
if (handler_tables_hash.records)
- mysql_ha_move_tickets_after_trans_sentinel(this);
+ mysql_ha_set_explicit_lock_duration(this);
}
void THD::get_definer(LEX_USER *definer)
{
- set_current_user_used();
+ binlog_invoker();
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
if (slave_thread && has_invoker())
{
diff --git a/sql/sql_class.h b/sql/sql_class.h
index aa0f6cf1aa3..02f28b54e10 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -109,6 +109,41 @@ extern MYSQL_PLUGIN_IMPORT const char **errmesg;
extern bool volatile shutdown_in_progress;
+extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd);
+extern "C" char **thd_query(MYSQL_THD thd);
+
+/**
+ @class CSET_STRING
+ @brief Character set armed LEX_STRING
+*/
+class CSET_STRING
+{
+private:
+ LEX_STRING string;
+ CHARSET_INFO *cs;
+public:
+ CSET_STRING() : cs(&my_charset_bin)
+ {
+ string.str= NULL;
+ string.length= 0;
+ }
+ CSET_STRING(char *str_arg, size_t length_arg, CHARSET_INFO *cs_arg) :
+ cs(cs_arg)
+ {
+ DBUG_ASSERT(cs_arg != NULL);
+ string.str= str_arg;
+ string.length= length_arg;
+ }
+
+ inline char *str() const { return string.str; }
+ inline uint32 length() const { return string.length; }
+ CHARSET_INFO *charset() const { return cs; }
+
+ friend LEX_STRING * thd_query_string (MYSQL_THD thd);
+ friend char **thd_query(MYSQL_THD thd);
+};
+
+
#define TC_LOG_PAGE_SIZE 8192
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
@@ -722,12 +757,24 @@ public:
This printing is needed at least in SHOW PROCESSLIST and SHOW
ENGINE INNODB STATUS.
*/
- LEX_STRING query_string;
-
- inline char *query() { return query_string.str; }
- inline uint32 query_length() { return query_string.length; }
- void set_query_inner(char *query_arg, uint32 query_length_arg);
+ CSET_STRING query_string;
+ inline char *query() const { return query_string.str(); }
+ inline uint32 query_length() const { return query_string.length(); }
+ CHARSET_INFO *query_charset() const { return query_string.charset(); }
+ void set_query_inner(const CSET_STRING &string_arg)
+ {
+ query_string= string_arg;
+ }
+ void set_query_inner(char *query_arg, uint32 query_length_arg,
+ CHARSET_INFO *cs_arg)
+ {
+ set_query_inner(CSET_STRING(query_arg, query_length_arg, cs_arg));
+ }
+ void reset_query_inner()
+ {
+ set_query_inner(CSET_STRING());
+ }
/**
Name of the current (default) database.
@@ -822,8 +869,8 @@ struct st_savepoint {
char *name;
uint length;
Ha_trx_info *ha_list;
- /** Last acquired lock before this savepoint was set. */
- MDL_ticket *mdl_savepoint;
+ /** State of metadata locks before this savepoint was set. */
+ MDL_savepoint mdl_savepoint;
};
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY};
@@ -1058,12 +1105,12 @@ class Open_tables_backup: public Open_tables_state
public:
/**
When we backup the open tables state to open a system
- table or tables, points at the last metadata lock
- acquired before the backup. Is used to release
- metadata locks on system tables after they are
+ table or tables, we want to save state of metadata
+ locks which were acquired before the backup. It is used
+ to release metadata locks on system tables after they are
no longer used.
*/
- MDL_ticket *mdl_system_tables_svp;
+ MDL_savepoint mdl_system_tables_svp;
};
/**
@@ -1336,26 +1383,43 @@ public:
};
Global_read_lock()
- :m_protection_count(0), m_state(GRL_NONE), m_mdl_global_shared_lock(NULL)
+ : m_state(GRL_NONE),
+ m_mdl_global_shared_lock(NULL),
+ m_mdl_blocks_commits_lock(NULL)
{}
bool lock_global_read_lock(THD *thd);
void unlock_global_read_lock(THD *thd);
- bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
- bool is_not_commit);
- void start_waiting_global_read_lock(THD *thd);
+ /**
+ Check if this connection can acquire protection against GRL and
+ emit error if otherwise.
+ */
+ bool can_acquire_protection() const
+ {
+ if (m_state)
+ {
+ my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
+ return TRUE;
+ }
+ return FALSE;
+ }
bool make_global_read_lock_block_commit(THD *thd);
bool is_acquired() const { return m_state != GRL_NONE; }
- bool has_protection() const { return m_protection_count > 0; }
- MDL_ticket *global_shared_lock() const { return m_mdl_global_shared_lock; }
+ void set_explicit_lock_duration(THD *thd);
private:
- uint m_protection_count; // GRL protection count
+ enum_grl_state m_state;
/**
In order to acquire the global read lock, the connection must
- acquire a global shared metadata lock, to prohibit all DDL.
+ acquire shared metadata lock in GLOBAL namespace, to prohibit
+ all DDL.
*/
- enum_grl_state m_state;
MDL_ticket *m_mdl_global_shared_lock;
+ /**
+ Also in order to acquire the global read lock, the connection
+ must acquire a shared metadata lock in COMMIT namespace, to
+ prohibit commits.
+ */
+ MDL_ticket *m_mdl_blocks_commits_lock;
};
@@ -1953,6 +2017,12 @@ public:
DYNAMIC_ARRAY user_var_events; /* For user variables replication */
MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */
+ /*
+ If checking this in conjunction with a wait condition, please
+ include a check after enter_cond() if you want to avoid a race
+ condition. For details see the implementation of awake(),
+ especially the "broadcast" part.
+ */
enum killed_state
{
NOT_KILLED=0,
@@ -2211,6 +2281,20 @@ public:
}
void set_time_after_lock() { utime_after_lock= my_micro_time(); }
ulonglong current_utime() { return my_micro_time(); }
+ /**
+ Update server status after execution of a top level statement.
+
+ Currently only checks if a query was slow, and assigns
+ the status accordingly.
+ Evaluate the current time, and if it exceeds the long-query-time
+ setting, mark the query as slow.
+ */
+ void update_server_status()
+ {
+ ulonglong end_utime_of_query= current_utime();
+ if (end_utime_of_query > utime_after_lock + variables.long_query_time)
+ server_status|= SERVER_QUERY_WAS_SLOW;
+ }
inline ulonglong found_rows(void)
{
return limit_found_rows;
@@ -2676,9 +2760,20 @@ public:
Assign a new value to thd->query and thd->query_id and mysys_var.
Protected with LOCK_thd_data mutex.
*/
- void set_query(char *query_arg, uint32 query_length_arg);
+ void set_query(char *query_arg, uint32 query_length_arg,
+ CHARSET_INFO *cs_arg)
+ {
+ set_query(CSET_STRING(query_arg, query_length_arg, cs_arg));
+ }
+ void set_query(char *query_arg, uint32 query_length_arg) /*Mutex protected*/
+ {
+ set_query(CSET_STRING(query_arg, query_length_arg, charset()));
+ }
+ void set_query(const CSET_STRING &str); /* Mutex protected */
+ void reset_query() /* Mutex protected */
+ { set_query(CSET_STRING()); }
void set_query_and_id(char *query_arg, uint32 query_length_arg,
- query_id_t new_query_id);
+ CHARSET_INFO *cs, query_id_t new_query_id);
void set_query_id(query_id_t new_query_id);
void set_open_tables(TABLE *open_tables_arg)
{
@@ -2691,14 +2786,13 @@ public:
{
DBUG_ASSERT(locked_tables_mode == LTM_NONE);
- mdl_context.set_trans_sentinel();
+ mdl_context.set_explicit_duration_for_all_locks();
locked_tables_mode= mode_arg;
}
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 binlog_invoker() { m_binlog_invoker= TRUE; }
+ bool need_binlog_invoker() { return m_binlog_invoker; }
void get_definer(LEX_USER *definer);
void set_invoker(const LEX_STRING *user, const LEX_STRING *host)
{
@@ -2739,7 +2833,7 @@ private:
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;
+ bool m_binlog_invoker;
/**
It points to the invoker in the Query_log_event.
@@ -3498,20 +3592,10 @@ public:
#define CF_DIAGNOSTIC_STMT (1U << 8)
/**
- SQL statements that must be protected against impending global read lock
- to prevent deadlock. This deadlock could otherwise happen if the statement
- starts waiting for the GRL to go away inside mysql_lock_tables while at the
- same time having "old" opened tables. The thread holding the GRL can be
- waiting for these "old" opened tables to be closed, causing a deadlock
- (FLUSH TABLES WITH READ LOCK).
- */
-#define CF_PROTECT_AGAINST_GRL (1U << 10)
-
-/**
Identifies statements that may generate row events
and that may end up in the binary log.
*/
-#define CF_CAN_GENERATE_ROW_EVENTS (1U << 11)
+#define CF_CAN_GENERATE_ROW_EVENTS (1U << 9)
/* Bits in server_command_flags */
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 7a9834b4cde..acc591f1ea2 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -277,7 +277,6 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused)))
rc= result->send_result_set_metadata(item_list, Protocol::SEND_NUM_ROWS);
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
result->send_eof();
- thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
}
return rc;
}
@@ -318,12 +317,10 @@ void Materialized_cursor::fetch(ulong num_rows)
case 0:
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
result->send_eof();
- thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
break;
case HA_ERR_END_OF_FILE:
thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
result->send_eof();
- thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
close();
break;
default:
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 517cb9139e9..292fbba2352 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -28,6 +28,8 @@
#include "sql_acl.h" // SELECT_ACL, DB_ACLS,
// acl_get, check_grant_db
#include "log_event.h" // Query_log_event
+#include "sql_base.h" // lock_table_names, tdc_remove_table
+#include "sql_handler.h" // mysql_ha_rm_tables
#include <mysys_err.h>
#include "sp.h"
#include "events.h"
@@ -44,10 +46,12 @@ const char *del_exts[]= {".frm", ".BAK", ".TMD",".opt", NullS};
static TYPELIB deletable_extentions=
{array_elements(del_exts)-1,"del_exts", del_exts, NULL};
-static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
- const char *db, const char *path, uint level,
- TABLE_LIST **dropped_tables);
-
+static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
+ const char *db,
+ const char *path,
+ TABLE_LIST **tables,
+ bool *found_other_files);
+
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error);
static void mysql_change_db_impl(THD *thd,
@@ -736,36 +740,37 @@ exit:
}
-/*
- Drop all tables in a database and the database itself
-
- SYNOPSIS
- mysql_rm_db()
- thd Thread handle
- db Database name in the case given by user
- It's already validated and set to lower case
- (if needed) when we come here
- if_exists Don't give error if database doesn't exists
- silent Don't generate errors
-
- RETURN
- FALSE ok (Database dropped)
- ERROR Error
+/**
+ Drop all tables, routines and events in a database and the database itself.
+
+ @param thd Thread handle
+ @param db Database name in the case given by user
+ It's already validated and set to lower case
+ (if needed) when we come here
+ @param if_exists Don't give error if database doesn't exists
+ @param silent Don't write the statement to the binary log and don't
+ send ok packet to the client
+
+ @retval false OK (Database dropped)
+ @retval true Error
*/
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
- long deleted=0;
- int error= 0;
+ ulong deleted_tables= 0;
+ bool error= true;
char path[FN_REFLEN+16];
MY_DIR *dirp;
uint length;
- TABLE_LIST* dropped_tables= 0;
+ bool found_other_files= false;
+ TABLE_LIST *tables= NULL;
+ TABLE_LIST *table;
+ Drop_table_error_handler err_handler;
DBUG_ENTER("mysql_rm_db");
if (lock_schema_name(thd, db))
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
@@ -777,20 +782,72 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
if (!if_exists)
{
- error= -1;
my_error(ER_DB_DROP_EXISTS, MYF(0), db);
- goto exit;
+ DBUG_RETURN(true);
}
else
+ {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db);
+ error= false;
+ goto update_binlog;
+ }
}
- else
+
+ thd->push_internal_handler(&err_handler);
+
+ if (find_db_tables_and_rm_known_files(thd, dirp, db, path, &tables,
+ &found_other_files))
{
- Drop_table_error_handler err_handler;
- thd->push_internal_handler(&err_handler);
+ thd->pop_internal_handler();
+ goto exit;
+ }
- error= -1;
+ /*
+ Disable drop of enabled log tables, must be done before name locking.
+ This check is only needed if we are dropping the "mysql" database.
+ */
+ if ((my_strcasecmp(system_charset_info, MYSQL_SCHEMA_NAME.str, db) == 0))
+ {
+ for (table= tables; table; table= table->next_local)
+ {
+ if (check_if_log_table(table->db_length, table->db,
+ table->table_name_length, table->table_name, true))
+ {
+ my_error(ER_BAD_LOG_STATEMENT, MYF(0), "DROP");
+ thd->pop_internal_handler();
+ goto exit;
+ }
+ }
+ }
+
+ /* Lock all tables and stored routines about to be dropped. */
+ if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY) ||
+ lock_db_routines(thd, db))
+ {
+ thd->pop_internal_handler();
+ goto exit;
+ }
+
+ /* mysql_ha_rm_tables() requires a non-null TABLE_LIST. */
+ if (tables)
+ mysql_ha_rm_tables(thd, tables);
+
+ for (table= tables; table; table= table->next_local)
+ {
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
+ false);
+ deleted_tables++;
+ }
+
+ if (thd->killed ||
+ (tables && mysql_rm_table_no_locks(thd, tables, true, false, true, true)))
+ {
+ tables= NULL;
+ }
+ else
+ {
/*
We temporarily disable the binary log while dropping the objects
in the database. Since the DROP DATABASE statement is always
@@ -808,23 +865,30 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
ha_drop_database(), since NDB otherwise detects the binary log
as disabled and will not log the drop database statement on any
other connected server.
- */
- if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0,
- &dropped_tables)) >= 0)
- {
- ha_drop_database(path);
- tmp_disable_binlog(thd);
- query_cache_invalidate1(db);
- (void) sp_drop_db_routines(thd, db); /* @todo Do not ignore errors */
+ */
+
+ ha_drop_database(path);
+ tmp_disable_binlog(thd);
+ query_cache_invalidate1(db);
+ (void) sp_drop_db_routines(thd, db); /* @todo Do not ignore errors */
#ifdef HAVE_EVENT_SCHEDULER
- Events::drop_schema_events(thd, db);
+ Events::drop_schema_events(thd, db);
#endif
- error = 0;
- reenable_binlog(thd);
- }
- thd->pop_internal_handler();
+ reenable_binlog(thd);
+
+ /*
+ If the directory is a symbolic link, remove the link first, then
+ remove the directory the symbolic link pointed at
+ */
+ if (found_other_files)
+ my_error(ER_DB_DROP_RMDIR, MYF(0), path, EEXIST);
+ else
+ error= rm_dir_w_symlink(path, true);
}
- if (!silent && deleted>=0)
+ thd->pop_internal_handler();
+
+update_binlog:
+ if (!silent && !error)
{
const char *query;
ulong query_length;
@@ -859,14 +923,13 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
*/
if (mysql_bin_log.write(&qinfo))
{
- error= -1;
+ error= true;
goto exit;
}
}
thd->clear_error();
thd->server_status|= SERVER_STATUS_DB_DROPPED;
- my_ok(thd, (ulong) deleted);
- thd->server_status&= ~SERVER_STATUS_DB_DROPPED;
+ my_ok(thd, deleted_tables);
}
else if (mysql_bin_log.is_open())
{
@@ -880,7 +943,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
query_end= query + MAX_DROP_TABLE_Q_LEN;
db_len= strlen(db);
- for (tbl= dropped_tables; tbl; tbl= tbl->next_local)
+ for (tbl= tables; tbl; tbl= tbl->next_local)
{
uint tbl_name_len;
@@ -894,7 +957,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
*/
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
{
- error= -1;
+ error= true;
goto exit;
}
query_pos= query_data_start;
@@ -914,7 +977,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
*/
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
{
- error= -1;
+ error= true;
goto exit;
}
}
@@ -927,28 +990,23 @@ exit:
SELECT DATABASE() in the future). For this we free() thd->db and set
it to 0.
*/
- if (thd->db && !strcmp(thd->db, db) && error == 0)
+ if (thd->db && !strcmp(thd->db, db) && !error)
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
+ my_dirend(dirp);
DBUG_RETURN(error);
}
-/*
- Removes files with known extensions plus all found subdirectories that
- are 2 hex digits (raid directories).
- thd MUST be set when calling this function!
-*/
-static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
- const char *org_path, uint level,
- TABLE_LIST **dropped_tables)
+static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
+ const char *db,
+ const char *path,
+ TABLE_LIST **tables,
+ bool *found_other_files)
{
- long deleted=0;
- ulong found_other_files=0;
char filePath[FN_REFLEN];
TABLE_LIST *tot_list=0, **tot_list_next_local, **tot_list_next_global;
- List<String> raid_dirs;
- DBUG_ENTER("mysql_rm_known_files");
- DBUG_PRINT("enter",("path: %s", org_path));
+ DBUG_ENTER("find_db_tables_and_rm_known_files");
+ DBUG_PRINT("enter",("path: %s", path));
tot_list_next_local= tot_list_next_global= &tot_list;
@@ -965,36 +1023,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
(file->name[1] == '.' && !file->name[2])))
continue;
- /* Check if file is a raid directory */
- if ((my_isdigit(system_charset_info, file->name[0]) ||
- (file->name[0] >= 'a' && file->name[0] <= 'f')) &&
- (my_isdigit(system_charset_info, file->name[1]) ||
- (file->name[1] >= 'a' && file->name[1] <= 'f')) &&
- !file->name[2] && !level)
- {
- char newpath[FN_REFLEN], *copy_of_path;
- MY_DIR *new_dirp;
- String *dir;
- uint length;
-
- strxmov(newpath,org_path,"/",file->name,NullS);
- length= unpack_filename(newpath,newpath);
- if ((new_dirp = my_dir(newpath,MYF(MY_DONT_SORT))))
- {
- DBUG_PRINT("my",("New subdir found: %s", newpath));
- if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1,0)) < 0)
- goto err;
- if (!(copy_of_path= (char*) thd->memdup(newpath, length+1)) ||
- !(dir= new (thd->mem_root) String(copy_of_path, length,
- &my_charset_bin)) ||
- raid_dirs.push_back(dir))
- goto err;
- continue;
- }
- found_other_files++;
- continue;
- }
- else if (file->name[0] == 'a' && file->name[1] == 'r' &&
+ if (file->name[0] == 'a' && file->name[1] == 'r' &&
file->name[2] == 'c' && file->name[3] == '\0')
{
/* .frm archive:
@@ -1003,16 +1032,16 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
*/
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
- strxmov(newpath, org_path, "/", "arc", NullS);
+ strxmov(newpath, path, "/", "arc", NullS);
(void) unpack_filename(newpath, newpath);
if ((new_dirp = my_dir(newpath, MYF(MY_DONT_SORT))))
{
DBUG_PRINT("my",("Archive subdir found: %s", newpath));
if ((mysql_rm_arc_files(thd, new_dirp, newpath)) < 0)
- goto err;
+ DBUG_RETURN(true);
continue;
}
- found_other_files++;
+ *found_other_files= true;
continue;
}
if (!(extension= strrchr(file->name, '.')))
@@ -1020,7 +1049,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
if (find_type(extension, &deletable_extentions,1+2) <= 0)
{
if (find_type(extension, ha_known_exts(),1+2) <= 0)
- found_other_files++;
+ *found_other_files= true;
continue;
}
/* just for safety we use files_charset_info */
@@ -1036,7 +1065,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
strlen(file->name) + 1);
if (!table_list)
- goto err;
+ DBUG_RETURN(true);
table_list->db= (char*) (table_list+1);
table_list->db_length= strmov(table_list->db, db) - table_list->db;
table_list->table_name= table_list->db + table_list->db_length + 1;
@@ -1054,61 +1083,23 @@ 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);
+ table_list->table_name, MDL_EXCLUSIVE,
+ MDL_TRANSACTION);
/* Link into list */
(*tot_list_next_local)= table_list;
(*tot_list_next_global)= table_list;
tot_list_next_local= &table_list->next_local;
tot_list_next_global= &table_list->next_global;
- deleted++;
}
else
{
- strxmov(filePath, org_path, "/", file->name, NullS);
+ strxmov(filePath, path, "/", file->name, NullS);
if (mysql_file_delete_with_symlink(key_file_misc, filePath, MYF(MY_WME)))
- {
- goto err;
- }
+ DBUG_RETURN(true);
}
}
- if (thd->killed ||
- (tot_list && mysql_rm_table_part2(thd, tot_list, 1, 0, 1, 1)))
- goto err;
-
- /* Remove RAID directories */
- {
- List_iterator<String> it(raid_dirs);
- String *dir;
- while ((dir= it++))
- if (rmdir(dir->c_ptr()) < 0)
- found_other_files++;
- }
- my_dirend(dirp);
-
- if (dropped_tables)
- *dropped_tables= tot_list;
-
- /*
- If the directory is a symbolic link, remove the link first, then
- remove the directory the symbolic link pointed at
- */
- if (found_other_files)
- {
- my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, EEXIST);
- DBUG_RETURN(-1);
- }
- else
- {
- /* Don't give errors if we can't delete 'RAID' directory */
- if (rm_dir_w_symlink(org_path, level == 0))
- DBUG_RETURN(-1);
- }
-
- DBUG_RETURN(deleted);
-
-err:
- my_dirend(dirp);
- DBUG_RETURN(-1);
+ *tables= tot_list;
+ DBUG_RETURN(false);
}
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 8c038e10a1f..d0982b879e7 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -334,7 +334,6 @@ Diagnostics_area::reset_diagnostics_area()
/** Don't take chances in production */
m_message[0]= '\0';
m_sql_errno= 0;
- m_server_status= 0;
m_affected_rows= 0;
m_last_insert_id= 0;
m_statement_warn_count= 0;
@@ -365,7 +364,6 @@ Diagnostics_area::set_ok_status(THD *thd, ulonglong affected_rows_arg,
if (is_error() || is_disabled())
return;
- m_server_status= thd->server_status;
m_statement_warn_count= thd->warning_info->statement_warn_count();
m_affected_rows= affected_rows_arg;
m_last_insert_id= last_insert_id_arg;
@@ -395,7 +393,6 @@ Diagnostics_area::set_eof_status(THD *thd)
if (is_error() || is_disabled())
return;
- m_server_status= thd->server_status;
/*
If inside a stored procedure, do not return the total
number of warnings, since they are not available to the client
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 87e98e27673..14dc5e6d12c 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -79,12 +79,6 @@ public:
const char* get_sqlstate() const
{ DBUG_ASSERT(m_status == DA_ERROR); return m_sqlstate; }
- uint server_status() const
- {
- DBUG_ASSERT(m_status == DA_OK || m_status == DA_EOF);
- return m_server_status;
- }
-
ulonglong affected_rows() const
{ DBUG_ASSERT(m_status == DA_OK); return m_affected_rows; }
@@ -111,15 +105,6 @@ private:
char m_sqlstate[SQLSTATE_LENGTH+1];
/**
- Copied from thd->server_status when the diagnostics area is assigned.
- We need this member as some places in the code use the following pattern:
- thd->server_status|= ...
- my_eof(thd);
- thd->server_status&= ~...
- Assigned by OK, EOF or ERROR.
- */
- uint m_server_status;
- /**
The number of rows affected by the last statement. This is
semantically close to thd->row_count_func, but has a different
life cycle. thd->row_count_func stores the value returned by
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index a5c126a8521..b5cd3ac9e9a 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -55,7 +55,7 @@
#include "sql_handler.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_base.h" // close_thread_tables
-#include "lock.h" // broadcast_refresh, mysql_unlock_tables
+#include "lock.h" // mysql_unlock_tables
#include "key.h" // key_copy
#include "sql_base.h" // insert_fields
#include "sql_select.h"
@@ -131,11 +131,7 @@ 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;
- if (close_thread_table(thd, &tables->table))
- {
- /* Tell threads waiting for refresh that something has happened */
- broadcast_refresh();
- }
+ (void) close_thread_table(thd, &tables->table);
thd->mdl_context.release_lock(tables->mdl_request.ticket);
}
else if (tables->table)
@@ -183,7 +179,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
uint dblen, namelen, aliaslen, counter;
bool error;
TABLE *backup_open_tables;
- MDL_ticket *mdl_savepoint;
+ MDL_savepoint mdl_savepoint;
DBUG_ENTER("mysql_ha_open");
DBUG_PRINT("enter",("'%s'.'%s' as '%s' reopen: %d",
tables->db, tables->table_name, tables->alias,
@@ -252,7 +248,13 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
memcpy(hash_tables->db, tables->db, dblen);
memcpy(hash_tables->table_name, tables->table_name, namelen);
memcpy(hash_tables->alias, tables->alias, aliaslen);
- hash_tables->mdl_request.init(MDL_key::TABLE, db, name, MDL_SHARED);
+ /*
+ We can't request lock with explicit duration for this table
+ right from the start as open_tables() can't handle properly
+ back-off for such locks.
+ */
+ hash_tables->mdl_request.init(MDL_key::TABLE, db, name, MDL_SHARED,
+ MDL_TRANSACTION);
/* for now HANDLER can be used only for real TABLES */
hash_tables->required_type= FRMTYPE_TABLE;
@@ -332,8 +334,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
thd->set_open_tables(backup_open_tables);
if (hash_tables->mdl_request.ticket)
{
- thd->mdl_context.
- move_ticket_after_trans_sentinel(hash_tables->mdl_request.ticket);
+ thd->mdl_context.set_lock_duration(hash_tables->mdl_request.ticket,
+ MDL_EXPLICIT);
thd->mdl_context.set_needs_thr_lock_abort(TRUE);
}
@@ -969,24 +971,23 @@ void mysql_ha_cleanup(THD *thd)
/**
- Move tickets for metadata locks corresponding to open HANDLERs
- after transaction sentinel in order to protect them from being
- released at the end of transaction.
+ Set explicit duration for metadata locks corresponding to open HANDLERs
+ to protect them from being released at the end of transaction.
@param thd Thread identifier.
*/
-void mysql_ha_move_tickets_after_trans_sentinel(THD *thd)
+void mysql_ha_set_explicit_lock_duration(THD *thd)
{
TABLE_LIST *hash_tables;
- DBUG_ENTER("mysql_ha_move_tickets_after_trans_sentinel");
+ DBUG_ENTER("mysql_ha_set_explicit_lock_duration");
for (uint i= 0; i < thd->handler_tables_hash.records; i++)
{
hash_tables= (TABLE_LIST*) my_hash_element(&thd->handler_tables_hash, i);
if (hash_tables->table && hash_tables->table->mdl_ticket)
- thd->mdl_context.
- move_ticket_after_trans_sentinel(hash_tables->table->mdl_ticket);
+ thd->mdl_context.set_lock_duration(hash_tables->table->mdl_ticket,
+ MDL_EXPLICIT);
}
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_handler.h b/sql/sql_handler.h
index c5da3c4d468..2eea552d7c9 100644
--- a/sql/sql_handler.h
+++ b/sql/sql_handler.h
@@ -31,6 +31,6 @@ 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);
+void mysql_ha_set_explicit_lock_duration(THD *thd);
#endif /* SQL_HANDLER_INCLUDED */
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 4e3df950134..7d106fbe936 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -699,7 +699,7 @@ bool mysqld_help(THD *thd, const char *mask)
if (count_topics == 0)
{
- int key_id;
+ int UNINIT_VAR(key_id);
if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
used_fields[help_keyword_name].field,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 1f8da3fab5c..bd2aa70806a 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -77,7 +77,8 @@
#include "sql_audit.h"
#ifndef EMBEDDED_LIBRARY
-static bool delayed_get_table(THD *thd, TABLE_LIST *table_list);
+static bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
+ TABLE_LIST *table_list);
static int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
LEX_STRING query, bool ignore, bool log_on);
static void end_delayed_insert(THD *thd);
@@ -529,32 +530,28 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
static
bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
{
+ MDL_request protection_request;
DBUG_ENTER("open_and_lock_for_insert_delayed");
#ifndef EMBEDDED_LIBRARY
- if (thd->locked_tables_mode && thd->global_read_lock.is_acquired())
- {
- /*
- If this connection has the global read lock, the handler thread
- will not be able to lock the table. It will wait for the global
- read lock to go away, but this will never happen since the
- connection thread will be stuck waiting for the handler thread
- to open and lock the table.
- If we are not in locked tables mode, INSERT will seek protection
- against the global read lock (and fail), thus we will only get
- to this point in locked tables mode.
- */
- my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
- DBUG_RETURN(TRUE);
- }
-
/*
In order for the deadlock detector to be able to find any deadlocks
- caused by the handler thread locking this table, we take the metadata
- lock inside the connection thread. If this goes ok, the ticket is cloned
- and added to the list of granted locks held by the handler thread.
+ caused by the handler thread waiting for GRL or this table, we acquire
+ protection against GRL (global IX metadata lock) and metadata lock on
+ table to being inserted into inside the connection thread.
+ If this goes ok, the tickets are cloned and added to the list of granted
+ locks held by the handler thread.
*/
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ if (thd->global_read_lock.can_acquire_protection())
+ DBUG_RETURN(TRUE);
+
+ protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_STATEMENT);
+
+ if (thd->mdl_context.acquire_lock(&protection_request,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(TRUE);
+
if (thd->mdl_context.acquire_lock(&table_list->mdl_request,
thd->variables.lock_wait_timeout))
/*
@@ -564,7 +561,7 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(TRUE);
bool error= FALSE;
- if (delayed_get_table(thd, table_list))
+ if (delayed_get_table(thd, &protection_request, table_list))
error= TRUE;
else if (table_list->table)
{
@@ -589,13 +586,13 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
}
/*
- If a lock was acquired above, we should release it after
- handle_delayed_insert() has cloned the ticket. Note that acquire_lock() can
- succeed because the connection already has the lock. In this case the ticket
- will be before the mdl_savepoint and we should not release it here.
+ We can't release protection against GRL and metadata lock on the table
+ being inserted into here. These locks might be required, for example,
+ because this INSERT DELAYED calls functions which may try to update
+ this or another tables (updating the same table is of course illegal,
+ but such an attempt can be discovered only later during statement
+ execution).
*/
- if (!thd->mdl_context.has_lock(mdl_savepoint, table_list->mdl_request.ticket))
- thd->mdl_context.release_lock(table_list->mdl_request.ticket);
/*
Reset the ticket in case we end up having to use normal insert and
@@ -1873,10 +1870,11 @@ public:
mysql_cond_t cond, cond_client;
volatile uint tables_in_use,stacked_inserts;
volatile bool status;
- /*
+ /**
When the handler thread starts, it clones a metadata lock ticket
- for the table to be inserted. This is done to allow the deadlock
- detector to detect deadlocks resulting from this lock.
+ which protects against GRL and ticket for the table to be inserted.
+ This is done to allow the deadlock detector to detect deadlocks
+ resulting from these locks.
Before this is done, the connection thread cannot safely exit
without causing problems for clone_ticket().
Once handler_thread_initialized has been set, it is safe for the
@@ -1888,6 +1886,11 @@ public:
I_List<delayed_row> rows;
ulong group_count;
TABLE_LIST table_list; // Argument
+ /**
+ Request for IX metadata lock protecting against GRL which is
+ passed from connection thread to the handler thread.
+ */
+ MDL_request grl_protection;
Delayed_insert()
:locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
@@ -2066,7 +2069,8 @@ Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
*/
static
-bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
+bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
+ TABLE_LIST *table_list)
{
int error;
Delayed_insert *di;
@@ -2099,7 +2103,8 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
mysql_mutex_unlock(&LOCK_thread_count);
di->thd.set_db(table_list->db, (uint) strlen(table_list->db));
di->thd.set_query(my_strdup(table_list->table_name,
- MYF(MY_WME | ME_FATALERROR)), 0);
+ MYF(MY_WME | ME_FATALERROR)),
+ 0, system_charset_info);
if (di->thd.db == NULL || di->thd.query() == NULL)
{
/* The error is reported */
@@ -2110,7 +2115,10 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
/* Replace volatile strings with local copies */
di->table_list.alias= di->table_list.table_name= di->thd.query();
di->table_list.db= di->thd.db;
- /* We need the ticket so that it can be cloned in handle_delayed_insert */
+ /* We need the tickets so that they can be cloned in handle_delayed_insert */
+ di->grl_protection.init(MDL_key::GLOBAL, "", "",
+ MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT);
+ di->grl_protection.ticket= grl_protection_request->ticket;
init_mdl_requests(&di->table_list);
di->table_list.mdl_request.ticket= table_list->mdl_request.ticket;
@@ -2650,13 +2658,15 @@ pthread_handler_t handle_delayed_insert(void *arg)
thd->set_current_stmt_binlog_format_row_if_mixed();
/*
- Clone the ticket representing the lock on the target table for
- the insert and add it to the list of granted metadata locks held by
- the handler thread. This is safe since the handler thread is
- not holding nor waiting on any metadata locks.
+ Clone tickets representing protection against GRL and the lock on
+ the target table for the insert and add them to the list of granted
+ metadata locks held by the handler thread. This is safe since the
+ handler thread is not holding nor waiting on any metadata locks.
*/
- if (thd->mdl_context.clone_ticket(&di->table_list.mdl_request))
+ if (thd->mdl_context.clone_ticket(&di->grl_protection) ||
+ thd->mdl_context.clone_ticket(&di->table_list.mdl_request))
{
+ thd->mdl_context.release_transactional_locks();
di->handler_thread_initialized= TRUE;
goto err;
}
@@ -3506,6 +3516,9 @@ bool select_insert::send_eof()
error= (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
table->file->ha_end_bulk_insert() : 0);
+ if (!error && thd->is_error())
+ error= thd->stmt_da->sql_errno();
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
@@ -4049,7 +4062,7 @@ bool select_create::send_eof()
{
bool tmp=select_insert::send_eof();
if (tmp)
- abort();
+ abort_result_set();
else
{
/*
@@ -4081,7 +4094,7 @@ void select_create::abort_result_set()
DBUG_ENTER("select_create::abort_result_set");
/*
- In select_insert::abort() we roll back the statement, including
+ In select_insert::abort_result_set() we roll back the statement, including
truncating the transaction cache of the binary log. To do this, we
pretend that the statement is transactional, even though it might
be the case that it was not.
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index d91489b4a7a..7a8a86d3ca4 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -417,7 +417,6 @@ void lex_start(THD *thd)
lex->nest_level=0 ;
lex->allow_sum_func= 0;
lex->in_sum_func= NULL;
- lex->protect_against_global_read_lock= FALSE;
/*
ok, there must be a better solution for this, long-term
I tried "bzero" in the sql_yacc.yy code, but that for
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 0f93275434d..191562bd3e8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1389,6 +1389,7 @@ public:
STMT_ACCESS_TABLE_COUNT
};
+#ifndef DBUG_OFF
static inline const char *stmt_accessed_table_string(enum_stmt_accessed_table accessed_table)
{
switch (accessed_table)
@@ -1422,7 +1423,10 @@ public:
DBUG_ASSERT(0);
break;
}
+ MY_ASSERT_UNREACHABLE();
+ return "";
}
+#endif /* DBUG */
#define BINLOG_DIRECT_ON 0xF0 /* unsafe when
--binlog-direct-non-trans-updates
@@ -2390,22 +2394,6 @@ struct LEX: public Query_tables_list
bool escape_used;
bool is_lex_started; /* If lex_start() did run. For debugging. */
- /*
- Special case for SELECT .. FOR UPDATE and LOCK TABLES .. WRITE.
-
- Protect from a impending GRL as otherwise the thread might deadlock
- if it starts waiting for the GRL in mysql_lock_tables.
-
- The protection is needed because there is a race between setting
- the global read lock and waiting for all open tables to be closed.
- The problem is a circular wait where a thread holding "old" open
- tables will wait for the global read lock to be released while the
- thread holding the global read lock will wait for all "old" open
- tables to be closed -- the flush part of flush tables with read
- lock.
- */
- bool protect_against_global_read_lock;
-
LEX();
virtual ~LEX()
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2f8a72ee25c..cb641b5ff68 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -18,12 +18,9 @@
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_parse.h" // sql_kill, *_precheck, *_prepare
-#include "lock.h" // wait_if_global_read_lock,
- // unlock_global_read_lock,
- // try_transactional_lock,
+#include "lock.h" // try_transactional_lock,
// check_transactional_lock,
// set_handler_table_locks,
- // start_waiting_global_read_lock,
// lock_global_read_lock,
// make_global_read_lock_block_commit
#include "sql_base.h" // find_temporary_tablesx
@@ -260,21 +257,20 @@ void init_update_queries(void)
the code, in particular in the Query_log_event's constructor.
*/
sql_command_flags[SQLCOM_CREATE_TABLE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL |
+ CF_AUTO_COMMIT_TRANS |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_TABLE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
- CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_TRUNCATE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
- CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ CF_AUTO_COMMIT_TRANS;
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 |
CF_CAN_GENERATE_ROW_EVENTS;
- sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
- sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
- sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
- sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_CREATE_VIEW]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
@@ -285,26 +281,18 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_CREATE_EVENT]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_EVENT]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_EVENT]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_CREATE_TRIGGER]= CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_DROP_TRIGGER]= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_UPDATE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_UPDATE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_INSERT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_INSERT_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_DELETE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
- CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_REPLACE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS;
@@ -366,20 +354,19 @@ void init_update_queries(void)
CF_REEXECUTION_FRAGILE);
- sql_command_flags[SQLCOM_CREATE_USER]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL;
- sql_command_flags[SQLCOM_RENAME_USER]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL;
- sql_command_flags[SQLCOM_DROP_USER]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL;
+ sql_command_flags[SQLCOM_CREATE_USER]= CF_CHANGES_DATA;
+ sql_command_flags[SQLCOM_RENAME_USER]= CF_CHANGES_DATA;
+ sql_command_flags[SQLCOM_DROP_USER]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_GRANT]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_REVOKE]= CF_CHANGES_DATA;
- sql_command_flags[SQLCOM_REVOKE_ALL]= CF_PROTECT_AGAINST_GRL;
sql_command_flags[SQLCOM_OPTIMIZE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_CREATE_FUNCTION]= CF_CHANGES_DATA;
- sql_command_flags[SQLCOM_CREATE_PROCEDURE]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_CREATE_SPFUNCTION]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_DROP_PROCEDURE]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_DROP_FUNCTION]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_ALTER_PROCEDURE]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_ALTER_FUNCTION]= CF_CHANGES_DATA | CF_PROTECT_AGAINST_GRL | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_CREATE_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_CREATE_SPFUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_DROP_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_DROP_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_INSTALL_PLUGIN]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]= CF_CHANGES_DATA;
@@ -550,7 +537,7 @@ static void handle_bootstrap_impl(THD *thd)
query= (char *) thd->memdup_w_gap(buff, length + 1,
thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE);
- thd->set_query_and_id(query, length, next_query_id());
+ thd->set_query_and_id(query, length, thd->charset(), next_query_id());
DBUG_PRINT("query",("%-.4096s",thd->query()));
#if defined(ENABLED_PROFILING)
thd->profiling.start_new_query();
@@ -712,6 +699,22 @@ bool do_command(THD *thd)
net_new_transaction(net);
+ /*
+ Synchronization point for testing of KILL_CONNECTION.
+ This sync point can wait here, to simulate slow code execution
+ between the last test of thd->killed and blocking in read().
+
+ The goal of this test is to verify that a connection does not
+ hang, if it is killed at this point of execution.
+ (Bug#37780 - main.kill fails randomly)
+
+ Note that the sync point wait itself will be terminated by a
+ kill. In this case it consumes a condition broadcast, but does
+ not change anything else. The consumed broadcast should not
+ matter here, because the read/recv() below doesn't use it.
+ */
+ DEBUG_SYNC(thd, "before_do_command_net_read");
+
if ((packet_length= my_net_read(net)) == packet_error)
{
DBUG_PRINT("info",("Got error %d reading command from socket %s",
@@ -1031,11 +1034,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
! thd->is_error())
{
- char *beginning_of_next_stmt= (char*)
- parser_state.m_lip.found_semicolon;
/*
Multiple queries exits, execute them individually
*/
+ char *beginning_of_next_stmt= (char*) parser_state.m_lip.found_semicolon;
+
+ /* Finalize server status flags after executing a statement. */
+ thd->update_server_status();
thd->protocol->end_statement();
query_cache_end_of_result(thd);
ulong length= (ulong)(packet_end - beginning_of_next_stmt);
@@ -1065,7 +1070,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->security_ctx->priv_user,
(char *) thd->security_ctx->host_or_ip);
- thd->set_query_and_id(beginning_of_next_stmt, length, next_query_id());
+ thd->set_query_and_id(beginning_of_next_stmt, length,
+ thd->charset(), next_query_id());
/*
Count each statement from the client.
*/
@@ -1095,7 +1101,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
SHOW statements should not add the used tables to the list of tables
used in a transaction.
*/
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_FIELDS]);
if (thd->copy_db_to(&db.str, &db.length))
@@ -1381,6 +1387,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(thd->open_tables == NULL ||
(thd->locked_tables_mode == LTM_LOCK_TABLES)));
+ /* Finalize server status flags after executing a command. */
+ thd->update_server_status();
thd->protocol->end_statement();
query_cache_end_of_result(thd);
@@ -1390,7 +1398,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
log_slow_statement(thd);
thd_proc_info(thd, "cleaning up");
- thd->set_query(NULL, 0);
+ thd->reset_query();
thd->command=COM_SLEEP;
dec_thread_running();
thd_proc_info(thd, 0);
@@ -1435,8 +1443,7 @@ void log_slow_statement(THD *thd)
ulonglong end_utime_of_query= thd->current_utime();
thd_proc_info(thd, "logging slow query");
- if (((end_utime_of_query - thd->utime_after_lock) >
- thd->variables.long_query_time ||
+ if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes &&
@@ -1738,16 +1745,6 @@ bool sp_process_definer(THD *thd)
/**
Execute command saved in thd and lex->sql_command.
- Before every operation that can request a write lock for a table
- wait if a global read lock exists. However do not wait if this
- thread has locked tables already. No new locks can be requested
- until the other locks are released. The thread that requests the
- global read lock waits for write locked tables to become unlocked.
-
- Note that wait_if_global_read_lock() sets a protection against a new
- global read lock when it succeeds. This needs to be released by
- start_waiting_global_read_lock() after the operation.
-
@param thd Thread handle
@todo
@@ -1781,7 +1778,6 @@ mysql_execute_command(THD *thd)
/* have table map for update for multi-update statement (BUG#37051) */
bool have_table_map_for_update= FALSE;
#endif
- /* Saved variable value */
DBUG_ENTER("mysql_execute_command");
#ifdef WITH_PARTITION_STORAGE_ENGINE
thd->work_part_info= 0;
@@ -1973,17 +1969,6 @@ mysql_execute_command(THD *thd)
thd->mdl_context.release_transactional_locks();
}
- /*
- Check if this command needs protection against the global read lock
- to avoid deadlock. See CF_PROTECT_AGAINST_GRL.
- start_waiting_global_read_lock() is called at the end of
- mysql_execute_command().
- */
- if (((sql_command_flags[lex->sql_command] & CF_PROTECT_AGAINST_GRL) != 0) &&
- !thd->locked_tables_mode)
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- goto error;
-
#ifndef DBUG_OFF
if (lex->sql_command != SQLCOM_SET_OPTION)
DEBUG_SYNC(thd,"before_execute_sql_command");
@@ -2058,10 +2043,6 @@ mysql_execute_command(THD *thd)
if (res)
break;
- if (!thd->locked_tables_mode && lex->protect_against_global_read_lock &&
- thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- break;
-
res= execute_sqlcom_select(thd, all_tables);
break;
}
@@ -2320,20 +2301,6 @@ case SQLCOM_PREPARE:
create_info.default_table_charset= create_info.table_charset;
create_info.table_charset= 0;
}
- /*
- The create-select command will open and read-lock the select table
- and then create, open and write-lock the new table. If a global
- read lock steps in, we get a deadlock. The write lock waits for
- the global read lock, while the global read lock waits for the
- select table to be closed. So we wait until the global readlock is
- gone before starting both steps. Note that
- wait_if_global_read_lock() sets a protection against a new global
- read lock when it succeeds. This needs to be released by
- start_waiting_global_read_lock(). We protect the normal CREATE
- TABLE in the same way. That way we avoid that a new table is
- created during a global read lock.
- Protection against grl is covered by the CF_PROTECT_AGAINST_GRL flag.
- */
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
@@ -2832,6 +2799,15 @@ end_with_restore_list:
thd->first_successful_insert_id_in_cur_stmt=
thd->first_successful_insert_id_in_prev_stmt;
+ DBUG_EXECUTE_IF("after_mysql_insert",
+ {
+ const char act[]=
+ "now "
+ "wait_for signal.continue";
+ DBUG_ASSERT(opt_debug_sync_timeout > 0);
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
break;
}
case SQLCOM_REPLACE_SELECT:
@@ -3118,9 +3094,6 @@ end_with_restore_list:
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
FALSE, UINT_MAX, FALSE))
goto error;
- if (lex->protect_against_global_read_lock &&
- thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- goto error;
thd->variables.option_bits|= OPTION_TABLE_LOCK;
thd->in_lock_tables=1;
@@ -3405,6 +3378,10 @@ end_with_restore_list:
if (check_access(thd, UPDATE_ACL, "mysql", NULL, NULL, 1, 1) &&
check_global_access(thd,CREATE_USER_ACL))
break;
+
+ /* Replicate current user as grantor */
+ thd->binlog_invoker();
+
/* Conditionally writes to binlog */
if (!(res = mysql_revoke_all(thd, lex->users_list)))
my_ok(thd);
@@ -3421,6 +3398,9 @@ end_with_restore_list:
first_table ? 0 : 1, 0))
goto error;
+ /* Replicate current user as grantor */
+ thd->binlog_invoker();
+
if (thd->security_ctx->user) // If not replication
{
LEX_USER *user, *tmp_user;
@@ -3769,13 +3749,22 @@ end_with_restore_list:
Security_context *backup= NULL;
LEX_USER *definer= thd->lex->definer;
/*
- We're going to issue an implicit GRANT statement.
- It takes metadata locks and updates system tables.
- Make sure that sp_create_routine() did not leave any
- locks in the MDL context, so there is no risk to
- deadlock.
+ We're going to issue an implicit GRANT statement so we close all
+ open tables. We have to keep metadata locks as this ensures that
+ this statement is atomic against concurent FLUSH TABLES WITH READ
+ LOCK. Deadlocks which can arise due to fact that this implicit
+ statement takes metadata locks should be detected by a deadlock
+ detector in MDL subsystem and reported as errors.
+
+ No need to commit/rollback statement transaction, it's not started.
+
+ TODO: Long-term we should either ensure that implicit GRANT statement
+ is written into binary log as a separate statement or make both
+ creation of routine and implicit GRANT parts of one fully atomic
+ statement.
*/
- close_mysql_tables(thd);
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
/*
Check if the definer exists on slave,
then use definer privilege to insert routine privileges to mysql.procs_priv.
@@ -4023,49 +4012,48 @@ create_sp_error:
int sp_result;
int type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
+ char *db= lex->spname->m_db.str;
+ char *name= lex->spname->m_name.str;
- /*
- @todo: here we break the metadata locking protocol by
- looking up the information about the routine without
- a metadata lock. Rewrite this piece to make sp_drop_routine
- return whether the routine existed or not.
- */
- sp_result= sp_routine_exists_in_table(thd, type, lex->spname);
- thd->warning_info->opt_clear_warning_info(thd->query_id);
- if (sp_result == SP_OK)
- {
- char *db= lex->spname->m_db.str;
- char *name= lex->spname->m_name.str;
-
- if (check_routine_access(thd, ALTER_PROC_ACL, db, name,
- lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
- goto error;
+ if (check_routine_access(thd, ALTER_PROC_ACL, db, name,
+ lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
+ goto error;
- /* Conditionally writes to binlog */
- sp_result= sp_drop_routine(thd, type, lex->spname);
+ /* Conditionally writes to binlog */
+ sp_result= sp_drop_routine(thd, type, lex->spname);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- /*
- We're going to issue an implicit REVOKE statement.
- It takes metadata locks and updates system tables.
- Make sure that sp_create_routine() did not leave any
- locks in the MDL context, so there is no risk to
- deadlock.
- */
- close_mysql_tables(thd);
+ /*
+ We're going to issue an implicit REVOKE statement so we close all
+ open tables. We have to keep metadata locks as this ensures that
+ this statement is atomic against concurent FLUSH TABLES WITH READ
+ LOCK. Deadlocks which can arise due to fact that this implicit
+ statement takes metadata locks should be detected by a deadlock
+ detector in MDL subsystem and reported as errors.
+
+ No need to commit/rollback statement transaction, it's not started.
+
+ TODO: Long-term we should either ensure that implicit REVOKE statement
+ is written into binary log as a separate statement or make both
+ dropping of routine and implicit REVOKE parts of one fully atomic
+ statement.
+ */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
- if (sp_automatic_privileges && !opt_noacl &&
- sp_revoke_privileges(thd, db, name,
- lex->sql_command == SQLCOM_DROP_PROCEDURE))
- {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_PROC_AUTO_REVOKE_FAIL,
- ER(ER_PROC_AUTO_REVOKE_FAIL));
- /* If this happens, an error should have been reported. */
- goto error;
- }
-#endif
+ if (sp_result != SP_KEY_NOT_FOUND &&
+ sp_automatic_privileges && !opt_noacl &&
+ sp_revoke_privileges(thd, db, name,
+ lex->sql_command == SQLCOM_DROP_PROCEDURE))
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_PROC_AUTO_REVOKE_FAIL,
+ ER(ER_PROC_AUTO_REVOKE_FAIL));
+ /* If this happens, an error should have been reported. */
+ goto error;
}
+#endif
+
res= sp_result;
switch (sp_result) {
case SP_OK:
@@ -4340,14 +4328,6 @@ error:
res= TRUE;
finish:
- if (thd->global_read_lock.has_protection())
- {
- /*
- Release the protection against the global read lock and wake
- everyone, who might want to set a global read lock.
- */
- thd->global_read_lock.start_waiting_global_read_lock(thd);
- }
DBUG_ASSERT(!thd->in_active_multi_stmt_transaction() ||
thd->in_multi_stmt_transaction_mode());
@@ -4383,6 +4363,11 @@ finish:
close_thread_tables(thd);
thd_proc_info(thd, 0);
+#ifndef DBUG_OFF
+ if (lex->sql_command != SQLCOM_SET_OPTION && ! thd->in_sub_stmt)
+ DEBUG_SYNC(thd, "execute_command_after_close_tables");
+#endif
+
if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END))
{
/* No transaction control allowed in sub-statements. */
@@ -4408,6 +4393,10 @@ finish:
*/
thd->mdl_context.release_transactional_locks();
}
+ else if (! thd->in_sub_stmt)
+ {
+ thd->mdl_context.release_statement_locks();
+ }
DBUG_RETURN(res || thd->is_error());
}
@@ -5119,10 +5108,17 @@ bool check_stack_overrun(THD *thd, long margin,
if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
(long) (my_thread_stack_size - margin))
{
- char ebuff[MYSQL_ERRMSG_SIZE];
- my_snprintf(ebuff, sizeof(ebuff), ER(ER_STACK_OVERRUN_NEED_MORE),
- stack_used, my_thread_stack_size, margin);
- my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATALERROR));
+ /*
+ Do not use stack for the message buffer to ensure correct
+ behaviour in cases we have close to no stack left.
+ */
+ char* ebuff= new char[MYSQL_ERRMSG_SIZE];
+ if (ebuff) {
+ my_snprintf(ebuff, MYSQL_ERRMSG_SIZE, ER(ER_STACK_OVERRUN_NEED_MORE),
+ stack_used, my_thread_stack_size, margin);
+ my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATALERROR));
+ delete [] ebuff;
+ }
return 1;
}
#ifndef DBUG_OFF
@@ -5481,7 +5477,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
if (found_semicolon && (ulong) (found_semicolon - thd->query()))
thd->set_query_inner(thd->query(),
(uint32) (found_semicolon -
- thd->query() - 1));
+ thd->query() - 1),
+ thd->charset());
/* Actually execute the query */
if (found_semicolon)
{
@@ -5870,7 +5867,8 @@ 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, mdl_type);
+ ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
+ MDL_TRANSACTION);
DBUG_RETURN(ptr);
}
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 0629d9f3737..cec047d11fc 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -166,12 +166,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
uint min_len, uint max_len,
uint flags,
PARTITION_ITERATOR *part_iter);
+
+#ifdef WITH_PARTITION_STORAGE_ENGINE
static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec);
static int cmp_rec_and_tuple_prune(part_column_list_val *val,
uint32 n_vals_in_rec,
bool tail_is_min);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
Convert constants in VALUES definition to the character set the
corresponding field uses.
@@ -1996,7 +1997,7 @@ static int add_part_field_list(File fptr, List<char> field_list)
String field_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_options= thd->variables.option_bits;
- thd->variables.option_bits= 0;
+ thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &field_string, field_str,
strlen(field_str));
thd->variables.option_bits= save_options;
@@ -2015,8 +2016,7 @@ static int add_name_string(File fptr, const char *name)
String name_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_options= thd->variables.option_bits;
-
- thd->variables.option_bits= 0;
+ thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &name_string, name,
strlen(name));
thd->variables.option_bits= save_options;
@@ -7484,8 +7484,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
PARTITION_ITERATOR *part_iter)
{
Field *field= part_info->part_field_array[0];
- uint32 max_endpoint_val;
- get_endpoint_func get_endpoint;
+ uint32 UNINIT_VAR(max_endpoint_val);
+ get_endpoint_func UNINIT_VAR(get_endpoint);
bool can_match_multiple_values; /* is not '=' */
uint field_len= field->pack_length_in_rec();
DBUG_ENTER("get_part_iter_for_interval_via_mapping");
@@ -7528,8 +7528,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
}
}
else
- assert(0);
-
+ MY_ASSERT_UNREACHABLE();
+
can_match_multiple_values= (flags || !min_value || !max_value ||
memcmp(min_value, max_value, field_len));
if (can_match_multiple_values &&
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 98750314a4a..8f6ab5803d7 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -18,7 +18,9 @@
#include "sql_lex.h" // Sql_statement
#include "sql_admin.h" // Analyze/Check/.._table_statement
#include "sql_partition_admin.h" // Alter_table_*_partition
+#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h" // ha_partition
+#endif
#include "sql_base.h" // open_and_lock_tables
#ifndef WITH_PARTITION_STORAGE_ENGINE
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 451277712db..0fe89cd3748 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1738,7 +1738,11 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
mysql_mutex_lock(&LOCK_plugin);
mysql_rwlock_wrlock(&LOCK_system_variables_hash);
- my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL);
+ if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL))
+ {
+ report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name->str);
+ goto err;
+ }
error= plugin_add(thd->mem_root, name, dl, &argc, argv, REPORT_TO_USER);
if (argv)
free_defaults(argv);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index fcbf2c48896..4a1d1ae7fe3 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1185,7 +1185,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
uint32 length= 0;
THD *thd= stmt->thd;
- DBUG_ENTER("insert_params_from_vars");
+ DBUG_ENTER("insert_params_from_vars_with_log");
if (query->copy(stmt->query(), stmt->query_length(), default_charset_info))
DBUG_RETURN(1);
@@ -2898,8 +2898,15 @@ bool Select_fetch_protocol_binary::send_result_set_metadata(List<Item> &list, ui
bool Select_fetch_protocol_binary::send_eof()
{
+ /*
+ Don't send EOF if we're in error condition (which implies we've already
+ sent or are sending an error)
+ */
+ if (thd->is_error())
+ return true;
+
::my_eof(thd);
- return FALSE;
+ return false;
}
@@ -3172,7 +3179,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
bool error;
Statement stmt_backup;
Query_arena *old_stmt_arena;
- MDL_ticket *mdl_savepoint= NULL;
DBUG_ENTER("Prepared_statement::prepare");
/*
If this is an SQLCOM_PREPARE, we also increase Com_prepare_sql.
@@ -3244,7 +3250,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
Marker used to release metadata locks acquired while the prepared
statement is being checked.
*/
- mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
/*
The only case where we should have items in the thd->free_list is
@@ -3735,7 +3741,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
to point at it even after we restore from backup. This is ok, as
expanded query was allocated in thd->mem_root.
*/
- stmt_backup.set_query_inner(thd->query(), thd->query_length());
+ stmt_backup.set_query_inner(thd->query_string);
/*
At first execution of prepared statement we may perform logical
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index ac15239b040..6a7b0b0b3ad 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -24,8 +24,7 @@
#include "sql_table.h" // build_table_filename
#include "sql_view.h" // mysql_frm_type, mysql_rename_view
#include "sql_trigger.h"
-#include "lock.h" // wait_if_global_read_lock
- // start_waiting_global_read_lock
+#include "lock.h" // MYSQL_OPEN_SKIP_TEMPORARY
#include "sql_base.h" // tdc_remove_table, lock_table_names,
#include "sql_handler.h" // mysql_ha_rm_tables
#include "datadict.h"
@@ -63,9 +62,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
mysql_ha_rm_tables(thd, table_list);
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- DBUG_RETURN(1);
-
if (logger.is_log_table_enabled(QUERY_LOG_GENERAL) ||
logger.is_log_table_enabled(QUERY_LOG_SLOW))
{
@@ -108,7 +104,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
*/
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name,
ren_table->table_name);
- DBUG_RETURN(1);
+ goto err;
}
}
else
@@ -121,7 +117,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
*/
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name,
ren_table->table_name);
- DBUG_RETURN(1);
+ goto err;
}
else
{
@@ -139,7 +135,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
else
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), rename_log_table[1],
rename_log_table[1]);
- DBUG_RETURN(1);
+ goto err;
}
}
@@ -189,7 +185,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
query_cache_invalidate3(thd, table_list, 0);
err:
- thd->global_read_lock.start_waiting_global_read_lock(thd);
DBUG_RETURN(error || binlog_error);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2a2fe3eb36f..ef2dd1d76e1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -47,6 +47,7 @@
#include "records.h" // init_read_record, end_read_record
#include "filesort.h" // filesort_free_buffers
#include "sql_union.h" // mysql_union
+#include "debug_sync.h" // DEBUG_SYNC
#include <m_ctype.h>
#include <my_bit.h>
#include <hash.h>
@@ -852,6 +853,7 @@ JOIN::optimize()
if (optimized)
DBUG_RETURN(0);
optimized= 1;
+ DEBUG_SYNC(thd, "before_join_optimize");
thd_proc_info(thd, "optimizing");
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
@@ -1754,6 +1756,9 @@ JOIN::reinit()
func->clear();
}
+ if (!(select_options & SELECT_DESCRIBE))
+ init_ftfuncs(thd, select_lex, test(order));
+
DBUG_RETURN(0);
}
@@ -2511,6 +2516,13 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
{
DBUG_RETURN(TRUE);
}
+ /*
+ Original join tabs might be overwritten at first
+ subselect execution. So we need to restore them.
+ */
+ Item_subselect *subselect= select_lex->master_unit()->item;
+ if (subselect && subselect->is_uncacheable() && join->reinit())
+ DBUG_RETURN(TRUE);
}
else
{
@@ -4048,8 +4060,12 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
continue;
}
-#ifdef HAVE_purify
- /* Valgrind complains about overlapped memcpy when save_pos==use. */
+#if defined(__GNUC__) && !MY_GNUC_PREREQ(4,4)
+ /*
+ Old gcc used a memcpy(), which is undefined if save_pos==use:
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39480
+ */
if (save_pos != use)
#endif
*save_pos= *use;
@@ -13429,6 +13445,8 @@ static bool
list_contains_unique_index(TABLE *table,
bool (*find_func) (Field *, void *), void *data)
{
+ if (table->pos_in_table_list->outer_join)
+ return 0;
for (uint keynr= 0; keynr < table->s->keys; keynr++)
{
if (keynr == table->s->primary_key ||
@@ -13442,7 +13460,7 @@ list_contains_unique_index(TABLE *table,
key_part < key_part_end;
key_part++)
{
- if (key_part->field->maybe_null() ||
+ if (key_part->field->real_maybe_null() ||
!find_func(key_part->field, data))
break;
}
@@ -15218,6 +15236,8 @@ calc_group_buffer(JOIN *join,ORDER *group)
{
key_length+= 8;
}
+ else if (type == MYSQL_TYPE_BLOB)
+ key_length+= MAX_BLOB_WIDTH; // Can't be used as a key
else
{
/*
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 16deb50b17c..74924f74fec 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -29,6 +29,8 @@
#include "repl_failsafe.h"
#include "sql_parse.h" // check_access, check_table_access
#include "sql_partition.h" // partition_element
+#include "sql_derived.h" // mysql_derived_prepare,
+ // mysql_handle_derived,
#include "sql_db.h" // check_db_dir_existence, load_db_opt_by_name
#include "sql_time.h" // interval_type_to_name
#include "tztime.h" // struct Time_zone
@@ -98,11 +100,13 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info);
+#ifdef WITH_PARTITION_STORAGE_ENGINE
static void get_cs_converted_string_value(THD *thd,
String *input_str,
String *output_str,
CHARSET_INFO *cs,
bool use_hex);
+#endif
static void
append_algorithm(TABLE_LIST *table, String *buff);
@@ -478,12 +482,6 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
else if (wild_compare(uname, wild, 0))
continue;
}
- if (!(file_name=
- thd->make_lex_string(file_name, uname, file_name_len, TRUE)))
- {
- my_dirend(dirp);
- DBUG_RETURN(FIND_FILES_OOM);
- }
}
else
{
@@ -600,11 +598,11 @@ public:
return m_view_access_denied_message_ptr;
}
- bool handle_condition(THD *thd, uint sql_errno, const char */* sqlstate */,
+ bool handle_condition(THD *thd, uint sql_errno, const char * /* sqlstate */,
MYSQL_ERROR::enum_warning_level level,
- const char *message, MYSQL_ERROR **/* cond_hdl */)
+ const char *message, MYSQL_ERROR ** /* cond_hdl */)
{
- /*
+ /*
The handler does not handle the errors raised by itself.
At this point we know if top_view is really a view.
*/
@@ -614,7 +612,7 @@ public:
m_handling= TRUE;
bool is_handled;
-
+
switch (sql_errno)
{
case ER_TABLEACCESS_DENIED_ERROR:
@@ -675,17 +673,24 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Metadata locks taken during SHOW CREATE should be released when
the statmement completes as it is an information statement.
*/
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
/* We want to preserve the tree for views. */
thd->lex->view_prepare_mode= TRUE;
{
+ /*
+ Use open_tables() directly rather than open_normal_and_derived_tables().
+ This ensures that close_thread_tables() is not called if open tables fails
+ and the error is ignored. This allows us to handle broken views nicely.
+ */
+ uint counter;
Show_create_error_handler view_error_suppressor(thd, table_list);
thd->push_internal_handler(&view_error_suppressor);
bool open_error=
- open_normal_and_derived_tables(thd, table_list,
- MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL);
+ open_tables(thd, &table_list, &counter,
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) ||
+ mysql_handle_derived(thd->lex, &mysql_derived_prepare);
thd->pop_internal_handler();
if (open_error && (thd->killed || thd->is_error()))
goto exit;
@@ -1731,7 +1736,7 @@ public:
time_t start_time;
uint command;
const char *user,*host,*db,*proc_info,*state_info;
- char *query;
+ CSET_STRING query_string;
};
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
@@ -1828,12 +1833,14 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
- thd_info->query=0;
/* Lock THD mutex that protects its data when looking at it. */
if (tmp->query())
{
uint length= min(max_query_length, tmp->query_length());
- thd_info->query= (char*) thd->strmake(tmp->query(),length);
+ char *q= thd->strmake(tmp->query(),length);
+ /* Safety: in case strmake failed, we set length to 0. */
+ thd_info->query_string=
+ CSET_STRING(q, q ? length : 0, tmp->query_charset());
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
thd_info->start_time= tmp->start_time;
@@ -1861,7 +1868,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
- protocol->store(thd_info->query, system_charset_info);
+ protocol->store(thd_info->query_string.str(),
+ thd_info->query_string.charset());
if (protocol->write())
break; /* purecov: inspected */
}
@@ -3190,7 +3198,7 @@ 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);
+ MDL_SHARED_HIGH_PRIO, MDL_TRANSACTION);
if (can_deadlock)
{
@@ -4934,18 +4942,29 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
else
table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
- if (table->pos_in_table_list->table_open_method &
- OPEN_FULL_TABLE)
+ /*
+ Only try to fill in the information about view updatability
+ if it is requested as part of the top-level query (i.e.
+ it's select * from i_s.views, as opposed to, say, select
+ security_type from i_s.views). Do not try to access the
+ underlying tables if there was an error when opening the
+ view: all underlying tables are released back to the table
+ definition cache on error inside open_normal_and_derived_tables().
+ If a field is not assigned explicitly, it defaults to NULL.
+ */
+ if (res == FALSE &&
+ table->pos_in_table_list->table_open_method & OPEN_FULL_TABLE)
{
updatable_view= 0;
if (tables->algorithm != VIEW_ALGORITHM_TMPTABLE)
{
/*
- We should use tables->view->select_lex.item_list here and
- can not use Field_iterator_view because the view always uses
- temporary algorithm during opening for I_S and
- TABLE_LIST fields 'field_translation' & 'field_translation_end'
- are uninitialized is this case.
+ We should use tables->view->select_lex.item_list here
+ and can not use Field_iterator_view because the view
+ always uses temporary algorithm during opening for I_S
+ and TABLE_LIST fields 'field_translation'
+ & 'field_translation_end' are uninitialized is this
+ case.
*/
List<Item> *fields= &tables->view->select_lex.item_list;
List_iterator<Item> it(*fields);
@@ -7738,7 +7757,7 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name)
Metadata locks taken during SHOW CREATE TRIGGER should be released when
the statement completes as it is an information statement.
*/
- MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
/*
Open the table by name in order to load Table_triggers_list object.
@@ -7839,6 +7858,7 @@ void initialize_information_schema_acl()
&is_internal_schema_access);
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
Convert a string in character set in column character set format
to utf8 character set if possible, the utf8 character set string
@@ -7930,3 +7950,4 @@ static void get_cs_converted_string_value(THD *thd,
}
return;
}
+#endif
diff --git a/sql/sql_show.h b/sql/sql_show.h
index d1323ede8c1..de8f2525baa 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -104,7 +104,6 @@ bool mysqld_show_storage_engines(THD *thd);
bool mysqld_show_authors(THD *thd);
bool mysqld_show_contributors(THD *thd);
bool mysqld_show_privileges(THD *thd);
-bool mysqld_show_column_types(THD *thd);
char *make_backup_log_name(char *buff, const char *name, const char* log_ext);
void calc_sum_of_all_status(STATUS_VAR *to);
void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 845b7c280b1..3642a96de35 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -91,9 +91,13 @@ public:
}
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return (void*) alloc_root(mem_root, (uint) size); }
- static void operator delete(void *ptr_arg,size_t size)
- { TRASH(ptr_arg, size); }
- static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
+ static void operator delete(void *ptr_arg, size_t size)
+ {
+ (void) ptr_arg;
+ (void) size;
+ TRASH(ptr_arg, size);
+ }
+ static void operator delete(void *, MEM_ROOT *)
{ /* never called */ }
~String() { free(); }
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 1c6ca4a48d9..772496a10d5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -23,9 +23,7 @@
#include "sql_parse.h" // test_if_data_home_dir
#include "sql_cache.h" // query_cache_*
#include "sql_base.h" // open_table_uncached, lock_table_names
-#include "lock.h" // wait_if_global_read_lock
- // start_waiting_global_read_lock,
- // mysql_unlock_tables
+#include "lock.h" // mysql_unlock_tables
#include "strfunc.h" // find_type2, find_set
#include "sql_view.h" // view_checksum
#include "sql_truncate.h" // regenerate_locked_table
@@ -1851,64 +1849,117 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
{
bool error;
Drop_table_error_handler err_handler;
+ TABLE_LIST *table;
DBUG_ENTER("mysql_rm_table");
- /* mark for close and remove all cached entries */
+ /* Disable drop of enabled log tables, must be done before name locking */
+ for (table= tables; table; table= table->next_local)
+ {
+ if (check_if_log_table(table->db_length, table->db,
+ table->table_name_length, table->table_name, true))
+ {
+ my_error(ER_BAD_LOG_STATEMENT, MYF(0), "DROP");
+ DBUG_RETURN(true);
+ }
+ }
+
+ mysql_ha_rm_tables(thd, tables);
if (!drop_temporary)
{
- if (!thd->locked_tables_mode &&
- thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- DBUG_RETURN(TRUE);
+ if (!thd->locked_tables_mode)
+ {
+ if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY))
+ DBUG_RETURN(true);
+ for (table= tables; table; table= table->next_local)
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
+ false);
+ }
+ else
+ {
+ for (table= tables; table; table= table->next_local)
+ if (table->open_type != OT_BASE_ONLY &&
+ find_temporary_table(thd, table))
+ {
+ /*
+ A temporary table.
+
+ Don't try to find a corresponding MDL lock or assign it
+ to table->mdl_request.ticket. There can't be metadata
+ locks for temporary tables: they are local to the session.
+
+ Later in this function we release the MDL lock only if
+ table->mdl_requeset.ticket is not NULL. Thus here we
+ ensure that we won't release the metadata lock on the base
+ table locked with LOCK TABLES as a side effect of temporary
+ table drop.
+ */
+ DBUG_ASSERT(table->mdl_request.ticket == NULL);
+ }
+ else
+ {
+ /*
+ Not a temporary table.
+
+ Since 'tables' list can't contain duplicates (this is ensured
+ by parser) it is safe to cache pointer to the TABLE instances
+ in its elements.
+ */
+ table->table= find_table_for_mdl_upgrade(thd->open_tables, table->db,
+ table->table_name, false);
+ if (!table->table)
+ DBUG_RETURN(true);
+ table->mdl_request.ticket= table->table->mdl_ticket;
+ }
+ }
}
+ /* mark for close and remove all cached entries */
thd->push_internal_handler(&err_handler);
- error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0);
+ error= mysql_rm_table_no_locks(thd, tables, if_exists, drop_temporary,
+ false, false);
thd->pop_internal_handler();
- if (thd->global_read_lock.has_protection())
- thd->global_read_lock.start_waiting_global_read_lock(thd);
-
if (error)
DBUG_RETURN(TRUE);
my_ok(thd);
DBUG_RETURN(FALSE);
}
-/*
- Execute the drop of a normal or temporary table
-
- SYNOPSIS
- mysql_rm_table_part2()
- thd Thread handler
- tables Tables to drop
- if_exists If set, don't give an error if table doesn't exists.
- In this case we give an warning of level 'NOTE'
- drop_temporary Only drop temporary tables
- drop_view Allow to delete VIEW .frm
- dont_log_query Don't write query to log files. This will also not
- generate warnings if the handler files doesn't exists
-
- TODO:
- When logging to the binary log, we should log
- tmp_tables and transactional tables as separate statements if we
- are in a transaction; This is needed to get these tables into the
- cached binary log that is only written on COMMIT.
-
- The current code only writes DROP statements that only uses temporary
- tables to the cache binary log. This should be ok on most cases, but
- not all.
- RETURN
- 0 ok
- 1 Error
- -1 Thread was killed
+/**
+ Execute the drop of a normal or temporary table.
+
+ @param thd Thread handler
+ @param tables Tables to drop
+ @param if_exists If set, don't give an error if table doesn't exists.
+ In this case we give an warning of level 'NOTE'
+ @param drop_temporary Only drop temporary tables
+ @param drop_view Allow to delete VIEW .frm
+ @param dont_log_query Don't write query to log files. This will also not
+ generate warnings if the handler files doesn't exists
+
+ @retval 0 ok
+ @retval 1 Error
+ @retval -1 Thread was killed
+
+ @note This function assumes that metadata locks have already been taken.
+ It is also assumed that the tables have been removed from TDC.
+
+ @todo When logging to the binary log, we should log
+ tmp_tables and transactional tables as separate statements if we
+ are in a transaction; This is needed to get these tables into the
+ cached binary log that is only written on COMMIT.
+ The current code only writes DROP statements that only uses temporary
+ tables to the cache binary log. This should be ok on most cases, but
+ not all.
*/
-int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
- bool drop_temporary, bool drop_view,
- bool dont_log_query)
+int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
+ bool drop_temporary, bool drop_view,
+ bool dont_log_query)
{
TABLE_LIST *table;
char path[FN_REFLEN + 1], *alias= NULL;
@@ -1922,7 +1973,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
bool non_tmp_table_deleted= 0;
String built_query;
String built_trans_tmp_query, built_non_trans_tmp_query;
- DBUG_ENTER("mysql_rm_table_part2");
+ DBUG_ENTER("mysql_rm_table_no_locks");
/*
Prepares the drop statements that will be written into the binary
@@ -1976,71 +2027,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
}
}
- mysql_ha_rm_tables(thd, tables);
-
- /* Disable drop of enabled log tables, must be done before name locking */
- for (table= tables; table; table= table->next_local)
- {
- if (check_if_log_table(table->db_length, table->db,
- table->table_name_length, table->table_name, 1))
- {
- my_error(ER_BAD_LOG_STATEMENT, MYF(0), "DROP");
- DBUG_RETURN(1);
- }
- }
-
- if (!drop_temporary)
- {
- if (!thd->locked_tables_mode)
- {
- if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
- MYSQL_OPEN_SKIP_TEMPORARY))
- DBUG_RETURN(1);
- for (table= tables; table; table= table->next_local)
- {
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
- FALSE);
- }
- }
- else
- {
- for (table= tables; table; table= table->next_local)
- if (table->open_type != OT_BASE_ONLY &&
- find_temporary_table(thd, table))
- {
- /*
- A temporary table.
-
- Don't try to find a corresponding MDL lock or assign it
- to table->mdl_request.ticket. There can't be metadata
- locks for temporary tables: they are local to the session.
-
- Later in this function we release the MDL lock only if
- table->mdl_requeset.ticket is not NULL. Thus here we
- ensure that we won't release the metadata lock on the base
- table locked with LOCK TABLES as a side effect of temporary
- table drop.
- */
- DBUG_ASSERT(table->mdl_request.ticket == NULL);
- }
- else
- {
- /*
- Not a temporary table.
-
- Since 'tables' list can't contain duplicates (this is ensured
- by parser) it is safe to cache pointer to the TABLE instances
- in its elements.
- */
- table->table= find_table_for_mdl_upgrade(thd->open_tables, table->db,
- table->table_name, FALSE);
- if (!table->table)
- DBUG_RETURN(1);
- table->mdl_request.ticket= table->table->mdl_ticket;
- }
- }
- }
-
for (table= tables; table; table= table->next_local)
{
bool is_trans;
@@ -2053,6 +2039,16 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->table ? (long) table->table->s : (long) -1));
/*
+ If we are in locked tables mode and are dropping a temporary table,
+ the ticket should be NULL to ensure that we don't release a lock
+ on a base table later.
+ */
+ DBUG_ASSERT(!(thd->locked_tables_mode &&
+ table->open_type != OT_BASE_ONLY &&
+ find_temporary_table(thd, table) &&
+ table->mdl_request.ticket != NULL));
+
+ /*
drop_temporary_table may return one of the following error codes:
. 0 - a temporary table was successfully dropped.
. 1 - a temporary table was not found.
@@ -2127,6 +2123,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->table= 0;
}
+ /* Check that we have an exclusive lock on the table to be dropped. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
+ table->table_name,
+ MDL_EXCLUSIVE));
if (thd->killed)
{
error= -1;
@@ -2169,8 +2169,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
built_query.append("`,");
}
}
- DEBUG_SYNC(thd, "rm_table_part2_before_delete_table");
- DBUG_EXECUTE_IF("sleep_before_part2_delete_table",
+ DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");
+ DBUG_EXECUTE_IF("sleep_before_no_locks_delete_table",
my_sleep(100000););
error= 0;
if (drop_temporary ||
@@ -2257,7 +2257,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
ER(ER_BAD_TABLE_ERROR), MYF(0),
table->table_name););
}
- DEBUG_SYNC(thd, "rm_table_part2_before_binlog");
+ DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
thd->thread_specific_used|= (trans_tmp_table_deleted ||
non_trans_tmp_table_deleted);
error= 0;
@@ -3815,6 +3815,46 @@ void sp_prepare_create_field(THD *thd, Create_field *sql_field)
(void) prepare_blob_field(thd, sql_field);
}
+
+/**
+ Auxiliary function which allows to check if freshly created .FRM
+ file for table can be opened.
+
+ @retval FALSE - Success.
+ @retval TRUE - Failure.
+*/
+
+static bool check_if_created_table_can_be_opened(THD *thd,
+ const char *path,
+ const char *db,
+ const char *table_name,
+ HA_CREATE_INFO *create_info,
+ handler *file)
+{
+ TABLE table;
+ TABLE_SHARE share;
+ bool result;
+
+ /*
+ It is impossible to open definition of partitioned table without .par file.
+ */
+ if (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
+ return TRUE;
+
+ init_tmp_table_share(thd, &share, db, 0, table_name, path);
+
+ result= (open_table_def(thd, &share, 0) ||
+ open_table_from_share(thd, &share, "", 0, (uint) READ_ALL,
+ 0, &table, TRUE));
+ if (! result)
+ (void) closefrm(&table, 0);
+
+ free_table_share(&share);
+ (void) file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info);
+ return result;
+}
+
+
/*
Create a table
@@ -4241,6 +4281,29 @@ bool mysql_create_table_no_lock(THD *thd,
thd->thread_specific_used= TRUE;
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ else if (part_info && create_info->frm_only)
+ {
+ /*
+ For partitioned tables we can't find some problems with table
+ until table is opened. Therefore in order to disallow creation
+ of corrupted tables we have to try to open table as the part
+ of its creation process.
+ In cases when both .FRM and SE part of table are created table
+ is implicitly open in ha_create_table() call.
+ In cases when we create .FRM without SE part we have to open
+ table explicitly.
+ */
+ if (check_if_created_table_can_be_opened(thd, path, db, table_name,
+ create_info, file))
+ {
+ char frm_name[FN_REFLEN];
+ strxmov(frm_name, path, reg_ext, NullS);
+ (void) mysql_file_delete(key_file_frm, frm_name, MYF(0));
+ goto err;
+ }
+ }
+#endif
error= FALSE;
err:
@@ -5592,7 +5655,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
TABLE *table, *new_table= 0;
MDL_ticket *mdl_ticket;
MDL_request target_mdl_request;
- bool has_target_mdl_lock= FALSE;
int error= 0;
char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN + 1];
char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias;
@@ -5754,7 +5816,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
else
{
target_mdl_request.init(MDL_key::TABLE, new_db, new_name,
- MDL_EXCLUSIVE);
+ MDL_EXCLUSIVE, MDL_TRANSACTION);
/*
Global intention exclusive lock must have been already acquired when
table to be altered was open, so there is no need to do it here.
@@ -5772,7 +5834,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(TRUE);
}
DEBUG_SYNC(thd, "locked_table_name");
- has_target_mdl_lock= TRUE;
/*
Table maybe does not exist, but we got an exclusive lock
on the name, now we can safely try to find out for sure.
@@ -5959,10 +6020,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
along with the implicit commit.
*/
if (new_name != table_name || new_db != db)
- {
- thd->mdl_context.release_lock(target_mdl_request.ticket);
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
- }
else
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
}
@@ -6667,10 +6725,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES)
{
if ((new_name != table_name || new_db != db))
- {
- thd->mdl_context.release_lock(target_mdl_request.ticket);
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
- }
else
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
}
@@ -6731,8 +6786,6 @@ err:
alter_info->datetime_field->field_name);
thd->abort_on_warning= save_abort_on_warning;
}
- if (has_target_mdl_lock)
- thd->mdl_context.release_lock(target_mdl_request.ticket);
DBUG_RETURN(TRUE);
@@ -6744,9 +6797,6 @@ err_with_mdl:
tables and release the exclusive metadata lock.
*/
thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
- if (has_target_mdl_lock)
- thd->mdl_context.release_lock(target_mdl_request.ticket);
-
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_table.h b/sql/sql_table.h
index eb0b1aa94dd..aa5738fd4c9 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -174,8 +174,9 @@ bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary);
-int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
- bool drop_temporary, bool drop_view, bool log_query);
+int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
+ bool drop_temporary, bool drop_view,
+ bool log_query);
bool quick_rm_table(handlerton *base,const char *db,
const char *table_name, uint flags);
void close_cached_table(THD *thd, TABLE *table);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index a9b52eee9fc..c2e3cd9944a 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -24,8 +24,6 @@
#include "parse_file.h"
#include "sp.h"
#include "sql_base.h" // find_temporary_table
-#include "lock.h" // wait_if_global_read_lock,
- // start_waiting_global_read_lock
#include "sql_show.h" // append_definer, append_identifier
#include "sql_table.h" // build_table_filename,
// check_n_cut_mysql50_prefix
@@ -391,15 +389,6 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
DBUG_RETURN(TRUE);
}
- /*
- We don't want perform our operations while global read lock is held
- so we have to wait until its end and then prevent it from occurring
- again until we are done, unless we are under lock tables.
- */
- if (!thd->locked_tables_mode &&
- thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- DBUG_RETURN(TRUE);
-
if (!create)
{
bool if_exists= thd->lex->drop_if_exists;
@@ -547,9 +536,6 @@ end:
if (!create)
thd->lex->restore_backup_query_tables_list(&backup);
- if (thd->global_read_lock.has_protection())
- thd->global_read_lock.start_waiting_global_read_lock(thd);
-
if (!result)
my_ok(thd);
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 0cff2875ac8..909c6a08b67 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -472,6 +472,13 @@ bool Truncate_statement::truncate_table(THD *thd, TABLE_LIST *table_ref)
binlog_stmt= !error || error != HA_ERR_WRONG_COMMAND;
}
+ /*
+ If we tried to open a MERGE table and failed due to problems with the
+ children tables, the table will have been closed and table_ref->table
+ will be invalid. Reset the pointer here in any case as
+ query_cache_invalidate does not need a valid TABLE object.
+ */
+ table_ref->table= NULL;
query_cache_invalidate3(thd, table_ref, FALSE);
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index acc0f704c44..1c0c48c0fec 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -176,7 +176,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
SELECT_LEX *sl, *first_sl= first_select();
select_result *tmp_result;
bool is_union_select;
- TABLE *empty_table= 0;
DBUG_ENTER("st_select_lex_unit::prepare");
describe= test(additional_options & SELECT_DESCRIBE);
@@ -278,14 +277,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
types= first_sl->item_list;
else if (sl == first_sl)
{
- /*
- We need to create an empty table object. It is used
- to create tmp_table fields in Item_type_holder.
- The main reason of this is that we can't create
- field object without table.
- */
- DBUG_ASSERT(!empty_table);
- empty_table= (TABLE*) thd->calloc(sizeof(TABLE));
types.empty();
List_iterator_fast<Item> it(sl->item_list);
Item *item_tmp;
@@ -443,6 +434,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
err:
thd_arg->lex->current_select= lex_select_save;
+ (void) cleanup();
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 96b1ac67b49..b49ed2beafe 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1026,9 +1026,17 @@ int mysql_multi_update_prepare(THD *thd)
/* following need for prepared statements, to run next time multi-update */
thd->lex->sql_command= SQLCOM_UPDATE_MULTI;
- /* open tables and create derived ones, but do not lock and fill them */
+ /*
+ Open tables and create derived ones, but do not lock and fill them yet.
+
+ During prepare phase acquire only S metadata locks instead of SW locks to
+ keep prepare of multi-UPDATE compatible with concurrent LOCK TABLES WRITE
+ and global read lock.
+ */
if ((original_multiupdate &&
- open_tables(thd, &table_list, &table_count, 0)) ||
+ open_tables(thd, &table_list, &table_count,
+ (thd->stmt_arena->is_stmt_prepare() ?
+ MYSQL_OPEN_FORCE_SHARED_MDL : 0))) ||
mysql_handle_derived(lex, &mysql_derived_prepare))
DBUG_RETURN(TRUE);
/*
@@ -2064,7 +2072,9 @@ bool multi_update::send_eof()
Does updates for the last n - 1 tables, returns 0 if ok;
error takes into account killed status gained in do_updates()
*/
- int local_error = (table_count) ? do_updates() : 0;
+ int local_error= thd->is_error();
+ if (!local_error)
+ local_error = (table_count) ? do_updates() : 0;
/*
if local_error is not set ON until after do_updates() then
later carried out killing should not affect binlogging.
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 5fdf7b8d850..54b5eb43ab1 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -22,7 +22,7 @@
#include "sql_base.h" // find_table_in_global_list, lock_table_names
#include "sql_parse.h" // sql_parse
#include "sql_cache.h" // query_cache_*
-#include "lock.h" // wait_if_global_read_lock
+#include "lock.h" // MYSQL_OPEN_SKIP_TEMPORARY
#include "sql_show.h" // append_identifier
#include "sql_table.h" // build_table_filename
#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
@@ -649,13 +649,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
}
#endif
-
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- {
- res= TRUE;
- goto err;
- }
-
res= mysql_register_view(thd, view, mode);
if (mysql_bin_log.is_open())
@@ -704,7 +697,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
if (mode != VIEW_CREATE_NEW)
query_cache_invalidate3(thd, view, 0);
- thd->global_read_lock.start_waiting_global_read_lock(thd);
if (res)
goto err;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d73dff9aaeb..9aa938437b1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7385,7 +7385,6 @@ select_lock_type:
LEX *lex=Lex;
lex->current_select->set_lock_for_tables(TL_WRITE);
lex->safe_to_cache_query=0;
- lex->protect_against_global_read_lock= TRUE;
}
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{
@@ -12334,6 +12333,12 @@ user:
system_charset_info, 0) ||
check_host_name(&$$->host))
MYSQL_YYABORT;
+ /*
+ Convert hostname part of username to lowercase.
+ It's OK to use in-place lowercase as long as
+ the character set is utf8.
+ */
+ my_casedn_str(system_charset_info, $$->host.str);
}
| CURRENT_USER optional_braces
{
@@ -12491,6 +12496,7 @@ keyword_sp:
| FILE_SYM {}
| FIRST_SYM {}
| FIXED_SYM {}
+ | GENERAL {}
| GEOMETRY_SYM {}
| GEOMETRYCOLLECTION {}
| GET_FORMAT {}
@@ -12500,6 +12506,7 @@ keyword_sp:
| HOSTS_SYM {}
| HOUR_SYM {}
| IDENTIFIED_SYM {}
+ | IGNORE_SERVER_IDS_SYM {}
| INVOKER_SYM {}
| IMPORT {}
| INDEXES {}
@@ -12522,6 +12529,7 @@ keyword_sp:
| LOGS_SYM {}
| MAX_ROWS {}
| MASTER_SYM {}
+ | MASTER_HEARTBEAT_PERIOD_SYM {}
| MASTER_HOST_SYM {}
| MASTER_PORT_SYM {}
| MASTER_LOG_FILE_SYM {}
@@ -12627,6 +12635,7 @@ keyword_sp:
| SIMPLE_SYM {}
| SHARE_SYM {}
| SHUTDOWN {}
+ | SLOW {}
| SNAPSHOT_SYM {}
| SOUNDS_SYM {}
| SOURCE_SYM {}
@@ -13172,9 +13181,6 @@ table_lock:
MDL_SHARED_NO_READ_WRITE :
MDL_SHARED_READ)))
MYSQL_YYABORT;
- /* If table is to be write locked, protect from a impending GRL. */
- if (lock_for_write)
- Lex->protect_against_global_read_lock= TRUE;
}
;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 5c9df82ddac..9ca97b5dded 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1436,7 +1436,6 @@ static Sys_var_ulong Sys_read_buff_size(
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024),
BLOCK_SIZE(IO_SIZE));
-static my_bool read_only;
static bool check_read_only(sys_var *self, THD *thd, set_var *var)
{
/* Prevent self dead-lock */
@@ -1520,6 +1519,16 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type)
read_only= opt_readonly;
DBUG_RETURN(result);
}
+
+
+/**
+ The read_only boolean is always equal to the opt_readonly boolean except
+ during fix_read_only(); when that function is entered, opt_readonly is
+ the pre-update value and read_only is the post-update value.
+ fix_read_only() compares them and runs needed operations for the
+ transition (especially when transitioning from false to true) and
+ synchronizes both booleans in the end.
+*/
static Sys_var_mybool Sys_readonly(
"read_only",
"Make all non-temporary tables read-only, with the exception for "
diff --git a/sql/table.cc b/sql/table.cc
index f55095d6e82..8cd2e9e9bab 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5219,7 +5219,8 @@ void init_mdl_requests(TABLE_LIST *table_list)
table_list->mdl_request.init(MDL_key::TABLE,
table_list->db, table_list->table_name,
table_list->lock_type >= TL_WRITE_ALLOW_WRITE ?
- MDL_SHARED_WRITE : MDL_SHARED_READ);
+ MDL_SHARED_WRITE : MDL_SHARED_READ,
+ MDL_TRANSACTION);
}
diff --git a/sql/table.h b/sql/table.h
index c8e1ad8e658..6aba4f21db2 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1384,7 +1384,8 @@ struct TABLE_LIST
lock_type= lock_type_arg;
mdl_request.init(MDL_key::TABLE, db, table_name,
(lock_type >= TL_WRITE_ALLOW_WRITE) ?
- MDL_SHARED_WRITE : MDL_SHARED_READ);
+ MDL_SHARED_WRITE : MDL_SHARED_READ,
+ MDL_TRANSACTION);
}
/*
diff --git a/sql/transaction.cc b/sql/transaction.cc
index d3e3ba142b9..b331fea89fe 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -21,6 +21,7 @@
#include "sql_priv.h"
#include "transaction.h"
#include "rpl_handler.h"
+#include "debug_sync.h" // DEBUG_SYNC
/* Conditions under which the transaction state must not change. */
static bool trans_check(THD *thd)
@@ -391,15 +392,15 @@ bool trans_savepoint(THD *thd, LEX_STRING name)
thd->transaction.savepoints= newsv;
/*
- Remember the last acquired lock before the savepoint was set.
- This is used as a marker to only release locks acquired after
+ Remember locks acquired before the savepoint was set.
+ They are used as a marker to only release locks acquired after
the setting of this savepoint.
Note: this works just fine if we're under LOCK TABLES,
since mdl_savepoint() is guaranteed to be beyond
the last locked table. This allows to release some
locks acquired during LOCK TABLES.
*/
- newsv->mdl_savepoint = thd->mdl_context.mdl_savepoint();
+ newsv->mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_RETURN(FALSE);
}
@@ -645,17 +646,31 @@ bool trans_xa_commit(THD *thd)
}
else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
{
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, FALSE))
+ MDL_request mdl_request;
+
+ /*
+ Acquire metadata lock which will ensure that COMMIT is blocked
+ by active FLUSH TABLES WITH READ LOCK (and vice versa COMMIT in
+ progress blocks FTWRL).
+
+ We allow FLUSHer to COMMIT; we assume FLUSHer knows what it does.
+ */
+ mdl_request.init(MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
+ MDL_TRANSACTION);
+
+ if (thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout))
{
ha_rollback_trans(thd, TRUE);
my_error(ER_XAER_RMERR, MYF(0));
}
else
{
+ DEBUG_SYNC(thd, "trans_xa_commit_after_acquire_commit_lock");
+
res= test(ha_commit_one_phase(thd, 1));
if (res)
my_error(ER_XAER_RMERR, MYF(0));
- thd->global_read_lock.start_waiting_global_read_lock(thd);
}
}
else
diff --git a/storage/Makefile.am b/storage/Makefile.am
deleted file mode 100644
index a188d8967be..00000000000
--- a/storage/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# Process this file with automake to create Makefile.in
-
-AUTOMAKE_OPTIONS = foreign
-
-# These are built from source in the Docs directory
-SUBDIRS = @mysql_se_dirs@
-DIST_SUBDIRS = @mysql_se_distdirs@
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am
deleted file mode 100644
index 8b08105cef3..00000000000
--- a/storage/archive/Makefile.am
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB
-# Copyright (C) 2009 SUN Microsystems
-#
-# This 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
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir) @ZLIB_INCLUDES@
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-noinst_HEADERS = ha_archive.h azlib.h
-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_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_CXXFLAGS)
-libarchive_a_CFLAGS = $(AM_CFLAGS)
-libarchive_a_SOURCES = ha_archive.cc azio.c
-
-
-archive_test_SOURCES = archive_test.c azio.c
-archive_test_CFLAGS = $(AM_CFLAGS)
-archive_test_LDADD = $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a \
- @ZLIB_LIBS@
-archive_test_LDFLAGS = @NOINST_LDFLAGS@
-
-archive_reader_SOURCES = archive_reader.c azio.c
-archive_reader_CFLAGS = $(AM_CFLAGS)
-archive_reader_LDADD = $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a \
- @ZLIB_LIBS@
-archive_reader_LDFLAGS = @NOINST_LDFLAGS@
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-# The object for static and dynamic linking of archive differ
-# For static linkage of archive to mysqld
-
-libarchive_a_LIBADD = probes_mysql.o
-libarchive_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-# For archive as shared library
-ha_archive_la_LIBADD = probes_sh_mysql.o
-# Hack: We "depend" on ".libs/" but have no rule for it,
-# but it is created as a byproduct of the ".lo"
-DTRACESHAREDDEPS = ha_archive_la-ha_archive.lo
-DTRACESHAREDFILES = ha_archive_la-ha_archive.o
-DTRACEPROVIDER = probes_mysql.d
-ha_archive_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers
-
-CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES)
-DTRACEFILES = libarchive_a-ha_archive.o
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@
- $(CP) $(DTRACESHAREDFILES) .libs
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-
-endif
diff --git a/storage/archive/plug.in b/storage/archive/plug.in
deleted file mode 100644
index 52131b12e6b..00000000000
--- a/storage/archive/plug.in
+++ /dev/null
@@ -1,4 +0,0 @@
-MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine],
- [Archive Storage Engine], [max,max-no-ndb])
-MYSQL_PLUGIN_STATIC(archive, [libarchive.a])
-MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la])
diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am
deleted file mode 100644
index 38c2f354844..00000000000
--- a/storage/blackhole/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, 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; 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
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-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_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_CXXFLAGS)
-libblackhole_a_CFLAGS = $(AM_CFLAGS)
-libblackhole_a_SOURCES= ha_blackhole.cc
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-# The object for static and dynamic linking of blackhole differ
-# For static linkage of blackhole to mysqld
-
-libblackhole_a_LIBADD = probes_mysql.o
-libblackhole_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-# For blackhole as shared library
-ha_blackhole_la_LIBADD = probes_sh_mysql.o
-# Hack: We "depend" on ".libs/" but have no rule for it,
-# but it is created as a byproduct of the ".lo"
-DTRACESHAREDDEPS = ha_blackhole_la-ha_blackhole.lo
-DTRACESHAREDFILES = ha_blackhole_la-ha_blackhole.o
-DTRACEPROVIDER = probes_mysql.d
-ha_blackhole_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers
-
-CLEANFILES = $(DTRACEPROVIDERS) dtrace_files dtrace_providers $(DTRACESHAREDDEPS)
-DTRACEFILES = libblackhole_a-ha_blackhole.o
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@
- $(CP) $(DTRACESHAREDFILES) .libs
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-
-endif
diff --git a/storage/blackhole/plug.in b/storage/blackhole/plug.in
deleted file mode 100644
index 725db0facba..00000000000
--- a/storage/blackhole/plug.in
+++ /dev/null
@@ -1,6 +0,0 @@
-MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine],
- [Basic Write-only Read-never tables], [max,max-no-ndb])
-MYSQL_PLUGIN_DIRECTORY(blackhole, [storage/blackhole])
-MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.a])
-MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la])
-
diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am
deleted file mode 100644
index 5e3587c893f..00000000000
--- a/storage/csv/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-INCLUDES = -I$(top_builddir)/include \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-LDADD =
-
-DEFS = @DEFS@
-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_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_CXXFLAGS)
-libcsv_a_SOURCES = transparent_file.cc ha_tina.cc
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-libcsv_a_LIBADD = probes_mysql.o
-libcsv_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = libcsv_a-ha_tina.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/storage/csv/plug.in b/storage/csv/plug.in
deleted file mode 100644
index bbc69680fcd..00000000000
--- a/storage/csv/plug.in
+++ /dev/null
@@ -1,5 +0,0 @@
-MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine],
- [Stores tables in text CSV format])
-MYSQL_PLUGIN_DIRECTORY(csv, [storage/csv])
-MYSQL_PLUGIN_STATIC(csv, [libcsv.a])
-MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging
diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am
deleted file mode 100644
index c79fbe97cc3..00000000000
--- a/storage/example/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, 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; 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
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-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_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_CXXFLAGS)
-libexample_a_CFLAGS = $(AM_CFLAGS)
-libexample_a_SOURCES= ha_example.cc
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-# The object for static and dynamic linking of example differ
-# For static linkage of example to mysqld
-# That's actually not needed as example is only dynamic loadable, but for completion
-libexample_a_LIBADD = probes_mysql.o
-libexample_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-# For example as shared library
-ha_example_la_LIBADD = probes_sh_mysql.o
-# Hack: We "depend" on ".libs/" but have no rule for it,
-# but it is created as a byproduct of the ".lo"
-DTRACESHAREDDEPS = ha_example_la-ha_example.lo
-DTRACESHAREDFILES = ha_example_la-ha_example.o
-DTRACEPROVIDER = probes_mysql.d
-ha_example_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers
-
-CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES)
-DTRACEFILES = libexample_a-ha_example.o
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@
- $(CP) $(DTRACESHAREDFILES) .libs
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-
-endif
diff --git a/storage/example/plug.in b/storage/example/plug.in
deleted file mode 100644
index ee6beaac64f..00000000000
--- a/storage/example/plug.in
+++ /dev/null
@@ -1,3 +0,0 @@
-MYSQL_STORAGE_ENGINE(example,, [Example Storage Engine],
- [Example for Storage Engines for developers], [max,max-no-ndb])
-MYSQL_PLUGIN_DYNAMIC(example, [ha_example.la])
diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am
deleted file mode 100644
index e07b0d95b97..00000000000
--- a/storage/federated/Makefile.am
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, 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; 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
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-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_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_CXXFLAGS)
-libfederated_a_CFLAGS = $(AM_CFLAGS)
-libfederated_a_SOURCES= ha_federated.cc
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-# The object for static and dynamic linking of federated differ
-# For static linkage of federated to mysqld
-
-libfederated_a_LIBADD = probes_mysql.o
-libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-# For federated as shared library
-ha_federated_la_LIBADD = probes_sh_mysql.o
-# Hack: We "depend" on ".libs/" but have no rule for it,
-# but it is created as a byproduct of the ".lo"
-DTRACESHAREDDEPS = ha_federated_la-ha_federated.lo
-DTRACESHAREDFILES = ha_federated_la-ha_federated.o
-DTRACEPROVIDER = probes_mysql.d
-ha_federated_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers
-
-CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES)
-DTRACEFILES = libfederated_a-ha_federated.o
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@
- $(CP) $(DTRACESHAREDFILES) .libs
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-
-endif
diff --git a/storage/federated/plug.in b/storage/federated/plug.in
deleted file mode 100644
index 23b607d699b..00000000000
--- a/storage/federated/plug.in
+++ /dev/null
@@ -1,5 +0,0 @@
-MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine],
- [Connects to tables on remote MySQL servers], [max,max-no-ndb])
-MYSQL_PLUGIN_STATIC(federated, [libfederated.a])
-MYSQL_PLUGIN_DYNAMIC(federated, [ha_federated.la])
-MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federated.cc])
diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am
deleted file mode 100644
index 677b2d60269..00000000000
--- a/storage/heap/Makefile.am
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (C) 2000-2002, 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-pkglib_LIBRARIES = libheap.a
-noinst_PROGRAMS = hp_test1 hp_test2
-noinst_LIBRARIES = libheap.a
-hp_test1_LDFLAGS = @NOINST_LDFLAGS@
-hp_test1_LDADD = libheap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
-hp_test2_LDFLAGS = @NOINST_LDFLAGS@
-hp_test2_LDADD = libheap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
-noinst_HEADERS = heapdef.h ha_heap.h
-libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \
- hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \
- hp_rsame.c hp_create.c hp_rename.c hp_rfirst.c \
- hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \
- hp_rkey.c hp_block.c \
- ha_heap.cc \
- hp_hash.c _check.c _rectest.c hp_static.c
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-libheap_a_LIBADD = probes_mysql.o
-libheap_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = ha_heap.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/storage/heap/plug.in b/storage/heap/plug.in
deleted file mode 100644
index 50f31c60f2b..00000000000
--- a/storage/heap/plug.in
+++ /dev/null
@@ -1,7 +0,0 @@
-MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine],
- [Volatile memory based tables])
-MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap])
-MYSQL_PLUGIN_STATIC(heap, [libheap.a])
-MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables
-MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(heap, [ha_heap.cc])
-
diff --git a/storage/ibmdb2i/CMakeLists.txt b/storage/ibmdb2i/CMakeLists.txt
deleted file mode 100644
index 54da2b00ef2..00000000000
--- a/storage/ibmdb2i/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-CHECK_INCLUDE_FILES(qlgusr.h HAVE_PASE_ENVIRONMENT)
-IF(HAVE_PASE_ENVIRONMENT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_BINARY_DIR}/include
- ${CMAKE_SOURCE_DIR}/regex
- ${CMAKE_SOURCE_DIR}/sql
- ${CMAKE_CURRENT_SOURCE_DIR}
- /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0f.xpf/cur/cmvc/base.pgm/my.xpf/apis
- /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/lg.xpf
- /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/tq.xpf
-)
-
-
-SET (IBMDB2I_SOURCES ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc
- db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc
- db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc
- db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc db2i_myconv.cc)
-
-
-MYSQL_ADD_PLUGIN(ibmdb2i ${IBMDB2I_SOURCES} STORAGE_ENGINE LINK_LIBRARIES iconv)
-
-ENDIF(HAVE_PASE_ENVIRONMENT)
diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am
deleted file mode 100644
index a9977de895d..00000000000
--- a/storage/ibmdb2i/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2007, 2008, IBM Corporation.
-# All rights reserved.
-#
-#
-
-#called from the top level Makefile
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir) \
- -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0f.xpf/cur/cmvc/base.pgm/my.xpf/apis \
- -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/lg.xpf \
- -I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/tq.xpf
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \
- db2i_ioBuffers.h db2i_blobCollection.h \
- db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \
- db2i_iconv.h db2i_myconv.h db2i_safeString.h db2i_sqlStatementStream.h \
- db2i_ileBridge.h db2i_validatedPointer.h
-
-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_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 \
- db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc \
- db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc \
- db2i_myconv.cc
-
-EXTRA_LIBRARIES = libibmdb2i.a
-noinst_LIBRARIES = @plugin_ibmdb2i_static_target@
-libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS)
-libibmdb2i_a_CFLAGS = $(AM_CFLAGS)
-libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES)
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
diff --git a/storage/ibmdb2i/db2i_blobCollection.cc b/storage/ibmdb2i/db2i_blobCollection.cc
deleted file mode 100644
index 17101c9c0a4..00000000000
--- a/storage/ibmdb2i/db2i_blobCollection.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "db2i_blobCollection.h"
-
-/**
- Return the size to use when allocating space for blob reads.
-
- @param fieldIndex The field to allocate for
- @param[out] shouldProtect Indicates whether storage protection should be
- applied to the space, because the size returned is
- smaller than the maximum possible size.
-*/
-
-uint32
-BlobCollection::getSizeToAllocate(int fieldIndex, bool& shouldProtect)
-{
- Field* field = table->getMySQLTable()->field[fieldIndex];
- uint fieldLength = field->max_display_length();
-
- if (fieldLength <= MAX_FULL_ALLOCATE_BLOB_LENGTH)
- {
- shouldProtect = false;
- return fieldLength;
- }
-
- shouldProtect = true;
-
- uint curMaxSize = table->getBlobFieldActualSize(fieldIndex);
-
- uint defaultAllocSize = min(defaultAllocation, fieldLength);
-
- return max(defaultAllocSize, curMaxSize);
-
-}
-
-void
-BlobCollection::generateBuffer(int fieldIndex)
-{
- DBUG_ASSERT(table->db2Field(fieldIndex).isBlob());
-
- bool protect;
- buffers[table->getBlobIdFromField(fieldIndex)].Malloc(getSizeToAllocate(fieldIndex, protect), protect);
-
- return;
-}
-
-/**
- Realloc the read buffer associated with a blob field.
-
- This is used when the previous allocation for a blob field is found to be
- too small (this is discovered when QMY_READ trips over the protected boundary
- page).
-
- @param fieldIndex The field to be reallocated
- @param size The size of buffer to allocate for this field.
-*/
-
-ValidatedPointer<char>&
-BlobCollection::reallocBuffer(int fieldIndex, size_t size)
-{
- ProtectedBuffer& buf = buffers[table->getBlobIdFromField(fieldIndex)];
- if (size <= buf.allocLen())
- return buf.ptr();
-
- table->updateBlobFieldActualSize(fieldIndex, size);
-
- DBUG_PRINT("BlobCollection::reallocBuffer",("PERF: reallocing %d to %d: ", fieldIndex, size));
-
- bool protect;
- buf.Free();
- buf.Malloc(getSizeToAllocate(fieldIndex, protect), protect);
- return buf.ptr();
-}
diff --git a/storage/ibmdb2i/db2i_blobCollection.h b/storage/ibmdb2i/db2i_blobCollection.h
deleted file mode 100644
index 6a60394555f..00000000000
--- a/storage/ibmdb2i/db2i_blobCollection.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_BLOBCOLLECTION_H
-#define DB2I_BLOBCOLLECTION_H
-
-#include "db2i_global.h"
-#include "db2i_file.h"
-
-/**
- @class ProtectedBuffer
- @brief Implements memory management for (optionally) protected buffers.
-
- Buffers created with the protection option will have a guard page set on the
- page following requested allocation size. The side effect is that the actual
- allocation is up to 2*4096-1 bytes larger than the size requested by the
- using code.
-*/
-
-class ProtectedBuffer
-{
-public:
- ProtectedBuffer() : protectBuf(false)
- {;}
-
- void Malloc(size_t size, bool protect = false)
- {
- protectBuf = protect;
- bufptr.alloc(size + (protectBuf ? 0x1fff : 0x0));
- if ((void*)bufptr != NULL)
- {
- len = size;
- if (protectBuf)
- mprotect(protectedPage(), 0x1000, PROT_NONE);
-#ifndef DBUG_OFF
- // Prevents a problem with DBUG_PRINT over-reading in recent versions of
- // MySQL
- *((char*)protectedPage()-1) = 0;
-#endif
- }
- }
-
- void Free()
- {
- if ((void*)bufptr != NULL)
- {
- if (protectBuf)
- mprotect(protectedPage(), 0x1000, PROT_READ | PROT_WRITE);
- bufptr.dealloc();
- }
- }
-
- ~ProtectedBuffer()
- {
- Free();
- }
-
- ValidatedPointer<char>& ptr() {return bufptr;}
- bool isProtected() const {return protectBuf;}
- size_t allocLen() const {return len;}
-private:
- void* protectedPage()
- {
- return (void*)(((address64_t)(void*)bufptr + len + 0x1000) & ~0xfff);
- }
-
- ValidatedPointer<char> bufptr;
- size_t len;
- bool protectBuf;
-
-};
-
-
-/**
- @class BlobCollection
- @brief Manages memory allocation for reading blobs associated with a table.
-
- Allocations are done on-demand and are protected with a guard page if less
- than the max possible size is allocated.
-*/
-class BlobCollection
-{
- public:
- BlobCollection(db2i_table* db2Table, uint32 defaultAllocSize) :
- defaultAllocation(defaultAllocSize), table(db2Table)
- {
- buffers = new ProtectedBuffer[table->getBlobCount()];
- }
-
- ~BlobCollection()
- {
- delete[] buffers;
- }
-
- ValidatedPointer<char>& getBufferPtr(int fieldIndex)
- {
- int blobIndex = table->getBlobIdFromField(fieldIndex);
- if ((char*)buffers[blobIndex].ptr() == NULL)
- generateBuffer(fieldIndex);
-
- return buffers[blobIndex].ptr();
- }
-
- ValidatedPointer<char>& reallocBuffer(int fieldIndex, size_t size);
-
-
- private:
-
- uint32 getSizeToAllocate(int fieldIndex, bool& shouldProtect);
- void generateBuffer(int fieldIndex);
-
- db2i_table* table; // The table being read
- ProtectedBuffer* buffers; // The buffers
- uint32 defaultAllocation;
- /* The default size to use when first allocating a buffer */
-};
-
-#endif
diff --git a/storage/ibmdb2i/db2i_charsetSupport.cc b/storage/ibmdb2i/db2i_charsetSupport.cc
deleted file mode 100644
index f5a3a74025e..00000000000
--- a/storage/ibmdb2i/db2i_charsetSupport.cc
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#include "db2i_charsetSupport.h"
-#include "as400_types.h"
-#include "as400_protos.h"
-#include "db2i_ileBridge.h"
-#include "qlgusr.h"
-#include "db2i_errors.h"
-
-
-/*
- The following arrays define a mapping between IANA-style text descriptors and
- IBM i CCSID text descriptors. The mapping is a 1-to-1 correlation between
- corresponding array slots.
-*/
-#define MAX_IANASTRING 23
-static const char ianaStringType[MAX_IANASTRING][10] =
-{
- {"ascii"},
- {"Big5"}, //big5
- {"cp1250"},
- {"cp1251"},
- {"cp1256"},
- {"cp850"},
- {"cp852"},
- {"cp866"},
- {"IBM943"}, //cp932
- {"EUC-KR"}, //euckr
- {"IBM1381"}, //gb2312
- {"IBM1386"}, //gbk
- {"greek"},
- {"hebrew"},
- {"latin1"},
- {"latin2"},
- {"latin5"},
- {"macce"},
- {"tis620"},
- {"Shift_JIS"}, //sjis
- {"ucs2"},
- {"EUC-JP"}, //ujis
- {"utf8"}
-};
-static const char ccsidType[MAX_IANASTRING][6] =
-{
- {"367"}, //ascii
- {"950"}, //big5
- {"1250"}, //cp1250
- {"1251"}, //cp1251
- {"1256"}, //cp1256
- {"850"}, //cp850
- {"852"}, //cp852
- {"866"}, //cp866
- {"943"}, //cp932
- {"970"}, //euckr
- {"1381"}, //gb2312
- {"1386"}, //gbk
- {"813"}, //greek
- {"916"}, //hebrew
- {"923"}, //latin1
- {"912"}, //latin2
- {"920"}, //latin5
- {"1282"}, //macce
- {"874"}, //tis620
- {"943"}, //sjis
- {"13488"},//ucs2
- {"5050"}, //ujis
- {"1208"} //utf8
-};
-
-static _ILEpointer *QlgCvtTextDescToDesc_sym;
-
-/* We keep a cache of the mapping for text descriptions obtained via
- QlgTextDescToDesc. The following structures implement this cache. */
-static HASH textDescMapHash;
-static MEM_ROOT textDescMapMemroot;
-static pthread_mutex_t textDescMapHashMutex;
-struct TextDescMap
-{
- struct HashKey
- {
- int32 inType;
- int32 outType;
- char inDesc[Qlg_MaxDescSize];
- } hashKey;
- char outDesc[Qlg_MaxDescSize];
-};
-
-/* We keep a cache of the mapping for open iconv descriptors. The following
- structures implement this cache. */
-static HASH iconvMapHash;
-static MEM_ROOT iconvMapMemroot;
-static pthread_mutex_t iconvMapHashMutex;
-struct IconvMap
-{
- struct HashKey
- {
- uint32 direction; // These are uint32s to avoid garbage data in the key from compiler padding
- uint32 db2CCSID;
- const CHARSET_INFO* myCharset;
- } hashKey;
- iconv_t iconvDesc;
-};
-
-
-/**
- Initialize the static structures used by this module.
-
- This must only be called once per plugin instantiation.
-
- @return 0 if successful. Failure otherwise
-*/
-int32 initCharsetSupport()
-{
- DBUG_ENTER("initCharsetSupport");
-
- int actmark = _ILELOAD("QSYS/QLGUSR", ILELOAD_LIBOBJ);
- if ( actmark == -1 )
- {
- DBUG_PRINT("initCharsetSupport", ("conversion srvpgm activation failed"));
- DBUG_RETURN(1);
- }
-
- QlgCvtTextDescToDesc_sym = (ILEpointer*)malloc_aligned(sizeof(ILEpointer));
- if (_ILESYM(QlgCvtTextDescToDesc_sym, actmark, "QlgCvtTextDescToDesc") == -1)
- {
- DBUG_PRINT("initCharsetSupport",
- ("resolve of QlgCvtTextDescToDesc failed"));
- DBUG_RETURN(errno);
- }
-
- VOID(pthread_mutex_init(&textDescMapHashMutex,MY_MUTEX_INIT_FAST));
- my_hash_init(&textDescMapHash, &my_charset_bin, 10, offsetof(TextDescMap, hashKey), sizeof(TextDescMap::hashKey), 0, 0, HASH_UNIQUE);
-
- VOID(pthread_mutex_init(&iconvMapHashMutex,MY_MUTEX_INIT_FAST));
- my_hash_init(&iconvMapHash, &my_charset_bin, 10, offsetof(IconvMap, hashKey), sizeof(IconvMap::hashKey), 0, 0, HASH_UNIQUE);
-
- init_alloc_root(&textDescMapMemroot, 2048, 0);
- init_alloc_root(&iconvMapMemroot, 256, 0);
-
- initMyconv();
-
- DBUG_RETURN(0);
-}
-
-/**
- Cleanup the static structures used by this module.
-
- This must only be called once per plugin instantiation and only if
- initCharsetSupport() was successful.
-*/
-void doneCharsetSupport()
-{
- cleanupMyconv();
-
- free_root(&textDescMapMemroot, 0);
- free_root(&iconvMapMemroot, 0);
-
- pthread_mutex_destroy(&textDescMapHashMutex);
- my_hash_free(&textDescMapHash);
- pthread_mutex_destroy(&iconvMapHashMutex);
- my_hash_free(&iconvMapHash);
- free_aligned(QlgCvtTextDescToDesc_sym);
-}
-
-
-/**
- Convert a text description from one type to another.
-
- This function is just a wrapper for the IBM i QlgTextDescToDesc function plus
- some overrides for conversions that the API does not handle correctly and
- support for caching the computed conversion.
-
- @param inType The type of descriptor pointed to by "in".
- @param outType The type of descriptor requested for "out".
- @param in The descriptor to be convereted.
- @param[out] out The equivalent descriptor
- @param hashKey The hash key to be used for caching the conversion result.
-
- @return 0 if successful. Failure otherwise
-*/
-static int32 getNewTextDesc(const int32 inType,
- const int32 outType,
- const char* in,
- char* out,
- const TextDescMap::HashKey* hashKey)
-{
- DBUG_ENTER("db2i_charsetSupport::getNewTextDesc");
- const arg_type_t signature[] = { ARG_INT32, ARG_INT32, ARG_MEMPTR, ARG_INT32, ARG_MEMPTR, ARG_INT32, ARG_INT32, ARG_END };
- struct ArgList
- {
- ILEarglist_base base;
- int32 CRDIInType;
- int32 CRDIOutType;
- ILEpointer CRDIDesc;
- int32 CRDIDescSize;
- ILEpointer CRDODesc;
- int32 CRDODescSize;
- int32 CTDCCSID;
- } *arguments;
-
- if ((inType == Qlg_TypeIANA) && (outType == Qlg_TypeAix41))
- {
- // Override non-standard charsets
- if (unlikely(strcmp("IBM1381", in) == 0))
- {
- strcpy(out, "IBM-1381");
- DBUG_RETURN(0);
- }
- }
- else if ((inType == Qlg_TypeAS400CCSID) && (outType == Qlg_TypeAix41))
- {
- // Override non-standard charsets
- if (strcmp("1148", in) == 0)
- {
- strcpy(out, "IBM-1148");
- DBUG_RETURN(0);
- }
- else if (unlikely(strcmp("1153", in) == 0))
- {
- strcpy(out, "IBM-1153");
- DBUG_RETURN(0);
- }
- }
-
- char argBuf[sizeof(ArgList)+15];
- arguments = (ArgList*)roundToQuadWordBdy(argBuf);
-
- arguments->CRDIInType = inType;
- arguments->CRDIOutType = outType;
- arguments->CRDIDesc.s.addr = (address64_t) in;
- arguments->CRDIDescSize = Qlg_MaxDescSize;
- arguments->CRDODesc.s.addr = (address64_t) out;
- arguments->CRDODescSize = Qlg_MaxDescSize;
- arguments->CTDCCSID = 819;
- _ILECALL(QlgCvtTextDescToDesc_sym,
- &arguments->base,
- signature,
- RESULT_INT32);
- if (unlikely(arguments->base.result.s_int32.r_int32 < 0))
- {
- if (arguments->base.result.s_int32.r_int32 == Qlg_InDescriptorNotFound)
- {
- DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
- }
- else
- {
- getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
- DBUG_RETURN(DB2I_ERR_ILECALL);
- }
- }
-
- // Store the conversion information into a cache entry
- TextDescMap* mapping = (TextDescMap*)alloc_root(&textDescMapMemroot, sizeof(TextDescMap));
- if (unlikely(!mapping))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- memcpy(&(mapping->hashKey), hashKey, sizeof(hashKey));
- strcpy(mapping->outDesc, out);
- pthread_mutex_lock(&textDescMapHashMutex);
- my_hash_insert(&textDescMapHash, (const uchar*)mapping);
- pthread_mutex_unlock(&textDescMapHashMutex);
-
- DBUG_RETURN(0);
-}
-
-
-/**
- Convert a text description from one type to another.
-
- This function takes a text description in one representation and converts
- it into another representation. Although the OS provides some facilities for
- doing this, the support is not complete, nor does MySQL always use standard
- identifiers. Therefore, there are a lot of hardcoded overrides required.
- There is probably some room for optimization here, but this should not be
- called frequently under most circumstances.
-
- @param inType The type of descriptor pointed to by "in".
- @param outType The type of descriptor requested for "out".
- @param in The descriptor to be convereted.
- @param[out] out The equivalent descriptor
-
- @return 0 if successful. Failure otherwise
-*/
-static int32 convertTextDesc(const int32 inType, const int32 outType, const char* inDesc, char* outDesc)
-{
- DBUG_ENTER("db2i_charsetSupport::convertTextDesc");
- const char* inDescOverride;
-
- if (inType == Qlg_TypeIANA)
- {
- // Override non-standard charsets
- if (strcmp("big5", inDesc) == 0)
- inDescOverride = "Big5";
- else if (strcmp("cp932", inDesc) == 0)
- inDescOverride = "IBM943";
- else if (strcmp("euckr", inDesc) == 0)
- inDescOverride = "EUC-KR";
- else if (strcmp("gb2312", inDesc) == 0)
- inDescOverride = "IBM1381";
- else if (strcmp("gbk", inDesc) == 0)
- inDescOverride = "IBM1386";
- else if (strcmp("sjis", inDesc) == 0)
- inDescOverride = "Shift_JIS";
- else if (strcmp("ujis", inDesc) == 0)
- inDescOverride = "EUC-JP";
- else
- inDescOverride = inDesc;
-
- // Hardcode non-standard charsets
- if (outType == Qlg_TypeAix41)
- {
- if (strcmp("Big5", inDescOverride) == 0)
- {
- strcpy(outDesc,"big5");
- DBUG_RETURN(0);
- }
- else if (strcmp("IBM1386", inDescOverride) == 0)
- {
- strcpy(outDesc,"GBK");
- DBUG_RETURN(0);
- }
- else if (strcmp("Shift_JIS", inDescOverride) == 0 ||
- strcmp("IBM943", inDescOverride) == 0)
- {
- strcpy(outDesc,"IBM-943");
- DBUG_RETURN(0);
- }
- else if (strcmp("tis620", inDescOverride) == 0)
- {
- strcpy(outDesc,"TIS-620");
- DBUG_RETURN(0);
- }
- else if (strcmp("ucs2", inDescOverride) == 0)
- {
- strcpy(outDesc,"UCS-2");
- DBUG_RETURN(0);
- }
- else if (strcmp("cp1250", inDescOverride) == 0)
- {
- strcpy(outDesc,"IBM-1250");
- DBUG_RETURN(0);
- }
- else if (strcmp("cp1251", inDescOverride) == 0)
- {
- strcpy(outDesc,"IBM-1251");
- DBUG_RETURN(0);
- }
- else if (strcmp("cp1256", inDescOverride) == 0)
- {
- strcpy(outDesc,"IBM-1256");
- DBUG_RETURN(0);
- }
- else if (strcmp("macce", inDescOverride) == 0)
- {
- strcpy(outDesc,"IBM-1282");
- DBUG_RETURN(0);
- }
- }
- else if (outType == Qlg_TypeAS400CCSID)
- {
- // See if we can fast path the convert
- for (int loopCnt = 0; loopCnt < MAX_IANASTRING; ++loopCnt)
- {
- if (strcmp((char*)ianaStringType[loopCnt],inDescOverride) == 0)
- {
- strcpy(outDesc,ccsidType[loopCnt]);
- DBUG_RETURN(0);
- }
- }
- }
- }
- else
- inDescOverride = inDesc;
-
- // We call getNewTextDesc for all other conversions and cache the result.
- TextDescMap *mapping;
- TextDescMap::HashKey hashKey;
- hashKey.inType= inType;
- hashKey.outType= outType;
- uint32 len = strlen(inDescOverride);
- memcpy(hashKey.inDesc, inDescOverride, len);
- memset(hashKey.inDesc+len, 0, sizeof(hashKey.inDesc) - len);
-
- if (!(mapping=(TextDescMap *) my_hash_search(&textDescMapHash,
- (const uchar*)&hashKey,
- sizeof(hashKey))))
- {
- DBUG_RETURN(getNewTextDesc(inType, outType, inDescOverride, outDesc, &hashKey));
- }
- else
- {
- strcpy(outDesc, mapping->outDesc);
- }
- DBUG_RETURN(0);
-}
-
-
-/**
- Convert an IANA character set name into a DB2 for i CCSID value.
-
- @param parmIANADesc An IANA character set name
- @param[out] db2Ccsid The equivalent CCSID value
-
- @return 0 if successful. Failure otherwise
-*/
-int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid)
-{
- int32 rc;
- uint16 aixCcsid;
- char aixCcsidString[Qlg_MaxDescSize];
- int aixEncodingScheme;
- int db2EncodingScheme;
- rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString);
- if (unlikely(rc))
- {
- if (rc == DB2I_ERR_UNSUPP_CHARSET)
- getErrTxt(DB2I_ERR_UNSUPP_CHARSET, parmIANADesc);
-
- return rc;
- }
- aixCcsid = atoi(aixCcsidString);
- rc = getEncodingScheme(aixCcsid, aixEncodingScheme);
- if (rc != 0)
- return rc;
- switch(aixEncodingScheme) { // Select on encoding scheme
- case 0x1100: // EDCDIC SBCS
- case 0x2100: // ASCII SBCS
- case 0x4100: // AIX SBCS
- case 0x4105: // MS Windows
- case 0x5100: // ISO 7 bit ASCII
- db2EncodingScheme = 0x1100;
- break;
- case 0x1200: // EDCDIC DBCS
- case 0x2200: // ASCII DBCS
- db2EncodingScheme = 0x1200;
- break;
- case 0x1301: // EDCDIC Mixed
- case 0x2300: // ASCII Mixed
- case 0x4403: // EUC (ISO 2022)
- db2EncodingScheme = 0x1301;
- break;
- case 0x7200: // UCS2
- db2EncodingScheme = 0x7200;
- break;
- case 0x7807: // UTF-8
- db2EncodingScheme = 0x7807;
- break;
- case 0x7500: // UTF-32
- db2EncodingScheme = 0x7500;
- break;
- default: // Unknown
- {
- getErrTxt(DB2I_ERR_UNKNOWN_ENCODING,aixEncodingScheme);
- return DB2I_ERR_UNKNOWN_ENCODING;
- }
- break;
- }
- if (aixEncodingScheme == db2EncodingScheme)
- {
- *db2Ccsid = aixCcsid;
- }
- else
- {
- rc = getAssociatedCCSID(aixCcsid, db2EncodingScheme, db2Ccsid); // EDCDIC SBCS
- if (rc != 0)
- return rc;
- }
-
- return 0;
-}
-
-
-/**
- Obtain the encoding scheme of a CCSID.
-
- @param inCcsid An IBM i CCSID
- @param[out] outEncodingScheme The associated encoding scheme
-
- @return 0 if successful. Failure otherwise
-*/
-int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme)
-{
- DBUG_ENTER("db2i_charsetSupport::getEncodingScheme");
-
- static bool ptrInited = FALSE;
- static char ptrSpace[sizeof(ILEpointer) + 15];
- static ILEpointer* ptrToPtr = (ILEpointer*)roundToQuadWordBdy(ptrSpace);
- int rc;
-
- if (!ptrInited)
- {
- rc = _RSLOBJ2(ptrToPtr, RSLOBJ_TS_PGM, "QTQGESP", "QSYS");
-
- if (rc)
- {
- getErrTxt(DB2I_ERR_RESOLVE_OBJ,"QTQGESP","QSYS","*PGM",errno);
- DBUG_RETURN(DB2I_ERR_RESOLVE_OBJ);
- }
- ptrInited = TRUE;
- }
-
- DBUG_ASSERT(inCcsid != 0);
-
- int GESPCCSID = inCcsid;
- int GESPLen = 32;
- int GESPNbrVal = 0;
- int32 GESPES;
- int GESPCSCPL[32];
- int GESPFB[3];
- void* ILEArgv[7];
- ILEArgv[0] = &GESPCCSID;
- ILEArgv[1] = &GESPLen;
- ILEArgv[2] = &GESPNbrVal;
- ILEArgv[3] = &GESPES;
- ILEArgv[4] = &GESPCSCPL;
- ILEArgv[5] = &GESPFB;
- ILEArgv[6] = NULL;
-
- rc = _PGMCALL(ptrToPtr, (void**)&ILEArgv, 0);
-
- if (rc)
- {
- getErrTxt(DB2I_ERR_PGMCALL,"QTQGESP","QSYS",rc);
- DBUG_RETURN(DB2I_ERR_PGMCALL);
- }
- if (GESPFB[0] != 0 ||
- GESPFB[1] != 0 ||
- GESPFB[2] != 0)
- {
- getErrTxt(DB2I_ERR_QTQGESP,GESPFB[0],GESPFB[1],GESPFB[2]);
- DBUG_RETURN(DB2I_ERR_QTQGESP);
- }
- outEncodingScheme = GESPES;
-
- DBUG_RETURN(0);
-}
-
-
-/**
- Get the best fit equivalent CCSID. (Wrapper for QTQGRDC API)
-
- @param inCcsid An IBM i CCSID
- @param inEncodingScheme The encoding scheme
- @param[out] outCcsid The equivalent CCSID
-
- @return 0 if successful. Failure otherwise
-*/
-int32 getAssociatedCCSID(const uint16 inCcsid, const int inEncodingScheme, uint16* outCcsid)
-{
- DBUG_ENTER("db2i_charsetSupport::getAssociatedCCSID");
- static bool ptrInited = FALSE;
- static char ptrSpace[sizeof(ILEpointer) + 15];
- static ILEpointer* ptrToPtr = (ILEpointer*)roundToQuadWordBdy(ptrSpace);
- int rc;
-
- // Override non-standard charsets
- if ((inCcsid == 923) && (inEncodingScheme == 0x1100))
- {
- *outCcsid = 1148;
- DBUG_RETURN(0);
- }
- else if ((inCcsid == 1250) && (inEncodingScheme == 0x1100))
- {
- *outCcsid = 1153;
- DBUG_RETURN(0);
- }
-
- if (!ptrInited)
- {
- rc = _RSLOBJ2(ptrToPtr, RSLOBJ_TS_PGM, "QTQGRDC", "QSYS");
-
- if (rc)
- {
- getErrTxt(DB2I_ERR_RESOLVE_OBJ,"QTQGRDC","QSYS","*PGM",errno);
- DBUG_RETURN(DB2I_ERR_RESOLVE_OBJ);
- }
- ptrInited = TRUE;
- }
-
- int GRDCCCSID = inCcsid;
- int GRDCES = inEncodingScheme;
- int GRDCSel = 0;
- int GRDCAssCCSID;
- int GRDCFB[3];
- void* ILEArgv[7];
- ILEArgv[0] = &GRDCCCSID;
- ILEArgv[1] = &GRDCES;
- ILEArgv[2] = &GRDCSel;
- ILEArgv[3] = &GRDCAssCCSID;
- ILEArgv[4] = &GRDCFB;
- ILEArgv[5] = NULL;
-
- rc = _PGMCALL(ptrToPtr, (void**)&ILEArgv, 0);
-
- if (rc)
- {
- getErrTxt(DB2I_ERR_PGMCALL,"QTQGRDC","QSYS",rc);
- DBUG_RETURN(DB2I_ERR_PGMCALL);
- }
- if (GRDCFB[0] != 0 ||
- GRDCFB[1] != 0 ||
- GRDCFB[2] != 0)
- {
- getErrTxt(DB2I_ERR_QTQGRDC,GRDCFB[0],GRDCFB[1],GRDCFB[2]);
- DBUG_RETURN(DB2I_ERR_QTQGRDC);
- }
-
- *outCcsid = GRDCAssCCSID;
-
- DBUG_RETURN(0);
-}
-
-/**
- Open an iconv conversion between a MySQL charset and the respective IBM i CCSID
-
- @param direction The direction of the conversion
- @param mysqlCSName Name of the MySQL character set
- @param db2CCSID The IBM i CCSID
- @param hashKey The key to use for inserting the opened conversion into the cache
- @param[out] newConversion The iconv descriptor
-
- @return 0 if successful. Failure otherwise
-*/
-static int32 openNewConversion(enum_conversionDirection direction,
- const char* mysqlCSName,
- uint16 db2CCSID,
- IconvMap::HashKey* hashKey,
- iconv_t& newConversion)
-{
- DBUG_ENTER("db2i_charsetSupport::openNewConversion");
-
- char mysqlAix41Desc[Qlg_MaxDescSize];
- char db2Aix41Desc[Qlg_MaxDescSize];
- char db2CcsidString[6] = "";
- int32 rc;
-
- /*
- First we have to convert the MySQL IANA-like name and the DB2 CCSID into
- there equivalent iconv descriptions.
- */
- rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc);
- if (unlikely(rc))
- {
- if (rc == DB2I_ERR_UNSUPP_CHARSET)
- getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
-
- DBUG_RETURN(rc);
- }
- CHARSET_INFO *cs= &my_charset_bin;
- (uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID);
- rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc);
- if (unlikely(rc))
- {
- if (rc == DB2I_ERR_UNSUPP_CHARSET)
- getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
-
- DBUG_RETURN(rc);
- }
-
- /* Call iconv to open the conversion. */
- if (direction == toDB2)
- {
- newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc);
- }
- else
- {
- newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc);
- }
-
- if (unlikely(newConversion == (iconv_t) -1))
- {
- getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
- DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
- }
-
- /* Insert the new conversion into the cache. */
- IconvMap* mapping = (IconvMap*)alloc_root(&iconvMapMemroot, sizeof(IconvMap));
- if (!mapping)
- {
- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(IconvMap));
- DBUG_RETURN( HA_ERR_OUT_OF_MEM);
- }
- memcpy(&(mapping->hashKey), hashKey, sizeof(mapping->hashKey));
- mapping->iconvDesc = newConversion;
- pthread_mutex_lock(&iconvMapHashMutex);
- my_hash_insert(&iconvMapHash, (const uchar*)mapping);
- pthread_mutex_unlock(&iconvMapHashMutex);
-
- DBUG_RETURN(0);
-}
-
-
-/**
- Open an iconv conversion between a MySQL charset and the respective IBM i CCSID
-
- @param direction The direction of the conversion
- @param cs The MySQL character set
- @param db2CCSID The IBM i CCSID
- @param[out] newConversion The iconv descriptor
-
- @return 0 if successful. Failure otherwise
-*/
-int32 getConversion(enum_conversionDirection direction, const CHARSET_INFO* cs, uint16 db2CCSID, iconv_t& conversion)
-{
- DBUG_ENTER("db2i_charsetSupport::getConversion");
-
- int32 rc;
-
- /* Build the hash key */
- IconvMap::HashKey hashKey;
- hashKey.direction= direction;
- hashKey.myCharset= cs;
- hashKey.db2CCSID= db2CCSID;
-
- /* Look for the conversion in the cache and add it if it is not there. */
- IconvMap *mapping;
- if (!(mapping= (IconvMap *) my_hash_search(&iconvMapHash,
- (const uchar*)&hashKey,
- sizeof(hashKey))))
- {
- DBUG_PRINT("getConversion", ("Hash miss for direction=%d, cs=%s, ccsid=%d", direction, cs->name, db2CCSID));
- rc= openNewConversion(direction, cs->csname, db2CCSID, &hashKey, conversion);
- if (rc)
- DBUG_RETURN(rc);
- }
- else
- {
- conversion= mapping->iconvDesc;
- }
-
- DBUG_RETURN(0);
-}
-
-/**
- Fast-path conversion from ASCII to EBCDIC for use in converting
- identifiers to be sent to the QMY APIs.
-
- @param input ASCII data
- @param[out] ouput EBCDIC data
- @param ilen Size of input buffer and output buffer
-*/
-int convToEbcdic(const char* input, char* output, size_t ilen)
-{
- static bool inited = FALSE;
- static iconv_t ic;
-
- if (ilen == 0)
- return 0;
-
- if (!inited)
- {
- ic = iconv_open( "IBM-037", "ISO8859-1" );
- inited = TRUE;
- }
- size_t substitutedChars;
- size_t olen = ilen;
- if (iconv( ic, (char**)&input, &ilen, &output, &olen, &substitutedChars ) == -1)
- return errno;
-
- return 0;
-}
-
-
-/**
- Fast-path conversion from EBCDIC to ASCII for use in converting
- data received from the QMY APIs.
-
- @param input EBCDIC data
- @param[out] ouput ASCII data
- @param ilen Size of input buffer and output buffer
-*/
-int convFromEbcdic(const char* input, char* output, size_t ilen)
-{
- static bool inited = FALSE;
- static iconv_t ic;
-
- if (ilen == 0)
- return 0;
-
- if (!inited)
- {
- ic = iconv_open("ISO8859-1", "IBM-037");
- inited = TRUE;
- }
-
- size_t substitutedChars;
- size_t olen = ilen;
- if (iconv( ic, (char**)&input, &ilen, &output, &olen, &substitutedChars) == -1)
- return errno;
-
- return 0;
-}
diff --git a/storage/ibmdb2i/db2i_charsetSupport.h b/storage/ibmdb2i/db2i_charsetSupport.h
deleted file mode 100644
index 77051e1e0db..00000000000
--- a/storage/ibmdb2i/db2i_charsetSupport.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_CHARSETSUPPORT_H
-#define DB2I_CHARSETSUPPORT_H
-
-#include "db2i_global.h"
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#include "db2i_iconv.h"
-
-/**
- @enum enum_conversionDirection
-
- Conversion directions for getConversion()
-*/
-enum enum_conversionDirection
-{
- toMySQL,
- toDB2
-};
-
-int initCharsetSupport();
-void doneCharsetSupport();
-int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid);
-int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme);
-int32 getAssociatedCCSID(const uint16 inCcsid, const int inEncodingScheme, uint16* outCcsid);
-int convToEbcdic(const char* input, char* output, size_t ilen);
-int convFromEbcdic(const char* input, char* output, size_t ilen);
-int32 getConversion(enum_conversionDirection direction, const CHARSET_INFO* cs, uint16 db2CCSID, iconv_t& conversion);
-
-#endif
diff --git a/storage/ibmdb2i/db2i_collationSupport.cc b/storage/ibmdb2i/db2i_collationSupport.cc
deleted file mode 100644
index 65a17fd2452..00000000000
--- a/storage/ibmdb2i/db2i_collationSupport.cc
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "db2i_collationSupport.h"
-#include "db2i_errors.h"
-
-
-/*
- The following arrays define a mapping between MySQL collation names and
- corresponding IBM i sort sequences. The mapping is a 1-to-1 correlation
- between corresponding array slots but is incomplete without case-sensitivity
- markers dynamically added to the mySqlSortSequence names.
-*/
-#define MAX_COLLATION 87
-static const char* mySQLCollation[MAX_COLLATION] =
-{
- {"ascii_general"},
- {"ascii"},
- {"big5_chinese"},
- {"big5"},
- {"cp1250_croatian"},
- {"cp1250_general"},
- {"cp1250_polish"},
- {"cp1250"},
- {"cp1251_bulgarian"},
- {"cp1251_general"},
- {"cp1251"},
- {"cp1256_general"},
- {"cp1256"},
- {"cp850_general"},
- {"cp850"},
- {"cp852_general"},
- {"cp852"},
- {"cp932_japanese"},
- {"cp932"},
- {"euckr_korean"},
- {"euckr"},
- {"gb2312_chinese"},
- {"gb2312"},
- {"gbk_chinese"},
- {"gbk"},
- {"greek_general"},
- {"greek"},
- {"hebrew_general"},
- {"hebrew"},
- {"latin1_danish"},
- {"latin1_general"},
- {"latin1_german1"},
- {"latin1_spanish"},
- {"latin1_swedish"},
- {"latin1"},
- {"latin2_croatian"},
- {"latin2_general"},
- {"latin2_hungarian"},
- {"latin2"},
- {"latin5_turkish"},
- {"latin5"},
- {"macce_general"},
- {"macce"},
- {"sjis_japanese"},
- {"sjis"},
- {"tis620_thai"},
- {"tis620"},
- {"ucs2_czech"},
- {"ucs2_danish"},
- {"ucs2_esperanto"},
- {"ucs2_estonian"},
- {"ucs2_general"},
- {"ucs2_hungarian"},
- {"ucs2_icelandic"},
- {"ucs2_latvian"},
- {"ucs2_lithuanian"},
- {"ucs2_persian"},
- {"ucs2_polish"},
- {"ucs2_romanian"},
- {"ucs2_slovak"},
- {"ucs2_slovenian"},
- {"ucs2_spanish"},
- {"ucs2_swedish"},
- {"ucs2_turkish"},
- {"ucs2_unicode"},
- {"ucs2"},
- {"ujis_japanese"},
- {"ujis"},
- {"utf8_czech"},
- {"utf8_danish"},
- {"utf8_esperanto"},
- {"utf8_estonian"},
- {"utf8_general"},
- {"utf8_hungarian"},
- {"utf8_icelandic"},
- {"utf8_latvian"},
- {"utf8_lithuanian"},
- {"utf8_persian"},
- {"utf8_polish"},
- {"utf8_romanian"},
- {"utf8_slovak"},
- {"utf8_slovenian"},
- {"utf8_spanish"},
- {"utf8_swedish"},
- {"utf8_turkish"},
- {"utf8_unicode"},
- {"utf8"}
-};
-
-
-static const char* mySqlSortSequence[MAX_COLLATION] =
-{
- {"QALA101F4"},
- {"QBLA101F4"},
- {"QACHT04B0"},
- {"QBCHT04B0"},
- {"QALA20481"},
- {"QCLA20481"},
- {"QDLA20481"},
- {"QELA20481"},
- {"QACYR0401"},
- {"QBCYR0401"},
- {"QCCYR0401"},
- {"QAARA01A4"},
- {"QBARA01A4"},
- {"QCLA101F4"},
- {"QDLA101F4"},
- {"QALA20366"},
- {"QBLA20366"},
- {"QAJPN04B0"},
- {"QBJPN04B0"},
- {"QAKOR04B0"},
- {"QBKOR04B0"},
- {"QACHS04B0"},
- {"QBCHS04B0"},
- {"QCCHS04B0"},
- {"QDCHS04B0"},
- {"QAELL036B"},
- {"QBELL036B"},
- {"QAHEB01A8"},
- {"QBHEB01A8"},
- {"QALA1047C"},
- {"QBLA1047C"},
- {"QCLA1047C"},
- {"QDLA1047C"},
- {"QELA1047C"},
- {"QFLA1047C"},
- {"QCLA20366"},
- {"QELA20366"},
- {"QFLA20366"},
- {"QGLA20366"},
- {"QATRK0402"},
- {"QBTRK0402"},
- {"QHLA20366"},
- {"QILA20366"},
- {"QCJPN04B0"},
- {"QDJPN04B0"},
- {"QATHA0346"},
- {"QBTHA0346"},
- {"ACS_CZ"},
- {"ADA_DK"},
- {"AEO"},
- {"AET"},
- {"QAUCS04B0"},
- {"AHU"},
- {"AIS"},
- {"ALV"},
- {"ALT"},
- {"AFA"},
- {"APL"},
- {"ARO"},
- {"ASK"},
- {"ASL"},
- {"AES"},
- {"ASW"},
- {"ATR"},
- {"AEN"},
- {"*HEX"},
- {"QEJPN04B0"},
- {"QFJPN04B0"},
- {"ACS_CZ"},
- {"ADA_DK"},
- {"AEO"},
- {"AET"},
- {"QAUCS04B0"},
- {"AHU"},
- {"AIS"},
- {"ALV"},
- {"ALT"},
- {"AFA"},
- {"APL"},
- {"ARO"},
- {"ASK"},
- {"ASL"},
- {"AES"},
- {"ASW"},
- {"ATR"},
- {"AEN"},
- {"*HEX"}
-};
-
-
-/**
- Get the IBM i sort sequence that corresponds to the given MySQL collation.
-
- @param fieldCharSet The collated character set
- @param[out] rtnSortSequence The corresponding sort sequence
-
- @return 0 if successful. Failure otherwise
-*/
-static int32 getAssociatedSortSequence(const CHARSET_INFO *fieldCharSet, const char** rtnSortSequence)
-{
- DBUG_ENTER("ha_ibmdb2i::getAssociatedSortSequence");
-
- if (strcmp(fieldCharSet->csname,"binary") != 0)
- {
- int collationSearchLen = strlen(fieldCharSet->name);
- if (fieldCharSet->state & MY_CS_BINSORT)
- collationSearchLen -= 4;
- else
- collationSearchLen -= 3;
-
- uint16 loopCnt = 0;
- for (loopCnt; loopCnt < MAX_COLLATION; ++loopCnt)
- {
- if ((strlen(mySQLCollation[loopCnt]) == collationSearchLen) &&
- (strncmp((char*)mySQLCollation[loopCnt], fieldCharSet->name, collationSearchLen) == 0))
- break;
- }
- if (loopCnt == MAX_COLLATION) // Did not find associated sort sequence
- {
- getErrTxt(DB2I_ERR_SRTSEQ);
- DBUG_RETURN(DB2I_ERR_SRTSEQ);
- }
- *rtnSortSequence = mySqlSortSequence[loopCnt];
- }
-
- DBUG_RETURN(0);
-}
-
-
-/**
- Update sort sequence information for a key.
-
- This function accumulates information about a key as it is called for each
- field composing the key. The caller should invoke the function for each field
- and (with the exception of the charset parm) preserve the values for the
- parms across invocations, until a particular key has been evaluated. Once
- the last field in the key has been evaluated, the fileSortSequence and
- fileSortSequenceLibrary parms will contain the correct information for
- creating the corresponding DB2 key.
-
- @param charset The character set under consideration
- @param[in, out] fileSortSequenceType The type of the current key's sort seq
- @param[in, out] fileSortSequence The IBM i identifier for the DB2 sort sequence
- that corresponds
-
- @return 0 if successful. Failure otherwise
-*/
-int32 updateAssociatedSortSequence(const CHARSET_INFO* charset,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary)
-{
- DBUG_ENTER("ha_ibmdb2i::updateAssociatedSortSequence");
- DBUG_ASSERT(charset);
- if (strcmp(charset->csname,"binary") != 0)
- {
- char newSortSequence[11] = "";
- char newSortSequenceType = ' ';
- const char* foundSortSequence;
- int rc = getAssociatedSortSequence(charset, &foundSortSequence);
- if (rc) DBUG_RETURN (rc);
- switch(foundSortSequence[0])
- {
- case '*': // Binary
- strcat(newSortSequence,foundSortSequence);
- newSortSequenceType = 'B';
- break;
- case 'Q': // Non-ICU sort sequence
- strcat(newSortSequence,foundSortSequence);
- if ((charset->state & MY_CS_BINSORT) != 0)
- {
- strcat(newSortSequence,"U");
- }
- else if ((charset->state & MY_CS_CSSORT) != 0)
- {
- strcat(newSortSequence,"U");
- }
- else
- {
- strcat(newSortSequence,"S");
- }
- newSortSequenceType = 'N';
- break;
- default: // ICU sort sequence
- {
- if ((charset->state & MY_CS_CSSORT) == 0)
- {
- if (osVersion.v >= 6)
- strcat(newSortSequence,"I34"); // ICU 3.4
- else
- strcat(newSortSequence,"I26"); // ICU 2.6.1
- }
- strcat(newSortSequence,foundSortSequence);
- newSortSequenceType = 'I';
- }
- break;
- }
- if (*fileSortSequenceType == ' ') // If no sort sequence has been set yet
- {
- // Set associated sort sequence
- strcpy(fileSortSequence,newSortSequence);
- strcpy(fileSortSequenceLibrary,"QSYS");
- *fileSortSequenceType = newSortSequenceType;
- }
- else if (strcmp(fileSortSequence,newSortSequence) != 0)
- {
- // Only one sort sequence/collation is supported for each DB2 index.
- getErrTxt(DB2I_ERR_MIXED_COLLATIONS);
- DBUG_RETURN(DB2I_ERR_MIXED_COLLATIONS);
- }
- }
-
- DBUG_RETURN(0);
-}
diff --git a/storage/ibmdb2i/db2i_collationSupport.h b/storage/ibmdb2i/db2i_collationSupport.h
deleted file mode 100644
index b2ce09de1ea..00000000000
--- a/storage/ibmdb2i/db2i_collationSupport.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_COLLATIONSUPPORT_H
-#define DB2I_COLLATIONSUPPORT_H
-
-#include "db2i_global.h"
-#include "mysql_priv.h"
-
-int32 updateAssociatedSortSequence(const CHARSET_INFO* charset,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary);
-
-#endif
diff --git a/storage/ibmdb2i/db2i_constraints.cc b/storage/ibmdb2i/db2i_constraints.cc
deleted file mode 100644
index 5b9d3600393..00000000000
--- a/storage/ibmdb2i/db2i_constraints.cc
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#include "ha_ibmdb2i.h"
-#include "db2i_safeString.h"
-
-// This function is called when building the CREATE TABLE information for
-// foreign key constraints. It converts a constraint, table, schema, or
-// field name from EBCDIC to ASCII. If the DB2 name is quoted, it removes
-// those quotes. It then adds the appropriate quotes for a MySQL identifier.
-
-static void convNameForCreateInfo(THD *thd, SafeString& info, char* fromName, int len)
-{
- int quote;
- char cquote; // Quote character
- char convName[MAX_DB2_FILENAME_LENGTH]; // Converted name
-
- memset(convName, 0, sizeof(convName));
- convFromEbcdic(fromName, convName, len);
- quote = get_quote_char_for_identifier(thd, convName, len);
- cquote = (char) quote;
- if (quote != EOF)
- info.strcat(cquote);
- if (convName[0] == '"') // If DB2 name was quoted, remove quotes
- {
- if (strstr(convName, "\"\""))
- stripExtraQuotes(convName+1, len-1);
- info.strncat((char*)(convName+1), len-2);
- }
- else // DB2 name was not quoted
- info.strncat(convName, len);
- if (quote != EOF)
- info.strcat(cquote);
-}
-
-/**
- Evaluate the parse tree to build foreign key constraint clauses
-
- @parm lex The parse tree
- @parm appendHere The DB2 string to receive the constraint clauses
- @parm path The path to the table under consideration
- @parm fields Pointer to the table's list of field pointers
- @parm[in, out] fileSortSequenceType The sort sequence type associated with the table
- @parm[in, out] fileSortSequence The sort sequence associated with the table
- @parm[in, out] fileSortSequenceLibrary The sort sequence library associated with the table
-
- @return 0 if successful; HA_ERR_CANNOT_ADD_FOREIGN otherwise
-*/
-int ha_ibmdb2i::buildDB2ConstraintString(LEX* lex,
- String& appendHere,
- const char* path,
- Field** fields,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary)
-{
- List_iterator<Key> keyIter(lex->alter_info.key_list);
- char colName[MAX_DB2_COLNAME_LENGTH+1];
-
- Key* curKey;
-
- while (curKey = keyIter++)
- {
- if (curKey->type == Key::FOREIGN_KEY)
- {
- appendHere.append(STRING_WITH_LEN(", "));
-
- Foreign_key* fk = (Foreign_key*)curKey;
-
- char db2LibName[MAX_DB2_SCHEMANAME_LENGTH+1];
- if (fk->name.str)
- {
- char db2FKName[MAX_DB2_FILENAME_LENGTH+1];
- appendHere.append(STRING_WITH_LEN("CONSTRAINT "));
- if (fk->ref_table->db.str)
- {
- convertMySQLNameToDB2Name(fk->ref_table->db.str, db2LibName, sizeof(db2LibName));
- }
- else
- {
- db2i_table::getDB2LibNameFromPath(path, db2LibName);
- }
- if (lower_case_table_names == 1)
- my_casedn_str(files_charset_info, db2LibName);
- appendHere.append(db2LibName);
-
- appendHere.append('.');
-
- convertMySQLNameToDB2Name(fk->name.str, db2FKName, sizeof(db2FKName));
- appendHere.append(db2FKName);
- }
-
- appendHere.append(STRING_WITH_LEN(" FOREIGN KEY ("));
-
- bool firstTime = true;
-
- List_iterator<Key_part_spec> column(fk->columns);
- Key_part_spec* curColumn;
-
- while (curColumn = column++)
- {
- if (!firstTime)
- {
- appendHere.append(',');
- }
- firstTime = false;
-
- convertMySQLNameToDB2Name(curColumn->field_name.str, colName, sizeof(colName));
- appendHere.append(colName);
-
- // DB2 requires that the sort sequence on the child table match the parent table's
- // sort sequence. We ensure that happens by updating the sort sequence according
- // to the constrained fields.
- Field** field = fields;
- do
- {
- if (strcmp((*field)->field_name, curColumn->field_name.str) == 0)
- {
- int rc = updateAssociatedSortSequence((*field)->charset(),
- fileSortSequenceType,
- fileSortSequence,
- fileSortSequenceLibrary);
-
- if (unlikely(rc)) return rc;
- }
- } while (*(++field));
- }
-
- firstTime = true;
-
- appendHere.append(STRING_WITH_LEN(") REFERENCES "));
-
- if (fk->ref_table->db.str)
- {
- convertMySQLNameToDB2Name(fk->ref_table->db.str, db2LibName, sizeof(db2LibName));
- }
- else
- {
- db2i_table::getDB2LibNameFromPath(path, db2LibName);
- }
- if (lower_case_table_names == 1)
- my_casedn_str(files_charset_info, db2LibName);
- appendHere.append(db2LibName);
- appendHere.append('.');
-
- char db2FileName[MAX_DB2_FILENAME_LENGTH+1];
- convertMySQLNameToDB2Name(fk->ref_table->table.str, db2FileName, sizeof(db2FileName));
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, db2FileName);
- appendHere.append(db2FileName);
-
-
- if (!fk->ref_columns.is_empty())
- {
- List_iterator<Key_part_spec> ref(fk->ref_columns);
- Key_part_spec* curRef;
- appendHere.append(STRING_WITH_LEN(" ("));
-
-
- while (curRef = ref++)
- {
- if (!firstTime)
- {
- appendHere.append(',');
- }
- firstTime = false;
-
- convertMySQLNameToDB2Name(curRef->field_name.str, colName, sizeof(colName));
- appendHere.append(colName);
- }
-
- appendHere.append(STRING_WITH_LEN(") "));
- }
-
- if (fk->delete_opt != Foreign_key::FK_OPTION_UNDEF)
- {
- appendHere.append(STRING_WITH_LEN("ON DELETE "));
- switch (fk->delete_opt)
- {
- case Foreign_key::FK_OPTION_RESTRICT:
- appendHere.append(STRING_WITH_LEN("RESTRICT ")); break;
- case Foreign_key::FK_OPTION_CASCADE:
- appendHere.append(STRING_WITH_LEN("CASCADE ")); break;
- case Foreign_key::FK_OPTION_SET_NULL:
- appendHere.append(STRING_WITH_LEN("SET NULL ")); break;
- case Foreign_key::FK_OPTION_NO_ACTION:
- appendHere.append(STRING_WITH_LEN("NO ACTION ")); break;
- case Foreign_key::FK_OPTION_DEFAULT:
- appendHere.append(STRING_WITH_LEN("SET DEFAULT ")); break;
- default:
- return HA_ERR_CANNOT_ADD_FOREIGN; break;
- }
- }
-
- if (fk->update_opt != Foreign_key::FK_OPTION_UNDEF)
- {
- appendHere.append(STRING_WITH_LEN("ON UPDATE "));
- switch (fk->update_opt)
- {
- case Foreign_key::FK_OPTION_RESTRICT:
- appendHere.append(STRING_WITH_LEN("RESTRICT ")); break;
- case Foreign_key::FK_OPTION_NO_ACTION:
- appendHere.append(STRING_WITH_LEN("NO ACTION ")); break;
- default:
- return HA_ERR_CANNOT_ADD_FOREIGN; break;
- }
- }
-
- }
-
- }
-
- return 0;
-}
-
-
-/***********************************************************************
-Get the foreign key information in the form of a character string so
-that it can be inserted into a CREATE TABLE statement. This is used by
-the SHOW CREATE TABLE statement. The string will later be freed by the
-free_foreign_key_create_info() method.
-************************************************************************/
-
-char* ha_ibmdb2i::get_foreign_key_create_info(void)
-{
- DBUG_ENTER("ha_ibmdb2i::get_foreign_key_create_info");
- int rc = 0;
- char* infoBuffer = NULL; // Pointer to string returned to MySQL
- uint32 constraintSpaceLength;// Length of space passed to DB2
- ValidatedPointer<char> constraintSpace; // Space pointer passed to DB2
- uint32 neededLen; // Length returned from DB2
- uint32 cstCnt; // Number of foreign key constraints from DB2
- uint32 fld; //
- constraint_hdr* cstHdr; // Pointer to constraint header structure
- FK_constraint* FKCstDef; // Pointer to constraint definition structure
- cst_name* fieldName; // Pointer to field name structure
- char* tempPtr; // Temp pointer for traversing constraint space
- char convName[128];
-
- /* Allocate space to retrieve the DB2 constraint information. */
-
- if (!(share = get_share(table_share->path.str, table)))
- DBUG_RETURN(NULL);
-
- constraintSpaceLength = 5000; // Try allocating 5000 bytes and see if enough.
-
- initBridge();
-
- constraintSpace.alloc(constraintSpaceLength);
- rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE)
- ->constraints(db2Table->dataFile()->getMasterDefnHandle(),
- constraintSpace,
- constraintSpaceLength,
- &neededLen,
- &cstCnt);
-
- if (unlikely(rc == QMY_ERR_NEED_MORE_SPACE))
- {
- constraintSpaceLength = neededLen; // Get length of space that's needed
- constraintSpace.realloc(constraintSpaceLength);
- rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE)
- ->constraints(db2Table->dataFile()->getMasterDefnHandle(),
- constraintSpace,
- constraintSpaceLength,
- &neededLen,
- &cstCnt);
- }
-
- /* If constraint information was returned by DB2, build a text string */
- /* to return to MySQL. */
-
- if ((rc == 0) && (cstCnt > 0))
- {
- THD* thd = ha_thd();
- infoBuffer = (char*) my_malloc(MAX_FOREIGN_LEN + 1, MYF(MY_WME));
- if (infoBuffer == NULL)
- {
- free_share(share);
- DBUG_RETURN(NULL);
- }
-
- SafeString info(infoBuffer, MAX_FOREIGN_LEN + 1);
-
- /* Loop through the DB2 constraints and build a text string for each foreign */
- /* key constraint that is found. */
-
- tempPtr = constraintSpace;
- cstHdr = (constraint_hdr_t*)(void*)constraintSpace; // Address first constraint definition
- for (int i = 0; i < cstCnt && !info.overflowed(); ++i)
- {
- if (cstHdr->CstType[0] == QMY_CST_FK) // If this is a foreign key constraint
- {
- tempPtr = (char*)(tempPtr + cstHdr->CstDefOff);
- FKCstDef = (FK_constraint_t*)tempPtr;
-
- /* Process the constraint name. */
-
- info.strncat(STRING_WITH_LEN(",\n CONSTRAINT "));
- convNameForCreateInfo(thd, info,
- FKCstDef->CstName.Name, FKCstDef->CstName.Len);
-
- /* Process the names of the foreign keys. */
-
- info.strncat(STRING_WITH_LEN(" FOREIGN KEY ("));
- tempPtr = (char*)(tempPtr + FKCstDef->KeyColOff);
- fieldName= (cst_name_t*)tempPtr;
- for (fld = 0; fld < FKCstDef->KeyCnt; ++fld)
- {
- convNameForCreateInfo(thd, info, fieldName->Name, fieldName->Len);
- if ((fld + 1) < FKCstDef->KeyCnt)
- {
- info.strncat(STRING_WITH_LEN(", "));
- fieldName = fieldName + 1;
- }
- }
-
- /* Process the schema-name and name of the referenced table. */
-
- info.strncat(STRING_WITH_LEN(") REFERENCES "));
- convNameForCreateInfo(thd, info,
- FKCstDef->RefSchema.Name, FKCstDef->RefSchema.Len);
- info.strcat('.');
- convNameForCreateInfo(thd, info,
- FKCstDef->RefTable.Name, FKCstDef->RefTable.Len);
- info.strncat(STRING_WITH_LEN(" ("));
-
- /* Process the names of the referenced keys. */
-
- tempPtr = (char*)FKCstDef;
- tempPtr = (char*)(tempPtr + FKCstDef->RefColOff);
- fieldName= (cst_name_t*)tempPtr;
- for (fld = 0; fld < FKCstDef->RefCnt; ++fld)
- {
- convNameForCreateInfo(thd, info, fieldName->Name, fieldName->Len);
- if ((fld + 1) < FKCstDef->RefCnt)
- {
- info.strncat(STRING_WITH_LEN(", "));
- fieldName = fieldName + 1;
- }
- }
-
- /* Process the ON UPDATE and ON DELETE rules. */
-
- info.strncat(STRING_WITH_LEN(") ON UPDATE "));
- switch(FKCstDef->UpdMethod)
- {
- case QMY_NOACTION: info.strncat(STRING_WITH_LEN("NO ACTION")); break;
- case QMY_RESTRICT: info.strncat(STRING_WITH_LEN("RESTRICT")); break;
- default: break;
- }
- info.strncat(STRING_WITH_LEN(" ON DELETE "));
- switch(FKCstDef->DltMethod)
- {
- case QMY_CASCADE: info.strncat(STRING_WITH_LEN("CASCADE")); break;
- case QMY_SETDFT: info.strncat(STRING_WITH_LEN("SET DEFAULT")); break;
- case QMY_SETNULL: info.strncat(STRING_WITH_LEN("SET NULL")); break;
- case QMY_NOACTION: info.strncat(STRING_WITH_LEN("NO ACTION")); break;
- case QMY_RESTRICT: info.strncat(STRING_WITH_LEN("RESTRICT")); break;
- default: break;
- }
- }
-
- /* Address the next constraint, if any. */
-
- if ((i+1) < cstCnt)
- {
- tempPtr = (char*)cstHdr + cstHdr->CstLen;
- cstHdr = (constraint_hdr_t*)(tempPtr);
- }
- }
- }
-
- /* Cleanup and return */
- free_share(share);
-
- DBUG_RETURN(infoBuffer);
-}
-
-/***********************************************************************
-Free the foreign key create info (for a table) that was acquired by the
-get_foreign_key_create_info() method.
-***********************************************************************/
-
-void ha_ibmdb2i::free_foreign_key_create_info(char* info)
-{
- DBUG_ENTER("ha_ibmdb2i::free_foreign_key_create_info");
-
- if (info)
- {
- my_free(info);
- }
- DBUG_VOID_RETURN;
-}
-
-/***********************************************************************
-This method returns to MySQL a list, with one entry in the list describing
-each foreign key constraint.
-***********************************************************************/
-
-int ha_ibmdb2i::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
-{
- DBUG_ENTER("ha_ibmdb2i::get_foreign_key_list");
- int rc = 0;
- uint32 constraintSpaceLength; // Length of space passed to DB2
- ValidatedPointer<char> constraintSpace; // Space pointer passed to DB2
- uint16 rtnCode; // Return code from DB2
- uint32 neededLen; // Bytes needed to contain DB2 constraint info
- uint32 cstCnt; // Number of constraints returned by DB2
- uint32 fld;
- constraint_hdr* cstHdr; // Pointer to a cst header structure
- FK_constraint* FKCstDef; // Pointer to definition of foreign key constraint
- cst_name* fieldName; // Pointer to field name structure
- const char *method;
- ulong methodLen;
- char* tempPtr; // Temp pointer for traversing constraint space
- char convName[128];
-
- if (!(share = get_share(table_share->path.str, table)))
- DBUG_RETURN(0);
-
- // Allocate space to retrieve the DB2 constraint information.
- constraintSpaceLength = 5000; // Try allocating 5000 bytes and see if enough.
-
- constraintSpace.alloc(constraintSpaceLength);
- rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE)
- ->constraints(db2Table->dataFile()->getMasterDefnHandle(),
- constraintSpace,
- constraintSpaceLength,
- &neededLen,
- &cstCnt);
-
- if (unlikely(rc == QMY_ERR_NEED_MORE_SPACE))
- {
- constraintSpaceLength = neededLen; // Get length of space that's needed
- constraintSpace.realloc(constraintSpaceLength);
- rc = bridge()->expectErrors(QMY_ERR_NEED_MORE_SPACE)
- ->constraints(db2Table->dataFile()->getMasterDefnHandle(),
- constraintSpace,
- constraintSpaceLength,
- &neededLen,
- &cstCnt);
- }
-
- /* If constraint information was returned by DB2, build a text string */
- /* to return to MySQL. */
- if ((rc == 0) && (cstCnt > 0))
- {
- tempPtr = constraintSpace;
- cstHdr = (constraint_hdr_t*)(void*)constraintSpace; // Address first constraint definition
- for (int i = 0; i < cstCnt; ++i)
- {
- if (cstHdr->CstType[0] == QMY_CST_FK) // If this is a foreign key constraint
- {
- FOREIGN_KEY_INFO f_key_info;
- LEX_STRING *name= 0;
- tempPtr = (char*)(tempPtr + cstHdr->CstDefOff);
- FKCstDef = (FK_constraint_t*)tempPtr;
-
- /* Process the constraint name. */
-
- convFromEbcdic(FKCstDef->CstName.Name, convName,FKCstDef->CstName.Len);
- if (convName[0] == '"') // If quoted, exclude quotes.
- f_key_info.foreign_id = thd_make_lex_string(thd, 0,
- convName + 1, (uint) (FKCstDef->CstName.Len - 2), 1);
- else // Not quoted
- f_key_info.foreign_id = thd_make_lex_string(thd, 0,
- convName, (uint) FKCstDef->CstName.Len, 1);
-
- /* Process the names of the foreign keys. */
-
-
- tempPtr = (char*)(tempPtr + FKCstDef->KeyColOff);
- fieldName = (cst_name_t*)tempPtr;
- for (fld = 0; fld < FKCstDef->KeyCnt; ++fld)
- {
- convFromEbcdic(fieldName->Name, convName, fieldName->Len);
- if (convName[0] == '"') // If quoted, exclude quotes.
- name = thd_make_lex_string(thd, name,
- convName + 1, (uint) (fieldName->Len - 2), 1);
- else
- name = thd_make_lex_string(thd, name, convName, (uint) fieldName->Len, 1);
- f_key_info.foreign_fields.push_back(name);
- if ((fld + 1) < FKCstDef->KeyCnt)
- fieldName = fieldName + 1;
- }
-
- /* Process the schema and name of the referenced table. */
-
- convFromEbcdic(FKCstDef->RefSchema.Name, convName, FKCstDef->RefSchema.Len);
- if (convName[0] == '"') // If quoted, exclude quotes.
- f_key_info.referenced_db = thd_make_lex_string(thd, 0,
- convName + 1, (uint) (FKCstDef->RefSchema.Len -2), 1);
- else
- f_key_info.referenced_db = thd_make_lex_string(thd, 0,
- convName, (uint) FKCstDef->RefSchema.Len, 1);
- convFromEbcdic(FKCstDef->RefTable.Name, convName, FKCstDef->RefTable.Len);
- if (convName[0] == '"') // If quoted, exclude quotes.
- f_key_info.referenced_table = thd_make_lex_string(thd, 0,
- convName +1, (uint) (FKCstDef->RefTable.Len -2), 1);
- else
- f_key_info.referenced_table = thd_make_lex_string(thd, 0,
- convName, (uint) FKCstDef->RefTable.Len, 1);
-
- /* Process the names of the referenced keys. */
-
- tempPtr = (char*)FKCstDef;
- tempPtr = (char*)(tempPtr + FKCstDef->RefColOff);
- fieldName= (cst_name_t*)tempPtr;
- for (fld = 0; fld < FKCstDef->RefCnt; ++fld)
- {
- convFromEbcdic(fieldName->Name, convName, fieldName->Len);
- if (convName[0] == '"') // If quoted, exclude quotes.
- name = thd_make_lex_string(thd, name,
- convName + 1, (uint) (fieldName->Len -2), 1);
- else
- name = thd_make_lex_string(thd, name, convName, (uint) fieldName->Len, 1);
- f_key_info.referenced_fields.push_back(name);
- if ((fld + 1) < FKCstDef->RefCnt)
- fieldName = fieldName + 1;
- }
-
- /* Process the ON UPDATE and ON DELETE rules. */
-
- switch(FKCstDef->UpdMethod)
- {
- case QMY_NOACTION:
- {
- method = "NO ACTION";
- methodLen=9;
- }
- break;
- case QMY_RESTRICT:
- {
- method = "RESTRICT";
- methodLen = 8;
- }
- break;
- default: break;
- }
- f_key_info.update_method = thd_make_lex_string(
- thd, f_key_info.update_method, method, methodLen, 1);
- switch(FKCstDef->DltMethod)
- {
- case QMY_CASCADE:
- {
- method = "CASCADE";
- methodLen = 7;
- }
- break;
- case QMY_SETDFT:
- {
- method = "SET DEFAULT";
- methodLen = 11;
- }
- break;
- case QMY_SETNULL:
- {
- method = "SET NULL";
- methodLen = 8;
- }
- break;
- case QMY_NOACTION:
- {
- method = "NO ACTION";
- methodLen = 9;
- }
- break;
- case QMY_RESTRICT:
- {
- method = "RESTRICT";
- methodLen = 8;
- }
- break;
- default: break;
- }
- f_key_info.delete_method = thd_make_lex_string(
- thd, f_key_info.delete_method, method, methodLen, 1);
- f_key_info.referenced_key_name= thd_make_lex_string(thd, 0, (char *)"", 1, 1);
- FOREIGN_KEY_INFO *pf_key_info = (FOREIGN_KEY_INFO *)
- thd_memdup(thd, &f_key_info, sizeof(FOREIGN_KEY_INFO));
- f_key_list->push_back(pf_key_info);
- }
-
- /* Address the next constraint, if any. */
-
- if ((i+1) < cstCnt)
- {
- tempPtr = (char*)cstHdr + cstHdr->CstLen;
- cstHdr = (constraint_hdr_t*)(tempPtr);
- }
- }
- }
-
- /* Cleanup and return. */
-
- free_share(share);
- DBUG_RETURN(0);
-}
-
-/***********************************************************************
-Checks if the table is referenced by a foreign key.
-Returns: 0 if not referenced (or error occurs),
- > 0 if is referenced
-***********************************************************************/
-
-uint ha_ibmdb2i::referenced_by_foreign_key(void)
-{
- DBUG_ENTER("ha_ibmdb2i::referenced_by_foreign_key");
-
- int rc = 0;
- FILE_HANDLE queryFile = 0;
- uint32 resultRowLen;
- uint32 count = 0;
-
- const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL);
- const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL);
-
- String query(128);
- query.append(STRING_WITH_LEN(" SELECT COUNT(*) FROM SYSIBM.SQLFOREIGNKEYS WHERE PKTABLE_SCHEM = '"));
- query.append(libName+1, strlen(libName)-2); // parent library name
- query.append(STRING_WITH_LEN("' AND PKTABLE_NAME = '"));
- query.append(fileName+1, strlen(fileName)-2); // parent file name
- query.append(STRING_WITH_LEN("'"));
-
- SqlStatementStream sqlStream(query);
-
- rc = bridge()->prepOpen(sqlStream.getPtrToData(),
- &queryFile,
- &resultRowLen);
- if (rc == 0)
- {
- IOReadBuffer rowBuffer(1, resultRowLen);
- rc = bridge()->read(queryFile, rowBuffer.ptr(), QMY_READ_ONLY, QMY_NONE, QMY_FIRST);
- if (!rc) count = *((uint32*)rowBuffer.getRowN(0));
- bridge()->deallocateFile(queryFile);
- }
- DBUG_RETURN(count);
-}
diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc
deleted file mode 100644
index 71a30802bf9..00000000000
--- a/storage/ibmdb2i/db2i_conversion.cc
+++ /dev/null
@@ -1,1459 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#include "db2i_ileBridge.h"
-#include "mysql_priv.h"
-#include "db2i_charsetSupport.h"
-#include "ctype.h"
-#include "ha_ibmdb2i.h"
-#include "db2i_errors.h"
-#include "wchar.h"
-
-const char ZERO_DATETIME_VALUE[] = "0000-00-00 00:00:00";
-const char ZERO_DATETIME_VALUE_SUBST[] = "0001-01-01 00:00:00";
-const char ZERO_DATE_VALUE[] = "0000-00-00";
-const char ZERO_DATE_VALUE_SUBST[] = "0001-01-01";
-
-
-/**
- Put a BCD digit into a BCD string.
-
- @param[out] bcdString The BCD string to be modified
- @param pos The position within the string to be updated.
- @param val The value to be assigned into the string at pos.
-*/
-static inline void bcdAssign(char* bcdString, uint pos, uint val)
-{
- bcdString[pos/2] |= val << ((pos % 2) ? 0 : 4);
-}
-
-/**
- Read a BCD digit from a BCD string.
-
- @param[out] bcdString The BCD string to be read
- @param pos The position within the string to be read.
-
- @return bcdGet The value of the BCD digit at pos.
-*/
-static inline uint bcdGet(const char* bcdString, uint pos)
-{
- return (bcdString[pos/2] >> ((pos % 2) ? 0 : 4)) & 0xf;
-}
-
-/**
- In-place convert a number in ASCII represenation to EBCDIC representation.
-
- @param string The string of ASCII characters
- @param len The length of string
-*/
-static inline void convertNumericToEbcdicFast(char* string, int len)
-{
- for (int i = 0; i < len; ++i, ++string)
- {
- switch(*string)
- {
- case '-':
- *string = 0x60; break;
- case ':':
- *string = 0x7A; break;
- case '.':
- *string = 0x4B; break;
- default:
- DBUG_ASSERT(isdigit(*string));
- *string += 0xF0 - '0';
- break;
- }
- }
-}
-
-
-/**
- atoi()-like function for a 4-character EBCDIC string.
-
- @param string The EBCDIC string
- @return a4toi_ebcdic The decimal value of the EBCDIC string
-*/
-static inline uint16 a4toi_ebcdic(const uchar* string)
-{
- return ((string[0]-0xF0) * 1000 +
- (string[1]-0xF0) * 100 +
- (string[2]-0xF0) * 10 +
- (string[3]-0xF0));
-};
-
-
-/**
- atoi()-like function for a 4-character EBCDIC string.
-
- @param string The EBCDIC string
- @return a4toi_ebcdic The decimal value of the EBCDIC string
-*/
-static inline uint8 a2toi_ebcdic(const uchar* string)
-{
- return ((string[0]-0xF0) * 10 +
- (string[1]-0xF0));
-};
-
-/**
- Perform character conversion for textual field data.
-*/
-int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction,
- uint16 fieldID,
- const char* input,
- char* output,
- size_t ilen,
- size_t olen,
- size_t* outDataLen,
- bool tacitErrors,
- size_t* substChars)
-{
- DBUG_PRINT("ha_ibmdb2i::convertFieldChars",("Direction: %d; length = %d", direction, ilen));
-
- if (unlikely(ilen == 0))
- {
- if (outDataLen) *outDataLen = 0;
- return (0);
- }
-
- iconv_t& conversion = db2Table->getConversionDefinition(direction, fieldID);
-
- if (unlikely(conversion == (iconv_t)(-1)))
- {
- return (DB2I_ERR_UNSUPP_CHARSET);
- }
-
- size_t initOLen= olen;
- size_t substitutedChars = 0;
- int rc = iconv(conversion, (char**)&input, &ilen, &output, &olen, &substitutedChars );
- if (outDataLen) *outDataLen = initOLen - olen;
- if (substChars) *substChars = substitutedChars;
- if (unlikely(rc < 0))
- {
- int er = errno;
- if (er == EILSEQ)
- {
- if (!tacitErrors) getErrTxt(DB2I_ERR_ILL_CHAR, table->field[fieldID]->field_name);
- return (DB2I_ERR_ILL_CHAR);
- }
- else
- {
- if (!tacitErrors) getErrTxt(DB2I_ERR_ICONV,er);
- return (DB2I_ERR_ICONV);
- }
- }
- if (unlikely(substitutedChars) && (!tacitErrors))
- {
- warning(ha_thd(), DB2I_ERR_SUB_CHARS, table->field[fieldID]->field_name);
- }
-
- return (0);
-}
-
-/**
- Append the appropriate default value clause onto a CREATE TABLE definition
-
- This was inspired by get_field_default_value in sql/sql_show.cc.
-
- @param field The field whose value is to be obtained
- @param statement The string to receive the DEFAULT clause
- @param quoteIt Does the data type require single quotes around the value?
- @param ccsid The ccsid of the field value (if a string type); 0 if no conversion needed
-*/
-static void get_field_default_value(Field *field,
- String &statement,
- bool quoteIt,
- uint32 ccsid,
- bool substituteZeroDates)
-{
- if ((field->type() != FIELD_TYPE_BLOB &&
- !(field->flags & NO_DEFAULT_VALUE_FLAG) &&
- field->unireg_check != Field::NEXT_NUMBER))
- {
- my_ptrdiff_t old_ptr= (my_ptrdiff_t) (field->table->s->default_values - field->table->record[0]);
- field->move_field_offset(old_ptr);
-
- String defaultClause(64);
- defaultClause.length(0);
- defaultClause.append(" DEFAULT ");
- if (!field->is_null())
- {
- my_bitmap_map *old_map = tmp_use_all_columns(field->table, field->table->read_set);
- char tmp[MAX_FIELD_WIDTH];
-
- if (field->real_type() == MYSQL_TYPE_ENUM ||
- field->real_type() == MYSQL_TYPE_SET)
- {
- CHARSET_INFO *cs= &my_charset_bin;
- uint len = (uint)(cs->cset->longlong10_to_str)(cs,tmp,sizeof(tmp), 10, field->val_int());
- tmp[len]=0;
- defaultClause.append(tmp);
- }
- else
- {
- String type(tmp, sizeof(tmp), field->charset());
- field->val_str(&type);
- if (type.length())
- {
- if (field->type() == MYSQL_TYPE_DATE &&
- memcmp(type.ptr(), STRING_WITH_LEN(ZERO_DATE_VALUE)) == 0)
- {
- if (substituteZeroDates)
- type.set(STRING_WITH_LEN(ZERO_DATE_VALUE_SUBST), field->charset());
- else
- {
- warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- return;
- }
- }
- else if ((field->type() == MYSQL_TYPE_DATETIME ||
- field->type() == MYSQL_TYPE_TIMESTAMP) &&
- memcmp(type.ptr(), STRING_WITH_LEN(ZERO_DATETIME_VALUE)) == 0)
- {
- if (substituteZeroDates)
- type.set(STRING_WITH_LEN(ZERO_DATETIME_VALUE_SUBST), field->charset());
- else
- {
- warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- return;
- }
- }
-
-
- if (field->type() != MYSQL_TYPE_STRING &&
- field->type() != MYSQL_TYPE_VARCHAR &&
- field->type() != MYSQL_TYPE_BLOB &&
- field->type() != MYSQL_TYPE_BIT)
- {
- if (quoteIt)
- defaultClause.append('\'');
- defaultClause.append(type);
- if (quoteIt)
- defaultClause.append('\'');
- }
- else
- {
- int length;
- char* out;
-
- // If a ccsid is specified, we need to make sure that the DEFAULT
- // string is converted to that encoding.
- if (ccsid != 0)
- {
- iconv_t iconvD;
- if (getConversion(toDB2, field->charset(), ccsid, iconvD))
- {
- warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- return;
- }
-
- size_t ilen = type.length();
- size_t olen = 6 * ilen;
- size_t origOlen = olen;
- const char* in = type.ptr();
- const char* tempIn = in;
- out = (char*)my_malloc(olen, MYF(MY_WME));
- char* tempOut = out;
- size_t substitutedChars;
-
- if (iconv(iconvD, (char**)&tempIn, &ilen, &tempOut, &olen, &substitutedChars) < 0)
- {
- warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- my_free(out);
- return;
- }
- // Now we process the converted string to represent it as
- // hexadecimal values.
-
- length = origOlen - olen;
- }
- else
- {
- length = type.length();
- out = (char*)my_malloc(length*2, MYF(MY_WME));
- memcpy(out, (char*)type.ptr(), length);
- }
-
- if (length > 16370)
- {
- warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- my_free(out);
- return;
- }
-
- if (ccsid == 1200)
- defaultClause.append("ux'");
- else if (ccsid == 13488)
- defaultClause.append("gx'");
- else if (field->charset() == &my_charset_bin)
- defaultClause.append("binary(x'");
- else
- defaultClause.append("x'");
-
- const char hexMap[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
- for (int c = length-1; c >= 0; --c)
- {
- out[c*2+1] = hexMap[out[c] & 0xF];
- out[c*2] = hexMap[out[c] >> 4];
- }
-
- defaultClause.append(out, length*2);
- defaultClause.append('\'');
- if (field->charset() == &my_charset_bin)
- defaultClause.append(")");
-
- my_free(out);
- }
- }
- else
- defaultClause.length(0);
- }
- tmp_restore_column_map(field->table->read_set, old_map);
- }
- else if (field->maybe_null())
- defaultClause.append(STRING_WITH_LEN("NULL"));
-
- if (old_ptr)
- field->move_field_offset(-old_ptr);
-
- statement.append(defaultClause);
- }
-}
-
-
-
-
-/**
- Convert a MySQL field definition into its corresponding DB2 type.
-
- The result will be appended to mapping as a DB2 SQL phrase.
-
- @param field The MySQL field to be evaluated
- @param[out] mapping The receiver for the DB2 SQL syntax
- @param timeFormat The format to be used for mapping the TIME type
-*/
-int ha_ibmdb2i::getFieldTypeMapping(Field* field,
- String& mapping,
- enum_TimeFormat timeFormat,
- enum_BlobMapping blobMapping,
- enum_ZeroDate zeroDateHandling,
- bool propagateDefaults,
- enum_YearFormat yearFormat)
-{
- char stringBuildBuffer[257];
- uint32 fieldLength;
- bool defaultNeedsQuotes = false;
- uint16 db2Ccsid = 0;
-
- CHARSET_INFO* fieldCharSet = field->charset();
- switch (field->type())
- {
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint precision= ((Field_new_decimal*)field)->precision;
- uint scale= field->decimals();
-
- if (precision <= MAX_DEC_PRECISION)
- {
- sprintf(stringBuildBuffer,"DECIMAL(%d, %d)",precision,scale);
- }
- else
- {
- if (scale > precision - MAX_DEC_PRECISION)
- {
- scale = scale - (precision - MAX_DEC_PRECISION);
- precision = MAX_DEC_PRECISION;
- sprintf(stringBuildBuffer,"DECIMAL(%d, %d)",precision,scale);
- }
- else
- {
- return HA_ERR_UNSUPPORTED;
- }
- warning(ha_thd(), DB2I_ERR_PRECISION);
- }
-
- mapping.append(stringBuildBuffer);
- }
- break;
- case MYSQL_TYPE_TINY:
- mapping.append(STRING_WITH_LEN("SMALLINT"));
- break;
- case MYSQL_TYPE_SHORT:
- if (((Field_num*)field)->unsigned_flag)
- mapping.append(STRING_WITH_LEN("INT"));
- else
- mapping.append(STRING_WITH_LEN("SMALLINT"));
- break;
- case MYSQL_TYPE_LONG:
- if (((Field_num*)field)->unsigned_flag)
- mapping.append(STRING_WITH_LEN("BIGINT"));
- else
- mapping.append(STRING_WITH_LEN("INT"));
- break;
- case MYSQL_TYPE_FLOAT:
- mapping.append(STRING_WITH_LEN("REAL"));
- break;
- case MYSQL_TYPE_DOUBLE:
- mapping.append(STRING_WITH_LEN("DOUBLE"));
- break;
- case MYSQL_TYPE_LONGLONG:
- if (((Field_num*)field)->unsigned_flag)
- mapping.append(STRING_WITH_LEN("DECIMAL(20,0)"));
- else
- mapping.append(STRING_WITH_LEN("BIGINT"));
- break;
- case MYSQL_TYPE_INT24:
- mapping.append(STRING_WITH_LEN("INTEGER"));
- break;
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_NEWDATE:
- mapping.append(STRING_WITH_LEN("DATE"));
- defaultNeedsQuotes = true;
- break;
- case MYSQL_TYPE_TIME:
- if (timeFormat == TIME_OF_DAY)
- {
- mapping.append(STRING_WITH_LEN("TIME"));
- defaultNeedsQuotes = true;
- }
- else
- mapping.append(STRING_WITH_LEN("INTEGER"));
- break;
- case MYSQL_TYPE_DATETIME:
- mapping.append(STRING_WITH_LEN("TIMESTAMP"));
- defaultNeedsQuotes = true;
- break;
- case MYSQL_TYPE_TIMESTAMP:
- mapping.append(STRING_WITH_LEN("TIMESTAMP"));
-
- if (table_share->timestamp_field == field && propagateDefaults)
- {
- switch (((Field_timestamp*)field)->get_auto_set_type())
- {
- case TIMESTAMP_NO_AUTO_SET:
- break;
- case TIMESTAMP_AUTO_SET_ON_INSERT:
- mapping.append(STRING_WITH_LEN(" DEFAULT CURRENT_TIMESTAMP"));
- break;
- case TIMESTAMP_AUTO_SET_ON_UPDATE:
- if (osVersion.v >= 6 &&
- !field->is_null())
- {
- mapping.append(STRING_WITH_LEN(" GENERATED BY DEFAULT FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP"));
- warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- }
- else
- warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- break;
- case TIMESTAMP_AUTO_SET_ON_BOTH:
- if (osVersion.v >= 6 &&
- !field->is_null())
- mapping.append(STRING_WITH_LEN(" GENERATED BY DEFAULT FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP"));
- else
- {
- mapping.append(STRING_WITH_LEN(" DEFAULT CURRENT_TIMESTAMP"));
- warning(ha_thd(), DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- }
- break;
- }
- }
- else
- defaultNeedsQuotes = true;
- break;
- case MYSQL_TYPE_YEAR:
- if (yearFormat == CHAR4)
- {
- mapping.append(STRING_WITH_LEN("CHAR(4) CCSID 1208"));
- defaultNeedsQuotes = true;
- }
- else
- {
- mapping.append(STRING_WITH_LEN("SMALLINT"));
- defaultNeedsQuotes = false;
- }
- break;
- case MYSQL_TYPE_BIT:
- sprintf(stringBuildBuffer, "BINARY(%d)", (field->max_display_length() / 8) + 1);
- mapping.append(stringBuildBuffer);
- break;
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_STRING:
- {
- if (field->real_type() == MYSQL_TYPE_ENUM ||
- field->real_type() == MYSQL_TYPE_SET)
- {
- mapping.append(STRING_WITH_LEN("BIGINT"));
- }
- else
- {
- defaultNeedsQuotes = true;
-
- fieldLength = field->max_display_length(); // Get field byte length
-
- if (fieldCharSet == &my_charset_bin)
- {
- if (field->type() == MYSQL_TYPE_STRING)
- {
- sprintf(stringBuildBuffer, "BINARY(%d)", max(fieldLength, 1));
- }
- else
- {
- if (fieldLength <= MAX_VARCHAR_LENGTH)
- {
- sprintf(stringBuildBuffer, "VARBINARY(%d)", max(fieldLength, 1));
- }
- else if (blobMapping == AS_VARCHAR &&
- (field->flags & PART_KEY_FLAG))
- {
- sprintf(stringBuildBuffer, "LONG VARBINARY ");
- }
- else
- {
- fieldLength = min(MAX_BLOB_LENGTH, fieldLength);
- sprintf(stringBuildBuffer, "BLOB(%d)", max(fieldLength, 1));
- }
- }
- mapping.append(stringBuildBuffer);
- }
- else
- {
- if (field->type() == MYSQL_TYPE_STRING)
- {
- if (fieldLength > MAX_CHAR_LENGTH)
- return 1;
- if (fieldCharSet->mbmaxlen > 1)
- {
- if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
- {
- sprintf(stringBuildBuffer, "GRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 13488;
- }
- else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
- strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
- {
- sprintf(stringBuildBuffer, "CHAR(%d)", max(fieldLength, 1)); // Number of bytes
- db2Ccsid = 1208;
- }
- else
- {
- sprintf(stringBuildBuffer, "GRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 1200;
- }
- }
- else
- {
- sprintf(stringBuildBuffer, "CHAR(%d)", max(fieldLength, 1));
- }
- mapping.append(stringBuildBuffer);
- }
- else
- {
- if (fieldLength <= MAX_VARCHAR_LENGTH)
- {
- if (fieldCharSet->mbmaxlen > 1)
- {
- if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
- {
- sprintf(stringBuildBuffer, "VARGRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 13488;
- }
- else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
- strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
- {
- sprintf(stringBuildBuffer, "VARCHAR(%d)", max(fieldLength, 1)); // Number of bytes
- db2Ccsid = 1208;
- }
- else
- {
- sprintf(stringBuildBuffer, "VARGRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 1200;
- }
- }
- else
- {
- sprintf(stringBuildBuffer, "VARCHAR(%d)", max(fieldLength, 1));
- }
- }
- else if (blobMapping == AS_VARCHAR &&
- (field->flags & PART_KEY_FLAG))
- {
- if (fieldCharSet->mbmaxlen > 1)
- {
- if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
- {
- sprintf(stringBuildBuffer, "LONG VARGRAPHIC ");
- db2Ccsid = 13488;
- }
- else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
- strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
- {
- sprintf(stringBuildBuffer, "LONG VARCHAR ");
- db2Ccsid = 1208;
- }
- else
- {
- sprintf(stringBuildBuffer, "LONG VARGRAPHIC ");
- db2Ccsid = 1200;
- }
- }
- else
- {
- sprintf(stringBuildBuffer, "LONG VARCHAR ");
- }
- }
- else
- {
- fieldLength = min(MAX_BLOB_LENGTH, fieldLength);
-
- if (fieldCharSet->mbmaxlen > 1)
- {
- if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
- {
- sprintf(stringBuildBuffer, "DBCLOB(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 13488;
- }
- else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
- strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
- {
- sprintf(stringBuildBuffer, "CLOB(%d)", max(fieldLength, 1)); // Number of bytes
- db2Ccsid = 1208;
- }
- else
- {
- sprintf(stringBuildBuffer, "DBCLOB(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
- db2Ccsid = 1200;
- }
- }
- else
- {
- sprintf(stringBuildBuffer, "CLOB(%d)", max(fieldLength, 1)); // Number of characters
- }
- }
-
- mapping.append(stringBuildBuffer);
- }
- if (db2Ccsid == 0) // If not overriding CCSID
- {
- int32 rtnCode = convertIANAToDb2Ccsid(fieldCharSet->csname, &db2Ccsid);
- if (rtnCode)
- return rtnCode;
- }
-
- if (db2Ccsid != 1208 &&
- db2Ccsid != 13488)
- {
- // Check whether there is a character conversion available.
- iconv_t temp;
- int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
- if (unlikely(rc))
- return rc;
- }
-
- sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid);
- mapping.append(stringBuildBuffer);
- }
- }
- }
- break;
-
- }
-
- if (propagateDefaults)
- get_field_default_value(field,
- mapping,
- defaultNeedsQuotes,
- db2Ccsid,
- (zeroDateHandling==SUBSTITUTE_0001_01_01));
-
- return 0;
-}
-
-
-/**
- Convert MySQL field data into the equivalent DB2 format
-
- @param field The MySQL field to be converted
- @param db2Field The corresponding DB2 field definition
- @param db2Buf The buffer to receive the converted data
- @param data NULL if field points to the correct data; otherwise,
- the data to be converted (for use with keys)
-*/
-int32 ha_ibmdb2i::convertMySQLtoDB2(Field* field, const DB2Field& db2Field, char* db2Buf, const uchar* data)
-{
- enum_field_types fieldType = field->type();
- switch (fieldType)
- {
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint precision= ((Field_new_decimal*)field)->precision;
- uint scale= field->decimals();
- uint db2Precision = min(precision, MAX_DEC_PRECISION);
- uint truncationAmount = precision - db2Precision;
-
- if (scale >= truncationAmount)
- {
- String tempString(precision+2);
-
- if (data == NULL)
- {
- field->val_str((String*)&tempString, (String*)(NULL));
- }
- else
- {
- field->val_str(&tempString, data);
- }
- const char* temp = tempString.ptr();
- char packed[32];
- memset(&packed, 0, sizeof(packed));
-
- int bcdPos = db2Precision - (db2Precision % 2 ? 1 : 0);
- bcdAssign(packed, bcdPos+1, (temp[0] == '-' ? 0xD : 0xF));
-
- int strPos=tempString.length() - 1 - truncationAmount;
-
- for (;strPos >= 0 && bcdPos >= 0; strPos--)
- {
- if (my_isdigit(&my_charset_latin1, temp[strPos]))
- {
- bcdAssign(packed, bcdPos, temp[strPos]-'0');
- --bcdPos;
- }
- }
- memcpy(db2Buf, &packed, (db2Precision/2)+1);
- }
-
- }
- break;
- case MYSQL_TYPE_TINY:
- {
- int16 temp = (data == NULL ? field->val_int() : field->val_int(data));
- memcpy(db2Buf , &temp, sizeof(temp));
- }
- break;
- case MYSQL_TYPE_SHORT:
- {
- if (((Field_num*)field)->unsigned_flag)
- {
- memset(db2Buf, 0, 2);
- memcpy(db2Buf+2, (data == NULL ? field->ptr : data), 2);
- }
- else
- {
- memcpy(db2Buf, (data == NULL ? field->ptr : data), 2);
- }
- }
- break;
- case MYSQL_TYPE_LONG:
- {
- if (((Field_num*)field)->unsigned_flag)
- {
- memset(db2Buf, 0, 4);
- memcpy(db2Buf+4, (data == NULL ? field->ptr : data), 4);
- }
- else
- {
- memcpy(db2Buf, (data == NULL ? field->ptr : data), 4);
- }
- }
- break;
- case MYSQL_TYPE_FLOAT:
- {
- memcpy(db2Buf, (data == NULL ? field->ptr : data), 4);
- }
- break;
- case MYSQL_TYPE_DOUBLE:
- {
- memcpy(db2Buf, (data == NULL ? field->ptr : data), 8);
- }
- break;
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_DATETIME:
- {
- String tempString(27);
- if (data == NULL)
- {
- field->val_str(&tempString, &tempString);
- }
- else
- {
- field->val_str(&tempString, data);
- }
- memset(db2Buf, '0', 26);
- memcpy(db2Buf, tempString.ptr(), tempString.length());
- if (strncmp(db2Buf,ZERO_DATETIME_VALUE,strlen(ZERO_DATETIME_VALUE)) == 0)
- {
- if (cachedZeroDateOption == SUBSTITUTE_0001_01_01)
- memcpy(db2Buf, ZERO_DATETIME_VALUE_SUBST, sizeof(ZERO_DATETIME_VALUE_SUBST));
- else
- {
- getErrTxt(DB2I_ERR_INVALID_COL_VALUE, field->field_name);
- return(DB2I_ERR_INVALID_COL_VALUE);
- }
- }
- (db2Buf)[10] = '-';
- (db2Buf)[13] = (db2Buf)[16] = (db2Buf)[19] = '.';
-
- convertNumericToEbcdicFast(db2Buf, 26);
- }
- break;
- case MYSQL_TYPE_LONGLONG:
- {
- if (((Field_num*)field)->unsigned_flag)
- {
- char temp[23];
- String tempString(temp, sizeof(temp), &my_charset_latin1);
-
- if (data == NULL)
- {
- field->val_str((String*)&tempString, (String*)(NULL));
- }
- else
- {
- field->val_str(&tempString, data);
- }
- char packed[11];
- memset(packed, 0, sizeof(packed));
- bcdAssign(packed, 21, (temp[0] == '-' ? 0xD : 0xF));
- int strPos=tempString.length()-1;
- int bcdPos=20;
-
- for (;strPos >= 0; strPos--)
- {
- if (my_isdigit(&my_charset_latin1, temp[strPos]))
- {
- bcdAssign(packed, bcdPos, temp[strPos]-'0');
- --bcdPos;
- }
- }
- memcpy(db2Buf, &packed, 11);
- }
- else
- {
- *(uint64*)db2Buf = *(uint64*)(data == NULL ? field->ptr : data);
- }
- }
- break;
- case MYSQL_TYPE_INT24:
- {
- int32 temp= (data == NULL ? field->val_int() : field->val_int(data));
- memcpy(db2Buf , &temp, sizeof(temp));
- }
- break;
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_NEWDATE:
- {
- String tempString(11);
- if (data == NULL)
- {
- field->val_str(&tempString, (String*)NULL);
- }
- else
- {
- field->val_str(&tempString, data);
- }
- memcpy(db2Buf, tempString.ptr(), 10);
- if (strncmp(db2Buf,ZERO_DATE_VALUE,strlen(ZERO_DATE_VALUE)) == 0)
- {
- if (cachedZeroDateOption == SUBSTITUTE_0001_01_01)
- memcpy(db2Buf, ZERO_DATE_VALUE_SUBST, sizeof(ZERO_DATE_VALUE_SUBST));
- else
- {
- getErrTxt(DB2I_ERR_INVALID_COL_VALUE,field->field_name);
- return(DB2I_ERR_INVALID_COL_VALUE);
- }
- }
-
- convertNumericToEbcdicFast(db2Buf,10);
- }
- break;
- case MYSQL_TYPE_TIME:
- {
- if (db2Field.getType() == QMY_TIME)
- {
- String tempString(10);
- if (data == NULL)
- {
- field->val_str(&tempString, (String*)NULL);
- }
- else
- {
- field->val_str(&tempString, data);
- }
- memcpy(db2Buf, tempString.ptr(), 8);
- (db2Buf)[2]=(db2Buf)[5] = '.';
-
- convertNumericToEbcdicFast(db2Buf, 8);
- }
- else
- {
- int32 temp = sint3korr(data == NULL ? field->ptr : data);
- memcpy(db2Buf, &temp, sizeof(temp));
- }
- }
- break;
- case MYSQL_TYPE_YEAR:
- {
- String tempString(5);
- if (db2Field.getType() == QMY_CHAR)
- {
- if (data == NULL)
- {
- field->val_str(&tempString, (String*)NULL);
- }
- else
- {
- field->val_str(&tempString, data);
- }
- memcpy(db2Buf, tempString.ptr(), 4);
- }
- else
- {
- uint8 temp = *(uint8*)(data == NULL ? field->ptr : data);
- *(uint16*)(db2Buf) = (temp ? temp + 1900 : 0);
- }
- }
- break;
- case MYSQL_TYPE_BIT:
- {
- int bytesToCopy = db2Field.getByteLengthInRecord();
-
- if (data == NULL)
- {
- uint64 temp = field->val_int();
- memcpy(db2Buf,
- ((char*)&temp) + (sizeof(temp) - bytesToCopy),
- bytesToCopy);
- }
- else
- {
- memcpy(db2Buf,
- data,
- bytesToCopy);
- }
- }
- break;
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_BLOB:
- {
- if (field->real_type() == MYSQL_TYPE_ENUM ||
- field->real_type() == MYSQL_TYPE_SET)
- {
- int64 temp= (data == NULL ? field->val_int() : field->val_int(data));
- *(int64*)db2Buf = temp;
- }
- else
- {
- const uchar* dataToStore;
- uint32 bytesToStore;
- uint32 bytesToPad = 0;
- CHARSET_INFO* fieldCharSet = field->charset();
- uint32 maxDisplayLength = field->max_display_length();
- switch (fieldType)
- {
- case MYSQL_TYPE_STRING:
- {
- bytesToStore = maxDisplayLength;
- if (data == NULL)
- dataToStore = field->ptr;
- else
- dataToStore = data;
- }
- break;
- case MYSQL_TYPE_VARCHAR:
- {
-
- if (data == NULL)
- {
- bytesToStore = field->data_length();
- dataToStore = field->ptr + ((Field_varstring*)field)->length_bytes;
- }
- else
- {
- // Key lens are stored little-endian
- bytesToStore = *(uint8*)data + ((*(uint8*)(data+1)) << 8);
- dataToStore = data + 2;
- }
- bytesToPad = maxDisplayLength - bytesToStore;
- }
- break;
- case MYSQL_TYPE_BLOB:
- {
- if (data == NULL)
- {
- bytesToStore = ((Field_blob*)field)->get_length();
- bytesToPad = maxDisplayLength - bytesToStore;
- ((Field_blob*)field)->get_ptr((uchar**)&dataToStore);
- }
- else
- {
- // Key lens are stored little-endian
- bytesToStore = *(uint8*)data + ((*(uint8*)(data+1)) << 8);
- dataToStore = data + 2;
- }
- }
- break;
- }
-
- int32 rc;
- uint16 db2FieldType = db2Field.getType();
- switch(db2FieldType)
- {
- case QMY_CHAR:
- if (maxDisplayLength == 0)
- bytesToPad = 1;
- case QMY_VARCHAR:
- if (db2FieldType == QMY_VARCHAR)
- {
- db2Buf += sizeof(uint16);
- bytesToPad = 0;
- }
-
- if (bytesToStore > db2Field.getDataLengthInRecord())
- {
- bytesToStore = db2Field.getDataLengthInRecord();
- field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
- }
-
- if (fieldCharSet == &my_charset_bin) // If binary
- {
- if (bytesToStore)
- memcpy(db2Buf, dataToStore, bytesToStore);
- if (bytesToPad)
- memset(db2Buf + bytesToStore, 0x00, bytesToPad);
- }
- else if (db2Field.getCCSID() == 1208) // utf8
- {
- if (bytesToStore)
- memcpy(db2Buf, dataToStore, bytesToStore);
- if (bytesToPad)
- memset(db2Buf + bytesToStore, ' ', bytesToPad);
- }
- else // single-byte ASCII to EBCDIC
- {
- DBUG_ASSERT(fieldCharSet->mbmaxlen == 1);
- if (bytesToStore)
- {
- rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore, db2Buf, bytesToStore, bytesToStore, NULL);
- if (rc)
- return rc;
- }
- if (bytesToPad)
- memset(db2Buf + bytesToStore, 0x40, bytesToPad);
- }
-
- if (db2FieldType == QMY_VARCHAR)
- *(uint16*)(db2Buf - sizeof(uint16)) = bytesToStore;
- break;
- case QMY_VARGRAPHIC:
- db2Buf += sizeof(uint16);
- bytesToPad = 0;
- case QMY_GRAPHIC:
- if (maxDisplayLength == 0 && db2FieldType == QMY_GRAPHIC)
- bytesToPad = 2;
-
- if (db2Field.getCCSID() == 13488)
- {
- if (bytesToStore)
- memcpy(db2Buf, dataToStore, bytesToStore);
- if (bytesToPad)
- memset16((db2Buf + bytesToStore), 0x0020, bytesToPad/2);
- }
- else
- {
- size_t db2BytesToStore;
- size_t maxDb2BytesToStore;
-
- if (maxDisplayLength == 0 && db2FieldType == QMY_GRAPHIC)
- maxDb2BytesToStore = 2;
- else
- maxDb2BytesToStore = min(((bytesToStore * 2) / fieldCharSet->mbminlen),
- ((maxDisplayLength * 2) / fieldCharSet->mbmaxlen));
-
- if (bytesToStore == 0)
- db2BytesToStore = 0;
- else
- {
- rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore, db2Buf, bytesToStore, maxDb2BytesToStore, &db2BytesToStore);
- if (rc)
- return rc;
- bytesToStore = db2BytesToStore;
- }
- if (db2BytesToStore < maxDb2BytesToStore) // If need to pad
- memset16((db2Buf + db2BytesToStore), 0x0020, (maxDb2BytesToStore - db2BytesToStore)/2);
- }
-
- if (db2FieldType == QMY_VARGRAPHIC)
- *(uint16*)(db2Buf-sizeof(uint16)) = bytesToStore/2;
- break;
- case QMY_BLOBCLOB:
- case QMY_DBCLOB:
- {
- DBUG_ASSERT(data == NULL);
- DB2LobField* lobField = (DB2LobField*)(db2Buf + db2Field.calcBlobPad());
-
- if ((fieldCharSet == &my_charset_bin) || // binary or
- (db2Field.getCCSID()==13488) ||
- (db2Field.getCCSID()==1208)) // binary UTF8
- {
- }
- else
- {
- char* temp;
- int32 rc;
- size_t db2BytesToStore;
- if (fieldCharSet->mbmaxlen == 1) // single-byte ASCII to EBCDIC
- {
- temp = getCharacterConversionBuffer(field->field_index, bytesToStore);
- rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore,temp,bytesToStore, bytesToStore, NULL);
- if (rc)
- return (rc);
- }
- else // Else Far East, special UTF8 or non-special UTF8/UCS2
- {
- size_t maxDb2BytesToStore;
- maxDb2BytesToStore = min(((bytesToStore * 2) / fieldCharSet->mbminlen),
- ((maxDisplayLength * 2) / fieldCharSet->mbmaxlen));
- temp = getCharacterConversionBuffer(field->field_index, maxDb2BytesToStore);
- rc = convertFieldChars(toDB2, field->field_index, (char*)dataToStore,temp,bytesToStore, maxDb2BytesToStore, &db2BytesToStore);
- if (rc)
- return (rc);
- bytesToStore = db2BytesToStore;
- }
- dataToStore = (uchar*)temp;
- }
-
- uint16 blobID = db2Table->getBlobIdFromField(field->field_index);
- if (blobWriteBuffers[blobID] != (char*)dataToStore)
- blobWriteBuffers[blobID].reassign((char*)dataToStore);
- if ((void*)blobWriteBuffers[blobID])
- lobField->dataHandle = (ILEMemHandle)blobWriteBuffers[blobID];
- else
- lobField->dataHandle = 0;
- lobField->length = bytesToStore / (db2FieldType == QMY_DBCLOB ? 2 : 1);
- }
- break;
- }
- }
- }
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
-
- return (ha_thd()->is_error());
-}
-
-
-/**
- Convert DB2 field data into the equivalent MySQL format
-
- @param db2Field The DB2 field definition
- @param field The MySQL field to receive the converted data
- @param buf The DB2 data to be converted
-*/
-int32 ha_ibmdb2i::convertDB2toMySQL(const DB2Field& db2Field, Field* field, const char* buf)
-{
- int32 storeRC = 0; // Result of the field->store() operation
-
- const char* bufPtr = buf + db2Field.getBufferOffset();
-
- switch (field->type())
- {
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint precision= ((Field_new_decimal*)field)->precision;
- uint scale= field->decimals();
- uint db2Precision = min(precision, MAX_DEC_PRECISION);
- uint decimalPlace = precision-scale+1;
- char temp[80];
-
- if (precision <= MAX_DEC_PRECISION ||
- scale > precision - MAX_DEC_PRECISION)
- {
- uint numNibbles = db2Precision + (db2Precision % 2 ? 0 : 1);
-
- temp[0] = (bcdGet(bufPtr, numNibbles) == 0xD ? '-' : ' ');
- int strPos=1;
- int bcdPos=(db2Precision % 2 ? 0 : 1);
-
- for (;bcdPos < numNibbles; bcdPos++, strPos++)
- {
- if (strPos == decimalPlace)
- {
- temp[strPos] = '.';
- strPos++;
- }
-
- temp[strPos] = bcdGet(bufPtr, bcdPos) + '0';
- }
-
- temp[strPos] = 0;
-
- storeRC = field->store(temp, strPos, &my_charset_latin1);
- }
- }
- break;
- case MYSQL_TYPE_TINY:
- {
- storeRC = field->store(*(int16*)bufPtr, ((Field_num*)field)->unsigned_flag);
- }
- break;
- case MYSQL_TYPE_SHORT:
- {
- if (((Field_num*)field)->unsigned_flag)
- {
- storeRC = field->store(*(int32*)bufPtr, TRUE);
- }
- else
- {
- storeRC = field->store(*(int16*)bufPtr, FALSE);
- }
- }
- break;
- case MYSQL_TYPE_LONG:
- {
- if (((Field_num*)field)->unsigned_flag)
- {
- storeRC = field->store(*(int64*)bufPtr, TRUE);
- }
- else
- {
- storeRC = field->store(*(int32*)bufPtr, FALSE);
- }
- }
- break;
- case MYSQL_TYPE_FLOAT:
- {
- storeRC = field->store(*(float*)bufPtr);
- }
- break;
- case MYSQL_TYPE_DOUBLE:
- {
- storeRC = field->store(*(double*)bufPtr);
- }
- break;
- case MYSQL_TYPE_LONGLONG:
- {
- char temp[23];
- if (((Field_num*)field)->unsigned_flag)
- {
- temp[0] = (bcdGet(bufPtr, 21) == 0xD ? '-' : ' ');
- int strPos=1;
- int bcdPos=0;
-
- for (;bcdPos <= 20; bcdPos++, strPos++)
- {
- temp[strPos] = bcdGet(bufPtr, bcdPos) + '0';
- }
-
- temp[strPos] = 0;
-
- storeRC = field->store(temp, strPos, &my_charset_latin1);
- }
- else
- {
- storeRC = field->store(*(int64*)bufPtr, FALSE);
- }
- }
- break;
- case MYSQL_TYPE_INT24:
- {
- storeRC = field->store(*(int32*)bufPtr, ((Field_num*)field)->unsigned_flag);
- }
- break;
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_NEWDATE:
- {
- longlong value= a4toi_ebcdic((uchar*)bufPtr) * 10000 +
- a2toi_ebcdic((uchar*)bufPtr+5) * 100 +
- a2toi_ebcdic((uchar*)bufPtr+8);
-
- if (cachedZeroDateOption == SUBSTITUTE_0001_01_01 &&
- value == (10000 + 100 + 1))
- value = 0;
-
- storeRC = field->store(value);
- }
- break;
- case MYSQL_TYPE_TIME:
- {
- if (db2Field.getType() == QMY_TIME)
- {
- longlong value= a2toi_ebcdic((uchar*)bufPtr) * 10000 +
- a2toi_ebcdic((uchar*)bufPtr+3) * 100 +
- a2toi_ebcdic((uchar*)bufPtr+6);
-
- storeRC = field->store(value);
- }
- else
- storeRC = field->store(*((int32*)bufPtr));
- }
- break;
- case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_DATETIME:
- {
- longlong value= (a4toi_ebcdic((uchar*)bufPtr) * 10000 +
- a2toi_ebcdic((uchar*)bufPtr+5) * 100 +
- a2toi_ebcdic((uchar*)bufPtr+8)) * 1000000LL +
- (a2toi_ebcdic((uchar*)bufPtr+11) * 10000 +
- a2toi_ebcdic((uchar*)bufPtr+14) * 100 +
- a2toi_ebcdic((uchar*)bufPtr+17));
-
- if (cachedZeroDateOption == SUBSTITUTE_0001_01_01 &&
- value == (10000 + 100 + 1) * 1000000LL)
- value = 0;
-
- storeRC = field->store(value);
- }
- break;
- case MYSQL_TYPE_YEAR:
- {
- if (db2Field.getType() == QMY_CHAR)
- {
- storeRC = field->store(bufPtr, 4, &my_charset_bin);
- }
- else
- {
- storeRC = field->store(*((uint16*)bufPtr));
- }
- }
- break;
- case MYSQL_TYPE_BIT:
- {
- uint64 temp= 0;
- int bytesToCopy= db2Field.getByteLengthInRecord();
- memcpy(((char*)&temp) + (sizeof(temp) - bytesToCopy), bufPtr, bytesToCopy);
- storeRC = field->store(temp, TRUE);
- }
- break;
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_BLOB:
- {
- if (field->real_type() == MYSQL_TYPE_ENUM ||
- field->real_type() == MYSQL_TYPE_SET)
- {
- storeRC = field->store(*(int64*)bufPtr);
- }
- else
- {
-
- const char* dataToStore = NULL;
- uint32 bytesToStore = 0;
- CHARSET_INFO* fieldCharSet = field->charset();
- switch(db2Field.getType())
- {
- case QMY_CHAR:
- case QMY_GRAPHIC:
- {
- bytesToStore = db2Field.getByteLengthInRecord();
- if (bytesToStore == 0)
- bytesToStore = 1;
- dataToStore = bufPtr;
- }
- break;
- case QMY_VARCHAR:
- {
- bytesToStore = *(uint16*)bufPtr;
- dataToStore = bufPtr+sizeof(uint16);
- }
- break;
- case QMY_VARGRAPHIC:
- {
- /* For VARGRAPHIC, convert the number of double-byte characters
- to the number of bytes. */
- bytesToStore = (*(uint16*)bufPtr)*2;
- dataToStore = bufPtr+sizeof(uint16);
- }
- break;
- case QMY_DBCLOB:
- case QMY_BLOBCLOB:
- {
- DB2LobField* lobField = (DB2LobField* )(bufPtr + db2Field.calcBlobPad());
- bytesToStore = lobField->length * (db2Field.getType() == QMY_DBCLOB ? 2 : 1);
- dataToStore = (char*)blobReadBuffers->getBufferPtr(field->field_index);
- }
- break;
-
- }
-
- if ((fieldCharSet != &my_charset_bin) && // not binary &
- (db2Field.getCCSID() != 13488) && // not UCS2 &
- (db2Field.getCCSID() != 1208))
- {
- char* temp;
- size_t db2BytesToStore;
- int rc;
- if (fieldCharSet->mbmaxlen > 1)
- {
- size_t maxDb2BytesToStore = ((bytesToStore / 2) * fieldCharSet->mbmaxlen); // Worst case for number of bytes
- temp = getCharacterConversionBuffer(field->field_index, maxDb2BytesToStore);
- rc = convertFieldChars(toMySQL, field->field_index, dataToStore, temp, bytesToStore, maxDb2BytesToStore, &db2BytesToStore);
- bytesToStore = db2BytesToStore;
- }
- else // single-byte ASCII to EBCDIC
- {
- temp = getCharacterConversionBuffer(field->field_index, bytesToStore);
- rc = convertFieldChars(toMySQL, field->field_index, dataToStore, temp, bytesToStore, bytesToStore, NULL);
- }
- if (rc)
- return (rc);
- dataToStore = temp;
- }
-
- if ((field)->flags & BLOB_FLAG)
- ((Field_blob*)(field))->set_ptr(bytesToStore, (uchar*)dataToStore);
- else
- storeRC = field->store(dataToStore, bytesToStore, &my_charset_bin);
- }
- }
- break;
- default:
- DBUG_ASSERT(0);
- break;
-
- }
-
- if (storeRC)
- {
- invalidDataFound = true;
- }
-
- return 0;
-}
diff --git a/storage/ibmdb2i/db2i_errors.cc b/storage/ibmdb2i/db2i_errors.cc
deleted file mode 100644
index dd50e40e61b..00000000000
--- a/storage/ibmdb2i/db2i_errors.cc
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "db2i_errors.h"
-#include "db2i_ileBridge.h"
-#include "db2i_charsetSupport.h"
-#include "mysql_priv.h"
-#include "stdarg.h"
-
-#define MAX_MSGSTRING 109
-
-/*
- The following strings are associated with errors that can be produced
- within the storage engine proper.
-*/
-static const char* engineErrors[MAX_MSGSTRING] =
-{
- {""},
- {"Error opening codeset conversion from %.64s to %.64s (errno = %d)"},
- {"Invalid %-.10s name '%-.128s'"},
- {"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"},
- {"The %-.64s character set is not supported."},
- {"Auto_increment is not allowed for a partitioned table"},
- {"Character set conversion error due to unknown encoding scheme %d"},
- {""},
- {"Table '%-.128s' was not found by the storage engine"},
- {"Could not resolve to %-.128s in library %-.10s type %-.10s (errno = %d)"},
- {"Error on _PGMCALL for program %-.10s in library %-.10s (error = %d)"},
- {"Error on _ILECALL for API '%.128s' (error = %d)"},
- {"Error in iconv() function during character set conversion (errno = %d)"},
- {"Error from Get Encoding Scheme (QTQGESP) API: %d, %d, %d"},
- {"Error from Get Related Default CCSID (QTQGRDC) API: %d, %d, %d"},
- {"Data out of range for column '%.192s'"},
- {"Schema name '%.128s' exceeds maximum length of %d characters"},
- {"Multiple collations not supported in a single index or constraint"},
- {"Sort sequence was not found"},
- {"One or more characters in column %.128s were substituted during conversion"},
- {"A decimal column exceeded the maximum precision. Data may be truncated."},
- {"Some data returned by DB2 for table %s could not be converted for MySQL"},
- {""},
- {"Column %.128s contains characters that cannot be converted"},
- {"An invalid name was specified for ibmdb2i_rdb_name."},
- {"A duplicate key was encountered for index '%.128s'"},
- {"A table with the same name exists but has incompatible column definitions."},
- {"The created table was discovered as an existing DB2 object."},
- {"Some attribute(s) defined for column '%.128s' may not be honored by accesses from DB2."},
-};
-
-/*
- The following strings are associated with errors that can be returned
- by the operating system via the QMY_* APIs. Most are very uncommon and
- indicate a bug somewhere.
-*/
-static const char* systemErrors[MAX_MSGSTRING] =
-{
- {"Thread ID is too long"},
- {"Error creating a SPACE memory object"},
- {"Error creating a FILE memory object"},
- {"Error creating a SPACE synchronization token"},
- {"Error creating a FILE synchronization token"},
- {"See message %-.7s in joblog for job %-.6s/%-.10s/%-.10s."},
- {"Error unlocking a synchronization token when closing a connection"},
- {"Invalid action specified for an 'object lock' request"},
- {"Invalid action specified for a savepoint request"},
- {"Partial keys are not supported with an ICU sort sequence"},
- {"Error retrieving an ICU sort key"},
- {"Error converting single-byte sort sequence to UCS-2"},
- {"An unsupported collation was specified"},
- {"Validation failed for referenced table of foreign key constraint"},
- {"Error extracting table for constraint information"},
- {"Error extracting referenced table for constraint information"},
- {"Invalid action specified for a 'commitment control' request"},
- {"Invalid commitment control isolation level specified on 'open' request"},
- {"Invalid file handle"},
- {" "},
- {"Invalid option specified for returning data on 'read' request"},
- {"Invalid orientation specified for 'read' request"},
- {"Invalid option type specified for 'read' request"},
- {"Invalid isolation level for starting commitment control"},
- {"Error unlocking a synchronization token in module QMYALC"},
- {"Length of space for returned format is not long enough"},
- {"SQL XA transactions are currently unsupported by this interface"},
- {"The associated QSQSRVR job was killed or ended unexpectedly."},
- {"Error unlocking a synchronization token in module QMYSEI"},
- {"Error unlocking a synchronization token in module QMYSPO"},
- {"Error converting input CCSID from short form to long form"},
- {" "},
- {"Error getting associated CCSID for CCSID conversion"},
- {"Error converting a string from one CCSID to another"},
- {"Error unlocking a synchronization token"},
- {"Error destroying a synchronization token"},
- {"Error locking a synchronization token"},
- {"Error recreating a synchronization token"},
- {"A space handle was not specified for a constraint request"},
- {"An SQL cursor was specified for a delete request"},
- {" "},
- {"Error on delete request because current UFCB for connection is not open"},
- {"An SQL cursor was specified for an object initialization request"},
- {"An SQL cursor was specified for an object override request"},
- {"A space handle was not specified for an object override request"},
- {"An SQL cursor was specified for an information request"},
- {"An SQL cursor was specified for an object lock request"},
- {"An SQL cursor was specified for an optimize request"},
- {"A data handle was not specified for a read request"},
- {"A row number handle was not specified for a read request"},
- {"A key handle was not specified for a read request"},
- {"An SQL cursor was specified for an row estimation request"},
- {"A space handle was not specified for a row estimation request"},
- {"An SQL cursor was specified for a release record request"},
- {"A statement handle was not specified for an 'execute immediate' request"},
- {"A statement handle was not specified for a 'prepare open' request"},
- {"An SQL cursor was specified for an update request"},
- {"The UFCB was not open for read"},
- {"Error on update request because current UFCB for connection is not open"},
- {"A data handle was not specified for an update request"},
- {"An SQL cursor was specified for a write request"},
- {"A data handle was not specified for a write request"},
- {"An unknown function was specified on a process request"},
- {"A share definition was not specified for an 'allocate share' request"},
- {"A share handle was not specified for an 'allocate share' request"},
- {"A use count handle was not specified for an 'allocate share' request"},
- {"A 'records per key' handle was not specified for an information request"},
- {"Error resolving LOB addresss"},
- {"Length of a LOB space is too small"},
- {"An unknown function was specified for a server request"},
- {"Object authorization failed. See message %-.7s in joblog for job %-.6s/%-.10s/%-.10s. for more information."},
- {" "},
- {"Error locking mutex on server"},
- {"Error unlocking mutex on server"},
- {"Error checking for RDB name in RDB Directory"},
- {"Error creating mutex on server"},
- {"A table with that name already exists"},
- {" "},
- {"Error unlocking mutex"},
- {"Error connecting to server job"},
- {"Error connecting to server job"},
- {" "},
- {"Function check occurred while registering parameter spaces. See joblog."},
- {" "},
- {" "},
- {"End of block"},
- {"The file has changed and might not be compatible with the MySQL table definition"},
- {"Error giving pipe to server job"},
- {"There are open object locks when attempting to deallocate"},
- {"There is no open lock"},
- {" "},
- {" "},
- {"The maximum value for the auto_increment data type was exceeded"},
- {"Error occurred closing the pipe "},
- {"Error occurred taking a descriptor for the pipe"},
- {"Error writing to pipe "},
- {"Server was interrupted "},
- {"No pipe descriptor exists for reuse "},
- {"Error occurred during an SQL prepare statement "},
- {"Error occurred during an SQL open "},
- {" "},
- {" "},
- {" "},
- {" "},
- {" "},
- {" "},
- {"An unspecified error was returned from the system."},
- {" "}
-};
-
-/**
- This function builds the text string for an error code, and substitutes
- a variable number of replacement variables into the string.
-*/
-void getErrTxt(int errCode, ...)
-{
- va_list args;
- va_start(args,errCode);
- char* buffer = db2i_ileBridge::getBridgeForThread()->getErrorStorage();
- const char* msg;
-
- if (errCode >= QMY_ERR_MIN && errCode <= QMY_ERR_SQ_OPEN)
- msg = systemErrors[errCode - QMY_ERR_MIN];
- else
- {
- DBUG_ASSERT(errCode >= DB2I_FIRST_ERR && errCode <= DB2I_LAST_ERR);
- msg = engineErrors[errCode - DB2I_FIRST_ERR];
- }
-
- (void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
- va_end(args);
- fprintf(stderr,"ibmdb2i error %d: %s\n",errCode,buffer);
- DBUG_PRINT("error", ("ibmdb2i error %d: %s",errCode,buffer));
-}
-
-static inline void trimSpace(char* str)
-{
- char* end = strchr(str, ' ');
- if (end) *end = 0;
-}
-
-
-/**
- Generate the error text specific to an API error returned by a QMY_* API.
-
- @parm errCode The error value
- @parm errInfo The structure containing the message and job identifiers.
-*/
-void reportSystemAPIError(int errCode, const Qmy_Error_output *errInfo)
-{
- if (errCode >= QMY_ERR_MIN && errCode <= QMY_ERR_SQ_OPEN)
- {
- switch(errCode)
- {
- case QMY_ERR_MSGID:
- case QMY_ERR_NOT_AUTH:
- {
- DBUG_ASSERT(errInfo);
- char jMsg[8]; // Error message ID
- char jName[11]; // Job name
- char jUser[11]; // Job user
- char jNbr[7]; // Job number
- memset(jMsg, 0, sizeof(jMsg));
- memset(jName, 0, sizeof(jMsg));
- memset(jUser, 0, sizeof(jMsg));
- memset(jMsg, 0, sizeof(jMsg));
-
- convFromEbcdic(errInfo->MsgId,jMsg,sizeof(jMsg)-1);
- convFromEbcdic(errInfo->JobName,jName,sizeof(jName)-1);
- trimSpace(jName);
- convFromEbcdic(errInfo->JobUser,jUser,sizeof(jUser)-1);
- trimSpace(jUser);
- convFromEbcdic(errInfo->JobNbr,jNbr,sizeof(jNbr)-1);
- getErrTxt(errCode,jMsg,jNbr,jUser,jName);
- }
- break;
- case QMY_ERR_RTNFMT:
- {
- getErrTxt(QMY_ERR_LVLID_MISMATCH);
- }
- break;
- default:
- getErrTxt(errCode);
- break;
- }
- }
-}
-
-
-/**
- Generate a warning for the specified error.
-*/
-void warning(THD *thd, int errCode, ...)
-{
- va_list args;
- va_start(args,errCode);
- char buffer[MYSQL_ERRMSG_SIZE];
- const char* msg;
-
- DBUG_ASSERT(errCode >= DB2I_FIRST_ERR && errCode <= DB2I_LAST_ERR);
- msg = engineErrors[errCode - DB2I_FIRST_ERR];
-
- (void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
- va_end(args);
- DBUG_PRINT("warning", ("ibmdb2i warning %d: %s",errCode,buffer));
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, errCode, buffer);
-}
-
-
diff --git a/storage/ibmdb2i/db2i_errors.h b/storage/ibmdb2i/db2i_errors.h
deleted file mode 100644
index b6dd314ef50..00000000000
--- a/storage/ibmdb2i/db2i_errors.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_ERRORS_H
-#define DB2I_ERRORS_H
-
-#include "qmyse.h"
-class THD;
-
-/**
- @enum DB2I_errors
-
- @brief These are the errors that can be returned by the storage engine proper
- and that are specific to the engine. Refer to db2i_errors.cc for text
- descriptions of the errors.
-*/
-
-enum DB2I_errors
-{
- DB2I_FIRST_ERR = 2500,
- DB2I_ERR_ICONV_OPEN,
- DB2I_ERR_INVALID_NAME,
- DB2I_ERR_RENAME_MOVE,
- DB2I_ERR_UNSUPP_CHARSET,
- DB2I_ERR_PART_AUTOINC,
- DB2I_ERR_UNKNOWN_ENCODING,
- DB2I_ERR_RESERVED,
- DB2I_ERR_TABLE_NOT_FOUND,
- DB2I_ERR_RESOLVE_OBJ,
- DB2I_ERR_PGMCALL,
- DB2I_ERR_ILECALL,
- DB2I_ERR_ICONV,
- DB2I_ERR_QTQGESP,
- DB2I_ERR_QTQGRDC,
- DB2I_ERR_INVALID_COL_VALUE,
- DB2I_ERR_TOO_LONG_SCHEMA,
- DB2I_ERR_MIXED_COLLATIONS,
- DB2I_ERR_SRTSEQ,
- DB2I_ERR_SUB_CHARS,
- DB2I_ERR_PRECISION,
- DB2I_ERR_INVALID_DATA,
- DB2I_ERR_RESERVED2,
- DB2I_ERR_ILL_CHAR,
- DB2I_ERR_BAD_RDB_NAME,
- DB2I_ERR_UNKNOWN_IDX,
- DB2I_ERR_DISCOVERY_MISMATCH,
- DB2I_ERR_WARN_CREATE_DISCOVER,
- DB2I_ERR_WARN_COL_ATTRS,
- DB2I_LAST_ERR = DB2I_ERR_WARN_COL_ATTRS
-};
-
-void getErrTxt(int errcode, ...);
-void reportSystemAPIError(int errCode, const Qmy_Error_output *errInfo);
-void warning(THD *thd, int errCode, ...);
-
-const char* DB2I_SQL0350 = "\xE2\xD8\xD3\xF0\xF3\xF5\xF0"; // SQL0350 in EBCDIC
-const char* DB2I_CPF503A = "\xC3\xD7\xC6\xF5\xF0\xF3\xC1"; // CPF503A in EBCDIC
-const char* DB2I_SQL0538 = "\xE2\xD8\xD3\xF0\xF5\xF3\xF8"; // SQL0538 in EBCDIC
-
-#endif
diff --git a/storage/ibmdb2i/db2i_file.cc b/storage/ibmdb2i/db2i_file.cc
deleted file mode 100644
index 2d83248eea7..00000000000
--- a/storage/ibmdb2i/db2i_file.cc
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#include "db2i_file.h"
-#include "db2i_charsetSupport.h"
-#include "db2i_collationSupport.h"
-#include "db2i_misc.h"
-#include "db2i_errors.h"
-#include "my_dir.h"
-
-db2i_table::db2i_table(const TABLE_SHARE* myTable, const char* path) :
- mysqlTable(myTable),
- db2StartId(0),
- blobFieldCount(0),
- blobFields(NULL),
- blobFieldActualSizes(NULL),
- logicalFiles(NULL),
- physicalFile(NULL),
- db2TableNameSQLAscii(NULL),
- db2LibNameSQLAscii(NULL)
-{
- char asciiLibName[MAX_DB2_SCHEMANAME_LENGTH + 1];
- getDB2LibNameFromPath(path, asciiLibName, ASCII_NATIVE);
-
- char asciiFileName[MAX_DB2_FILENAME_LENGTH + 1];
- getDB2FileNameFromPath(path, asciiFileName, ASCII_NATIVE);
-
- size_t libNameLen = strlen(asciiLibName);
- size_t fileNameLen = strlen(asciiFileName);
-
- db2LibNameEbcdic=(char *)
- my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &db2LibNameEbcdic, libNameLen+1,
- &db2LibNameAscii, libNameLen+1,
- &db2LibNameSQLAscii, libNameLen*2 + 1,
- &db2TableNameEbcdic, fileNameLen+1,
- &db2TableNameAscii, fileNameLen+1,
- &db2TableNameSQLAscii, fileNameLen*2 + 1,
- NullS);
-
- if (likely(db2LibNameEbcdic))
- {
- memcpy(db2LibNameAscii, asciiLibName, libNameLen);
- convertNativeToSQLName(db2LibNameAscii, db2LibNameSQLAscii);
- convToEbcdic(db2LibNameAscii, db2LibNameEbcdic, libNameLen);
- memcpy(db2TableNameAscii, asciiFileName, fileNameLen);
- convertNativeToSQLName(db2TableNameAscii, db2TableNameSQLAscii);
- convToEbcdic(db2TableNameAscii, db2TableNameEbcdic, fileNameLen);
- }
-
- conversionDefinitions[toMySQL] = NULL;
- conversionDefinitions[toDB2] = NULL;
-
- isTemporaryTable = (strstr(mysqlTable->path.str, mysql_tmpdir) == mysqlTable->path.str);
-}
-
-
-int32 db2i_table::initDB2Objects(const char* path)
-{
- uint fileObjects = 1 + mysqlTable->keys;
- ValidatedPointer<ShrDef> fileDefnSpace(sizeof(ShrDef) * fileObjects);
-
- physicalFile = new db2i_file(this);
- physicalFile->fillILEDefn(&fileDefnSpace[0], true);
-
- logicalFileCount = mysqlTable->keys;
- if (logicalFileCount > 0)
- {
- logicalFiles = new db2i_file*[logicalFileCount];
- for (int k = 0; k < logicalFileCount; k++)
- {
- logicalFiles[k] = new db2i_file(this, k);
- logicalFiles[k]->fillILEDefn(&fileDefnSpace[k+1], false);
- }
- }
-
- ValidatedPointer<FILE_HANDLE> fileDefnHandles(sizeof(FILE_HANDLE) * fileObjects);
- size_t formatSpaceLen = sizeof(format_hdr_t) + mysqlTable->fields * sizeof(DB2Field);
- formatSpace.alloc(formatSpaceLen);
-
- int rc = db2i_ileBridge::getBridgeForThread()->
- expectErrors(QMY_ERR_RTNFMT)->
- allocateFileDefn(fileDefnSpace,
- fileDefnHandles,
- fileObjects,
- db2LibNameEbcdic,
- strlen(db2LibNameEbcdic),
- formatSpace,
- formatSpaceLen);
-
- if (rc)
- {
- // We have to handle a format space error as a special case of a FID
- // mismatch. We should only get the space error if columns have been added
- // to the DB2 table without MySQL's knowledge, which is effectively a
- // FID problem.
- if (rc == QMY_ERR_RTNFMT)
- {
- rc = QMY_ERR_LVLID_MISMATCH;
- getErrTxt(rc);
- }
- return rc;
- }
-
- convFromEbcdic(((format_hdr_t*)formatSpace)->FilLvlId, fileLevelID, sizeof(fileLevelID));
-
- if (!doFileIDsMatch(path))
- {
- getErrTxt(QMY_ERR_LVLID_MISMATCH);
- return QMY_ERR_LVLID_MISMATCH;
- }
-
- physicalFile->setMasterDefnHandle(fileDefnHandles[0]);
- for (int k = 0; k < mysqlTable->keys; k++)
- {
- logicalFiles[k]->setMasterDefnHandle(fileDefnHandles[k+1]);
- }
-
- db2StartId = (uint64)(((format_hdr_t*)formatSpace)->StartIdVal);
- db2Fields = (DB2Field*)((char*)(void*)formatSpace + ((format_hdr_t*)formatSpace)->ColDefOff);
-
- uint fields = mysqlTable->fields;
- for (int i = 0; i < fields; ++i)
- {
- if (db2Field(i).isBlob())
- {
- blobFieldCount++;
- }
- }
-
- if (blobFieldCount)
- {
- blobFieldActualSizes = (uint*)my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &blobFieldActualSizes, blobFieldCount * sizeof(uint),
- &blobFields, blobFieldCount * sizeof(uint16),
- NullS);
-
- int b = 0;
- for (int i = 0; i < fields; ++i)
- {
- if (db2Field(i).isBlob())
- {
- blobFields[b++] = i;
- }
- }
- }
-
- my_multi_malloc(MYF(MY_WME),
- &conversionDefinitions[toMySQL], fields * sizeof(iconv_t),
- &conversionDefinitions[toDB2], fields * sizeof(iconv_t),
- NullS);
- for (int i = 0; i < fields; ++i)
- {
- conversionDefinitions[toMySQL][i] = (iconv_t)(-1);
- conversionDefinitions[toDB2][i] = (iconv_t)(-1);
- }
-
- return 0;
-}
-
-int db2i_table::fastInitForCreate(const char* path)
-{
- ValidatedPointer<ShrDef> fileDefnSpace(sizeof(ShrDef));
-
- physicalFile = new db2i_file(this);
- physicalFile->fillILEDefn(fileDefnSpace, true);
-
- ValidatedPointer<FILE_HANDLE> fileDefnHandles(sizeof(FILE_HANDLE));
-
- size_t formatSpaceLen = sizeof(format_hdr_t) +
- mysqlTable->fields * sizeof(DB2Field);
- formatSpace.alloc(formatSpaceLen);
-
- int rc = db2i_ileBridge::getBridgeForThread()->allocateFileDefn(fileDefnSpace,
- fileDefnHandles,
- 1,
- db2LibNameEbcdic,
- strlen(db2LibNameEbcdic),
- formatSpace,
- formatSpaceLen);
-
- if (rc)
- return rc;
-
- convFromEbcdic(((format_hdr_t*)formatSpace)->FilLvlId, fileLevelID, sizeof(fileLevelID));
- doFileIDsMatch(path);
-
- return 0;
-}
-
-bool db2i_table::doFileIDsMatch(const char* path)
-{
- char name_buff[FN_REFLEN];
-
- fn_format(name_buff, path, "", FID_EXT, (MY_REPLACE_EXT | MY_UNPACK_FILENAME));
-
- File fd = my_open(name_buff, O_RDONLY, MYF(0));
-
- if (fd == -1)
- {
- if (errno == ENOENT)
- {
- fd = my_create(name_buff, 0, O_WRONLY, MYF(MY_WME));
-
- if (fd == -1)
- {
- // TODO: Report errno here
- return false;
- }
- my_write(fd, (uchar*)fileLevelID, sizeof(fileLevelID), MYF(MY_WME));
- my_close(fd, MYF(0));
- return true;
- }
- else
- {
- // TODO: Report errno here
- return false;
- }
- }
-
- char diskFID[sizeof(fileLevelID)];
-
- bool match = false;
-
- if (my_read(fd, (uchar*)diskFID, sizeof(diskFID), MYF(MY_WME)) == sizeof(diskFID) &&
- (memcmp(diskFID, fileLevelID, sizeof(diskFID)) == 0))
- match = true;
-
- my_close(fd, MYF(0));
-
- return match;
-}
-
-void db2i_table::deleteAssocFiles(const char* name)
-{
- char name_buff[FN_REFLEN];
- fn_format(name_buff, name, "", FID_EXT, (MY_REPLACE_EXT | MY_UNPACK_FILENAME));
- my_delete(name_buff, MYF(0));
-}
-
-void db2i_table::renameAssocFiles(const char* from, const char* to)
-{
- rename_file_ext(from, to, FID_EXT);
-}
-
-
-db2i_table::~db2i_table()
-{
- my_free(blobFieldActualSizes);
- my_free(conversionDefinitions[toMySQL]);
-
- if (logicalFiles)
- {
- for (int k = 0; k < logicalFileCount; ++k)
- {
- delete logicalFiles[k];
- }
-
- delete[] logicalFiles;
- }
- delete physicalFile;
-
- my_free(db2LibNameEbcdic);
-}
-
-void db2i_table::getDB2QualifiedName(char* to)
-{
- strcat(to, getDB2LibName(ASCII_SQL));
- strcat(to, ".");
- strcat(to, getDB2TableName(ASCII_SQL));
-}
-
-
-void db2i_table::getDB2QualifiedNameFromPath(const char* path, char* to)
-{
- getDB2LibNameFromPath(path, to);
- strcat(to, ".");
- getDB2FileNameFromPath(path, strend(to));
-}
-
-
-size_t db2i_table::smartFilenameToTableName(const char *in, char* out, size_t outlen)
-{
- if (strchr(in, '@') == NULL)
- {
- return filename_to_tablename(in, out, outlen);
- }
-
- char* test = (char*) my_malloc(outlen, MYF(MY_WME));
-
- filename_to_tablename(in, test, outlen);
-
- char* cur = test;
-
- while (*cur)
- {
- if ((*cur <= 0x20) || (*cur >= 0x80))
- {
- strncpy(out, in, outlen);
- my_free(test);
- return min(outlen, strlen(out));
- }
- ++cur;
- }
-
- strncpy(out, test, outlen);
- my_free(test);
- return min(outlen, strlen(out));
-}
-
-void db2i_table::filenameToTablename(const char* in, char* out, size_t outlen)
-{
- if (strchr(in, '#') == NULL)
- {
- smartFilenameToTableName(in, out, outlen);
- return;
- }
-
- char* temp = (char*)sql_alloc(outlen);
-
- const char* part1, *part2, *part3, *part4;
- part1 = in;
- part2 = strstr(part1, "#P#");
- if (part2);
- {
- part3 = part2 + 3;
- part4 = strchr(part3, '#');
- if (!part4)
- part4 = strend(in);
- }
-
- memcpy(temp, part1, min(outlen, part2 - part1));
- temp[min(outlen-1, part2-part1)] = 0;
-
- int32 accumLen = smartFilenameToTableName(temp, out, outlen);
-
- if (part2 && (accumLen + 4 < outlen))
- {
- strcat(out, "#P#");
- accumLen += 4;
-
- memset(temp, 0, min(outlen, part2-part1));
- memcpy(temp, part3, min(outlen, part4-part3));
- temp[min(outlen-1, part4-part3)] = 0;
-
- accumLen += smartFilenameToTableName(temp, strend(out), outlen-accumLen);
-
- if (part4 && (accumLen + (strend(in) - part4 + 1) < outlen))
- {
- strcat(out, part4);
- }
- }
-}
-
-void db2i_table::getDB2LibNameFromPath(const char* path, char* lib, NameFormatFlags format)
-{
- if (strstr(path, mysql_tmpdir) == path)
- {
- strcpy(lib, DB2I_TEMP_TABLE_SCHEMA);
- }
- else
- {
- const char* c = strend(path) - 1;
- while (c > path && *c != '\\' && *c != '/')
- --c;
-
- if (c != path)
- {
- const char* dbEnd = c;
- do {
- --c;
- } while (c >= path && *c != '\\' && *c != '/');
-
- if (c >= path)
- {
- const char* dbStart = c+1;
- char fileName[FN_REFLEN];
- memcpy(fileName, dbStart, dbEnd - dbStart);
- fileName[dbEnd-dbStart] = 0;
-
- char dbName[MAX_DB2_SCHEMANAME_LENGTH+1];
- filenameToTablename(fileName, dbName , sizeof(dbName));
-
- convertMySQLNameToDB2Name(dbName, lib, sizeof(dbName), true, (format==ASCII_SQL) );
- }
- else
- DBUG_ASSERT(0); // This should never happen!
- }
- }
-}
-
-void db2i_table::getDB2FileNameFromPath(const char* path, char* file, NameFormatFlags format)
-{
- const char* fileEnd = strend(path);
- const char* c = fileEnd;
- while (c > path && *c != '\\' && *c != '/')
- --c;
-
- if (c != path)
- {
- const char* fileStart = c+1;
- char fileName[FN_REFLEN];
- memcpy(fileName, fileStart, fileEnd - fileStart);
- fileName[fileEnd - fileStart] = 0;
- char db2Name[MAX_DB2_FILENAME_LENGTH+1];
- filenameToTablename(fileName, db2Name, sizeof(db2Name));
- convertMySQLNameToDB2Name(db2Name, file, sizeof(db2Name), true, (format==ASCII_SQL) );
- }
-}
-
-// Generates the DB2 index name when given the MySQL index and table names.
-int32 db2i_table::appendQualifiedIndexFileName(const char* indexName,
- const char* tableName,
- String& to,
- NameFormatFlags format,
- enum_DB2I_INDEX_TYPE type)
-{
- char generatedName[MAX_DB2_FILENAME_LENGTH+1];
- strncpy(generatedName, indexName, DB2I_INDEX_NAME_LENGTH_TO_PRESERVE);
- generatedName[DB2I_INDEX_NAME_LENGTH_TO_PRESERVE] = 0;
- char* endOfGeneratedName;
-
- if (type == typeDefault)
- {
- strcat(generatedName, DB2I_DEFAULT_INDEX_NAME_DELIMITER);
- endOfGeneratedName = strend(generatedName);
- }
- else if (type != typeNone)
- {
- strcat(generatedName, DB2I_ADDL_INDEX_NAME_DELIMITER);
- endOfGeneratedName = strend(generatedName);
- *(endOfGeneratedName-2) = char(type);
- }
-
- uint lenWithoutFile = endOfGeneratedName - generatedName;
-
- char strippedTableName[MAX_DB2_FILENAME_LENGTH+1];
- if (format == ASCII_SQL)
- {
- strcpy(strippedTableName, tableName);
- stripExtraQuotes(strippedTableName+1, sizeof(strippedTableName));
- tableName = strippedTableName;
- }
-
- if (strlen(tableName) > (MAX_DB2_FILENAME_LENGTH-lenWithoutFile))
- return -1;
-
- strncat(generatedName,
- tableName+1,
- min(strlen(tableName), (MAX_DB2_FILENAME_LENGTH-lenWithoutFile))-2 );
-
- char finalName[MAX_DB2_FILENAME_LENGTH+1];
- convertMySQLNameToDB2Name(generatedName, finalName, sizeof(finalName), true, (format==ASCII_SQL));
- to.append(finalName);
-
- return 0;
-}
-
-
-void db2i_table::findConversionDefinition(enum_conversionDirection direction, uint16 fieldID)
-{
- getConversion(direction,
- mysqlTable->field[fieldID]->charset(),
- db2Field(fieldID).getCCSID(),
- conversionDefinitions[direction][fieldID]);
-}
-
-
-db2i_file::db2i_file(db2i_table* table) : db2Table(table)
-{
- commonCtorInit();
-
- DBUG_ASSERT(table->getMySQLTable()->table_name.length <= MAX_DB2_FILENAME_LENGTH-2);
-
- db2FileName = (char*)table->getDB2TableName(db2i_table::EBCDIC_NATIVE);
-}
-
-db2i_file::db2i_file(db2i_table* table, int index) : db2Table(table)
-{
- commonCtorInit();
-
- if ((index == table->getMySQLTable()->primary_key) && !table->isTemporary())
- {
- db2FileName = (char*)table->getDB2TableName(db2i_table::EBCDIC_NATIVE);
- }
- else
- {
- // Generate the index name (in index___table form); quote and EBCDICize it.
- String qualifiedPath;
- qualifiedPath.length(0);
-
- const char* asciiFileName = table->getDB2TableName(db2i_table::ASCII_NATIVE);
-
- db2i_table::appendQualifiedIndexFileName(table->getMySQLTable()->key_info[index].name,
- asciiFileName,
- qualifiedPath,
- db2i_table::ASCII_NATIVE,
- typeDefault);
-
- db2FileName = (char*)my_malloc(qualifiedPath.length()+1, MYF(MY_WME | MY_ZEROFILL));
- convToEbcdic(qualifiedPath.ptr(), db2FileName, qualifiedPath.length());
- }
-}
-
-void db2i_file::commonCtorInit()
-{
- masterDefn = 0;
- memset(&formats, 0, maxRowFormats*sizeof(RowFormat));
-}
-
-
-void db2i_file::fillILEDefn(ShrDef* defn, bool readInArrivalSeq)
-{
- defn->ObjNamLen = strlen(db2FileName);
- DBUG_ASSERT(defn->ObjNamLen <= sizeof(defn->ObjNam));
- memcpy(defn->ObjNam, db2FileName, defn->ObjNamLen);
- defn->ArrSeq[0] = (readInArrivalSeq ? QMY_YES : QMY_NO);
-}
-
diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h
deleted file mode 100644
index 6cc6ae8947b..00000000000
--- a/storage/ibmdb2i/db2i_file.h
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_FILE_H
-#define DB2I_FILE_H
-
-#include "db2i_global.h"
-#include "db2i_ileBridge.h"
-#include "db2i_validatedPointer.h"
-#include "my_atomic.h"
-#include "db2i_iconv.h"
-#include "db2i_charsetSupport.h"
-
-const char FID_EXT[] = ".FID";
-
-class db2i_file;
-
-#pragma pack(1)
-struct DB2LobField
-{
- char reserved1;
- uint32 length;
- char reserved2[4];
- uint32 ordinal;
- ILEMemHandle dataHandle;
- char reserved3[8];
-};
-#pragma pack(pop)
-
-class DB2Field
-{
- public:
- uint16 getType() const { return *(uint16*)(&definition.ColType); }
- uint16 getByteLengthInRecord() const { return definition.ColLen; }
- uint16 getDataLengthInRecord() const
- {
- return (getType() == QMY_VARCHAR || getType() == QMY_VARGRAPHIC ? definition.ColLen - 2 : definition.ColLen);
- }
- uint16 getCCSID() const { return *(uint16*)(&definition.ColCCSID); }
- bool isBlob() const
- {
- uint16 type = getType();
- return (type == QMY_BLOBCLOB || type == QMY_DBCLOB);
- }
- uint16 getBufferOffset() const { return definition.ColBufOff; }
- uint16 calcBlobPad() const
- {
- DBUG_ASSERT(isBlob());
- return getByteLengthInRecord() - sizeof (DB2LobField);
- }
- DB2LobField* asBlobField(char* buf) const
- {
- DBUG_ASSERT(isBlob());
- return (DB2LobField*)(buf + getBufferOffset() + calcBlobPad());
- }
- private:
- col_def_t definition;
-};
-
-
-/**
- @class db2i_table
-
- @details
- This class describes the logical SQL table provided by DB2.
- It stores "table-scoped" information such as the name of the
- DB2 schema, BLOB descriptions, and the corresponding MySQL table definition.
- Only one instance exists per SQL table.
-*/
-class db2i_table
-{
- public:
- enum NameFormatFlags
- {
- ASCII_SQL,
- ASCII_NATIVE,
- EBCDIC_NATIVE
- };
-
- db2i_table(const TABLE_SHARE* myTable, const char* path = NULL);
-
- ~db2i_table();
-
- int32 initDB2Objects(const char* path);
-
- const TABLE_SHARE* getMySQLTable() const
- {
- return mysqlTable;
- }
-
- uint64 getStartId() const
- {
- return db2StartId;
- }
-
- void updateStartId(uint64 newStartId)
- {
- db2StartId = newStartId;
- }
-
- bool hasBlobs() const
- {
- return (blobFieldCount > 0);
- }
-
- uint16 getBlobCount() const
- {
- return blobFieldCount;
- }
-
- uint getBlobFieldActualSize(uint fieldIndex) const
- {
- return blobFieldActualSizes[getBlobIdFromField(fieldIndex)];
- }
-
- void updateBlobFieldActualSize(uint fieldIndex, uint32 newSize)
- {
- // It's OK that this isn't threadsafe, since this is just an advisory
- // value. If a race condition causes the lesser of two values to be stored,
- // that's OK.
- uint16 blobID = getBlobIdFromField(fieldIndex);
- DBUG_ASSERT(blobID < blobFieldCount);
-
- if (blobFieldActualSizes[blobID] < newSize)
- {
- blobFieldActualSizes[blobID] = newSize;
- }
- }
-
-
-
- const char* getDB2LibName(NameFormatFlags format = EBCDIC_NATIVE)
- {
- switch (format)
- {
- case EBCDIC_NATIVE:
- return db2LibNameEbcdic; break;
- case ASCII_NATIVE:
- return db2LibNameAscii; break;
- case ASCII_SQL:
- return db2LibNameSQLAscii; break;
- default:
- DBUG_ASSERT(0);
- }
- return NULL;
- }
-
- const char* getDB2TableName(NameFormatFlags format = EBCDIC_NATIVE) const
- {
- switch (format)
- {
- case EBCDIC_NATIVE:
- return db2TableNameEbcdic; break;
- case ASCII_NATIVE:
- return db2TableNameAscii; break;
- case ASCII_SQL:
- return db2TableNameAscii; break;
- break;
- default:
- DBUG_ASSERT(0);
- }
- return NULL;
- }
-
- DB2Field& db2Field(int fieldID) const { return db2Fields[fieldID]; }
- DB2Field& db2Field(const Field* field) const { return db2Field(field->field_index); }
-
- void processFormatSpace();
-
- void* getFormatSpace(size_t& spaceNeeded)
- {
- DBUG_ASSERT(formatSpace == NULL);
- spaceNeeded = sizeof(format_hdr_t) + mysqlTable->fields * sizeof(DB2Field);
- formatSpace.alloc(spaceNeeded);
- return (void*)formatSpace;
- }
-
- bool isTemporary() const
- {
- return isTemporaryTable;
- }
-
- void getDB2QualifiedName(char* to);
- static void getDB2LibNameFromPath(const char* path, char* lib, NameFormatFlags format=ASCII_SQL);
- static void getDB2FileNameFromPath(const char* path, char* file, NameFormatFlags format=ASCII_SQL);
- static void getDB2QualifiedNameFromPath(const char* path, char* to);
- static int32 appendQualifiedIndexFileName(const char* indexName,
- const char* tableName,
- String& to,
- NameFormatFlags format=ASCII_SQL,
- enum_DB2I_INDEX_TYPE type=typeDefault);
-
- uint16 getBlobIdFromField(uint16 fieldID) const
- {
- for (int i = 0; i < blobFieldCount; ++i)
- {
- if (blobFields[i] == fieldID)
- return i;
- }
- DBUG_ASSERT(0);
- return 0;
- }
-
- iconv_t& getConversionDefinition(enum_conversionDirection direction,
- uint16 fieldID)
- {
- if (conversionDefinitions[direction][fieldID] == (iconv_t)(-1))
- findConversionDefinition(direction, fieldID);
-
- return conversionDefinitions[direction][fieldID];
- }
-
- const db2i_file* dataFile() const
- {
- return physicalFile;
- }
-
- const db2i_file* indexFile(uint idx) const
- {
- return logicalFiles[idx];
- }
-
- const char* getFileLevelID() const
- {
- return fileLevelID;
- }
-
- static void deleteAssocFiles(const char* name);
- static void renameAssocFiles(const char* from, const char* to);
-
- int fastInitForCreate(const char* path);
- int initDiscoveredTable(const char* path);
-
- uint16* blobFields;
-
-private:
-
- void findConversionDefinition(enum_conversionDirection direction, uint16 fieldID);
- static void filenameToTablename(const char* in, char* out, size_t outlen);
- static size_t smartFilenameToTableName(const char *in, char* out, size_t outlen);
- void convertNativeToSQLName(const char* input,
- char* output)
- {
-
- output[0] = input[0];
-
- uint o = 1;
- uint i = 1;
- do
- {
- output[o++] = input[i];
- if (input[i] == '"' && input[i+1])
- output[o++] = '"';
- } while (input[++i]);
-
- output[o] = 0; // This isn't the most user-friendly way to handle overflows,
- // but at least its safe.
- }
-
- bool doFileIDsMatch(const char* path);
-
- ValidatedPointer<format_hdr_t> formatSpace;
- DB2Field* db2Fields;
- uint64 db2StartId; // Starting value for identity column
- uint16 blobFieldCount; // Count of LOB fields in the DB2 table
- uint* blobFieldActualSizes; // Array of LOB field lengths (actual vs. allocated).
- // This is updated as LOBs are read and will contain
- // the length of the longest known LOB in that field.
- iconv_t* conversionDefinitions[2];
-
- const TABLE_SHARE* mysqlTable;
- uint16 logicalFileCount;
- char* db2LibNameEbcdic; // Quoted and in EBCDIC
- char* db2LibNameAscii;
- char* db2TableNameEbcdic;
- char* db2TableNameAscii;
- char* db2TableNameSQLAscii;
- char* db2LibNameSQLAscii;
-
- db2i_file* physicalFile;
- db2i_file** logicalFiles;
-
- bool isTemporaryTable;
- char fileLevelID[13];
-};
-
-/**
- @class db2i_file
-
- @details This class describes a file object underlaying a particular SQL
- table. Both "physical files" (data) and "logical files" (indices) are
- described by this class. Only one instance of the class exists per DB2 file
- object. The single instance is responsible for de/allocating the multiple
- handles used by the handlers.
-*/
-class db2i_file
-{
-
-public:
- struct RowFormat
- {
- uint16 readRowLen;
- uint16 readRowNullOffset;
- uint16 writeRowLen;
- uint16 writeRowNullOffset;
- char inited;
- };
-
-public:
-
- // Construct an instance for a physical file.
- db2i_file(db2i_table* table);
-
- // Construct an instance for a logical file.
- db2i_file(db2i_table* table, int index);
-
- ~db2i_file()
- {
- if (masterDefn)
- db2i_ileBridge::getBridgeForThread()->deallocateFile(masterDefn);
-
- if (db2FileName != (char*)db2Table->getDB2TableName(db2i_table::EBCDIC_NATIVE))
- my_free(db2FileName);
- }
-
- // This is roughly equivalent to an "open". It tells ILE to allocate a descriptor
- // for the file. The associated handle is returned to the caller.
- int allocateNewInstance(FILE_HANDLE* newHandle, ILEMemHandle inuseSpace) const
- {
- int rc;
-
- rc = db2i_ileBridge::getBridgeForThread()->allocateFileInstance(masterDefn,
- inuseSpace,
- newHandle);
-
- if (rc) *newHandle = 0;
-
- return rc;
- }
-
- // This obtains the row layout associated with a particular access intent for
- // an open instance of the file.
- int obtainRowFormat(FILE_HANDLE instanceHandle,
- char intent,
- char commitLevel,
- const RowFormat** activeFormat) const
- {
- DBUG_ENTER("db2i_file::obtainRowFormat");
- RowFormat* rowFormat;
-
- if (intent == QMY_UPDATABLE)
- rowFormat = &(formats[readWrite]);
- else if (intent == QMY_READ_ONLY)
- rowFormat = &(formats[readOnly]);
-
- if (unlikely(!rowFormat->inited))
- {
- int rc = db2i_ileBridge::getBridgeForThread()->
- initFileForIO(instanceHandle,
- intent,
- commitLevel,
- &(rowFormat->writeRowLen),
- &(rowFormat->writeRowNullOffset),
- &(rowFormat->readRowLen),
- &(rowFormat->readRowNullOffset));
- if (rc) DBUG_RETURN(rc);
- rowFormat->inited = 1;
- }
-
- *activeFormat = rowFormat;
- DBUG_RETURN(0);
- }
-
- const char* getDB2FileName() const
- {
- return db2FileName;
- }
-
- void fillILEDefn(ShrDef* defn, bool readInArrivalSeq);
-
- void setMasterDefnHandle(FILE_HANDLE handle)
- {
- masterDefn = handle;
- }
-
- FILE_HANDLE getMasterDefnHandle() const
- {
- return masterDefn;
- }
-
-private:
- enum RowFormats
- {
- readOnly = 0,
- readWrite,
- maxRowFormats
- };
-
- mutable RowFormat formats[maxRowFormats];
-
- void commonCtorInit();
-
- char* db2FileName; // Quoted and in EBCDIC
-
- db2i_table* db2Table; // The logical SQL table contained by this file.
-
- bool db2CanSort;
-
- FILE_HANDLE masterDefn;
-};
-
-
-#endif
diff --git a/storage/ibmdb2i/db2i_global.h b/storage/ibmdb2i/db2i_global.h
deleted file mode 100644
index 1cf8a9a7c61..00000000000
--- a/storage/ibmdb2i/db2i_global.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_GLOBAL_H
-#define DB2I_GLOBAL_H
-
-#define MYSQL_SERVER 1
-
-#include "my_global.h"
-#include "my_sys.h"
-
-const uint MAX_DB2_KEY_PARTS=120;
-const int MAX_DB2_V5R4_LIBNAME_LENGTH = 10;
-const int MAX_DB2_V6R1_LIBNAME_LENGTH = 30;
-const int MAX_DB2_SCHEMANAME_LENGTH=258;
-const int MAX_DB2_FILENAME_LENGTH=258;
-const int MAX_DB2_COLNAME_LENGTH=128;
-const int MAX_DB2_SAVEPOINTNAME_LENGTH=128;
-const int MAX_DB2_QUALIFIEDNAME_LENGTH=MAX_DB2_V6R1_LIBNAME_LENGTH + 1 + MAX_DB2_FILENAME_LENGTH;
-const uint32 MAX_CHAR_LENGTH = 32765;
-const uint32 MAX_VARCHAR_LENGTH = 32739;
-const uint32 MAX_DEC_PRECISION = 63;
-const uint32 MAX_BLOB_LENGTH = 2147483646;
-const uint32 MAX_BINARY_LENGTH = MAX_CHAR_LENGTH;
-const uint32 MAX_VARBINARY_LENGTH = MAX_VARCHAR_LENGTH;
-const uint32 MAX_FULL_ALLOCATE_BLOB_LENGTH = 65536;
-const uint32 MAX_FOREIGN_LEN = 64000;
-const char* DB2I_TEMP_TABLE_SCHEMA = "QTEMP";
-const char DB2I_ADDL_INDEX_NAME_DELIMITER[5] = {'_','_','_','_','_'};
-const char DB2I_DEFAULT_INDEX_NAME_DELIMITER[3] = {'_','_','_'};
-const int DB2I_INDEX_NAME_LENGTH_TO_PRESERVE = 110;
-
-enum enum_DB2I_INDEX_TYPE
-{
- typeNone = 0,
- typeDefault = 'D',
- typeHex = 'H',
- typeAscii = 'A'
-};
-
-void* roundToQuadWordBdy(void* ptr)
-{
- return (void*)(((uint64)(ptr)+0xf) & ~0xf);
-}
-
-typedef uint64_t ILEMemHandle;
-
-struct OSVersion
-{
- uint8 v;
- uint8 r;
-};
-extern OSVersion osVersion;
-
-
-/**
- Allocate 16-byte aligned space using the MySQL heap allocator
-
- @details Many of the spaces used by the QMY_* APIS are required to be
- aligned on 16 byte boundaries. The standard system malloc will do this
- alignment by default. However, in order to use the heap debug and tracking
- features of the mysql allocator, we chose to implement an aligning wrapper
- around my_malloc. Essentially, we overallocate the storage space, find the
- first aligned address in the space, store a pointer to the true malloc
- allocation in the bytes immediately preceding the aligned address, and return
- the aligned address to the caller.
-
- @parm size The size of heap storage needed
-
- @return A 16-byte aligned pointer to the storage requested.
-*/
-void* malloc_aligned(size_t size)
-{
- char* p;
- char* base;
- base = (char*)my_malloc(size + sizeof(void*) + 15, MYF(MY_WME));
- if (likely(base))
- {
- p = (char*)roundToQuadWordBdy(base + sizeof(void*));
- char** p2 = (char**)(p - sizeof(void*));
- *p2 = base;
- }
- else
- p = NULL;
-
- return p;
-}
-
-/**
- Free a 16-byte aligned space alloced by malloc_aligned
-
- @details We know that a pointer to the true malloced storage immediately
- precedes the aligned address, so we pull that out and call my_free().
-
- @parm p A 16-byte aligned pointer generated by malloc_aligned
-*/
-void free_aligned(void* p)
-{
- if (likely(p))
- {
- my_free(*(char**)((char*)p-sizeof(void*)));
- }
-}
-
-#endif
diff --git a/storage/ibmdb2i/db2i_iconv.h b/storage/ibmdb2i/db2i_iconv.h
deleted file mode 100644
index 9fc6e4ed636..00000000000
--- a/storage/ibmdb2i/db2i_iconv.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-/**
- @file
-
- @brief Used to redefine iconv symbols to the optimized "myconv" ones
-*/
-
-#ifndef DB2I_ICONV_H
-#define DB2I_ICONV_H
-
-#include "db2i_myconv.h"
-#define iconv_open(A, B) myconv_open(A, B, CONVERTER_DMAP)
-#define iconv_close myconv_close
-#define iconv myconv_dmap
-#define iconv_t myconv_t
-
-#endif
diff --git a/storage/ibmdb2i/db2i_ileBridge.cc b/storage/ibmdb2i/db2i_ileBridge.cc
deleted file mode 100644
index fac98dd7107..00000000000
--- a/storage/ibmdb2i/db2i_ileBridge.cc
+++ /dev/null
@@ -1,1342 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#include "db2i_ileBridge.h"
-#include "my_dbug.h"
-#include "db2i_global.h"
-#include "db2i_charsetSupport.h"
-#include "db2i_errors.h"
-
-
-// static class member data
-ILEpointer* db2i_ileBridge::functionSymbols;
-db2i_ileBridge* db2i_ileBridge::globalBridge;
-#ifndef DBUG_OFF
-uint32 db2i_ileBridge::registeredPtrs;
-#endif
-
-pthread_key(IleParms*, THR_ILEPARMS);
-
-static void ileParmsDtor(void* parmsToFree)
-{
- if (parmsToFree)
- {
- free_aligned(parmsToFree);
- DBUG_PRINT("db2i_ileBridge", ("Freeing space for parms"));
- }
-}
-
-
-/**
- Convert a timestamp in ILE time format into a unix time_t
-*/
-static inline time_t convertILEtime(const ILE_time_t& input)
-{
- tm temp;
-
- temp.tm_sec = input.Second;
- temp.tm_min = input.Minute;
- temp.tm_hour = input.Hour;
- temp.tm_mday = input.Day;
- temp.tm_mon = input.Month-1;
- temp.tm_year = input.Year - 1900;
- temp.tm_isdst = -1;
-
- return mktime(&temp);
-}
-
-/**
- Allocate and intialize a new bridge structure
-*/
-db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE connID)
-{
- DBUG_PRINT("db2i_ileBridge::createNewBridge",("Building new bridge..."));
- db2i_ileBridge* newBridge = (db2i_ileBridge*)my_malloc(sizeof(db2i_ileBridge), MYF(MY_WME));
-
- if (unlikely(newBridge == NULL))
- return NULL;
-
- newBridge->stmtTxActive = false;
- newBridge->connErrText = NULL;
- newBridge->pendingLockedHandles.head = NULL;
- newBridge->cachedConnectionID = connID;
-
- return newBridge;
-}
-
-
-void db2i_ileBridge::destroyBridge(db2i_ileBridge* bridge)
-{
- bridge->freeErrorStorage();
- my_free(bridge);
-}
-
-
-void db2i_ileBridge::destroyBridgeForThread(const THD* thd)
-{
- void* thdData = *thd_ha_data(thd, ibmdb2i_hton);
- if (thdData != NULL)
- {
- destroyBridge((db2i_ileBridge*)thdData);
- }
-}
-
-
-void db2i_ileBridge::registerPtr(const void* ptr, ILEMemHandle* receiver)
-{
- static const arg_type_t ileSignature[] = { ARG_MEMPTR, ARG_END };
-
- if (unlikely(ptr == NULL))
- {
- *receiver = 0;
- return;
- }
-
- struct ArgList
- {
- ILEarglist_base base;
- ILEpointer ptr;
- } *arguments;
-
- char argBuf[sizeof(ArgList)+15];
- arguments = (ArgList*)roundToQuadWordBdy(argBuf);
-
- arguments->ptr.s.addr = (address64_t)(ptr);
-
- _ILECALL(&functionSymbols[funcRegisterSpace],
- &arguments->base,
- ileSignature,
- RESULT_INT64);
-
-#ifndef DBUG_OFF
- uint32 truncHandle = arguments->base.result.r_uint64;
- DBUG_PRINT("db2i_ileBridge::registerPtr",("Register 0x%p with handle %d", ptr, truncHandle));
- getBridgeForThread()->registeredPtrs++;
-#endif
-
- *receiver = arguments->base.result.r_uint64;
- return;
-}
-
-void db2i_ileBridge::unregisterPtr(ILEMemHandle handle)
-{
- static const arg_type_t ileSignature[] = { ARG_UINT64, ARG_END };
-
- if (unlikely(handle == NULL))
- return;
-
- struct ArgList
- {
- ILEarglist_base base;
- uint64 handle;
- } *arguments;
-
- char argBuf[sizeof(ArgList)+15];
- arguments = (ArgList*)roundToQuadWordBdy(argBuf);
-
- arguments->handle = (uint64)(handle);
-
- _ILECALL(&functionSymbols[funcUnregisterSpace],
- &arguments->base,
- ileSignature,
- RESULT_VOID);
-
-#ifndef DBUG_OFF
- DBUG_PRINT("db2i_ileBridge::unregisterPtr",("Unregister handle %d", (uint32)handle));
- getBridgeForThread()->registeredPtrs--;
-#endif
-}
-
-
-
-/**
- Initialize the bridge component
-
- @details Resolves srvpgm and function names of the APIs. If this fails,
- the approrpiate operating system support (PTFs) is probably not installed.
-
- WARNING:
- Must be called before any other functions in this class are used!!!!
- Can only be called by a single thread!
-*/
-int db2i_ileBridge::setup()
-{
- static const char funcNames[db2i_ileBridge::funcListEnd][32] =
- {
- {"QmyRegisterParameterSpaces"},
- {"QmyRegisterSpace"},
- {"QmyUnregisterSpace"},
- {"QmyProcessRequest"}
- };
-
- DBUG_ENTER("db2i_ileBridge::setup");
-
- int actmark = _ILELOAD("QSYS/QMYSE", ILELOAD_LIBOBJ);
- if ( actmark == -1 )
- {
- DBUG_PRINT("db2i_ileBridge::setup", ("srvpgm activation failed"));
- DBUG_RETURN(1);
- }
-
- functionSymbols = (ILEpointer*)malloc_aligned(sizeof(ILEpointer) * db2i_ileBridge::funcListEnd);
-
- for (int i = 0; i < db2i_ileBridge::funcListEnd; i++)
- {
- if (_ILESYM(&functionSymbols[i], actmark, funcNames[i]) == -1)
- {
- DBUG_PRINT("db2i_ileBridge::setup",
- ("resolve of %s failed", funcNames[i]));
- DBUG_RETURN(errno);
- }
- }
-
- pthread_key_create(&THR_ILEPARMS, &ileParmsDtor);
-
-#ifndef DBUG_OFF
- registeredPtrs = 0;
-#endif
-
- globalBridge = createNewBridge(0);
-
- DBUG_RETURN(0);
-}
-
-/**
- Cleanup any resources before shutting down plug-in
-*/
-void db2i_ileBridge::takedown()
-{
- if (globalBridge)
- destroyBridge(globalBridge);
- free_aligned(functionSymbols);
-}
-
-/**
- Call off to QmyProcessRequest to perform the API that the caller prepared
-*/
-inline int32 db2i_ileBridge::doIt()
-{
- static const arg_type_t ileSignature[] = {ARG_END};
-
- struct ArgList
- {
- ILEarglist_base base;
- } *arguments;
-
- char argBuf[sizeof(ArgList)+15];
- arguments = (ArgList*)roundToQuadWordBdy(argBuf);
-
- _ILECALL(&functionSymbols[funcProcessRequest],
- &arguments->base,
- ileSignature,
- RESULT_INT32);
-
- return translateErrorCode(arguments->base.result.s_int32.r_int32);
-}
-
-/**
- Call off to QmyProcessRequest to perform the API that the caller prepared and
- log any errors that may occur.
-*/
-inline int32 db2i_ileBridge::doItWithLog()
-{
- int32 rc = doIt();
-
- if (unlikely(rc))
- {
- // Only report errors that we weren't expecting
- if (rc != tacitErrors[0] &&
- rc != tacitErrors[1] &&
- rc != QMY_ERR_END_OF_BLOCK)
- reportSystemAPIError(rc, (Qmy_Error_output_t*)parms()->outParms);
- }
- memset(tacitErrors, 0, sizeof(tacitErrors));
-
- return rc;
-}
-
-
-/**
- Interface to QMY_ALLOCATE_SHARE API
-
- See QMY_ALLOCATE_SHARE documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::allocateFileDefn(ILEMemHandle definitionSpace,
- ILEMemHandle handleSpace,
- uint16 fileCount,
- const char* schemaName,
- uint16 schemaNameLength,
- ILEMemHandle formatSpace,
- uint32 formatSpaceLen)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
-
- IleParms* parmBlock = parms();
- Qmy_MAOS0100 *input = (Qmy_MAOS0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_ALLOCATE_SHARE;
- input->ShrDefSpcHnd = definitionSpace;
- input->ShrHndSpcHnd = handleSpace;
- input->ShrDefCnt = fileCount;
- input->FmtSpcHnd = formatSpace;
- input->FmtSpcLen = formatSpaceLen;
-
- if (schemaNameLength > sizeof(input->SchNam))
- {
- // This should never happen!
- DBUG_ASSERT(0);
- return HA_ERR_GENERIC;
- }
-
- memcpy(input->SchNam, schemaName, schemaNameLength);
- input->SchNamLen = schemaNameLength;
-
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_ALLOCATE_INSTANCE API
-
- See QMY_ALLOCATE_INSTANCE documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::allocateFileInstance(FILE_HANDLE defnHandle,
- ILEMemHandle inuseSpace,
- FILE_HANDLE* instance)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
-
- IleParms* parmBlock = parms();
- Qmy_MAOI0100 *input = (Qmy_MAOI0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_ALLOCATE_INSTANCE;
- input->ShrHnd = defnHandle;
- input->CnnHnd = cachedConnectionID;
- input->UseSpcHnd = inuseSpace;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MAOI0100_output* output = (Qmy_MAOI0100_output*)parmBlock->outParms;
- DBUG_ASSERT(instance);
- *instance = output->ObjHnd;
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_DEALLOCATE_OBJECT API
-
- See QMY_DEALLOCATE_OBJECT documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::deallocateFile(FILE_HANDLE rfileHandle,
- bool postDropTable)
-{
- IleParms* parmBlock = parms();
- Qmy_MDLC0100 *input = (Qmy_MDLC0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DEALLOCATE_OBJECT;
- input->ObjHnd = rfileHandle;
- input->ObjDrp[0] = (postDropTable ? QMY_YES : QMY_NO);
-
- DBUG_PRINT("db2i_ileBridge::deallocateFile", ("Deallocating %d", (uint32)rfileHandle));
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_OBJECT_INITIALIZATION API
-
- See QMY_OBJECT_INITIALIZATION documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::initFileForIO(FILE_HANDLE rfileHandle,
- char accessIntent,
- char commitLevel,
- uint16* inRecSize,
- uint16* inRecNullOffset,
- uint16* outRecSize,
- uint16* outRecNullOffset)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MOIX0100 *input = (Qmy_MOIX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_OBJECT_INITIALIZATION;
- input->CmtLvl[0] = commitLevel;
- input->Intent[0] = accessIntent;
- input->ObjHnd = rfileHandle;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MOIX0100_output* output = (Qmy_MOIX0100_output*)parmBlock->outParms;
- *inRecSize = output->InNxtRowOff;
- *inRecNullOffset = output->InNullMapOff;
- *outRecSize = output->OutNxtRowOff;
- *outRecNullOffset = output->OutNullMapOff;
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_READ_ROWS API for reading a row with a specific RRN.
-
- See QMY_READ_ROWS documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::readByRRN(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- uint32 inRRN,
- char accessIntent,
- char commitLevel)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MRDX0100 *input = (Qmy_MRDX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_READ_ROWS;
- input->CmtLvl[0] = commitLevel;
- input->ObjHnd = rfileHandle;
- input->Intent[0] = accessIntent;
- input->OutSpcHnd = (uint64)buf;
- input->RelRowNbr = inRRN;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- if (rc == QMY_ERR_END_OF_BLOCK)
- {
- rc = 0;
- DBUG_PRINT("db2i_ileBridge::readByRRN", ("End of block signalled"));
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_WRITE_ROWS API.
-
- See QMY_WRITE_ROWS documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::writeRows(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- char commitLevel,
- int64* outIdVal,
- bool* outIdGen,
- uint32* dupKeyRRN,
- char** dupKeyName,
- uint32* dupKeyNameLen,
- uint32* outIdIncrement)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MWRT0100 *input = (Qmy_MWRT0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_WRITE_ROWS;
- input->CmtLvl[0] = commitLevel;
-
- input->ObjHnd = rfileHandle;
- input->InSpcHnd = (uint64_t) buf;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- Qmy_MWRT0100_output_t* output = (Qmy_MWRT0100_output_t*)parmBlock->outParms;
- if (likely(rc == 0 || rc == HA_ERR_FOUND_DUPP_KEY))
- {
- DBUG_ASSERT(dupKeyRRN && dupKeyName && dupKeyNameLen && outIdGen && outIdIncrement && outIdVal);
- *dupKeyRRN = output->DupRRN;
- *dupKeyName = (char*)parmBlock->outParms + output->DupObjNamOff;
- *dupKeyNameLen = output->DupObjNamLen;
- *outIdGen = (output->NewIdGen[0] == QMY_YES ? TRUE : FALSE);
- if (*outIdGen == TRUE)
- {
- *outIdIncrement = output->IdIncrement;
- *outIdVal = output->NewIdVal;
- }
- }
-
- return rc;
-
-}
-
-/**
- Interface to QMY_EXECUTE_IMMEDIATE API.
-
- See QMY_EXECUTE_IMMEDIATE documentation for more information about
- parameters and return codes.
-*/
-uint32 db2i_ileBridge::execSQL(const char* statement,
- uint32 statementCount,
- uint8 commitLevel,
- bool autoCreateSchema,
- bool dropSchema,
- bool noCommit,
- FILE_HANDLE fileHandle)
-
-{
- IleParms* parmBlock = parms();
- Qmy_MSEI0100 *input = (Qmy_MSEI0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_EXECUTE_IMMEDIATE;
-
- registerPtr(statement, &input->StmtsSpcHnd);
-
- input->NbrStmts = statementCount;
- *(uint16*)(&input->StmtCCSID) = 850;
- input->AutoCrtSchema[0] = (autoCreateSchema == TRUE ? QMY_YES : QMY_NO);
- input->DropSchema[0] = (dropSchema == TRUE ? QMY_YES : QMY_NO);
- input->CmtLvl[0] = commitLevel;
- if ((commitLevel == QMY_NONE && statementCount == 1) || noCommit)
- {
- input->CmtBefore[0] = QMY_NO;
- input->CmtAfter[0] = QMY_NO;
- }
- else
- {
- input->CmtBefore[0] = QMY_YES;
- input->CmtAfter[0] = QMY_YES;
- }
- input->CnnHnd = current_thd->thread_id;
- input->ObjHnd = fileHandle;
-
- int32 rc = doItWithLog();
-
- unregisterPtr(input->StmtsSpcHnd);
-
- return rc;
-}
-
-/**
- Interface to QMY_PREPARE_OPEN_CURSOR API.
-
- See QMY_PREPARE_OPEN_CURSOR documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::prepOpen(const char* statement,
- FILE_HANDLE* rfileHandle,
- uint32* recLength)
-{
- IleParms* parmBlock = parms();
- Qmy_MSPO0100 *input = (Qmy_MSPO0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_PREPARE_OPEN_CURSOR;
-
- registerPtr(statement, &input->StmtsSpcHnd );
- *(uint16*)(&input->StmtCCSID) = 850;
- input->CnnHnd = current_thd->thread_id;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MSPO0100_output* output = (Qmy_MSPO0100_output*)parmBlock->outParms;
- *rfileHandle = output->ObjHnd;
- *recLength = max(output->InNxtRowOff, output->OutNxtRowOff);
- }
-
-
- unregisterPtr(input->StmtsSpcHnd);
-
- return rc;
-}
-
-
-/**
- Interface to QMY_DELETE_ROW API.
-
- See QMY_DELETE_ROW documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::deleteRow(FILE_HANDLE rfileHandle,
- uint32 rrn)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MDLT0100 *input = (Qmy_MDLT0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DELETE_ROW;
- input->ObjHnd = rfileHandle;
- input->RelRowNbr = rrn;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_UPDATE_ROW API.
-
- See QMY_UPDATE_ROW documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::updateRow(FILE_HANDLE rfileHandle,
- uint32 rrn,
- ILEMemHandle buf,
- uint32* dupKeyRRN,
- char** dupKeyName,
- uint32* dupKeyNameLen)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MUPD0100 *input = (Qmy_MUPD0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_UPDATE_ROW;
- input->ObjHnd = rfileHandle;
- input->InSpcHnd = (uint64)buf;
- input->RelRowNbr = rrn;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- if (rc == HA_ERR_FOUND_DUPP_KEY)
- {
- Qmy_MUPD0100_output* output = (Qmy_MUPD0100_output*)parmBlock->outParms;
- DBUG_ASSERT(dupKeyRRN && dupKeyName && dupKeyNameLen);
- *dupKeyRRN = output->DupRRN;
- *dupKeyName = (char*)parmBlock->outParms + output->DupObjNamOff;
- *dupKeyNameLen = output->DupObjNamLen;
- }
-
- return rc;
-}
-
-/**
- Interface to QMY_DESCRIBE_RANGE API.
-
- See QMY_DESCRIBE_RANGE documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::recordsInRange(FILE_HANDLE defnHandle,
- ILEMemHandle inSpc,
- uint32 inKeyCnt,
- uint32 inLiteralCnt,
- uint32 inBoundsOff,
- uint32 inLitDefOff,
- uint32 inLiteralsOff,
- uint32 inCutoff,
- uint32 inSpcLen,
- uint16 inEndByte,
- uint64* outRecCnt,
- uint16* outRtnCode)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
-
- IleParms* parmBlock = parms();
- Qmy_MDRG0100 *input = (Qmy_MDRG0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DESCRIBE_RANGE;
- input->ShrHnd = defnHandle;
- input->SpcHnd = (uint64)inSpc;
- input->KeyCnt = inKeyCnt;
- input->LiteralCnt = inLiteralCnt;
- input->BoundsOff = inBoundsOff;
- input->LitDefOff = inLitDefOff;
- input->LiteralsOff = inLiteralsOff;
- input->Cutoff = inCutoff;
- input->SpcLen = inSpcLen;
- input->EndByte = inEndByte;
- input->CnnHnd = cachedConnectionID;
-
- int rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MDRG0100_output* output = (Qmy_MDRG0100_output*)parmBlock->outParms;
- DBUG_ASSERT(outRecCnt && outRtnCode);
- *outRecCnt = output->RecCnt;
- *outRtnCode = output->RtnCode;
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_RELEASE_ROW API.
-
- See QMY_RELEASE_ROW documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::rrlslck(FILE_HANDLE rfileHandle, char accessIntent)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
-
- IleParms* parmBlock = parms();
- Qmy_MRRX0100 *input = (Qmy_MRRX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_RELEASE_ROW;
-
- input->ObjHnd = rfileHandle;
- input->CnnHnd = cachedConnectionID;
- input->Intent[0] = accessIntent;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-/**
- Interface to QMY_LOCK_OBJECT API.
-
- See QMY_LOCK_OBJECT documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::lockObj(FILE_HANDLE defnHandle,
- uint64 lockVal,
- char lockAction,
- char lockType,
- char lockTimeout)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MOLX0100 *input = (Qmy_MOLX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_LOCK_OBJECT;
- input->ShrHnd = defnHandle;
- input->LckTimeoutVal = lockVal;
- input->Action[0] = lockAction;
- input->LckTyp[0] = lockType;
- input->LckTimeout[0] = lockTimeout;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-/**
- Interface to QMY_DESCRIBE_CONSTRAINTS API.
-
- See QMY_DESCRIBE_CONSTRAINTS documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::constraints(FILE_HANDLE defnHandle,
- ILEMemHandle inSpc,
- uint32 inSpcLen,
- uint32* outLen,
- uint32* outCnt)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MDCT0100 *input = (Qmy_MDCT0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DESCRIBE_CONSTRAINTS;
- input->ShrHnd = defnHandle;
- input->CstSpcHnd = (uint64)inSpc;
- input->CstSpcLen = inSpcLen;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MDCT0100_output* output = (Qmy_MDCT0100_output*)parmBlock->outParms;
- DBUG_ASSERT(outLen && outCnt);
- *outLen = output->NeededLen;
- *outCnt = output->CstCnt;
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_REORGANIZE_TABLE API.
-
- See QMY_REORGANIZE_TABLE documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::optimizeTable(FILE_HANDLE defnHandle)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MRGX0100 *input = (Qmy_MRGX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_REORGANIZE_TABLE;
- input->ShrHnd = defnHandle;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_PROCESS_COMMITMENT_CONTROL API.
-
- See QMY_PROCESS_COMMITMENT_CONTROL documentation for more information about
- parameters and return codes.
-*/
-int32 db2i_ileBridge::commitmentControl(uint8 function)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MCCX0100 *input = (Qmy_MCCX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_PROCESS_COMMITMENT_CONTROL;
- input->Function[0] = function;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_PROCESS_SAVEPOINT API.
-
- See QMY_PROCESS_SAVEPOINT documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::savepoint(uint8 function,
- const char* savepointName)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- DBUG_PRINT("db2i_ileBridge::savepoint",("%d %s", (uint32)function, savepointName));
-
- IleParms* parmBlock = parms();
- Qmy_MSPX0100 *input = (Qmy_MSPX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- char* savPtNam = (char*)(input+1);
-
- input->Format = QMY_PROCESS_SAVEPOINT;
-
- if (strlen(savepointName) > MAX_DB2_SAVEPOINTNAME_LENGTH)
- {
- DBUG_ASSERT(0);
- return HA_ERR_GENERIC;
- }
- strcpy(savPtNam, savepointName);
-
- input->Function[0] = function;
- input->SavPtNamOff = savPtNam - (char*)(input);
- input->SavPtNamLen = strlen(savepointName);
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-static ILEMemHandle traceSpcHandle;
-/**
- Do initialization for the QMY_* APIs.
-
- @parm aspName The name of the relational database to use for all
- connections.
-
- @return 0 if successful; error otherwise
-*/
-int32 db2i_ileBridge::initILE(const char* aspName,
- uint16* traceCtlPtr)
-{
- // We forego the typical thread-based parms space because MySQL doesn't
- // allow us to clean it up before checking for memory leaks. As a result
- // we get a complaint about leaked memory on server shutdown.
- int32 rc;
- char inParms[db2i_ileBridge_MAX_INPARM_SIZE];
- char outParms[db2i_ileBridge_MAX_OUTPARM_SIZE];
- if (rc = registerParmSpace(inParms, outParms))
- {
- reportSystemAPIError(rc, NULL);
- return rc;
- }
-
- registerPtr(traceCtlPtr, &traceSpcHandle);
-
- struct ParmBlock
- {
- Qmy_MINI0100 parms;
- } *parmBlock = (ParmBlock*)inParms;
-
- memset(inParms, 0, sizeof(ParmBlock));
-
- parmBlock->parms.Format = QMY_INITIALIZATION;
-
- char paddedName[18];
- if (strlen(aspName) > sizeof(paddedName))
- {
- getErrTxt(DB2I_ERR_BAD_RDB_NAME);
- return DB2I_ERR_BAD_RDB_NAME;
- }
-
- memset(paddedName, ' ', sizeof(paddedName));
- memcpy(paddedName, aspName, strlen(aspName));
- convToEbcdic(paddedName, parmBlock->parms.RDBName, strlen(paddedName));
-
- parmBlock->parms.RDBNamLen = strlen(paddedName);
- parmBlock->parms.TrcSpcHnd = traceSpcHandle;
-
- rc = doIt();
-
- if (rc)
- {
- reportSystemAPIError(rc, (Qmy_Error_output_t*)outParms);
- }
-
- return rc;
-}
-
-/**
- Signal to the QMY_ APIs to perform any cleanup they need to do.
-*/
-int32 db2i_ileBridge::exitILE()
-{
- IleParms* parmBlock = parms();
- Qmy_MCLN0100 *input = (Qmy_MCLN0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_CLEANUP;
-
- int32 rc = doIt();
-
- if (rc)
- {
- reportSystemAPIError(rc, (Qmy_Error_output_t*)parmBlock->outParms);
- }
-
- unregisterPtr(traceSpcHandle);
-
- DBUG_PRINT("db2i_ileBridge::exitILE", ("Registered ptrs remaining: %d", registeredPtrs));
-#ifndef DBUG_OFF
- if (registeredPtrs != 0)
- printf("Oh no! IBMDB2I left some pointers registered. Count was %d.\n", registeredPtrs);
-#endif
-
- // This is needed to prevent SAFE_MALLOC from complaining at process termination.
- my_pthread_setspecific_ptr(THR_ILEPARMS, NULL);
- free_aligned(parmBlock);
-
- return rc;
-
-}
-
-
-/**
- Designate the specified addresses as parameter passing buffers.
-
- @parm in Input to the API will go here; format is defined by the individual API
- @parm out Output from the API will be; format is defined by the individual API
-
- @return 0 if success; error otherwise
-*/
-int db2i_ileBridge::registerParmSpace(char* in, char* out)
-{
- static const arg_type_t ileSignature[] = { ARG_MEMPTR, ARG_MEMPTR, ARG_END };
-
- struct ArgList
- {
- ILEarglist_base base;
- ILEpointer input;
- ILEpointer output;
- } *arguments;
-
- char argBuf[sizeof(ArgList)+15];
- arguments = (ArgList*)roundToQuadWordBdy(argBuf);
-
- arguments->input.s.addr = (address64_t)(in);
- arguments->output.s.addr = (address64_t)(out);
-
- _ILECALL(&functionSymbols[funcRegisterParameterSpaces],
- &arguments->base,
- ileSignature,
- RESULT_INT32);
-
- return arguments->base.result.s_int32.r_int32;
-}
-
-
-/**
- Interface to QMY_OBJECT_OVERRIDE API.
-
- See QMY_OBJECT_OVERRIDE documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::objectOverride(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- uint32 recordWidth)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MOOX0100 *input = (Qmy_MOOX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_OBJECT_OVERRIDE;
- input->ObjHnd = rfileHandle;
- input->OutSpcHnd = (uint64)buf;
- input->NxtRowOff = recordWidth;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-/**
- Interface to QMY_DESCRIBE_OBJECT API for obtaining table stats.
-
- See QMY_DESCRIBE_OBJECT documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::retrieveTableInfo(FILE_HANDLE defnHandle,
- uint16 dataRequested,
- ha_statistics& stats,
- ILEMemHandle inSpc)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MDSO0100 *input = (Qmy_MDSO0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DESCRIBE_OBJECT;
- input->ShrHnd = defnHandle;
- input->CnnHnd = cachedConnectionID;
-
- if (dataRequested & objLength)
- input->RtnObjLen[0] = QMY_YES;
- if (dataRequested & rowCount)
- input->RtnRowCnt[0] = QMY_YES;
- if (dataRequested & deletedRowCount)
- input->RtnDltRowCnt[0] = QMY_YES;
- if (dataRequested & rowsPerKey)
- {
- input->RowKeyHnd = (uint64)inSpc;
- input->RtnRowKey[0] = QMY_YES;
- }
- if (dataRequested & meanRowLen)
- input->RtnMeanRowLen[0] = QMY_YES;
- if (dataRequested & lastModTime)
- input->RtnModTim[0] = QMY_YES;
- if (dataRequested & createTime)
- input->RtnCrtTim[0] = QMY_YES;
- if (dataRequested & ioCount)
- input->RtnEstIoCnt[0] = QMY_YES;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MDSO0100_output* output = (Qmy_MDSO0100_output*)parmBlock->outParms;
- if (dataRequested & objLength)
- stats.data_file_length = output->ObjLen;
- if (dataRequested & rowCount)
- stats.records= output->RowCnt;
- if (dataRequested & deletedRowCount)
- stats.deleted = output->DltRowCnt;
- if (dataRequested & meanRowLen)
- stats.mean_rec_length = output->MeanRowLen;
- if (dataRequested & lastModTime)
- stats.update_time = convertILEtime(output->ModTim);
- if (dataRequested & createTime)
- stats.create_time = convertILEtime(output->CrtTim);
- if (dataRequested & ioCount)
- stats.data_file_length = output->EstIoCnt;
- }
-
- return rc;
-}
-
-/**
- Interface to QMY_DESCRIBE_OBJECT API for finding index size.
-
- See QMY_DESCRIBE_OBJECT documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::retrieveIndexInfo(FILE_HANDLE defnHandle,
- uint64* outPageCnt)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MDSO0100 *input = (Qmy_MDSO0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_DESCRIBE_OBJECT;
- input->ShrHnd = defnHandle;
- input->CnnHnd = cachedConnectionID;
- input->RtnPageCnt[0] = QMY_YES;
-
- int32 rc = doItWithLog();
-
- if (likely(rc == 0))
- {
- Qmy_MDSO0100_output* output = (Qmy_MDSO0100_output*)parmBlock->outParms;
- *outPageCnt = output->PageCnt;
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_CLOSE_CONNECTION API
-
- See QMY_CLOSE_CONNECTION documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::closeConnection(CONNECTION_HANDLE conn)
-{
- IleParms* parmBlock = parms();
- Qmy_MCCN0100 *input = (Qmy_MCCN0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_CLOSE_CONNECTION;
- input->CnnHnd = conn;
-
- int32 rc = doItWithLog();
-
- return rc;
-}
-
-
-/**
- Interface to QMY_INTERRUPT API
-
- See QMY_INTERRUPT documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::readInterrupt(FILE_HANDLE fileHandle)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MINT0100 *input = (Qmy_MINT0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_INTERRUPT;
- input->CnnHnd = cachedConnectionID;
- input->ObjHnd = fileHandle;
-
- int32 rc = doItWithLog();
-
- if (rc == QMY_ERR_END_OF_BLOCK)
- {
- rc = 0;
- DBUG_PRINT("db2i_ileBridge::readInterrupt", ("End of block signalled"));
- }
-
- return rc;
-}
-
-/**
- Interface to QMY_READ_ROWS API
-
- See QMY_READ_ROWS documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::read(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- char accessIntent,
- char commitLevel,
- char orientation,
- bool asyncRead,
- ILEMemHandle rrn,
- ILEMemHandle key,
- uint32 keylen,
- uint16 keyParts,
- int pipeFD)
-{
- DBUG_ASSERT(cachedStateIsCoherent());
- IleParms* parmBlock = parms();
- Qmy_MRDX0100 *input = (Qmy_MRDX0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_READ_ROWS;
- input->CmtLvl[0] = commitLevel;
-
- input->ObjHnd = rfileHandle;
- input->Intent[0] = accessIntent;
- input->OutSpcHnd = (uint64)buf;
- input->OutRRNSpcHnd = (uint64)rrn;
- input->RtnData[0] = QMY_RETURN_DATA;
-
- if (key)
- {
- input->KeySpcHnd = (uint64)key;
- input->KeyColsLen = keylen;
- input->KeyColsNbr = keyParts;
- }
-
- input->Async[0] = (asyncRead ? QMY_YES : QMY_NO);
- input->PipeDesc = pipeFD;
- input->Orientation[0] = orientation;
- input->CnnHnd = cachedConnectionID;
-
- int32 rc = doItWithLog();
-
- // QMY_ERR_END_OF_BLOCK is informational only, so we ignore it.
- if (rc == QMY_ERR_END_OF_BLOCK)
- {
- rc = 0;
- DBUG_PRINT("db2i_ileBridge::read", ("End of block signalled"));
- }
-
- return rc;
-}
-
-
-/**
- Interface to QMY_QUIESCE_OBJECT API
-
- See QMY_QUIESCE_OBJECT documentation for more information about parameters and
- return codes.
-*/
-int32 db2i_ileBridge::quiesceFileInstance(FILE_HANDLE rfileHandle)
-{
- IleParms* parmBlock = parms();
- Qmy_MQSC0100 *input = (Qmy_MQSC0100*)&(parmBlock->inParms);
- memset(input, 0, sizeof(*input));
-
- input->Format = QMY_QUIESCE_OBJECT;
- input->ObjHnd = rfileHandle;
-
- int32 rc = doItWithLog();
-
-#ifndef DBUG_OFF
- if (unlikely(rc))
- {
- DBUG_ASSERT(0);
- }
-#endif
-
- return rc;
-}
-
-void db2i_ileBridge::PreservedHandleList::add(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share)
-{
- NameHandlePair *newPair = (NameHandlePair*)my_malloc(sizeof(NameHandlePair), MYF(MY_WME));
-
- newPair->next = head;
- head = newPair;
-
- strcpy(newPair->name, newname);
- newPair->handle = newhandle;
- newPair->share = share;
- DBUG_PRINT("db2i_ileBridge", ("Added handle %d for %s", uint32(newhandle), newname));
-}
-
-
-FILE_HANDLE db2i_ileBridge::PreservedHandleList::findAndRemove(const char* fileName, IBMDB2I_SHARE** share)
-{
- NameHandlePair* current = head;
- NameHandlePair* prev = NULL;
-
- while (current)
- {
- NameHandlePair* next = current->next;
- if (strcmp(fileName, current->name) == 0)
- {
- FILE_HANDLE tmp = current->handle;
- *share = current->share;
- if (prev)
- prev->next = next;
- if (current == head)
- head = next;
- my_free(current);
- DBUG_PRINT("db2i_ileBridge", ("Found handle %d for %s", uint32(tmp), fileName));
- return tmp;
- }
- prev = current;
- current = next;
- }
-
- return 0;
-}
-
-
-IleParms* db2i_ileBridge::initParmsForThread()
-{
-
- IleParms* p = (IleParms*)malloc_aligned(sizeof(IleParms));
- DBUG_ASSERT((uint64)(&(p->outParms))% 16 == 0); // Guarantee that outParms are aligned correctly
-
- if (likely(p))
- {
- int32 rc = registerParmSpace((p->inParms), (p->outParms));
- if (likely(rc == 0))
- {
- my_pthread_setspecific_ptr(THR_ILEPARMS, p);
- DBUG_PRINT("db2i_ileBridge", ("Inited space for parms"));
- return p;
- }
- else
- reportSystemAPIError(rc, NULL);
- }
-
- return NULL;
-}
-
diff --git a/storage/ibmdb2i/db2i_ileBridge.h b/storage/ibmdb2i/db2i_ileBridge.h
deleted file mode 100644
index 3a3ca141f69..00000000000
--- a/storage/ibmdb2i/db2i_ileBridge.h
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_ILEBRIDGE_H
-#define DB2I_ILEBRIDGE_H
-
-#include "db2i_global.h"
-#include "mysql_priv.h"
-#include "as400_types.h"
-#include "as400_protos.h"
-#include "qmyse.h"
-#include "db2i_errors.h"
-
-typedef uint64_t FILE_HANDLE;
-typedef my_thread_id CONNECTION_HANDLE;
-const char SAVEPOINT_NAME[] = {0xD4,0xE2,0xD7,0xC9,0xD5,0xE3,0xC5,0xD9,0xD5,0x0};
-const uint32 TACIT_ERRORS_SIZE=2;
-
-enum db2i_InfoRequestSpec
-{
- objLength = 1,
- rowCount = 2,
- deletedRowCount = 4,
- rowsPerKey = 8,
- meanRowLen = 16,
- lastModTime = 32,
- createTime = 64,
- ioCount = 128
-};
-
-extern handlerton *ibmdb2i_hton;
-struct IBMDB2I_SHARE;
-
-const uint32 db2i_ileBridge_MAX_INPARM_SIZE = 512;
-const uint32 db2i_ileBridge_MAX_OUTPARM_SIZE = 512;
-
-extern pthread_key(IleParms*, THR_ILEPARMS);
-struct IleParms
-{
- char inParms[db2i_ileBridge_MAX_INPARM_SIZE];
- char outParms[db2i_ileBridge_MAX_OUTPARM_SIZE];
-};
-
-/**
- @class db2i_ileBridge
-
- Implements a connection-based interface to the QMY_* APIs
-
- @details Each client connection that touches an IBMDB2I table has a "bridge"
- associated with it. This bridge is constructed on first use and provides a
- more C-like interface to the APIs. As well, it is reponsible for tracking
- connection scoped information such as statement transaction state and error
- message text. The bridge is destroyed when the connection ends.
-*/
-class db2i_ileBridge
-{
- enum ileFuncs
- {
- funcRegisterParameterSpaces,
- funcRegisterSpace,
- funcUnregisterSpace,
- funcProcessRequest,
- funcListEnd
- };
-
- static db2i_ileBridge* globalBridge;
-public:
-
-
- static int setup();
- static void takedown();
-
- /**
- Obtain a pointer to the bridge for the current connection.
-
- If a MySQL client connection is on the stack, we get the associated brideg.
- Otherwise, we use the globalBridge.
- */
- static db2i_ileBridge* getBridgeForThread()
- {
- THD* thd = current_thd;
- if (likely(thd))
- return getBridgeForThread(thd);
-
- return globalBridge;
- }
-
- /**
- Obtain a pointer to the bridge for the specified connection.
-
- If a bridge exists already, we return it immediately. Otherwise, prepare
- a new bridge for the connection.
- */
- static db2i_ileBridge* getBridgeForThread(const THD* thd)
- {
- void* thdData = *thd_ha_data(thd, ibmdb2i_hton);
- if (likely(thdData != NULL))
- return (db2i_ileBridge*)(thdData);
-
- db2i_ileBridge* newBridge = createNewBridge(thd->thread_id);
- *thd_ha_data(thd, ibmdb2i_hton) = (void*)newBridge;
- return newBridge;
- }
-
- static void destroyBridgeForThread(const THD* thd);
- static void registerPtr(const void* ptr, ILEMemHandle* receiver);
- static void unregisterPtr(ILEMemHandle handle);
- int32 allocateFileDefn(ILEMemHandle definitionSpace,
- ILEMemHandle handleSpace,
- uint16 fileCount,
- const char* schemaName,
- uint16 schemaNameLength,
- ILEMemHandle formatSpace,
- uint32 formatSpaceLen);
- int32 allocateFileInstance(FILE_HANDLE defnHandle,
- ILEMemHandle inuseSpace,
- FILE_HANDLE* instance);
- int32 deallocateFile(FILE_HANDLE fileHandle,
- bool postDropTable=FALSE);
- int32 read(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- char accessIntent,
- char commitLevel,
- char orientation,
- bool asyncRead = FALSE,
- ILEMemHandle rrn = 0,
- ILEMemHandle key = 0,
- uint32 keylen = 0,
- uint16 keyParts = 0,
- int pipeFD = -1);
- int32 readByRRN(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- uint32 inRRN,
- char accessIntent,
- char commitLevel);
- int32 writeRows(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- char commitLevel,
- int64* outIdVal,
- bool* outIdGen,
- uint32* dupKeyRRN,
- char** dupKeyName,
- uint32* dupKeyNameLen,
- uint32* outIdIncrement);
- uint32 execSQL(const char* statement,
- uint32 statementCount,
- uint8 commitLevel,
- bool autoCreateSchema = FALSE,
- bool dropSchema = FALSE,
- bool noCommit = FALSE,
- FILE_HANDLE fileHandle = 0);
- int32 prepOpen(const char* statement,
- FILE_HANDLE* rfileHandle,
- uint32* recLength);
- int32 deleteRow(FILE_HANDLE rfileHandle,
- uint32 rrn);
- int32 updateRow(FILE_HANDLE rfileHandle,
- uint32 rrn,
- ILEMemHandle buf,
- uint32* dupKeyRRN,
- char** dupKeyName,
- uint32* dupKeyNameLen);
- int32 commitmentControl(uint8 function);
- int32 savepoint(uint8 function,
- const char* savepointName);
- int32 recordsInRange(FILE_HANDLE rfileHandle,
- ILEMemHandle inSpc,
- uint32 inKeyCnt,
- uint32 inLiteralCnt,
- uint32 inBoundsOff,
- uint32 inLitDefOff,
- uint32 inLiteralsOff,
- uint32 inCutoff,
- uint32 inSpcLen,
- uint16 inEndByte,
- uint64* outRecCnt,
- uint16* outRtnCode);
- int32 rrlslck(FILE_HANDLE rfileHandle,
- char accessIntent);
- int32 lockObj(FILE_HANDLE rfileHandle,
- uint64 inTimeoutVal,
- char inAction,
- char inLockType,
- char inTimeout);
- int32 constraints(FILE_HANDLE rfileHandle,
- ILEMemHandle inSpc,
- uint32 inSpcLen,
- uint32* outLen,
- uint32* outCnt);
- int32 optimizeTable(FILE_HANDLE rfileHandle);
- static int32 initILE(const char* aspName,
- uint16* traceCtlPtr);
- int32 initFileForIO(FILE_HANDLE rfileHandle,
- char accessIntent,
- char commitLevel,
- uint16* inRecSize,
- uint16* inRecNullOffset,
- uint16* outRecSize,
- uint16* outRecNullOffset);
- int32 readInterrupt(FILE_HANDLE fileHandle);
- static int32 exitILE();
-
- int32 objectOverride(FILE_HANDLE rfileHandle,
- ILEMemHandle buf,
- uint32 recordWidth = 0);
-
- int32 retrieveTableInfo(FILE_HANDLE rfileHandle,
- uint16 dataRequested,
- ha_statistics& stats,
- ILEMemHandle inSpc = NULL);
-
- int32 retrieveIndexInfo(FILE_HANDLE rfileHandle,
- uint64* outPageCnt);
-
- int32 closeConnection(CONNECTION_HANDLE conn);
- int32 quiesceFileInstance(FILE_HANDLE rfileHandle);
-
- /**
- Mark the beginning of a "statement transaction"
-
- @detail MySQL "statement transactions" (see sql/handler.cc) are implemented
- as DB2 savepoints having a predefined name.
-
- @return 0 if successful; error otherwise
- */
- uint32 beginStmtTx()
- {
- DBUG_ENTER("db2i_ileBridge::beginStmtTx");
- if (stmtTxActive)
- DBUG_RETURN(0);
-
- stmtTxActive = true;
-
- DBUG_RETURN(savepoint(QMY_SET_SAVEPOINT, SAVEPOINT_NAME));
- }
-
- /**
- Commit a "statement transaction"
-
- @return 0 if successful; error otherwise
- */
- uint32 commitStmtTx()
- {
- DBUG_ENTER("db2i_ileBridge::commitStmtTx");
- DBUG_ASSERT(stmtTxActive);
- stmtTxActive = false;
- DBUG_RETURN(savepoint(QMY_RELEASE_SAVEPOINT, SAVEPOINT_NAME));
- }
-
- /**
- Roll back a "statement transaction"
-
- @return 0 if successful; error otherwise
- */
- uint32 rollbackStmtTx()
- {
- DBUG_ENTER("db2i_ileBridge::rollbackStmtTx");
- DBUG_ASSERT(stmtTxActive);
- stmtTxActive = false;
- DBUG_RETURN(savepoint(QMY_ROLLBACK_SAVEPOINT, SAVEPOINT_NAME));
- }
-
-
- /**
- Provide storage for generating error messages.
-
- This storage must persist until the error message is retrieved from the
- handler instance. It is for this reason that we associate it with the bridge.
-
- @return Pointer to heap storage of MYSQL_ERRMSG_SIZE bytes
- */
- char* getErrorStorage()
- {
- if (!connErrText)
- {
- connErrText = (char*)my_malloc(MYSQL_ERRMSG_SIZE, MYF(MY_WME));
- if (connErrText) connErrText[0] = 0;
- }
-
- return connErrText;
- }
-
- /**
- Free storage for generating error messages.
- */
- void freeErrorStorage()
- {
- if (likely(connErrText))
- {
- my_free(connErrText);
- connErrText = NULL;
- }
- }
-
-
- /**
- Store a file handle for later retrieval.
-
- If deallocateFile encounters a lock when trying to perform its operation,
- the file remains allocated but must be deallocated later. This function
- provides a way for the connection to "remember" that this deallocation is
- still needed.
-
- @param newname The name of the file to be added
- @param newhandle The handle associated with newname
-
- */
- void preserveHandle(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share)
- {
- pendingLockedHandles.add(newname, newhandle, share);
- }
-
- /**
- Retrieve a file handle stored by preserveHandle().
-
- @param name The name of the file to be retrieved.
-
- @return The handle associated with name
- */
- FILE_HANDLE findAndRemovePreservedHandle(const char* name, IBMDB2I_SHARE** share)
- {
- FILE_HANDLE hdl = pendingLockedHandles.findAndRemove(name, share);
- return hdl;
- }
-
- /**
- Indicate which error messages should be suppressed on the next API call
-
- These functions are useful for ensuring that the provided error numbers
- are returned if a failure occurs but do not cause a spurious error message
- to be returned.
-
- @return A pointer to this instance
- */
- db2i_ileBridge* expectErrors(int32 er1)
- {
- tacitErrors[0]=er1;
- return this;
- }
-
- db2i_ileBridge* expectErrors(int32 er1, int32 er2)
- {
- tacitErrors[0]=er1;
- tacitErrors[1]=er2;
- return this;
- }
-
- /**
- Obtain the IBM i system message that accompanied the last API failure.
-
- @return A pointer to the 7 character message ID.
- */
- static const char* getErrorMsgID()
- {
- return ((Qmy_Error_output_t*)parms()->outParms)->MsgId;
- }
-
- /**
- Convert an API error code into the equivalent MySQL error code (if any)
-
- @param rc The QMYSE API error code
-
- @return If an equivalent exists, the MySQL error code; else rc
- */
- static int32 translateErrorCode(int32 rc)
- {
- if (likely(rc == 0))
- return 0;
-
- switch (rc)
- {
- case QMY_ERR_KEY_NOT_FOUND:
- return HA_ERR_KEY_NOT_FOUND;
- case QMY_ERR_DUP_KEY:
- return HA_ERR_FOUND_DUPP_KEY;
- case QMY_ERR_END_OF_FILE:
- return HA_ERR_END_OF_FILE;
- case QMY_ERR_LOCK_TIMEOUT:
- return HA_ERR_LOCK_WAIT_TIMEOUT;
- case QMY_ERR_CST_VIOLATION:
- return HA_ERR_NO_REFERENCED_ROW;
- case QMY_ERR_TABLE_NOT_FOUND:
- return HA_ERR_NO_SUCH_TABLE;
- case QMY_ERR_NON_UNIQUE_KEY:
- return ER_DUP_ENTRY;
- case QMY_ERR_MSGID:
- {
- if (memcmp(getErrorMsgID(), DB2I_CPF503A, 7) == 0)
- return HA_ERR_ROW_IS_REFERENCED;
- if (memcmp(getErrorMsgID(), DB2I_SQL0538, 7) == 0)
- return HA_ERR_CANNOT_ADD_FOREIGN;
- }
- }
- return rc;
- }
-
-private:
-
- static db2i_ileBridge* createNewBridge(CONNECTION_HANDLE connID);
- static void destroyBridge(db2i_ileBridge* bridge);
- static int registerParmSpace(char* in, char* out);
- static int32 doIt();
- int32 doItWithLog();
-
- static _ILEpointer *functionSymbols; ///< Array of ILE function pointers
- CONNECTION_HANDLE cachedConnectionID; ///< The associated connection
- bool stmtTxActive; ///< Inside statement transaction
- char *connErrText; ///< Storage for error message
- int32 tacitErrors[TACIT_ERRORS_SIZE]; ///< List of errors to be suppressed
-
- static IleParms* initParmsForThread();
-
- /**
- Get space for passing parameters to the QMY_* APIs
-
- @details A fixed-length parameter passing space is associated with each
- pthread. This space is allocated and registered by initParmsForThread()
- the first time a pthread works with a bridge. The space is cached away
- and remains available until the pthread ends. It became necessary to
- disassociate the parameter space from the bridge in order to support
- future enhancements to MySQL that sever the one-to-one relationship between
- pthreads and user connections. The QMY_* APIs scope a registered parameter
- space to the thread that executes the register operation.
- */
- static IleParms* parms()
- {
- IleParms* p = my_pthread_getspecific_ptr(IleParms*, THR_ILEPARMS);
- if (likely(p))
- return p;
-
- return initParmsForThread();
- }
-
- class PreservedHandleList
- {
- friend db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE);
- public:
- void add(const char* newname, FILE_HANDLE newhandle, IBMDB2I_SHARE* share);
- FILE_HANDLE findAndRemove(const char* fileName, IBMDB2I_SHARE** share);
-
- private:
- struct NameHandlePair
- {
- char name[FN_REFLEN];
- FILE_HANDLE handle;
- IBMDB2I_SHARE* share;
- NameHandlePair* next;
- }* head;
- } pendingLockedHandles;
-
-
-#ifndef DBUG_OFF
- bool cachedStateIsCoherent()
- {
- return (current_thd->thread_id == cachedConnectionID);
- }
-
- friend void db2i_ileBridge::unregisterPtr(ILEMemHandle);
- friend void db2i_ileBridge::registerPtr(const void*, ILEMemHandle*);
- static uint32 registeredPtrs;
-#endif
-};
-
-
-
-#endif
diff --git a/storage/ibmdb2i/db2i_ioBuffers.cc b/storage/ibmdb2i/db2i_ioBuffers.cc
deleted file mode 100644
index 9525a6e34b5..00000000000
--- a/storage/ibmdb2i/db2i_ioBuffers.cc
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "db2i_ioBuffers.h"
-
-/**
- Request another block of rows
-
- Request the next set of rows from DB2. This must only be called after
- newReadRequest().
-
- @param orientation The direction to use when reading through the table.
-*/
-void IOAsyncReadBuffer::loadNewRows(char orientation)
-{
- rewind();
- maxRows() = rowsToBlock;
-
- DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("Requesting %d rows, async = %d", rowsToBlock, readIsAsync));
-
- rc = getBridge()->expectErrors(QMY_ERR_END_OF_BLOCK, QMY_ERR_LOB_SPACE_TOO_SMALL)
- ->read(file,
- ptr(),
- accessIntent,
- commitLevel,
- orientation,
- readIsAsync,
- rrnList,
- 0,
- 0,
- 0);
-
- DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("recordsRead: %d, rc: %d", (uint32)rowCount(), rc));
-
-
- *releaseRowNeeded = true;
-
- if (rc == QMY_ERR_END_OF_BLOCK)
- {
- // This is really just an informational error, so we ignore it.
- rc = 0;
- DBUG_PRINT("db2i_ioBuffers::loadNewRows", ("End of block signalled"));
- }
- else if (rc == QMY_ERR_END_OF_FILE)
- {
- // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked.
- rc = HA_ERR_END_OF_FILE;
- *releaseRowNeeded = false;
- }
- else if (rc == QMY_ERR_KEY_NOT_FOUND)
- {
- rc = HA_ERR_KEY_NOT_FOUND;
- *releaseRowNeeded = false;
- }
-
- if (rc) closePipe();
-}
-
-
-/**
- Empty the message pipe to prepare for another read.
-*/
-void IOAsyncReadBuffer::drainPipe()
-{
- DBUG_ASSERT(pipeState == PendingFullBufferMsg);
- PipeRpy_t msg[32];
- int bytes;
- PipeRpy_t* lastMsg;
- while ((bytes = read(msgPipe, msg, sizeof(msg))) > 0)
- {
- DBUG_PRINT("db2i_ioBuffers::drainPipe",("Pipe returned %d bytes", bytes));
- lastMsg = &msg[bytes / (sizeof(msg[0]))-1];
- if (lastMsg->CumRowCnt == maxRows() ||
- lastMsg->RtnCod != 0)
- {
- pipeState = ConsumedFullBufferMsg;
- break;
- }
-
- }
- DBUG_PRINT("db2i_ioBuffers::drainPipe",("rc = %d, rows = %d, max = %d", lastMsg->RtnCod, lastMsg->CumRowCnt, (uint32)maxRows()));
-}
-
-
-/**
- Poll the message pipe for async read messages
-
- Only valid in async
-
- @param orientation The direction to use when reading through the table.
-*/
-void IOAsyncReadBuffer::pollNextRow(char orientation)
-{
- DBUG_ASSERT(readIsAsync);
-
- // Handle the case in which the buffer is full.
- if (rowCount() == maxRows())
- {
- // If we haven't read to the end, exit here.
- if (readCursor < rowCount())
- return;
-
- if (pipeState == PendingFullBufferMsg)
- drainPipe();
- if (pipeState == ConsumedFullBufferMsg)
- loadNewRows(orientation);
- }
-
- if (!rc)
- {
- PipeRpy_t* lastMsg = NULL;
- while (true)
- {
- PipeRpy_t msg[32];
- int bytes = read(msgPipe, msg, sizeof(msg));
- DBUG_PRINT("db2i_ioBuffers::pollNextRow",("Pipe returned %d bytes", bytes));
-
- if (unlikely(bytes < 0))
- {
- DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("Error"));
- rc = errno;
- break;
- }
- else if (bytes == 0)
- break;
-
- DBUG_ASSERT(bytes % sizeof(msg[0]) == 0);
- lastMsg = &msg[bytes / (sizeof(msg[0]))-1];
-
- if (lastMsg->RtnCod || (lastMsg->CumRowCnt == usedRows()))
- {
- rc = lastMsg->RtnCod;
- break;
- }
- }
-
- *releaseRowNeeded = true;
-
- if (rc == QMY_ERR_END_OF_BLOCK)
- rc = 0;
- else if (rc == QMY_ERR_END_OF_FILE)
- {
- // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked.
- rc = HA_ERR_END_OF_FILE;
- *releaseRowNeeded = false;
- }
- else if (rc == QMY_ERR_KEY_NOT_FOUND)
- {
- rc = HA_ERR_KEY_NOT_FOUND;
- *releaseRowNeeded = false;
- }
-
- if (lastMsg)
- DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("Good data: rc=%d; rows=%d; usedRows=%d", lastMsg->RtnCod, lastMsg->CumRowCnt, (uint32)usedRows()));
- if (lastMsg && likely(!rc))
- {
- if (lastMsg->CumRowCnt < maxRows())
- pipeState = PendingFullBufferMsg;
- else
- pipeState = ConsumedFullBufferMsg;
-
- DBUG_ASSERT(lastMsg->CumRowCnt <= usedRows());
-
- }
- DBUG_ASSERT(rowCount() <= getRowCapacity());
- }
- DBUG_PRINT("db2i_ioBuffers::pollNextRow", ("filledRows: %d, rc: %d", rowCount(), rc));
- if (rc) closePipe();
-}
-
-
-/**
- Prepare for the destruction of the row buffer storage.
-*/
-void IOAsyncReadBuffer::prepForFree()
-{
- interruptRead();
- rewind();
- IORowBuffer::prepForFree();
-}
-
-
-/**
- Initialize the newly allocated storage.
-
- @param sizeChanged Indicates whether the storage capacity is being changed.
-*/
-void IOAsyncReadBuffer::initAfterAllocate(bool sizeChanged)
-{
- rewind();
-
- if (sizeChanged || ((void*)rrnList == NULL))
- rrnList.realloc(getRowCapacity() * sizeof(uint32));
-}
-
-
-/**
- Send an initial read request
-
- @param infile The file (table/index) being read from
- @param orientation The orientation to use for this read request
- @param rowsToBuffer The number of rows to request each time
- @param useAsync Whether reads should be performed asynchronously.
- @param key The key to use (if any)
- @param keyLength The length of key (if any)
- @param keyParts The number of columns in the key (if any)
-
-*/
-void IOAsyncReadBuffer::newReadRequest(FILE_HANDLE infile,
- char orientation,
- uint32 rowsToBuffer,
- bool useAsync,
- ILEMemHandle key,
- int keyLength,
- int keyParts)
-{
- DBUG_ENTER("db2i_ioBuffers::newReadRequest");
- DBUG_ASSERT(rowsToBuffer <= getRowCapacity());
-#ifndef DBUG_OFF
- if (readCursor < rowCount())
- DBUG_PRINT("PERF:",("Wasting %d buffered rows!\n", rowCount() - readCursor));
-#endif
-
- int fildes[2];
- int ileDescriptor = QMY_REUSE;
-
- interruptRead();
-
- if (likely(useAsync))
- {
- if (rowsToBuffer == 1)
- {
- // Async provides little or no benefit for single row reads, so we turn it off
- DBUG_PRINT("db2i_ioBuffers::newReadRequest", ("Disabling async"));
- useAsync = false;
- }
- else
- {
- rc = pipe(fildes);
- if (rc) DBUG_VOID_RETURN;
-
- // Translate the pipe write descriptor into the equivalent ILE descriptor
- rc = fstatx(fildes[1], (struct stat*)&ileDescriptor, sizeof(ileDescriptor), STX_XPFFD_PASE);
- if (rc)
- {
- close(fildes[0]);
- close(fildes[1]);
- DBUG_VOID_RETURN;
- }
- pipeState = Untouched;
- msgPipe = fildes[0];
-
- DBUG_PRINT("db2i_ioBuffers::newReadRequest", ("Opened pipe %d", fildes[0]));
- }
- }
-
- file = infile;
- readIsAsync = useAsync;
- rowsToBlock = rowsToBuffer;
-
- rewind();
- maxRows() = 1;
- rc = getBridge()->expectErrors(QMY_ERR_END_OF_BLOCK, QMY_ERR_LOB_SPACE_TOO_SMALL)
- ->read(file,
- ptr(),
- accessIntent,
- commitLevel,
- orientation,
- useAsync,
- rrnList,
- key,
- keyLength,
- keyParts,
- ileDescriptor);
-
- // Having shared the pipe with ILE, we relinquish our claim on the write end
- // of the pipe.
- if (useAsync)
- close(fildes[1]);
-
- // If we reach EOF or end-of-key, DB2 guarantees that no rows will be locked.
- if (rc == QMY_ERR_END_OF_FILE)
- {
- rc = HA_ERR_END_OF_FILE;
- *releaseRowNeeded = false;
- }
- else if (rc == QMY_ERR_KEY_NOT_FOUND)
- {
- if (rowCount())
- rc = HA_ERR_END_OF_FILE;
- else
- rc = HA_ERR_KEY_NOT_FOUND;
- *releaseRowNeeded = false;
- }
- else
- *releaseRowNeeded = true;
-
- DBUG_VOID_RETURN;
-}
diff --git a/storage/ibmdb2i/db2i_ioBuffers.h b/storage/ibmdb2i/db2i_ioBuffers.h
deleted file mode 100644
index 350d854f055..00000000000
--- a/storage/ibmdb2i/db2i_ioBuffers.h
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-/**
- @file db2i_ioBuffers.h
-
- @brief Buffer classes used for interacting with QMYSE read/write buffers.
-
-*/
-
-
-#include "db2i_validatedPointer.h"
-#include "mysql_priv.h"
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <as400_types.h>
-
-// Needed for compilers which do not include fstatx in standard headers.
-extern "C" int fstatx(int, struct stat *, int, int);
-
-/**
- Basic row buffer
-
- Provides the basic structure and methods needed for communicating
- with QMYSE I/O APIs.
-
- @details All QMYSE I/O apis use a buffer that is structured as two integer
- row counts (max and used) and storage for some number of rows. The row counts
- are both input and output for the API, and their usage depends on the
- particular API invoked. This class encapsulates that buffer definition.
-*/
-class IORowBuffer
-{
- public:
- IORowBuffer() : allocSize(0), rowLength(0) {;}
- ~IORowBuffer() { freeBuf(); }
- ValidatedPointer<char>& ptr() { return data; }
-
- /**
- Sets up the buffer to hold the size indicated.
-
- @param rowLen length of the rows that will be stored in this buffer
- @param nullMapOffset position of null map within each row
- @param size buffer size requested
- */
- void allocBuf(uint32 rowLen, uint16 nullMapOffset, uint32 size)
- {
- nullOffset = nullMapOffset;
- uint32 newSize = size + sizeof(BufferHdr_t);
- // If the internal structure of the row is changing, we need to
- // remember this and notify the subclasses via initAfterAllocate();
- bool formatChanged = ((size/rowLen) != rowCapacity);
-
- if (newSize > allocSize)
- {
- this->freeBuf();
- data.alloc(newSize);
- if (likely((void*)data))
- allocSize = newSize;
- }
-
- if (likely((void*)data))
- {
- DBUG_ASSERT((uint64)(void*)data % 16 == 0);
- rowLength = rowLen;
- rowCapacity = size / rowLength;
- initAfterAllocate(formatChanged);
- }
- else
- {
- allocSize = 0;
- rowCapacity = 0;
- }
-
- DBUG_PRINT("db2i_ioBuffers::allocBuf",("rowCapacity = %d", rowCapacity));
- }
-
- void zeroBuf()
- {
- memset(data, 0, allocSize);
- }
-
- void freeBuf()
- {
- if (likely(allocSize))
- {
- prepForFree();
- DBUG_PRINT("IORowBuffer::freeBuf",("Freeing 0x%p", (char*)data));
- data.dealloc();
- }
- }
-
- char* getRowN(uint32 n)
- {
- if (unlikely(n >= getRowCapacity()))
- return NULL;
- return (char*)data + sizeof(BufferHdr_t) + (rowLength * n);
- };
-
- uint32 getRowCapacity() const {return rowCapacity;}
- uint32 getRowNullOffset() const {return nullOffset;}
- uint32 getRowLength() const {return rowLength;}
-
- protected:
- /**
- Called prior to freeing buffer storage so that subclasses can do
- any required cleanup
- */
- virtual void prepForFree()
- {
- allocSize = 0;
- rowCapacity = 0;
- }
-
- /**
- Called after buffer storage so that subclasses can do any required setup.
- */
- virtual void initAfterAllocate(bool sizeChanged) { return;}
-
- ValidatedPointer<char> data;
- uint32 allocSize;
- uint32 rowCapacity;
- uint32 rowLength;
- uint16 nullOffset;
- uint32& usedRows() const { return ((BufferHdr_t*)(char*)data)->UsedRowCnt; }
- uint32& maxRows() const {return ((BufferHdr_t*)(char*)data)->MaxRowCnt; }
-};
-
-
-/**
- Write buffer
-
- Implements methods for inserting data into a row buffer for use with the
- QMY_WRITE and QMY_UPDATE APIs.
-
- @details The max row count defines how many rows are in the buffer. The used
- row count is updated by QMYSE to indicate how many rows have been
- successfully written.
-*/
-class IOWriteBuffer : public IORowBuffer
-{
- public:
- bool endOfBuffer() const {return (maxRows() == getRowCapacity());}
-
- char* addRow()
- {
- return getRowN(maxRows()++);
- }
-
- void resetAfterWrite()
- {
- maxRows() = 0;
- }
-
- void deleteRow()
- {
- --maxRows();
- }
-
- uint32 rowCount() const {return maxRows();}
-
- uint32 rowsWritten() const {return usedRows()-1;}
-
- private:
- void initAfterAllocate(bool sizeChanged) {maxRows() = 0; usedRows() = 0;}
-};
-
-
-/**
- Read buffer
-
- Implements methods for reading data from and managing a row buffer for use
- with the QMY_READ APIs. This is primarily for use with metainformation queries.
-*/
-class IOReadBuffer : public IORowBuffer
-{
- public:
-
- IOReadBuffer() {;}
- IOReadBuffer(uint32 rows, uint32 rowLength)
- {
- allocBuf(rows, 0, rows * rowLength);
- maxRows() = rows;
- }
-
- uint32 rowCount() {return usedRows();}
- void setRowsToProcess(uint32 rows) { maxRows() = rows; }
-};
-
-
-/**
- Read buffer
-
- Implements methods for reading data from and managing a row buffer for use
- with the QMY_READ APIs.
-
- @details This class supports both sync and async read modes. The max row
- count defines the number of rows that are requested to be read. The used row
- count defines how many rows have been read. Sync mode is reasonably
- straightforward, but async mode has a complex system of communicating with
- QMYSE that is optimized for low latency. In async mode, the used row count is
- updated continuously by QMYSE as rows are read. At the same time, messages are
- sent to the associated pipe indicating that a row has been read. As long as
- the internal read cursor lags behind the used row count, the pipe is never
- consulted. But if the internal read cursor "catches up to" the used row count,
- then we block on the pipe until we find a message indicating that a new row
- has been read or that an error has occurred.
-*/
-class IOAsyncReadBuffer : public IOReadBuffer
-{
- public:
- IOAsyncReadBuffer() :
- file(0), readIsAsync(false), msgPipe(QMY_REUSE), bridge(NULL)
- {
- }
-
- ~IOAsyncReadBuffer()
- {
- interruptRead();
- rrnList.dealloc();
- }
-
-
- /**
- Signal read operation complete
-
- Indicates that the storage engine requires no more data from the table.
- Must be called between calls to newReadRequest().
- */
- void endRead()
- {
-#ifndef DBUG_OFF
- if (readCursor < rowCount())
- DBUG_PRINT("PERF:",("Wasting %d buffered rows!\n", rowCount() - readCursor));
-#endif
- interruptRead();
-
- file = 0;
- bridge = NULL;
- }
-
- /**
- Update data that may change on each read operation
- */
- void update(char newAccessIntent,
- bool* newReleaseRowNeeded,
- char commitLvl)
- {
- accessIntent = newAccessIntent;
- releaseRowNeeded = newReleaseRowNeeded;
- commitLevel = commitLvl;
- }
-
- /**
- Read the next row in the table.
-
- Return a pointer to the next row in the table, where "next" is defined
- by the orientation.
-
- @param orientaton
- @param[out] rrn The relative record number of the row returned. Not reliable
- if NULL is returned by this function.
-
- @return Pointer to the row. Null if no more rows are available or an error
- occurred.
- */
- char* readNextRow(char orientation, uint32& rrn)
- {
- DBUG_PRINT("db2i_ioBuffers::readNextRow", ("readCursor: %d, filledRows: %d, rc: %d", readCursor, rowCount(), rc));
-
- while (readCursor >= rowCount() && !rc)
- {
- if (!readIsAsync)
- loadNewRows(orientation);
- else
- pollNextRow(orientation);
- }
-
- if (readCursor >= rowCount())
- return NULL;
-
- rrn = rrnList[readCursor];
- return getRowN(readCursor++);
- }
-
- /**
- Retrieve the return code generated by the last operation.
-
- @return The return code, translated to the appropriate HA_ERR_*
- value if possible.
- */
- int32 lastrc()
- {
- return db2i_ileBridge::translateErrorCode(rc);
- }
-
- void rewind()
- {
- readCursor = 0;
- rc = 0;
- usedRows() = 0;
- }
-
- bool reachedEOD() { return EOD; }
-
- void newReadRequest(FILE_HANDLE infile,
- char orientation,
- uint32 rowsToBuffer,
- bool useAsync,
- ILEMemHandle key,
- int keyLength,
- int keyParts);
-
- private:
-
- /**
- End any running async read operation.
- */
- void interruptRead()
- {
- closePipe();
- if (file && readIsAsync && (rc == 0) && (rowCount() < getRowCapacity()))
- {
- DBUG_PRINT("IOReadBuffer::interruptRead", ("PERF: Interrupting %d", (uint32)file));
- getBridge()->readInterrupt(file);
- }
- }
-
- void closePipe()
- {
- if (msgPipe != QMY_REUSE)
- {
- DBUG_PRINT("db2i_ioBuffers::closePipe", ("Closing pipe %d", msgPipe));
- close(msgPipe);
- msgPipe = QMY_REUSE;
- }
- }
-
- /**
- Get a pointer to the active ILE bridge.
-
- Getting the bridge pointer is (relatively) expensive, so we cache
- it off for each operation.
- */
- db2i_ileBridge* getBridge()
- {
- if (unlikely(bridge == NULL))
- {
- bridge = db2i_ileBridge::getBridgeForThread();
- }
- return bridge;
- }
-
- void drainPipe();
- void pollNextRow(char orientation);
- void prepForFree();
- void initAfterAllocate(bool sizeChanged);
- void loadNewRows(char orientation);
-
-
- uint32 readCursor; // Read position within buffer
- int32 rc; // Last return code received
- ValidatedPointer<uint32> rrnList; // Receiver for list of rrns
- char accessIntent; // The access intent for this read
- char commitLevel; // What isolation level should be used
- char EOD; // Whether end-of-data was hit
- char readIsAsync; // Are reads to be done asynchronously?
- bool* releaseRowNeeded;
- /* Does the caller need to release the current row when finished reading */
- FILE_HANDLE file; // The file to be read
- int msgPipe;
- /* The read descriptor of the pipe used to pass messages during async reads */
- db2i_ileBridge* bridge; // Cached pointer to bridge
- uint32 rowsToBlock; // Number of rows to request
- enum
- {
- ConsumedFullBufferMsg,
- PendingFullBufferMsg,
- Untouched
- } pipeState;
- /* The state of the async read message pipe */
-};
-
diff --git a/storage/ibmdb2i/db2i_misc.h b/storage/ibmdb2i/db2i_misc.h
deleted file mode 100644
index f0b527aaad0..00000000000
--- a/storage/ibmdb2i/db2i_misc.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-#ifndef DB2I_MISC_H
-#define DB2I_MISC_H
-
-/**
- Undelimit quote-delimited DB2 names in-place
-*/
-void stripExtraQuotes(char* name, uint maxLen)
-{
- char* oldName = (char*)sql_strdup(name);
- uint i = 0;
- uint j = 0;
- do
- {
- name[j] = oldName[i];
- if (oldName[i] == '"' && oldName[i+1] == '"')
- ++i;
- } while (++j < maxLen && oldName[++i]);
-
- if (j == maxLen)
- --j;
- name[j] = 0;
-}
-
-/**
- Convert a MySQL identifier name into a DB2 compatible format
-
- @parm input The MySQL name
- @parm output The DB2 name
- @parm outlen The amount of space allocated for output
- @parm delimit Should delimiting quotes be placed around the converted name?
- @parm delimitQuotes Should quotes in the MySQL be delimited with additional quotes?
-
- @return FALSE if output was too small and name was truncated; TRUE otherwise
-*/
-bool convertMySQLNameToDB2Name(const char* input,
- char* output,
- size_t outlen,
- bool delimit = true,
- bool delimitQuotes = true)
-{
- uint o = 0;
- if (delimit)
- output[o++] = '"';
-
- uint i = 0;
- do
- {
- output[o] = input[i];
- if (delimitQuotes && input[i] == '"')
- output[++o] = '"';
- } while (++o < outlen-2 && input[++i]);
-
- if (delimit)
- output[o++] = '"';
- output[min(o, outlen-1)] = 0; // This isn't the most user-friendly way to handle overflows,
- // but at least its safe.
- return (o <= outlen-1);
-}
-
-bool isOrdinaryIdentifier(const char* s)
-{
- while (*s)
- {
- if (my_isupper(system_charset_info, *s) ||
- my_isdigit(system_charset_info, *s) ||
- (*s == '_') ||
- (*s == '@') ||
- (*s == '$') ||
- (*s == '#') ||
- (*s == '"'))
- ++s;
- else
- return false;
- }
- return true;
-}
-
-/**
- Fill memory with a 16-bit word.
-
- @param p Pointer to space to fill.
- @param v Value to fill
- @param l Length of space (in 16-bit words)
-*/
-void memset16(void* p, uint16 v, size_t l)
-{
- uint16* p2=(uint16*)p;
- while (l--)
- {
- *(p2++) = v;
- }
-}
-
-#endif
diff --git a/storage/ibmdb2i/db2i_myconv.cc b/storage/ibmdb2i/db2i_myconv.cc
deleted file mode 100644
index 7be6e1236cd..00000000000
--- a/storage/ibmdb2i/db2i_myconv.cc
+++ /dev/null
@@ -1,1498 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-/**
- @file
-
- @brief A direct map optimization of iconv and related functions
- This was show to significantly reduce character conversion cost
- for short strings when compared to calling iconv system code.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <errno.h>
-#include <iconv.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <string.h>
-#include <as400_protos.h>
-
-#include "db2i_myconv.h"
-#include "db2i_global.h"
-
-int32_t myconvDebug=0;
-
-static char szGetTimeString[20];
-static char * GetTimeString(time_t now)
-{
- struct tm * tm;
-
- now = time(&now);
- tm = (struct tm *) localtime(&now);
- sprintf(szGetTimeString, "%04d/%02d/%02d %02d:%02d:%02d",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-
- return szGetTimeString;
-}
-
-static MEM_ROOT dmapMemRoot;
-
-void initMyconv()
-{
- init_alloc_root(&dmapMemRoot, 0x200, 0);
-}
-
-void cleanupMyconv()
-{
- free_root(&dmapMemRoot,0);
-}
-
-
-#ifdef DEBUG
-/* type: */
-#define STDOUT_WITH_TIME -1 /* to stdout with time */
-#define STDERR_WITH_TIME -2 /* to stderr with time */
-#define STDOUT_WO_TIME 1 /* : to stdout */
-#define STDERR_WO_TIME 2 /* : to stderr */
-
-
-static void MyPrintf(long type,
- char * fmt, ...)
-{
- char StdoutFN[256];
- va_list ap;
- char * p;
- time_t now;
- FILE * fd=stderr;
-
- if (type < 0)
- {
- now = time(&now);
- fprintf(fd, "%s ", GetTimeString(now));
- }
- va_start(ap, fmt);
- vfprintf(fd, fmt, ap);
- va_end(ap);
-}
-#endif
-
-
-
-
-#define MAX_CONVERTER 128
-
-mycstoccsid(const char* pname)
-{
- if (strcmp(pname, "UTF-16")==0)
- return 1200;
- else if (strcmp(pname, "big5")==0)
- return 950;
- else
- return cstoccsid(pname);
-}
-#define cstoccsid mycstoccsid
-
-static struct __myconv_rec myconv_rec [MAX_CONVERTER];
-static struct __dmap_rec dmap_rec [MAX_CONVERTER];
-
-static int dmap_open(const char * to,
- const char * from,
- const int32_t idx)
-{
- if (myconvIsSBCS(from) && myconvIsSBCS(to)) {
- dmap_rec[idx].codingSchema = DMAP_S2S;
- if ((dmap_rec[idx].dmapS2S = (uchar *) alloc_root(&dmapMemRoot, 0x100)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_S2S, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapS2S, 0x00, 0x100);
- myconv_rec[idx].allocatedSize=0x100;
-
- {
- char dmapSrc[0x100];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft=0x100;
- size_t outBytesLeft=0x100;
- size_t len;
- char * inBuf=dmapSrc;
- char * outBuf=(char *) dmap_rec[idx].dmapS2S;
-
- if ((cd = iconv_open(to, from)) == (iconv_t) -1) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- inBytesLeft = 0x100;
- for (i = 0; i < inBytesLeft; ++i)
- dmapSrc[i]=i;
-
- do {
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d: iconv() returns %d, errno = %d in %s at %d\n",
- to, from, idx, DMAP_S2S, len, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "inBytesLeft = %d, inBuf - dmapSrc = %d\n", inBytesLeft, inBuf-dmapSrc);
- MyPrintf(STDERR_WITH_TIME,
- "outBytesLeft = %d, outBuf - dmapS2S = %d\n", outBytesLeft, outBuf-(char *) dmap_rec[idx].dmapS2S);
- }
- if ((inBytesLeft == 86 || inBytesLeft == 64 || inBytesLeft == 1) &&
- memcmp(from, "IBM-1256", 9) == 0 &&
- memcmp(to, "IBM-420", 8) == 0) {
- /* Known problem for IBM-1256_IBM-420 */
- --inBytesLeft;
- ++inBuf;
- *outBuf=0x00;
- ++outBuf;
- --outBytesLeft;
- continue;
- } else if ((inBytesLeft == 173 || inBytesLeft == 172 ||
- inBytesLeft == 74 || inBytesLeft == 73 ||
- inBytesLeft == 52 || inBytesLeft == 50 ||
- inBytesLeft == 31 || inBytesLeft == 20 ||
- inBytesLeft == 6) &&
- memcmp(to, "IBM-1256", 9) == 0 &&
- memcmp(from, "IBM-420", 8) == 0) {
- /* Known problem for IBM-420_IBM-1256 */
- --inBytesLeft;
- ++inBuf;
- *outBuf=0x00;
- ++outBuf;
- --outBytesLeft;
- continue;
- } else if ((128 >= inBytesLeft) &&
- memcmp(to, "IBM-037", 8) == 0 &&
- memcmp(from, "IBM-367", 8) == 0) {
- /* Known problem for IBM-367_IBM-037 */
- --inBytesLeft;
- ++inBuf;
- *outBuf=0x00;
- ++outBuf;
- --outBytesLeft;
- continue;
- } else if (((1 <= inBytesLeft && inBytesLeft <= 4) || (97 <= inBytesLeft && inBytesLeft <= 128)) &&
- memcmp(to, "IBM-838", 8) == 0 &&
- memcmp(from, "TIS-620", 8) == 0) {
- /* Known problem for TIS-620_IBM-838 */
- --inBytesLeft;
- ++inBuf;
- *outBuf=0x00;
- ++outBuf;
- --outBytesLeft;
- continue;
- }
- iconv_close(cd);
- return -1;
-#else
- /* Tolerant to undefined conversions for any converter */
- --inBytesLeft;
- ++inBuf;
- *outBuf=0x00;
- ++outBuf;
- --outBytesLeft;
- continue;
-#endif
- }
- } while (inBytesLeft > 0);
-
- if (myconvIsISO(to))
- myconv_rec[idx].subS=0x1A;
- else if (myconvIsASCII(to))
- myconv_rec[idx].subS=0x7F;
- else if (myconvIsEBCDIC(to))
- myconv_rec[idx].subS=0x3F;
-
- if (myconvIsISO(from))
- myconv_rec[idx].srcSubS=0x1A;
- else if (myconvIsASCII(from))
- myconv_rec[idx].srcSubS=0x7F;
- else if (myconvIsEBCDIC(from))
- myconv_rec[idx].srcSubS=0x3F;
-
- iconv_close(cd);
- }
- } else if (((myconvIsSBCS(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_S2U)) ||
- ((myconvIsSBCS(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_S28))) {
- int i;
-
- /* single byte mapping */
- if ((dmap_rec[idx].dmapD12U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_S2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapD12U, 0x00, 0x100 * 2);
- myconv_rec[idx].allocatedSize=0x100 * 2;
-
-
- {
- char dmapSrc[2];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft;
- size_t outBytesLeft;
- size_t len;
- char * inBuf;
- char * outBuf;
- char SS=0x1A;
-#ifdef support_surrogate
- if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- for (i = 0; i < 0x100; ++i) {
- dmapSrc[0]=i;
- inBuf=dmapSrc;
- inBytesLeft=1;
- outBuf=(char *) &(dmap_rec[idx].dmapD12U[i]);
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if ((errno == EILSEQ || errno == EINVAL) &&
- inBytesLeft == 1 &&
- outBytesLeft == 2) {
- continue;
- } else {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%02x,%d,%02x%02x,%d), errno = %d in %s at %d\n",
- to, from, idx, dmapSrc[0], 1,
- (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1], 2,
- errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "inBytesLeft=%d, outBytesLeft=%d, %02x%02x\n",
- inBytesLeft, outBytesLeft,
- (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1]);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- dmap_rec[idx].dmapD12U[i]=0x0000;
- }
- if (dmap_rec[idx].dmapE02U[i] == 0x001A && /* pick the first one */
- myconv_rec[idx].srcSubS == 0x00) {
- myconv_rec[idx].srcSubS=i;
- }
- }
- iconv_close(cd);
- }
- myconv_rec[idx].subS=0x1A;
- myconv_rec[idx].subD=0xFFFD;
-
-
- } else if (((myconvIsUCS2(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_U2S)) ||
- ((myconvIsUTF16(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_T2S)) ||
- ((myconvIsUTF8(from) && myconvIsSBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_82S))) {
- /* UTF-16 -> SBCS, the direct map a bit of waste of space,
- * binary search may be reasonable alternative
- */
- if ((dmap_rec[idx].dmapU2S = (uchar *) alloc_root(&dmapMemRoot, 0x10000 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_U2S, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapU2S, 0x00, 0x10000);
- myconv_rec[idx].allocatedSize=(0x10000 * 2);
-
- {
- iconv_t cd;
- int32_t i;
-
-#ifdef support_surrogate
- if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- for (i = 0; i < 0x100; ++i) {
- UniChar dmapSrc[0x100];
- int32_t j;
- for (j = 0; j < 0x100; ++j) {
- dmapSrc[j]=i * 0x100 + j;
- }
- char * inBuf=(char *) dmapSrc;
- char * outBuf=(char *) &(dmap_rec[idx].dmapU2S[i*0x100]);
- size_t inBytesLeft=sizeof(dmapSrc);
- size_t outBytesLeft=0x100;
- size_t len;
-
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (inBytesLeft == 0 && outBytesLeft == 0) { /* a number of substitution returns */
- continue;
- }
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- from, to, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "iconv() retuns %d, errno=%d, InBytesLeft=%d, OutBytesLeft=%d\n",
- len, errno, inBytesLeft, outBytesLeft, __FILE__,__LINE__);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- }
- iconv_close(cd);
-
- myconv_rec[idx].subS = dmap_rec[idx].dmapU2S[0x1A];
- myconv_rec[idx].subD = dmap_rec[idx].dmapU2S[0xFFFD];
- myconv_rec[idx].srcSubS = 0x1A;
- myconv_rec[idx].srcSubD = 0xFFFD;
- }
-
-
-
- } else if (((myconvIsDBCS(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_D2U)) ||
- ((myconvIsDBCS(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_D28))) {
- int i;
- /* single byte mapping */
- if ((dmap_rec[idx].dmapD12U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_D2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapD12U, 0x00, 0x100 * 2);
-
- /* double byte mapping, assume 7 bit ASCII is not use as the first byte of DBCS. */
- if ((dmap_rec[idx].dmapD22U = (UniChar *) alloc_root(&dmapMemRoot, 0x8000 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_D2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapD22U, 0x00, 0x8000 * 2);
-
- myconv_rec[idx].allocatedSize=(0x100 + 0x8000) * 2;
-
-
- {
- char dmapSrc[2];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft;
- size_t outBytesLeft;
- size_t len;
- char * inBuf;
- char * outBuf;
- char SS=0x1A;
-
-#ifdef support_surrogate
- if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- for (i = 0; i < 0x100; ++i) {
- dmapSrc[0]=i;
- inBuf=dmapSrc;
- inBytesLeft=1;
- outBuf=(char *) (&dmap_rec[idx].dmapD12U[i]);
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if ((errno == EILSEQ || errno == EINVAL) &&
- inBytesLeft == 1 &&
- outBytesLeft == 2) {
- continue;
- } else {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%02x,%d,%02x%02x,%d), errno = %d in %s at %d\n",
- to, from, idx, dmapSrc[0], 1,
- (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1], 2,
- errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "inBytesLeft=%d, outBytesLeft=%d, %02x%02x\n",
- inBytesLeft, outBytesLeft,
- (&dmap_rec[idx].dmapD12U[i])[0],(&dmap_rec[idx].dmapD12U[i])[1]);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- dmap_rec[idx].dmapD12U[i]=0x0000;
- }
- if (dmap_rec[idx].dmapD12U[i] == 0x001A && /* pick the first one */
- myconv_rec[idx].srcSubS == 0x00) {
- myconv_rec[idx].srcSubS=i;
- }
- }
-
-
- for (i = 0x80; i < 0x100; ++i) {
- int j;
- if (dmap_rec[idx].dmapD12U[i] != 0x0000)
- continue;
- for (j = 0x01; j < 0x100; ++j) {
- dmapSrc[0]=i;
- dmapSrc[1]=j;
- int offset = i-0x80;
- offset<<=8;
- offset+=j;
-
- inBuf=dmapSrc;
- inBytesLeft=2;
- outBuf=(char *) &(dmap_rec[idx].dmapD22U[offset]);
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (inBytesLeft == 2 && outBytesLeft == 2 && (errno == EILSEQ || errno == EINVAL)) {
- ; /* invalid DBCS character, dmapDD2U[offset] remains 0x0000 */
- } else {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(cd,%p,2,%p,2), errno = %d in %s at %d\n",
- to, from, idx,
- dmapSrc, &(dmap_rec[idx].dmapD22U[offset]),
- errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME,
- "iconv(cd,0x%02x%02x,2,0x%04x,2) returns %d, inBytesLeft=%d, outBytesLeft=%d\n",
- dmapSrc[0], dmapSrc[1],
- dmap_rec[idx].dmapD22U[offset],
- len, inBytesLeft, outBytesLeft);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- } else {
-#ifdef TRACE_DMAP
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n",
- to, from, idx, len, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf=%02X%02X%02X, outBytesLeft=%d\n",
- i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1],
- inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft);
- MyPrintf(STDERR_WITH_TIME,
- "&dmapSrc=%p, inBuf=%p, %p, outBuf=%p\n",
- dmapSrc, inBuf, dmap_rec[idx].dmapU2M3 + (i - 0x80) * 2, outBuf);
- }
-#endif
- }
- }
- if (dmap_rec[idx].dmapD12U[i] == 0xFFFD) { /* pick the last one */
- myconv_rec[idx].srcSubD=i* 0x100 + j;
- }
- }
- iconv_close(cd);
- }
-
- myconv_rec[idx].subS=0x1A;
- myconv_rec[idx].subD=0xFFFD;
- myconv_rec[idx].srcSubD=0xFCFC;
-
-
- } else if (((myconvIsUCS2(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_U2D)) ||
- ((myconvIsUTF16(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_T2D)) ||
- ((myconvIsUTF8(from) && myconvIsDBCS(to)) && (dmap_rec[idx].codingSchema = DMAP_82D))) {
- /* UTF-16 -> DBCS single/double byte */
- /* A single table will cover all characters, assuming no second byte is 0x00. */
- if ((dmap_rec[idx].dmapU2D = (uchar *) alloc_root(&dmapMemRoot, 0x10000 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_U2D, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- memset(dmap_rec[idx].dmapU2D, 0x00, 0x10000 * 2);
- myconv_rec[idx].allocatedSize=(0x10000 * 2);
-
- {
- UniChar dmapSrc[1];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft;
- size_t outBytesLeft;
- size_t len;
- char * inBuf;
- char * outBuf;
-
-#ifdef support_surrogate
- if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- /* easy implementation, convert 1 Unicode character at one time. */
- /* If the open performance is an issue, convert a chunk such as 128 chracters. */
- /* if the converted length is not the same as the original, convert one by one. */
- (dmap_rec[idx].dmapU2D)[0x0000]=0x00;
- for (i = 1; i < 0x10000; ++i) {
- dmapSrc[0]=i;
- inBuf=(char *) dmapSrc;
- inBytesLeft=2;
- outBuf=(char *) &((dmap_rec[idx].dmapU2D)[2*i]);
- outBytesLeft=2;
- do {
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (len == 1 && inBytesLeft == 0 && outBytesLeft == 1 && (dmap_rec[idx].dmapU2D)[2*i] == 0x1A) {
- /* UCS-2_TIS-620:0x0080 => 0x1A, converted to SBCS replacement character */
- (dmap_rec[idx].dmapU2D)[2*i+1]=0x00;
- break;
- } else if (len == 1 && inBytesLeft == 0 && outBytesLeft == 0) {
- break;
- }
- if (errno == EILSEQ || errno == EINVAL) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME,
- "iconv(cd,%04x,2,%02x%02x,2) returns inBytesLeft=%d, outBytesLeft=%d\n",
- dmapSrc[0],
- (dmap_rec[idx].dmapU2D)[2*i], (dmap_rec[idx].dmapU2D)[2*i+1],
- inBytesLeft, outBytesLeft);
- if (outBuf - (char *) dmap_rec[idx].dmapU2M2 > 1)
- MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]);
- }
-#endif
- inBuf+=2;
- inBytesLeft-=2;
- memcpy(outBuf, (char *) &(myconv_rec[idx].subD), 2);
- outBuf+=2;
- outBytesLeft-=2;
- } else {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "[%d] dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- i, to, from, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME,
- "iconv(cd,%04x,2,%02x%02x,2) returns %d inBytesLeft=%d, outBytesLeft=%d\n",
- dmapSrc[0],
- (dmap_rec[idx].dmapU2D)[2*i],
- (dmap_rec[idx].dmapU2D)[2*i+1],
- len, inBytesLeft,outBytesLeft);
- if (i == 1) {
- MyPrintf(STDERR_WO_TIME,
- " inBuf [-1..2]=%02x%02x%02x%02x\n",
- inBuf[-1],inBuf[0],inBuf[1],inBuf[2]);
- MyPrintf(STDERR_WO_TIME,
- " outBuf [-1..2]=%02x%02x%02x%02x\n",
- outBuf[-1],outBuf[0],outBuf[1],outBuf[2]);
- } else {
- MyPrintf(STDERR_WO_TIME,
- " inBuf [-2..2]=%02x%02x%02x%02x%02x\n",
- inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]);
- MyPrintf(STDERR_WO_TIME,
- " outBuf [-2..2]=%02x%02x%02x%02x%02x\n",
- outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- if (len == 0 && inBytesLeft == 0 && outBytesLeft == 1) { /* converted to SBCS */
- (dmap_rec[idx].dmapU2D)[2*i+1]=0x00;
- break;
- }
- }
- } while (inBytesLeft > 0);
- }
- iconv_close(cd);
- myconv_rec[idx].subS = dmap_rec[idx].dmapU2D[2*0x1A];
- myconv_rec[idx].subD = dmap_rec[idx].dmapU2D[2*0xFFFD] * 0x100
- + dmap_rec[idx].dmapU2D[2*0xFFFD+1];
- myconv_rec[idx].srcSubS = 0x1A;
- myconv_rec[idx].srcSubD = 0xFFFD;
- }
-
-
- } else if (((myconvIsEUC(from) && myconvIsUnicode2(to)) && (dmap_rec[idx].codingSchema = DMAP_E2U)) ||
- ((myconvIsEUC(from) && myconvIsUTF8(to)) && (dmap_rec[idx].codingSchema = DMAP_E28))) {
- int i;
- /* S0: 0x00 - 0x7F */
- if ((dmap_rec[idx].dmapE02U = (UniChar *) alloc_root(&dmapMemRoot, 0x100 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapE02U, 0x00, 0x100 * 2);
-
- /* S1: 0xA0 - 0xFF, 0xA0 - 0xFF */
- if ((dmap_rec[idx].dmapE12U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x60 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapE12U, 0x00, 0x60 * 0x60 * 2);
-
- /* SS2: 0x8E + 0xA0 - 0xFF, 0xA0 - 0xFF */
- if ((dmap_rec[idx].dmapE22U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x61 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapE22U, 0x00, 0x60 * 0x61 * 2);
-
- /* SS3: 0x8F + 0xA0 - 0xFF, 0xA0 - 0xFF */
- if ((dmap_rec[idx].dmapE32U = (UniChar *) alloc_root(&dmapMemRoot, 0x60 * 0x61 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_E2U, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapE32U, 0x00, 0x60 * 0x61 * 2);
-
- myconv_rec[idx].allocatedSize=(0x100 + 0x60 * 0x60 + 0x60 * 0x61* 2) * 2;
-
-
- {
- char dmapSrc[0x60 * 0x60 * 3];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft;
- size_t outBytesLeft;
- size_t len;
- char * inBuf;
- char * outBuf;
- char SS=0x8E;
-
-#ifdef support_surrogate
- if ((cd = iconv_open("UTF-16", from)) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open("UCS-2", from)) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- for (i = 0; i < 0x100; ++i) {
- dmapSrc[0]=i;
- inBuf=dmapSrc;
- inBytesLeft=1;
- outBuf=(char *) (&dmap_rec[idx].dmapE02U[i]);
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
- }
-#endif
- dmap_rec[idx].dmapE02U[i]=0x0000;
- }
- if (dmap_rec[idx].dmapE02U[i] == 0x001A && /* pick the first one */
- myconv_rec[idx].srcSubS == 0x00) {
- myconv_rec[idx].srcSubS=i;
- }
- }
-
-
- inBuf=dmapSrc;
- for (i = 0; i < 0x60; ++i) {
- int j;
- for (j = 0; j < 0x60; ++j) {
- *inBuf=i+0xA0;
- ++inBuf;
- *inBuf=j+0xA0;
- ++inBuf;
- }
- }
- inBuf=dmapSrc;
- inBytesLeft=0x60 * 0x60 * 2;
- outBuf=(char *) dmap_rec[idx].dmapE12U;
- outBytesLeft=0x60 * 0x60 * 2;
- do {
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (errno == EILSEQ) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft);
- if (inBuf - dmapSrc > 1 && inBuf - dmapSrc <= sizeof(dmapSrc) - 2)
- MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]);
- if (outBuf - (char *) dmap_rec[idx].dmapE12U > 1)
- MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]);
- }
-#endif
- inBuf+=2;
- inBytesLeft-=2;
- outBuf[0]=0x00;
- outBuf[1]=0x00;
- outBuf+=2;
- outBytesLeft-=2;
- } else {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- iconv_close(cd);
- return -1;
- }
- }
- } while (inBytesLeft > 0);
-
- /* SS2: 0x8E + 1 or 2 bytes */
- /* SS3: 0x8E + 1 or 2 bytes */
- while (SS != 0x00) {
- int32_t numSuccess=0;
- for (i = 0; i < 0x60; ++i) {
- inBuf=dmapSrc;
- inBuf[0]=SS;
- inBuf[1]=i+0xA0;
- inBytesLeft=2;
- if (SS == 0x8E)
- outBuf=(char *) &(dmap_rec[idx].dmapE22U[i]);
- else
- outBuf=(char *) &(dmap_rec[idx].dmapE32U[i]);
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (SS == 0x8E)
- dmap_rec[idx].dmapE22U[i]=0x0000;
- else
- dmap_rec[idx].dmapE32U[i]=0x0000;
- } else {
- ++numSuccess;
- }
- }
- if (numSuccess == 0) { /* SS2 is 2 bytes */
- inBuf=dmapSrc;
- for (i = 0; i < 0x60; ++i) {
- int j;
- for (j = 0; j < 0x60; ++j) {
- *inBuf=SS;
- ++inBuf;
- *inBuf=i+0xA0;
- ++inBuf;
- *inBuf=j+0xA0;
- ++inBuf;
- }
- }
- inBuf=dmapSrc;
- inBytesLeft=0x60 * 0x60 * 3;
- if (SS == 0x8E)
- outBuf=(char *) &(dmap_rec[idx].dmapE22U[0x60]);
- else
- outBuf=(char *) &(dmap_rec[idx].dmapE32U[0x60]);
- outBytesLeft=0x60 * 0x60 * 2;
- do {
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "%02X:dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- SS, to, from, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft);
- if (inBuf - dmapSrc > 1 && inBuf - dmapSrc <= sizeof(dmapSrc) - 2)
- MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]);
- }
-#endif
- if (errno == EILSEQ || errno == EINVAL) {
- inBuf+=3;
- inBytesLeft-=3;
- outBuf[0]=0x00;
- outBuf[1]=0x00;
- outBuf+=2;
- outBytesLeft-=2;
- } else {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "%02X:dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- SS, to, from, idx, errno, __FILE__,__LINE__);
-#endif
- iconv_close(cd);
- return -1;
- }
- }
- } while (inBytesLeft > 0);
- }
- if (SS == 0x8E)
- SS=0x8F;
- else
- SS = 0x00;
- }
- iconv_close(cd);
-
- myconv_rec[idx].subS=0x1A;
- myconv_rec[idx].subD=0xFFFD;
- for (i = 0; i < 0x80; ++i) {
- if (dmap_rec[idx].dmapE02U[i] == 0x001A) {
- myconv_rec[idx].srcSubS=i; /* pick the first one */
- break;
- }
- }
-
- for (i = 0; i < 0x60 * 0x60; ++i) {
- if (dmap_rec[idx].dmapE12U[i] == 0xFFFD) {
- uchar byte1=i / 0x60;
- uchar byte2=i % 0x60;
- myconv_rec[idx].srcSubD=(byte1 + 0xA0) * 0x100 + (byte2 + 0xA0); /* pick the last one */
- }
- }
-
- }
-
- } else if (((myconvIsUCS2(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_U2E)) ||
- ((myconvIsUTF16(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_T2E)) ||
- ((myconvIsUTF8(from) && myconvIsEUC(to)) && (dmap_rec[idx].codingSchema = DMAP_82E))) {
- /* S0: 0x00 - 0xFF */
- if ((dmap_rec[idx].dmapU2S = (uchar *) alloc_root(&dmapMemRoot, 0x100)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapU2S, 0x00, 0x100);
-
- /* U0080 - UFFFF -> S1: 0xA0 - 0xFF, 0xA0 - 0xFF */
- if ((dmap_rec[idx].dmapU2M2 = (uchar *) alloc_root(&dmapMemRoot, 0xFF80 * 2)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapU2M2, 0x00, 0xFF80 * 2);
-
- /* U0080 - UFFFF -> SS2: 0x8E + 0xA0 - 0xFF, 0xA0 - 0xFF
- * SS3: 0x8F + 0xA0 - 0xFF, 0xA0 - 0xFF */
- if ((dmap_rec[idx].dmapU2M3 = (uchar *) alloc_root(&dmapMemRoot, 0xFF80 * 3)) == NULL) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d), CS=%d failed with malloc(), errno = %d in %s at %d\n",
- to, from, idx, DMAP_U2E, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
- memset(dmap_rec[idx].dmapU2M3, 0x00, 0xFF80 * 3);
- myconv_rec[idx].allocatedSize=(0x100 + 0xFF80 * 2 + 0xFF80 * 3);
-
- {
- UniChar dmapSrc[0x80];
- iconv_t cd;
- int32_t i;
- size_t inBytesLeft;
- size_t outBytesLeft;
- size_t len;
- char * inBuf;
- char * outBuf;
-
-#ifdef support_surrogate
- if ((cd = iconv_open(to, "UTF-16")) == (iconv_t) -1) {
-#else
- if ((cd = iconv_open(to, "UCS-2")) == (iconv_t) -1) {
-#endif
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed with iconv_open(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- return -1;
- }
-
- for (i = 0; i < 0x80; ++i)
- dmapSrc[i]=i;
- inBuf=(char *) dmapSrc;
- inBytesLeft=0x80 * 2;
- outBuf=(char *) dmap_rec[idx].dmapU2S;
- outBytesLeft=0x80;
- do {
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
-#ifdef DEBUG
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
-#endif
- iconv_close(cd);
- return -1;
- }
- } while (inBytesLeft > 0);
-
- myconv_rec[idx].srcSubS = 0x1A;
- myconv_rec[idx].srcSubD = 0xFFFD;
- myconv_rec[idx].subS = dmap_rec[idx].dmapU2S[0x1A];
-
- outBuf=(char *) &(myconv_rec[idx].subD);
- dmapSrc[0]=0xFFFD;
- inBuf=(char *) dmapSrc;
- inBytesLeft=2;
- outBytesLeft=2;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n",
- to, from, idx, len, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME, "iconv(0x1A,1,%p,1) returns outBuf=%p, outBytesLeft=%d\n",
- dmapSrc, outBuf, outBytesLeft);
- }
-#endif
- if (outBytesLeft == 0) {
- /* UCS-2_IBM-eucKR returns error.
- myconv(iconv) rc=1, error=0, InBytesLeft=0, OutBytesLeft=18
- myconv(iconvRev) rc=-1, error=116, InBytesLeft=2, OutBytesLeft=20
- iconv: 0xFFFD => 0xAFFE => 0x rc=1,-1 sub=0,0
- */
- ;
- } else {
- iconv_close(cd);
- return -1;
- }
- }
-
- for (i = 0x80; i < 0xFFFF; ++i) {
- uchar eucBuf[3];
- dmapSrc[0]=i;
- inBuf=(char *) dmapSrc;
- inBytesLeft=2;
- outBuf=(char *) eucBuf;
- outBytesLeft=sizeof(eucBuf);
- errno=0;
- if ((len = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft)) != (size_t) 0) {
- if (len == 1 && errno == 0 && inBytesLeft == 0 && outBytesLeft == 1) { /* substitution occurred. */ continue;
- }
-
- if (errno == EILSEQ) {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), errno = %d in %s at %d\n",
- to, from, idx, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WO_TIME, "inBytesLeft=%d, outBytesLeft=%d\n", inBytesLeft, outBytesLeft);
- if (inBuf - (char *) dmapSrc > 1 && inBuf - (char *) dmapSrc <= sizeof(dmapSrc) - 2)
- MyPrintf(STDERR_WO_TIME, "inBuf[-2..2]=%02X%02X%02X%02X%02X\n", inBuf[-2],inBuf[-1],inBuf[0],inBuf[1],inBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "inBuf[0..2]=%02X%02X%02X\n", inBuf[0],inBuf[1],inBuf[2]);
- if (outBuf - (char *) dmap_rec[idx].dmapU2M2 > 1)
- MyPrintf(STDERR_WO_TIME, "outBuf[-2..2]=%02X%02X%02X%02X%02X\n", outBuf[-2],outBuf[-1],outBuf[0],outBuf[1],outBuf[2]);
- else
- MyPrintf(STDERR_WO_TIME, "outBuf[0..2]=%02X%02X%02X\n", outBuf[0],outBuf[1],outBuf[2]);
- }
-#endif
- inBuf+=2;
- inBytesLeft-=2;
- memcpy(outBuf, (char *) &(myconv_rec[idx].subD), 2);
- outBuf+=2;
- outBytesLeft-=2;
- } else {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc = %d, errno = %d in %s at %d\n",
- to, from, idx, len, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf[-2..0]=%02X%02X%02X, outBytesLeft=%d\n",
- i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1],
- inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft);
- MyPrintf(STDERR_WITH_TIME,
- "&dmapSrc=%p, inBuf=%p, dmapU2M2 + %d = %p, outBuf=%p\n",
- dmapSrc, inBuf, (i - 0x80) * 2, dmap_rec[idx].dmapU2M2 + (i - 0x80) * 2, outBuf);
- }
-#endif
- iconv_close(cd);
- return -1;
- }
- }
- if (sizeof(eucBuf) - outBytesLeft == 1) {
- if (i < 0x100) {
- (dmap_rec[idx].dmapU2S)[i]=eucBuf[0];
- } else {
- dmap_rec[idx].dmapU2M2[(i - 0x80) * 2] = eucBuf[0];
- dmap_rec[idx].dmapU2M2[(i - 0x80) * 2 + 1] = 0x00;
- }
- } else if (sizeof(eucBuf) - outBytesLeft == 2) { /* 2 bytes */
- dmap_rec[idx].dmapU2M2[(i - 0x80) * 2] = eucBuf[0];
- dmap_rec[idx].dmapU2M2[(i - 0x80) * 2 + 1] = eucBuf[1];
- } else if (sizeof(eucBuf) - outBytesLeft == 3) { /* 3 byte SS2/SS3 */
- dmap_rec[idx].dmapU2M3[(i - 0x80) * 3] = eucBuf[0];
- dmap_rec[idx].dmapU2M3[(i - 0x80) * 3 + 1] = eucBuf[1];
- dmap_rec[idx].dmapU2M3[(i - 0x80) * 3 + 2] = eucBuf[2];
- } else {
-#ifdef DEBUG
- if (myconvDebug) {
- MyPrintf(STDERR_WITH_TIME,
- "dmap_open(%s,%s,%d) failed to initialize with iconv(), rc=%d, errno=%d in %s at %d\n",
- to, from, idx, len, errno, __FILE__,__LINE__);
- MyPrintf(STDERR_WITH_TIME,
- "%04X: src=%04X%04X, inBuf=0x%02X%02X, inBytesLeft=%d, outBuf=%02X%02X%02X, outBytesLeft=%d\n",
- i, dmapSrc[0], dmapSrc[1], inBuf[0], inBuf[1],
- inBytesLeft, outBuf[-2], outBuf[-1], outBuf[0], outBytesLeft);
- MyPrintf(STDERR_WITH_TIME,
- "&dmapSrc=%p, inBuf=%p, %p, outBuf=%p\n",
- dmapSrc, inBuf, dmap_rec[idx].dmapU2M3 + (i - 0x80) * 2, outBuf);
- }
-#endif
- return -1;
- }
-
- }
- iconv_close(cd);
- }
-
- } else if (myconvIsUTF16(from) && myconvIsUTF8(to)) {
- dmap_rec[idx].codingSchema = DMAP_T28;
-
- } else if (myconvIsUCS2(from) && myconvIsUTF8(to)) {
- dmap_rec[idx].codingSchema = DMAP_U28;
-
- } else if (myconvIsUTF8(from) && myconvIsUnicode2(to)) {
- dmap_rec[idx].codingSchema = DMAP_82U;
-
- } else if (myconvIsUnicode2(from) && myconvIsUnicode2(to)) {
- dmap_rec[idx].codingSchema = DMAP_U2U;
-
- } else {
-
- return -1;
- }
- myconv_rec[idx].cnv_dmap=&(dmap_rec[idx]);
- return 0;
-}
-
-
-
-static int bins_open(const char * to,
- const char * from,
- const int32_t idx)
-{
- return -1;
-}
-
-
-
-static int32_t dmap_close(const int32_t idx)
-{
- if (dmap_rec[idx].codingSchema == DMAP_S2S) {
- if (dmap_rec[idx].dmapS2S != NULL) {
- dmap_rec[idx].dmapS2S=NULL;
- }
- } else if (dmap_rec[idx].codingSchema = DMAP_E2U) {
- if (dmap_rec[idx].dmapE02U != NULL) {
- dmap_rec[idx].dmapE02U=NULL;
- }
- if (dmap_rec[idx].dmapE12U != NULL) {
- dmap_rec[idx].dmapE12U=NULL;
- }
- if (dmap_rec[idx].dmapE22U != NULL) {
- dmap_rec[idx].dmapE22U=NULL;
- }
- if (dmap_rec[idx].dmapE32U != NULL) {
- dmap_rec[idx].dmapE32U=NULL;
- }
- }
-
- return 0;
-}
-
-
-static int32_t bins_close(const int32_t idx)
-{
- return 0;
-}
-
-
-myconv_t myconv_open(const char * toCode,
- const char * fromCode,
- int32_t converter)
-{
- int32 i;
- for (i = 0; i < MAX_CONVERTER; ++i) {
- if (myconv_rec[i].converterType == 0)
- break;
- }
- if (i >= MAX_CONVERTER)
- return ((myconv_t) -1);
-
- myconv_rec[i].converterType = converter;
- myconv_rec[i].index=i;
- myconv_rec[i].fromCcsid=cstoccsid(fromCode);
- if (myconv_rec[i].fromCcsid == 0 && memcmp(fromCode, "big5",5) == 0)
- myconv_rec[i].fromCcsid=950;
- myconv_rec[i].toCcsid=cstoccsid(toCode);
- if (myconv_rec[i].toCcsid == 0 && memcmp(toCode, "big5",5) == 0)
- myconv_rec[i].toCcsid=950;
- strncpy(myconv_rec[i].from, fromCode, sizeof(myconv_rec[i].from)-1);
- strncpy(myconv_rec[i].to, toCode, sizeof(myconv_rec[i].to)-1);
-
- if (converter == CONVERTER_ICONV) {
- if ((myconv_rec[i].cnv_iconv=iconv_open(toCode, fromCode)) == (iconv_t) -1) {
- return ((myconv_t) -1);
- }
- myconv_rec[i].allocatedSize = -1;
- myconv_rec[i].srcSubS=myconvGetSubS(fromCode);
- myconv_rec[i].srcSubD=myconvGetSubD(fromCode);
- myconv_rec[i].subS=myconvGetSubS(toCode);
- myconv_rec[i].subD=myconvGetSubD(toCode);
- return &(myconv_rec[i]);
- } else if (converter == CONVERTER_DMAP &&
- dmap_open(toCode, fromCode, i) != -1) {
- return &(myconv_rec[i]);
- }
- return ((myconv_t) -1);
-}
-
-
-
-int32_t myconv_close(myconv_t cd)
-{
- int32_t ret=0;
-
- if (cd->converterType == CONVERTER_ICONV) {
- ret=iconv_close(cd->cnv_iconv);
- } else if (cd->converterType == CONVERTER_DMAP) {
- ret=dmap_close(cd->index);
- }
- memset(&(myconv_rec[cd->index]), 0x00, sizeof(myconv_rec[cd->index]));
- return ret;
-}
-
-
-
-
-/* reference: http://www-306.ibm.com/software/globalization/other/es.jsp */
-/* systemCL would be expensive, and myconvIsXXXXX is called frequently.
- need to cache entries */
-#define MAX_CCSID 256
-static int ccsidList [MAX_CCSID];
-static int esList [MAX_CCSID];
-int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme);
-EXTERN int myconvGetES(CCSID ccsid)
-{
- /* call QtqValidateCCSID in ILE to get encoding schema */
- /* return QtqValidateCCSID(ccsid); */
- int i;
- for (i = 0; i < MAX_CCSID; ++i) {
- if (ccsidList[i] == ccsid)
- return esList[i];
- if (ccsidList[i] == 0x00)
- break;
- }
-
- if (i >= MAX_CCSID) {
- i=MAX_CCSID-1;
- }
-
- {
- ccsidList[i]=ccsid;
- getEncodingScheme(ccsid, esList[i]);
-#ifdef DEBUG_PASE
- if (myconvDebug) {
- fprintf(stderr, "CCSID=%d, ES=0x%04X\n", ccsid, esList[i]);
- }
-#endif
- return esList[i];
- }
- return 0;
-}
-
-
-EXTERN int myconvIsEBCDIC(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x1100 ||
- es == 0x1200 ||
- es == 0x6100 ||
- es == 0x6200 ||
- es == 0x1301 ) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsISO(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x4100 ||
- es == 0x4105 ||
- es == 0x4155 ||
- es == 0x5100 ||
- es == 0x5150 ||
- es == 0x5200 ||
- es == 0x5404 ||
- es == 0x5409 ||
- es == 0x540A ||
- es == 0x5700) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsASCII(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x2100 ||
- es == 0x3100 ||
- es == 0x8100 ||
- es == 0x2200 ||
- es == 0x3200 ||
- es == 0x9200 ||
- es == 0x2300 ||
- es == 0x2305 ||
- es == 0x3300 ||
- es == 0x2900 ||
- es == 0x2A00) {
- return TRUE;
- } else if (memcmp(pName, "big5", 5) == 0) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-
-EXTERN int myconvIsUCS2(const char * pName)
-{
- if (cstoccsid(pName) == 13488) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsUTF16(const char * pName)
-{
- if (cstoccsid(pName) == 1200) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsUnicode2(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x7200 ||
- es == 0x720B ||
- es == 0x720F) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsUTF8(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x7807) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsUnicode(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x7200 ||
- es == 0x720B ||
- es == 0x720F ||
- es == 0x7807) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsEUC(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x4403) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsDBCS(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x1200 ||
- es == 0x2200 ||
- es == 0x2300 ||
- es == 0x2305 ||
- es == 0x2A00 ||
- es == 0x3200 ||
- es == 0x3300 ||
- es == 0x5200 ||
- es == 0x6200 ||
- es == 0x9200) {
- return TRUE;
- } else if (memcmp(pName, "big5", 5) == 0) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-EXTERN int myconvIsSBCS(const char * pName)
-{
- int es = myconvGetES(cstoccsid(pName));
- if (es == 0x1100 ||
- es == 0x2100 ||
- es == 0x3100 ||
- es == 0x4100 ||
- es == 0x4105 ||
- es == 0x5100 ||
- es == 0x5150 ||
- es == 0x6100 ||
- es == 0x8100) {
- return TRUE;
- }
- return FALSE;
-}
-
-
-
-EXTERN char myconvGetSubS(const char * code)
-{
- if (myconvIsEBCDIC(code)) {
- return 0x3F;
- } else if (myconvIsASCII(code)) {
- return 0x1A;
- } else if (myconvIsISO(code)) {
- return 0x1A;
- } else if (myconvIsEUC(code)) {
- return 0x1A;
- } else if (myconvIsUCS2(code)) {
- return 0x00;
- } else if (myconvIsUTF8(code)) {
- return 0x1A;
- }
- return 0x00;
-}
-
-
-EXTERN UniChar myconvGetSubD(const char * code)
-{
- if (myconvIsEBCDIC(code)) {
- return 0xFDFD;
- } else if (myconvIsASCII(code)) {
- return 0xFCFC;
- } else if (myconvIsISO(code)) {
- return 0x00;
- } else if (myconvIsEUC(code)) {
- return 0x00;
- } else if (myconvIsUCS2(code)) {
- return 0xFFFD;
- } else if (myconvIsUTF8(code)) {
- return 0x00;
- }
- return 0x00;
-}
-
diff --git a/storage/ibmdb2i/db2i_myconv.h b/storage/ibmdb2i/db2i_myconv.h
deleted file mode 100644
index 98032748148..00000000000
--- a/storage/ibmdb2i/db2i_myconv.h
+++ /dev/null
@@ -1,3201 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-/**
- @file
-
- @brief A direct map optimization of iconv and related functions
- This was show to significantly reduce character conversion cost
- for short strings when compared to calling iconv system code.
-*/
-
-#ifndef DB2I_MYCONV_H
-#define DB2I_MYCONV_H
-
-
-#include <sys/time.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <errno.h>
-#include <iconv.h>
-#include <ctype.h>
-#include <time.h>
-#include <stdarg.h>
-#include <string.h>
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifdef __cplusplus
-#define INTERN inline
-#define EXTERN extern "C"
-#else
-#define INTERN static
-#define EXTERN extern
-#endif
-
-
-/* ANSI integer data types */
-#if defined(__OS400_TGTVRM__)
-/* for DTAMDL(*P128), datamodel(P128): int/long/pointer=4/4/16 */
-/* LLP64:4/4/8 is used for teraspace ?? */
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned int uint32_t;
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-#elif defined(PASE)
-/* PASE uses IPL32: int/long/pointer=4/4/4 + long long */
-#elif defined(__64BIT__)
-/* AIX 64 bit uses LP64: int/long/pointer=4/8/8 */
-#endif
-
-#define CONVERTER_ICONV 1
-#define CONVERTER_DMAP 2
-
-#define DMAP_S2S 10
-#define DMAP_S2U 20
-#define DMAP_D2U 30
-#define DMAP_E2U 40
-#define DMAP_U2S 120
-#define DMAP_T2S 125
-#define DMAP_U2D 130
-#define DMAP_T2D 135
-#define DMAP_U2E 140
-#define DMAP_T2E 145
-#define DMAP_S28 220
-#define DMAP_D28 230
-#define DMAP_E28 240
-#define DMAP_82S 310
-#define DMAP_82D 320
-#define DMAP_82E 330
-#define DMAP_U28 410
-#define DMAP_82U 420
-#define DMAP_T28 425
-#define DMAP_U2U 510
-
-
-typedef struct __dmap_rec *dmap_t;
-
-struct __dmap_rec
-{
- uint32_t codingSchema;
- unsigned char * dmapS2S; /* SBCS -> SBCS */
- /* The following conversion needs be followed by conversion from UCS-2/UTF-16 to UTF-8 */
- UniChar * dmapD12U; /* DBCS(non-EUC) -> UCS-2/UTF-16 */
- UniChar * dmapD22U; /* DBCS(non-EUC) -> UCS-2/UTF-16 */
- UniChar * dmapE02U; /* EUC/SS0 -> UCS-2/UTF-16 */
- UniChar * dmapE12U; /* EUC/SS1 -> UCS-2/UTF-16 */
- UniChar * dmapE22U; /* EUC/0x8E + SS2 -> UCS-2/UTF-16 */
- UniChar * dmapE32U; /* EUC/0x8F + SS3 -> UCS-2/UTF-16 */
- uchar * dmapU2D; /* UCS-2 -> DBCS */
- uchar * dmapU2S; /* UCS-2 -> EUC SS0 */
- uchar * dmapU2M2; /* UCS-2 -> EUC SS1 */
- uchar * dmapU2M3; /* UCS-2 -> EUC SS2/SS3 */
- /* All of these pointers/tables are not used at the same time.
- * You may be able save some space if you consolidate them.
- */
- uchar * dmapS28; /* SBCS -> UTF-8 */
- uchar * dmapD28; /* DBCS -> UTF-8 */
-};
-
-typedef struct __myconv_rec *myconv_t;
-struct __myconv_rec
-{
- uint32_t converterType;
- uint32_t index; /* for close */
- union {
- iconv_t cnv_iconv;
- dmap_t cnv_dmap;
- };
- int32_t allocatedSize;
- int32_t fromCcsid;
- int32_t toCcsid;
- UniChar subD; /* DBCS substitution char */
- char subS; /* SBCS substitution char */
- UniChar srcSubD; /* DBCS substitution char of src codepage */
- char srcSubS; /* SBCS substitution char of src codepage */
- char from [41+1]; /* codepage name is up to 41 bytes */
- char to [41+1]; /* codepage name is up to 41 bytes */
-#ifdef __64BIT__
- char reserved[10]; /* align 128 */
-#else
- char reserved[14]; /* align 128 */
-#endif
-};
-
-
-EXTERN int32_t myconvDebug;
-
-
-
-EXTERN int myconvGetES(CCSID);
-EXTERN int myconvIsEBCDIC(const char *);
-EXTERN int myconvIsASCII(const char *);
-EXTERN int myconvIsUnicode(const char *); /* UTF-8, UTF-16, or UCS-2 */
-EXTERN int myconvIsUnicode2(const char *); /* 2 byte Unicode */
-EXTERN int myconvIsUCS2(const char *);
-EXTERN int myconvIsUTF16(const char *);
-EXTERN int myconvIsUTF8(const char *);
-EXTERN int myconvIsEUC(const char *);
-EXTERN int myconvIsISO(const char *);
-EXTERN int myconvIsSBCS(const char *);
-EXTERN int myconvIsDBCS(const char *);
-EXTERN char myconvGetSubS(const char *);
-EXTERN UniChar myconvGetSubD(const char *);
-
-
-EXTERN myconv_t myconv_open(const char*, const char*, int32_t);
-EXTERN int myconv_close(myconv_t);
-
-INTERN size_t myconv_iconv(myconv_t cd ,
- char** inBuf,
- size_t* inBytesLeft,
- char** outBuf,
- size_t* outBytesLeft,
- size_t* numSub)
-{
- return iconv(cd->cnv_iconv, inBuf, inBytesLeft, outBuf, outBytesLeft);
-}
-
-INTERN size_t myconv_dmap(myconv_t cd,
- char** inBuf,
- size_t* inBytesLeft,
- char** outBuf,
- size_t* outBytesLeft,
- size_t* numSub)
-{
- if (cd->cnv_dmap->codingSchema == DMAP_S2S) {
- register unsigned char * dmapS2S=cd->cnv_dmap->dmapS2S;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register size_t numS=0;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- } else {
- *pOut=dmapS2S[*pIn];
- if (*pOut == 0x00) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(*inBytesLeft-inLen);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- if (*pOut == subS) {
- if ((*pOut=dmapS2S[*pIn]) == subS) {
- if (*pIn != cd->srcSubS)
- ++numS;
- }
- }
- }
- ++pIn;
- --inLen;
- ++pOut;
- }
- *outBytesLeft-=(*inBytesLeft-inLen);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_E2U) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapE02U=(uchar *) (cd->cnv_dmap->dmapE02U);
- register uchar * dmapE12U=(uchar *) (cd->cnv_dmap->dmapE12U);
- register uchar * dmapE22U=(uchar *) (cd->cnv_dmap->dmapE22U);
- register uchar * dmapE32U=(uchar *) (cd->cnv_dmap->dmapE32U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- if (*pIn == 0x8E) { /* SS2 */
- if (inLen < 2) {
- if (cd->fromCcsid == 33722 || /* IBM-eucJP */
- cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE22U[offset] == 0x00 &&
- dmapE22U[offset+1] == 0x00) { /* 2 bytes */
- if (inLen < 3) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60 + 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE22U[offset] == 0x00 &&
- dmapE22U[offset+1] == 0x00) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- *pOut=dmapE22U[offset];
- ++pOut;
- *pOut=dmapE22U[offset+1];
- ++pOut;
- if (dmapE22U[offset] == 0xFF &&
- dmapE22U[offset+1] == 0xFD) {
- if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=3;
- } else { /* 1 bytes */
- *pOut=dmapE22U[offset];
- ++pOut;
- *pOut=dmapE22U[offset+1];
- ++pOut;
- ++pIn;
- inLen-=2;
- }
- } else if (*pIn == 0x8F) { /* SS3 */
- if (inLen < 2) {
- if (cd->fromCcsid == 33722) /* IBM-eucJP */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 970 || /* IBM-eucKR */
- cd->fromCcsid == 964 || /* IBM-eucTW */
- cd->fromCcsid == 1383 || /* IBM-eucCN */
- (cd->fromCcsid == 33722 && 3 <= inLen)) /* IBM-eucJP */
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE32U[offset] == 0x00 &&
- dmapE32U[offset+1] == 0x00) { /* 0x8F + 2 bytes */
- if (inLen < 3) {
- if (cd->fromCcsid == 33722)
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60 + 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE32U[offset] == 0x00 &&
- dmapE32U[offset+1] == 0x00) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- *pOut=dmapE32U[offset];
- ++pOut;
- *pOut=dmapE32U[offset+1];
- ++pOut;
- if (dmapE32U[offset] == 0xFF &&
- dmapE32U[offset+1] == 0xFD) {
- if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=3;
- } else { /* 0x8F + 1 bytes */
- *pOut=dmapE32U[offset];
- ++pOut;
- *pOut=dmapE32U[offset+1];
- ++pOut;
- ++pIn;
- inLen-=2;
- }
-
- } else {
- offset=*pIn;
- offset<<=1;
- if (dmapE02U[offset] == 0x00 &&
- dmapE02U[offset+1] == 0x00) { /* SS1 */
- if (inLen < 2) {
- if ((cd->fromCcsid == 33722 && (*pIn == 0xA0 || (0xA9 <= *pIn && *pIn <= 0xAF) || *pIn == 0xFF)) ||
- (cd->fromCcsid == 970 && (*pIn == 0xA0 || *pIn == 0xAD || *pIn == 0xAE || *pIn == 0xAF || *pIn == 0xFF)) ||
- (cd->fromCcsid == 964 && (*pIn == 0xA0 || (0xAA <= *pIn && *pIn <= 0xC1) || *pIn == 0xC3 || *pIn == 0xFE || *pIn == 0xFF)) ||
- (cd->fromCcsid == 1383 && (*pIn == 0xA0 || *pIn == 0xFF)))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE12U[offset] == 0x00 &&
- dmapE12U[offset+1] == 0x00) { /* undefined mapping */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- *pOut=dmapE12U[offset];
- ++pOut;
- *pOut=dmapE12U[offset+1];
- ++pOut;
- if (dmapE12U[offset] == 0xFF &&
- dmapE12U[offset+1] == 0xFD) {
- if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=2;
- } else {
- *pOut=dmapE02U[offset];
- ++pOut;
- *pOut=dmapE02U[offset+1];
- ++pOut;
- if (dmapE02U[offset] == 0x00 &&
- dmapE02U[offset+1] == 0x1A) {
- if (*pIn != cd->srcSubS)
- ++numS;
- }
- ++pIn;
- --inLen;
- }
- }
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_E28) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapE02U=(uchar *) (cd->cnv_dmap->dmapE02U);
- register uchar * dmapE12U=(uchar *) (cd->cnv_dmap->dmapE12U);
- register uchar * dmapE22U=(uchar *) (cd->cnv_dmap->dmapE22U);
- register uchar * dmapE32U=(uchar *) (cd->cnv_dmap->dmapE32U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- register UniChar in; /* copy part of U28 */
- register UniChar ucs2;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- if (*pIn == 0x8E) { /* SS2 */
- if (inLen < 2) {
- if (cd->fromCcsid == 33722 || /* IBM-eucJP */
- cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE22U[offset] == 0x00 &&
- dmapE22U[offset+1] == 0x00) { /* 2 bytes */
- if (inLen < 3) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60 + 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE22U[offset] == 0x00 &&
- dmapE22U[offset+1] == 0x00) {
- if (cd->fromCcsid == 964) /* IBM-eucTW */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- in=dmapE22U[offset];
- in<<=8;
- in+=dmapE22U[offset+1];
- if (dmapE22U[offset] == 0xFF &&
- dmapE22U[offset+1] == 0xFD) {
- if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=3;
- } else { /* 1 bytes */
- in=dmapE22U[offset];
- in<<=8;
- in+=dmapE22U[offset+1];
- ++pIn;
- inLen-=2;
- }
- } else if (*pIn == 0x8F) { /* SS3 */
- if (inLen < 2) {
- if (cd->fromCcsid == 33722) /* IBM-eucJP */
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- ++pIn;
- if (*pIn < 0xA0) {
- if (cd->fromCcsid == 970 || /* IBM-eucKR */
- cd->fromCcsid == 964 || /* IBM-eucTW */
- cd->fromCcsid == 1383 || /* IBM-eucCN */
- (cd->fromCcsid == 33722 && 3 <= inLen)) /* IBM-eucJP */
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE32U[offset] == 0x00 &&
- dmapE32U[offset+1] == 0x00) { /* 0x8F + 2 bytes */
- if (inLen < 3) {
- if (cd->fromCcsid == 33722)
- errno=EINVAL; /* 22 */
- else
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60 + 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE32U[offset] == 0x00 &&
- dmapE32U[offset+1] == 0x00) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- return -1;
- }
- in=dmapE32U[offset];
- in<<=8;
- in+=dmapE32U[offset+1];
- if (dmapE32U[offset] == 0xFF &&
- dmapE32U[offset+1] == 0xFD) {
- if (pIn[-2] * 0x100 + pIn[-1] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=3;
- } else { /* 0x8F + 1 bytes */
- in=dmapE32U[offset];
- in<<=8;
- in+=dmapE32U[offset+1];
- ++pIn;
- inLen-=2;
- }
-
- } else {
- offset=*pIn;
- offset<<=1;
- if (dmapE02U[offset] == 0x00 &&
- dmapE02U[offset+1] == 0x00) { /* SS1 */
- if (inLen < 2) {
- if ((cd->fromCcsid == 33722 && (*pIn == 0xA0 || (0xA9 <= *pIn && *pIn <= 0xAF) || *pIn == 0xFF)) ||
- (cd->fromCcsid == 970 && (*pIn == 0xA0 || *pIn == 0xAD || *pIn == 0xAE || *pIn == 0xAF || *pIn == 0xFF)) ||
- (cd->fromCcsid == 964 && (*pIn == 0xA0 || (0xAA <= *pIn && *pIn <= 0xC1) || *pIn == 0xC3 || *pIn == 0xFE || *pIn == 0xFF)) ||
- (cd->fromCcsid == 1383 && (*pIn == 0xA0 || *pIn == 0xFF)))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- offset=(*pIn - 0xA0) * 0x60;
- ++pIn;
- if (*pIn < 0xA0) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- offset+=(*pIn - 0xA0);
- offset<<=1;
- if (dmapE12U[offset] == 0x00 &&
- dmapE12U[offset+1] == 0x00) { /* undefined mapping */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- in=dmapE12U[offset];
- in<<=8;
- in+=dmapE12U[offset+1];
- if (dmapE12U[offset] == 0xFF &&
- dmapE12U[offset+1] == 0xFD) {
- if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=2;
- } else {
- in=dmapE02U[offset];
- in<<=8;
- in+=dmapE02U[offset+1];
- if (dmapE02U[offset] == 0x00 &&
- dmapE02U[offset+1] == 0x1A) {
- if (*pIn != cd->srcSubS)
- ++numS;
- }
- ++pIn;
- --inLen;
- }
- }
- ucs2=in;
- if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */
- *pOut=in;
- ++pOut;
- } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */
- register uchar byte;
- in>>=6;
- in&=0x001F; /* 0b0000000000011111 */
- in|=0x00C0; /* 0b0000000011000000 */
- *pOut=in;
- ++pOut;
- byte=ucs2; /* dmapD12U[offset+1]; */
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- } else if ((in & 0xFC00) == 0xD800) {
- *pOut=0xEF;
- ++pOut;
- *pOut=0xBF;
- ++pOut;
- *pOut=0xBD;
- ++pOut;
- } else {
- register uchar byte;
- register uchar work;
- byte=(ucs2>>8); /* dmapD12U[offset]; */
- byte>>=4;
- byte|=0xE0; /* 0b11100000; */
- *pOut=byte;
- ++pOut;
-
- byte=(ucs2>>8); /* dmapD12U[offset]; */
- byte<<=2;
- work=ucs2; /* dmapD12U[offset+1]; */
- work>>=6;
- byte|=work;
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
-
- byte=ucs2; /* dmapD12U[offset+1]; */
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- }
- /* end of U28 */
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_U2E) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2;
- register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- register size_t rc=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if (in < 0x100 && dmapU2S[in] != 0x0000) {
- if ((*pOut=dmapU2S[in]) == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- ++pOut;
- } else {
- in<<=1;
- if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */
- in*=1.5;
- if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/
- *pOut=pSubD[0];
- ++pOut;
- *pOut=pSubD[1];
- ++pOut;
- ++numS;
- ++rc;
- } else {
- *pOut=dmapU2M3[in];
- ++pOut;
- *pOut=dmapU2M3[1+in];
- ++pOut;
- *pOut=dmapU2M3[2+in];
- ++pOut;
- }
- } else {
- *pOut=dmapU2M2[in];
- ++pOut;
- if (dmapU2M2[1+in] == 0x00) {
- if (*pOut == subS) {
- in>>=1;
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2M2[1+in];
- ++pOut;
- if (memcmp(pOut-2, pSubD, 2) == 0) {
- in>>=1;
- if (in != cd->srcSubD) {
- ++numS;
- ++rc;
- }
- }
- }
- }
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return rc; /* compatibility to iconv() */
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_T2E) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2;
- register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- register size_t rc=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen-1;
- *outBuf=pOut;
- *inBuf=pIn;
- ++numS;
- *numSub+=numS;
- return 0;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if (0xD800 <= in && in <= 0xDBFF) { /* first byte of surrogate */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-2;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn+2;
- ++numS;
- *numSub+=numS;
- return -1;
-
- } else if (0xDC00 <= in && in <= 0xDFFF) { /* second byte of surrogate */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- ++numS;
- *numSub+=numS;
- return -1;
-
- } else if (in < 0x100 && dmapU2S[in] != 0x0000) {
- if ((*pOut=dmapU2S[in]) == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- ++pOut;
- } else {
- in<<=1;
- if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */
- in*=1.5;
- if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/
- *pOut=pSubD[0];
- ++pOut;
- *pOut=pSubD[1];
- ++pOut;
- ++numS;
- ++rc;
- } else {
- *pOut=dmapU2M3[in];
- ++pOut;
- *pOut=dmapU2M3[1+in];
- ++pOut;
- *pOut=dmapU2M3[2+in];
- ++pOut;
- }
- } else {
- *pOut=dmapU2M2[in];
- ++pOut;
- if (dmapU2M2[1+in] == 0x00) {
- if (*pOut == subS) {
- in>>=1;
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2M2[1+in];
- ++pOut;
- if (memcmp(pOut-2, pSubD, 2) == 0) {
- in>>=1;
- if (in != cd->srcSubD) {
- ++numS;
- ++rc;
- }
- }
- }
- }
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_82E) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register uchar * dmapU2M2=cd->cnv_dmap->dmapU2M2 - 0x80 * 2;
- register uchar * dmapU2M3=cd->cnv_dmap->dmapU2M3 - 0x80 * 3;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- register size_t rc=0;
- while (0 < inLen) {
- register uint32_t in;
- uint32_t in2;
- if (pLastOutBuf < pOut)
- break;
- /* convert from UTF-8 to UCS-2 */
- if (*pIn == 0x00) {
- in=0x0000;
- ++pIn;
- --inLen;
- } else { /* 82U: */
- register uchar byte1=*pIn;
- if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */
- /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/
- in=byte1;
- ++pIn;
- --inLen;
- } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */
- if (inLen < 2) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- /* 2 bytes sequence:
- 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */
- register uchar byte2;
- ++pIn;
- byte2=*pIn;
- if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */
- register uchar work=byte1;
- work<<=6;
- byte2&=0x3F; /* 0b00111111; */
- byte2|=work;
-
- byte1&=0x1F; /* 0b00011111; */
- byte1>>=2;
- in=byte1;
- in<<=8;
- in+=byte2;
- inLen-=2;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */
- /* 3 bytes sequence:
- 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */
- register uchar byte2;
- register uchar byte3;
- if (inLen < 3) {
- if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- if ((byte2 & 0xC0) != 0x80 ||
- (byte3 & 0xC0) != 0x80 ||
- (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- *numSub+=numS;
- return -1;
- }
- {
- register uchar work=byte2;
- work<<=6;
- byte3&=0x3F; /* 0b00111111; */
- byte3|=work;
-
- byte2&=0x3F; /* 0b00111111; */
- byte2>>=2;
-
- byte1<<=4;
- in=byte1 | byte2;;
- in<<=8;
- in+=byte3;
- inLen-=3;
- ++pIn;
- }
- } else if ((0xF0 <= byte1 && byte1 <= 0xF4)) { /* (bytes1 & 11111000) == 0x1110000 */
- /* 4 bytes sequence
- 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx
- where uuuuu = wwww + 1 */
- register uchar byte2;
- register uchar byte3;
- register uchar byte4;
- if (inLen < 4) {
- if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) ||
- (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) ||
- (cd->toCcsid == 13488) )
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- ++pIn;
- byte4=*pIn;
- if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */
- (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */
- (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */
- register uchar work=byte2;
- if (byte1 == 0xF0 && byte2 < 0x90) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- /* iconv() returns 0 for 0xF4908080 and convert to 0x00
- } else if (byte1 == 0xF4 && byte2 > 0x8F) {
- errno=EINVAL;
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- */
- }
-
- work&=0x30; /* 0b00110000; */
- work>>=4;
- byte1&=0x07; /* 0b00000111; */
- byte1<<=2;
- byte1+=work; /* uuuuu */
- --byte1; /* wwww */
-
- work=byte1 & 0x0F;
- work>>=2;
- work+=0xD8; /* 0b11011011; */
- in=work;
- in<<=8;
-
- byte1<<=6;
- byte2<<=2;
- byte2&=0x3C; /* 0b00111100; */
- work=byte3;
- work>>=4;
- work&=0x03; /* 0b00000011; */
- work|=byte1;
- work|=byte2;
- in+=work;
-
- work=byte3;
- work>>=2;
- work&=0x03; /* 0b00000011; */
- work|=0xDC; /* 0b110111xx; */
- in2=work;
- in2<<=8;
-
- byte3<<=6;
- byte4&=0x3F; /* 0b00111111; */
- byte4|=byte3;
- in2+=byte4;
- inLen-=4;
- ++pIn;
-#ifdef match_with_GBK
- if ((0xD800 == in && in2 < 0xDC80) ||
- (0xD840 == in && in2 < 0xDC80) ||
- (0xD880 == in && in2 < 0xDC80) ||
- (0xD8C0 == in && in2 < 0xDC80) ||
- (0xD900 == in && in2 < 0xDC80) ||
- (0xD940 == in && in2 < 0xDC80) ||
- (0xD980 == in && in2 < 0xDC80) ||
- (0xD9C0 == in && in2 < 0xDC80) ||
- (0xDA00 == in && in2 < 0xDC80) ||
- (0xDA40 == in && in2 < 0xDC80) ||
- (0xDA80 == in && in2 < 0xDC80) ||
- (0xDAC0 == in && in2 < 0xDC80) ||
- (0xDB00 == in && in2 < 0xDC80) ||
- (0xDB40 == in && in2 < 0xDC80) ||
- (0xDB80 == in && in2 < 0xDC80) ||
- (0xDBC0 == in && in2 < 0xDC80)) {
-#else
- if ((0xD800 <= in && in <= 0xDBFF) &&
- (0xDC00 <= in2 && in2 <= 0xDFFF)) {
-#endif
- *pOut=subS;
- ++pOut;
- ++numS;
- continue;
- }
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- }
- } else if (0xF5 <= byte1 && byte1 <= 0xFF) { /* minic iconv() behavior */
- if (inLen < 4 ||
- (inLen >= 4 && byte1 == 0xF8 && pIn[1] < 0x90) ||
- pIn[1] < 0x80 || 0xBF < pIn[1] ||
- pIn[2] < 0x80 || 0xBF < pIn[2] ||
- pIn[3] < 0x80 || 0xBF < pIn[3] ) {
- if (inLen == 1)
- errno=EINVAL; /* 22 */
- else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else if (inLen >= 4 && (byte1 == 0xF8 || (pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
-
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- } else if ((pIn[1] == 0x80 || pIn[1] == 0x90 || pIn[1] == 0xA0 || pIn[1] == 0xB0) &&
- pIn[2] < 0x82) {
- *pOut=subS; /* Though returns replacement character, which iconv() does not return. */
- ++pOut;
- ++numS;
- pIn+=4;
- inLen-=4;
- continue;
- } else {
- *pOut=pSubD[0]; /* Though returns replacement character, which iconv() does not return. */
- ++pOut;
- *pOut=pSubD[1];
- ++pOut;
- ++numS;
- pIn+=4;
- inLen-=4;
- continue;
- /* iconv() returns 0 with strange 1 byte converted values */
- }
-
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- }
- /* end of UTF-8 to UCS-2 */
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if (in < 0x100 && dmapU2S[in] != 0x0000) {
- if ((*pOut=dmapU2S[in]) == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- ++pOut;
- } else {
- in<<=1;
- if (dmapU2M2[in] == 0x00) { /* not found in dmapU2M2 */
- in*=1.5;
- if (dmapU2M3[in] == 0x00) { /* not found in dmapU2M3*/
- *pOut=pSubD[0];
- ++pOut;
- *pOut=pSubD[1];
- ++pOut;
- ++numS;
- ++rc;
- } else {
- *pOut=dmapU2M3[in];
- ++pOut;
- *pOut=dmapU2M3[1+in];
- ++pOut;
- *pOut=dmapU2M3[2+in];
- ++pOut;
- }
- } else {
- *pOut=dmapU2M2[in];
- ++pOut;
- if (dmapU2M2[1+in] == 0x00) {
- if (*pOut == subS) {
- in>>=1;
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2M2[1+in];
- ++pOut;
- if (memcmp(pOut-2, pSubD, 2) == 0) {
- in>>=1;
- if (in != cd->srcSubD) {
- ++numS;
- ++rc;
- }
- }
- }
- }
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_S2U) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- offset=*pIn;
- offset<<=1;
- *pOut=dmapD12U[offset];
- ++pOut;
- *pOut=dmapD12U[offset+1];
- ++pOut;
- if (dmapD12U[offset] == 0x00) {
- if (dmapD12U[offset+1] == 0x1A) {
- if (*pIn != cd->srcSubS)
- ++numS;
- } else if (dmapD12U[offset+1] == 0x00) {
- pOut-=2;
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- }
- ++pIn;
- --inLen;
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_S28) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- register UniChar in; /* copy part of U28 */
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- offset=*pIn;
- offset<<=1;
- in=dmapD12U[offset];
- in<<=8;
- in+=dmapD12U[offset+1];
- if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */
- if (in == 0x000) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- *pOut=in;
- ++pOut;
- } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */
- register uchar byte;
- in>>=6;
- in&=0x001F; /* 0b0000000000011111 */
- in|=0x00C0; /* 0b0000000011000000 */
- *pOut=in;
- ++pOut;
- byte=dmapD12U[offset+1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- } else if ((in & 0xFC00) == 0xD800) { /* There should not be no surrogate character in SBCS. */
- *pOut=0xEF;
- ++pOut;
- *pOut=0xBF;
- ++pOut;
- *pOut=0xBD;
- ++pOut;
- } else {
- register uchar byte;
- register uchar work;
- byte=dmapD12U[offset];
- byte>>=4;
- byte|=0xE0; /* 0b11100000; */
- *pOut=byte;
- ++pOut;
-
- byte=dmapD12U[offset];
- byte<<=2;
- work=dmapD12U[offset+1];
- work>>=6;
- byte|=work;
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
-
- byte=dmapD12U[offset+1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- }
- /* end of U28 */
- if (dmapD12U[offset] == 0x00) {
- if (dmapD12U[offset+1] == 0x1A) {
- if (*pIn != cd->srcSubS)
- ++numS;
- }
- }
- ++pIn;
- --inLen;
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_U2S) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
-
- *inBytesLeft=inLen;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- } else {
- if ((*pOut=dmapU2S[in]) == 0x00) {
- *pOut=subS;
- ++numS;
- errno=EINVAL; /* 22 */
- } else if (*pOut == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- }
- ++pOut;
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return numS;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_T2S) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
-
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- ++numS;
- *numSub+=numS;
- return 0;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
-
- } else if (0xD800 <= in && in <= 0xDFFF) { /* 0xD800-0xDFFF, surrogate first and second values */
- if (0xDC00 <= in ) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
-
- } else if (inLen < 4) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-2;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn+2;
- return -1;
-
- } else {
- register uint32_t in2;
- in2=pIn[2];
- in2<<=8;
- in2+=pIn[3];
- if (0xDC00 <= in2 && in2 <= 0xDFFF) { /* second surrogate character =0xDC00 - 0xDFFF*/
- *pOut=subS;
- ++numS;
- pIn+=4;
- } else {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- }
- } else {
- if ((*pOut=dmapU2S[in]) == 0x00) {
- *pOut=subS;
- ++numS;
- errno=EINVAL; /* 22 */
- } else if (*pOut == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- }
- ++pOut;
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_82S) {
- register uchar * dmapU2S=cd->cnv_dmap->dmapU2S;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- uint32_t in2; /* The second surrogate value */
- if (pLastOutBuf < pOut)
- break;
- /* convert from UTF-8 to UCS-2 */
- if (*pIn == 0x00) {
- in=0x0000;
- ++pIn;
- --inLen;
- } else { /* 82U: */
- register uchar byte1=*pIn;
- if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */
- /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/
- in=byte1;
- ++pIn;
- --inLen;
- } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */
- if (inLen < 2) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- /* 2 bytes sequence:
- 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */
- register uchar byte2;
- ++pIn;
- byte2=*pIn;
- if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */
- register uchar work=byte1;
- work<<=6;
- byte2&=0x3F; /* 0b00111111; */
- byte2|=work;
-
- byte1&=0x1F; /* 0b00011111; */
- byte1>>=2;
- in=byte1;
- in<<=8;
- in+=byte2;
- inLen-=2;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */
- /* 3 bytes sequence:
- 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */
- register uchar byte2;
- register uchar byte3;
- if (inLen < 3) {
- if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- if ((byte2 & 0xC0) != 0x80 ||
- (byte3 & 0xC0) != 0x80 ||
- (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- *numSub+=numS;
- return -1;
- }
- {
- register uchar work=byte2;
- work<<=6;
- byte3&=0x3F; /* 0b00111111; */
- byte3|=work;
-
- byte2&=0x3F; /* 0b00111111; */
- byte2>>=2;
-
- byte1<<=4;
- in=byte1 | byte2;;
- in<<=8;
- in+=byte3;
- inLen-=3;
- ++pIn;
- }
- } else if ((0xF0 <= byte1 && byte1 <= 0xF4) || /* (bytes1 & 11111000) == 0x1110000 */
- ((byte1&=0xF7) && 0xF0 <= byte1 && byte1 <= 0xF4)) { /* minic iconv() behavior */
- /* 4 bytes sequence
- 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx
- where uuuuu = wwww + 1 */
- register uchar byte2;
- register uchar byte3;
- register uchar byte4;
- if (inLen < 4) {
- if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) ||
- (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) ||
- (cd->toCcsid == 13488) )
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- ++pIn;
- byte4=*pIn;
- if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */
- (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */
- (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */
- register uchar work=byte2;
- if (byte1 == 0xF0 && byte2 < 0x90) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- /* iconv() returns 0 for 0xF4908080 and convert to 0x00
- } else if (byte1 == 0xF4 && byte2 > 0x8F) {
- errno=EINVAL;
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- */
- }
-
- work&=0x30; /* 0b00110000; */
- work>>=4;
- byte1&=0x07; /* 0b00000111; */
- byte1<<=2;
- byte1+=work; /* uuuuu */
- --byte1; /* wwww */
-
- work=byte1 & 0x0F;
- work>>=2;
- work+=0xD8; /* 0b11011011; */
- in=work;
- in<<=8;
-
- byte1<<=6;
- byte2<<=2;
- byte2&=0x3C; /* 0b00111100; */
- work=byte3;
- work>>=4;
- work&=0x03; /* 0b00000011; */
- work|=byte1;
- work|=byte2;
- in+=work;
-
- work=byte3;
- work>>=2;
- work&=0x03; /* 0b00000011; */
- work|=0xDC; /* 0b110111xx; */
- in2=work;
- in2<<=8;
-
- byte3<<=6;
- byte4&=0x3F; /* 0b00111111; */
- byte4|=byte3;
- in2+=byte4;
- inLen-=4;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xF0) { /* minic iconv() behavior */
- if (inLen < 4 ||
- pIn[1] < 0x80 || 0xBF < pIn[1] ||
- pIn[2] < 0x80 || 0xBF < pIn[2] ||
- pIn[3] < 0x80 || 0xBF < pIn[3] ) {
- if (inLen == 1)
- errno=EINVAL; /* 22 */
- else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else if (inLen >= 4 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
-
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- } else {
- *pOut=subS; /* Though returns replacement character, which iconv() does not return. */
- ++pOut;
- ++numS;
- pIn+=4;
- inLen-=4;
- /* UTF-8_IBM-850 0xF0908080 : converted value does not match, iconv=0x00, dmap=0x7F
- UTF-8_IBM-850 0xF0908081 : converted value does not match, iconv=0x01, dmap=0x7F
- UTF-8_IBM-850 0xF0908082 : converted value does not match, iconv=0x02, dmap=0x7F
- UTF-8_IBM-850 0xF0908083 : converted value does not match, iconv=0x03, dmap=0x7F
- ....
- UTF-8_IBM-850 0xF09081BE : converted value does not match, iconv=0x7E, dmap=0x7F
- UTF-8_IBM-850 0xF09081BF : converted value does not match, iconv=0x1C, dmap=0x7F
- UTF-8_IBM-850 0xF09082A0 : converted value does not match, iconv=0xFF, dmap=0x7F
- UTF-8_IBM-850 0xF09082A1 : converted value does not match, iconv=0xAD, dmap=0x7F
- ....
- */
- continue;
- /* iconv() returns 0 with strange 1 byte converted values */
- }
-
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- }
- /* end of UTF-8 to UCS-2 */
- if (in == 0x0000) {
- *pOut=0x00;
- } else {
- if ((*pOut=dmapU2S[in]) == 0x00) {
- *pOut=subS;
- ++numS;
- errno=EINVAL; /* 22 */
- } else if (*pOut == subS) {
- if (in != cd->srcSubS) {
- ++numS;
- }
- }
- }
- ++pOut;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_D2U) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U);
- register uchar * dmapD22U=(uchar *) (cd->cnv_dmap->dmapD22U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- offset=*pIn;
- offset<<=1;
- if (dmapD12U[offset] == 0x00 &&
- dmapD12U[offset+1] == 0x00) { /* DBCS */
- if (inLen < 2) {
- if (*pIn == 0x80 || *pIn == 0xFF ||
- (cd->fromCcsid == 943 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0xA0 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xEF || *pIn == 0xFD || *pIn == 0xFE)) ||
- (cd->fromCcsid == 932 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0x87 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xED || *pIn == 0xEE || *pIn == 0xEF)) ||
- (cd->fromCcsid == 1381 && ((0x85 <= *pIn && *pIn <= 0x8B) || (0xAA <= *pIn && *pIn <= 0xAF) || (0xF8 <= *pIn && *pIn <= 0xFE))))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- offset-=0x100;
- ++pIn;
- offset<<=8;
- offset+=(*pIn * 2);
- if (dmapD22U[offset] == 0x00 &&
- dmapD22U[offset+1] == 0x00) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- *pOut=dmapD22U[offset];
- ++pOut;
- *pOut=dmapD22U[offset+1];
- ++pOut;
- if (dmapD22U[offset] == 0xFF &&
- dmapD22U[offset+1] == 0xFD) {
- if (pIn[-1] * 0x100 + pIn[0] != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=2;
- } else { /* SBCS */
- *pOut=dmapD12U[offset];
- ++pOut;
- *pOut=dmapD12U[offset+1];
- ++pOut;
- if (dmapD12U[offset] == 0x00 &&
- dmapD12U[offset+1] == 0x1A) {
- if (*pIn != cd->srcSubS)
- ++numS;
- }
- ++pIn;
- --inLen;
- }
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_D28) {
- /* use uchar * instead of UniChar to avoid memcpy */
- register uchar * dmapD12U=(uchar *) (cd->cnv_dmap->dmapD12U);
- register uchar * dmapD22U=(uchar *) (cd->cnv_dmap->dmapD22U);
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register int offset;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- register UniChar in; /* copy part of U28 */
- register UniChar ucs2;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else {
- offset=*pIn;
- offset<<=1;
- if (dmapD12U[offset] == 0x00 &&
- dmapD12U[offset+1] == 0x00) { /* DBCS */
- if (inLen < 2) {
- if (*pIn == 0x80 || *pIn == 0xFF ||
- (cd->fromCcsid == 943 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0xA0 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xEF || *pIn == 0xFD || *pIn == 0xFE)) ||
- (cd->fromCcsid == 932 && (*pIn == 0x85 || *pIn == 0x86 || *pIn == 0x87 || *pIn == 0xEB || *pIn == 0xEC || *pIn == 0xED || *pIn == 0xEE || *pIn == 0xEF)) ||
- (cd->fromCcsid == 1381 && ((0x85 <= *pIn && *pIn <= 0x8B) || (0xAA <= *pIn && *pIn <= 0xAF) || (0xF8 <= *pIn && *pIn <= 0xFE))))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- offset-=0x100;
- ++pIn;
- offset<<=8;
- offset+=(*pIn * 2);
- if (dmapD22U[offset] == 0x00 &&
- dmapD22U[offset+1] == 0x00) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- return -1;
- }
- in=dmapD22U[offset];
- in<<=8;
- in+=dmapD22U[offset+1];
- ucs2=in;
- if (dmapD22U[offset] == 0xFF &&
- dmapD22U[offset+1] == 0xFD) {
- if (in != cd->srcSubD)
- ++numS;
- }
- ++pIn;
- inLen-=2;
- } else { /* SBCS */
- in=dmapD12U[offset];
- in<<=8;
- in+=dmapD12U[offset+1];
- ucs2=in;
- if (dmapD12U[offset] == 0x00 &&
- dmapD12U[offset+1] == 0x1A) {
- if (in != cd->srcSubS)
- ++numS;
- }
- ++pIn;
- --inLen;
- }
- if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */
- *pOut=in;
- ++pOut;
- } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */
- register uchar byte;
- in>>=6;
- in&=0x001F; /* 0b0000000000011111 */
- in|=0x00C0; /* 0b0000000011000000 */
- *pOut=in;
- ++pOut;
- byte=ucs2; /* dmapD12U[offset+1]; */
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- } else if ((in & 0xFC00) == 0xD800) { /* There should not be no surrogate character in SBCS. */
- *pOut=0xEF;
- ++pOut;
- *pOut=0xBF;
- ++pOut;
- *pOut=0xBD;
- ++pOut;
- } else {
- register uchar byte;
- register uchar work;
- byte=(ucs2>>8); /* dmapD12U[offset]; */
- byte>>=4;
- byte|=0xE0; /* 0b11100000; */
- *pOut=byte;
- ++pOut;
-
- byte=(ucs2>>8); /* dmapD12U[offset]; */
- byte<<=2;
- work=ucs2; /* dmapD12U[offset+1]; */
- work>>=6;
- byte|=work;
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
-
- byte=ucs2; /* dmapD12U[offset+1]; */
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- }
- /* end of U28 */
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_U2D) {
- register uchar * dmapU2D=cd->cnv_dmap->dmapU2D;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
-
- *inBytesLeft=inLen;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else {
- in<<=1;
- *pOut=dmapU2D[in];
- ++pOut;
- if (dmapU2D[in+1] == 0x00) { /* SBCS */
- if (*pOut == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2D[in+1];
- ++pOut;
- if (dmapU2D[in] == pSubD[0] &&
- dmapU2D[in+1] == pSubD[1]) {
- in>>=1;
- if (in != cd->srcSubD)
- ++numS;
- }
- }
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return numS; /* to minic iconv() behavior */
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_T2D) {
- register uchar * dmapU2D=cd->cnv_dmap->dmapU2D;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- ++numS;
- *numSub+=numS;
- return 0;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if (0xD800 <= in && in <= 0xDBFF) { /* first byte of surrogate */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-2;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn+2;
- ++numS;
- *numSub+=numS;
- return -1;
-
- } else if (0xDC00 <= in && in <= 0xDFFF) { /* second byte of surrogate */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- ++numS;
- *numSub+=numS;
- return -1;
-
- } else {
- in<<=1;
- *pOut=dmapU2D[in];
- ++pOut;
- if (dmapU2D[in+1] == 0x00) { /* SBCS */
- if (*pOut == subS) {
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2D[in+1];
- ++pOut;
- if (dmapU2D[in] == pSubD[0] &&
- dmapU2D[in+1] == pSubD[1]) {
- in>>=1;
- if (in != cd->srcSubD)
- ++numS;
- }
- }
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0; /* to minic iconv() behavior */
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_82D) {
- register uchar * dmapU2D=cd->cnv_dmap->dmapU2D;
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register char subS=cd->subS;
- register char * pSubD=(char *) &(cd->subD);
- register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- uint32_t in2;
- if (pLastOutBuf < pOut)
- break;
- /* convert from UTF-8 to UCS-2 */
- if (*pIn == 0x00) {
- in=0x0000;
- ++pIn;
- --inLen;
- } else { /* 82U: */
- register uchar byte1=*pIn;
- if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */
- /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/
- in=byte1;
- ++pIn;
- --inLen;
- } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */
- if (inLen < 2) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- /* 2 bytes sequence:
- 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */
- register uchar byte2;
- ++pIn;
- byte2=*pIn;
- if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */
- register uchar work=byte1;
- work<<=6;
- byte2&=0x3F; /* 0b00111111; */
- byte2|=work;
-
- byte1&=0x1F; /* 0b00011111; */
- byte1>>=2;
- in=byte1;
- in<<=8;
- in+=byte2;
- inLen-=2;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */
- /* 3 bytes sequence:
- 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */
- register uchar byte2;
- register uchar byte3;
- if (inLen < 3) {
- if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- if ((byte2 & 0xC0) != 0x80 ||
- (byte3 & 0xC0) != 0x80 ||
- (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- *numSub+=numS;
- return -1;
- }
- {
- register uchar work=byte2;
- work<<=6;
- byte3&=0x3F; /* 0b00111111; */
- byte3|=work;
-
- byte2&=0x3F; /* 0b00111111; */
- byte2>>=2;
-
- byte1<<=4;
- in=byte1 | byte2;;
- in<<=8;
- in+=byte3;
- inLen-=3;
- ++pIn;
- }
- } else if ((0xF0 <= byte1 && byte1 <= 0xF4)) { /* (bytes1 & 11111000) == 0x1110000 */
- /* 4 bytes sequence
- 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx
- where uuuuu = wwww + 1 */
- register uchar byte2;
- register uchar byte3;
- register uchar byte4;
- if (inLen < 4) {
- if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) ||
- (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) ||
- (cd->toCcsid == 13488) )
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- ++pIn;
- byte4=*pIn;
- if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */
- (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */
- (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */
- register uchar work=byte2;
- if (byte1 == 0xF0 && byte2 < 0x90) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- /* iconv() returns 0 for 0xF4908080 and convert to 0x00
- } else if (byte1 == 0xF4 && byte2 > 0x8F) {
- errno=EINVAL;
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- */
- }
-
- work&=0x30; /* 0b00110000; */
- work>>=4;
- byte1&=0x07; /* 0b00000111; */
- byte1<<=2;
- byte1+=work; /* uuuuu */
- --byte1; /* wwww */
-
- work=byte1 & 0x0F;
- work>>=2;
- work+=0xD8; /* 0b11011011; */
- in=work;
- in<<=8;
-
- byte1<<=6;
- byte2<<=2;
- byte2&=0x3C; /* 0b00111100; */
- work=byte3;
- work>>=4;
- work&=0x03; /* 0b00000011; */
- work|=byte1;
- work|=byte2;
- in+=work;
-
- work=byte3;
- work>>=2;
- work&=0x03; /* 0b00000011; */
- work|=0xDC; /* 0b110111xx; */
- in2=work;
- in2<<=8;
-
- byte3<<=6;
- byte4&=0x3F; /* 0b00111111; */
- byte4|=byte3;
- in2+=byte4;
- inLen-=4;
- ++pIn;
-#ifdef match_with_GBK
- if ((0xD800 == in && in2 < 0xDC80) ||
- (0xD840 == in && in2 < 0xDC80) ||
- (0xD880 == in && in2 < 0xDC80) ||
- (0xD8C0 == in && in2 < 0xDC80) ||
- (0xD900 == in && in2 < 0xDC80) ||
- (0xD940 == in && in2 < 0xDC80) ||
- (0xD980 == in && in2 < 0xDC80) ||
- (0xD9C0 == in && in2 < 0xDC80) ||
- (0xDA00 == in && in2 < 0xDC80) ||
- (0xDA40 == in && in2 < 0xDC80) ||
- (0xDA80 == in && in2 < 0xDC80) ||
- (0xDAC0 == in && in2 < 0xDC80) ||
- (0xDB00 == in && in2 < 0xDC80) ||
- (0xDB40 == in && in2 < 0xDC80) ||
- (0xDB80 == in && in2 < 0xDC80) ||
- (0xDBC0 == in && in2 < 0xDC80)) {
-#else
- if ((0xD800 <= in && in <= 0xDBFF) &&
- (0xDC00 <= in2 && in2 <= 0xDFFF)) {
-#endif
- *pOut=subS;
- ++pOut;
- ++numS;
- continue;
- }
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- }
- } else if (0xF5 <= byte1 && byte1 <= 0xFF) { /* minic iconv() behavior */
- if (inLen < 4 ||
- (inLen >= 4 && byte1 == 0xF8 && pIn[1] < 0x90) ||
- pIn[1] < 0x80 || 0xBF < pIn[1] ||
- pIn[2] < 0x80 || 0xBF < pIn[2] ||
- pIn[3] < 0x80 || 0xBF < pIn[3] ) {
- if (inLen == 1)
- errno=EINVAL; /* 22 */
- else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else if (inLen >= 4 && (byte1 == 0xF8 || (pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
-
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- } else if ((pIn[1] == 0x80 || pIn[1] == 0x90 || pIn[1] == 0xA0 || pIn[1] == 0xB0) &&
- pIn[2] < 0x82) {
- *pOut=subS; /* Though returns replacement character, which iconv() does not return. */
- ++pOut;
- ++numS;
- pIn+=4;
- inLen-=4;
- continue;
- } else {
- *pOut=pSubD[0]; /* Though returns replacement character, which iconv() does not return. */
- ++pOut;
- *pOut=pSubD[1];
- ++pOut;
- ++numS;
- pIn+=4;
- inLen-=4;
- continue;
- /* iconv() returns 0 with strange 1 byte converted values */
- }
-
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- }
- /* end of UTF-8 to UCS-2 */
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else {
- in<<=1;
- *pOut=dmapU2D[in];
- ++pOut;
- if (dmapU2D[in+1] == 0x00) { /* SBCS */
- if (dmapU2D[in] == subS) {
- in>>=1;
- if (in != cd->srcSubS)
- ++numS;
- }
- } else {
- *pOut=dmapU2D[in+1];
- ++pOut;
- if (dmapU2D[in] == pSubD[0] &&
- dmapU2D[in+1] == pSubD[1]) {
- in>>=1;
- if (in != cd->srcSubD)
- ++numS;
- }
- }
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_82U) {
- /* See http://unicode.org/versions/corrigendum1.html */
- /* convert from UTF-8 to UTF-16 can cover all conversion from UTF-8 to UCS-2 */
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- register size_t numS=0;
- while (0 < inLen) {
- if (pLastOutBuf < pOut)
- break;
- if (*pIn == 0x00) {
- *pOut=0x00;
- ++pOut;
- *pOut=0x00;
- ++pOut;
- ++pIn;
- --inLen;
- } else { /* 82U: */
- register uchar byte1=*pIn;
- if ((byte1 & 0x80) == 0x00) { /* if (byte1 & 0b10000000 == 0b00000000) { */
- /* 1 bytes sequence: 0xxxxxxx => 00000000 0xxxxxxx*/
- *pOut=0x00;
- ++pOut;
- *pOut=byte1;
- ++pOut;
- ++pIn;
- --inLen;
- } else if ((byte1 & 0xE0) == 0xC0) { /* (byte1 & 0b11100000 == 0b11000000) { */
- if (inLen < 2) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- if (byte1 == 0xC0 || byte1 == 0xC1) { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- /* 2 bytes sequence:
- 110yyyyy 10xxxxxx => 00000yyy yyxxxxxx */
- register uchar byte2;
- ++pIn;
- byte2=*pIn;
- if ((byte2 & 0xC0) == 0x80) { /* byte2 & 0b11000000 == 0b10000000) { */
- register uchar work=byte1;
- work<<=6;
- byte2&=0x3F; /* 0b00111111; */
- byte2|=work;
-
- byte1&=0x1F; /* 0b00011111; */
- byte1>>=2;
- *pOut=byte1;
- ++pOut;
- *pOut=byte2;
- ++pOut;
- inLen-=2;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-1;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xE0) { /* byte1 & 0b11110000 == 0b11100000 */
- /* 3 bytes sequence:
- 1110zzzz 10yyyyyy 10xxxxxx => zzzzyyyy yyxxxxxx */
- register uchar byte2;
- register uchar byte3;
- if (inLen < 3) {
- if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- if ((byte2 & 0xC0) != 0x80 ||
- (byte3 & 0xC0) != 0x80 ||
- (byte1 == 0xE0 && byte2 < 0xA0)) { /* invalid sequence, only 0xA0-0xBF allowed after 0xE0 */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-2;
- *numSub+=numS;
- return -1;
- }
- {
- register uchar work=byte2;
- work<<=6;
- byte3&=0x3F; /* 0b00111111; */
- byte3|=work;
-
- byte2&=0x3F; /* 0b00111111; */
- byte2>>=2;
-
- byte1<<=4;
- *pOut=byte1 | byte2;;
- ++pOut;
- *pOut=byte3;
- ++pOut;
- inLen-=3;
- ++pIn;
- }
- } else if ((0xF0 <= byte1 && byte1 <= 0xF4) || /* (bytes1 & 11111000) == 0x1110000 */
- ((byte1&=0xF7) && 0xF0 <= byte1 && byte1 <= 0xF4)) { /* minic iconv() behavior */
- /* 4 bytes sequence
- 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx => 110110ww wwzzzzyy 110111yy yyxxxxxx
- where uuuuu = wwww + 1 */
- register uchar byte2;
- register uchar byte3;
- register uchar byte4;
- if (inLen < 4 || cd->toCcsid == 13488) {
- if ((inLen >= 2 && (pIn[1] & 0xC0) != 0x80) ||
- (inLen >= 3 && (pIn[2] & 0xC0) != 0x80) ||
- (cd->toCcsid == 13488) )
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- ++pIn;
- byte2=*pIn;
- ++pIn;
- byte3=*pIn;
- ++pIn;
- byte4=*pIn;
- if ((byte2 & 0xC0) == 0x80 && /* byte2 & 0b11000000 == 0b10000000 */
- (byte3 & 0xC0) == 0x80 && /* byte3 & 0b11000000 == 0b10000000 */
- (byte4 & 0xC0) == 0x80) { /* byte4 & 0b11000000 == 0b10000000 */
- register uchar work=byte2;
- if (byte1 == 0xF0 && byte2 < 0x90) {
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- } else if (byte1 == 0xF4 && byte2 > 0x8F) {
- errno=EINVAL; /* 22 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- }
-
- work&=0x30; /* 0b00110000; */
- work>>=4;
- byte1&=0x07; /* 0b00000111; */
- byte1<<=2;
- byte1+=work; /* uuuuu */
- --byte1; /* wwww */
-
- work=byte1 & 0x0F;
- work>>=2;
- work+=0xD8; /* 0b11011011; */
- *pOut=work;
- ++pOut;
-
- byte1<<=6;
- byte2<<=2;
- byte2&=0x3C; /* 0b00111100; */
- work=byte3;
- work>>=4;
- work&=0x03; /* 0b00000011; */
- work|=byte1;
- work|=byte2;
- *pOut=work;
- ++pOut;
-
- work=byte3;
- work>>=2;
- work&=0x03; /* 0b00000011; */
- work|=0xDC; /* 0b110111xx; */
- *pOut=work;
- ++pOut;
-
- byte3<<=6;
- byte4&=0x3F; /* 0b00111111; */
- byte4|=byte3;
- *pOut=byte4;
- ++pOut;
- inLen-=4;
- ++pIn;
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn-3;
- *numSub+=numS;
- return -1;
- }
- } else if ((byte1 & 0xF0) == 0xF0) {
- if (cd->toCcsid == 13488) {
- errno=EILSEQ; /* 116 */
- } else {
- if (inLen == 1)
- errno=EINVAL; /* 22 */
- else if (inLen == 2 && (pIn[1] & 0xC0) != 0x80)
- errno=EILSEQ; /* 116 */
- else if (inLen == 3 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else if (inLen >= 4 && ((pIn[1] & 0xC0) != 0x80 || (pIn[2] & 0xC0) != 0x80 || (pIn[3] & 0xC0) != 0x80))
- errno=EILSEQ; /* 116 */
- else
- errno=EINVAL; /* 22 */
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
-
- } else { /* invalid sequence */
- errno=EILSEQ; /* 116 */
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return -1;
- }
- }
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- *numSub+=numS;
- return 0;
- } else if (cd->cnv_dmap->codingSchema == DMAP_U28) {
- /* See http://unicode.org/versions/corrigendum1.html */
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- // register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */
- *pOut=in;
- ++pOut;
- } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */
- register uchar byte;
- in>>=6;
- in&=0x001F; /* 0b0000000000011111 */
- in|=0x00C0; /* 0b0000000011000000 */
- *pOut=in;
- ++pOut;
- byte=pIn[1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- } else {
- register uchar byte;
- register uchar work;
- byte=pIn[0];
- byte>>=4;
- byte|=0xE0; /* 0b11100000; */
- *pOut=byte;
- ++pOut;
-
- byte=pIn[0];
- byte<<=2;
- work=pIn[1];
- work>>=6;
- byte|=work;
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
-
- byte=pIn[1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- // *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_T28) { /* UTF-16_UTF-8 */
- /* See http://unicode.org/versions/corrigendum1.html */
- register int inLen=*inBytesLeft;
- register char * pOut=*outBuf;
- register char * pIn=*inBuf;
- register char * pLastOutBuf = *outBuf + *outBytesLeft - 1;
- // register size_t numS=0;
- while (0 < inLen) {
- register uint32_t in;
- if (inLen == 1) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=0;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return 0;
- }
- if (pLastOutBuf < pOut)
- break;
- in=pIn[0];
- in<<=8;
- in+=pIn[1];
- if (in == 0x0000) {
- *pOut=0x00;
- ++pOut;
- } else if ((in & 0xFF80) == 0x0000) { /* U28: in & 0b1111111110000000 == 0x0000 */
- *pOut=in;
- ++pOut;
- } else if ((in & 0xF800) == 0x0000) { /* in & 0b1111100000000000 == 0x0000 */
- register uchar byte;
- in>>=6;
- in&=0x001F; /* 0b0000000000011111 */
- in|=0x00C0; /* 0b0000000011000000 */
- *pOut=in;
- ++pOut;
- byte=pIn[1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- } else if ((in & 0xFC00) == 0xD800) { /* in & 0b1111110000000000 == 0b1101100000000000, first surrogate character */
- if (0xDC00 <= in ) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
-
- } else if (inLen < 4) {
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-2;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn+2;
- return -1;
-
- } else if ((pIn[2] & 0xFC) != 0xDC) { /* pIn[2] & 0b11111100 == 0b11011100, second surrogate character */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-2;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn+2;
- return -1;
-
- } else {
- register uchar byte;
- register uchar work;
- in>>=6;
- in&=0x000F; /* 0b0000000000001111 */
- byte=in; /* wwww */
- ++byte; /* uuuuu */
- work=byte; /* save uuuuu */
- byte>>=2;
- byte|=0xF0; /* 0b11110000; */
- *pOut=byte;
- ++pOut;
-
- byte=work;
- byte&=0x03; /* 0b00000011; */
- byte<<=4;
- byte|=0x80; /* 0b10000000; */
- work=pIn[1];
- work&=0x3C; /* 0b00111100; */
- work>>=2;
- byte|=work;
- *pOut=byte;
- ++pOut;
-
- byte=pIn[1];
- byte&=0x03; /* 0b00000011; */
- byte<<=4;
- byte|=0x80; /* 0b10000000; */
- work=pIn[2];
- work&=0x03; /* 0b00000011; */
- work<<=2;
- byte|=work;
- work=pIn[3];
- work>>=6;
- byte|=work;
- *pOut=byte;
- ++pOut;
-
- byte=pIn[3];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- pIn+=2;
- inLen-=2;
- }
- } else if ((in & 0xFC00) == 0xDC00) { /* in & 0b11111100 == 0b11011100, second surrogate character */
- errno=EINVAL; /* 22 */
- *inBytesLeft=inLen-1;
- *outBytesLeft-=(pOut-*outBuf);
- *outBuf=pOut;
- *inBuf=pIn;
- return -1;
-
- } else {
- register uchar byte;
- register uchar work;
- byte=pIn[0];
- byte>>=4;
- byte|=0xE0; /* 0b11100000; */
- *pOut=byte;
- ++pOut;
-
- byte=pIn[0];
- byte<<=2;
- work=pIn[1];
- work>>=6;
- byte|=work;
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
-
- byte=pIn[1];
- byte&=0x3F; /* 0b00111111; */
- byte|=0x80; /* 0b10000000; */
- *pOut=byte;
- ++pOut;
- }
- pIn+=2;
- inLen-=2;
- }
- *outBytesLeft-=(pOut-*outBuf);
- *inBytesLeft=inLen;
- *outBuf=pOut;
- *inBuf=pIn;
- // *numSub+=numS;
- return 0;
-
- } else if (cd->cnv_dmap->codingSchema == DMAP_U2U) { /* UTF-16_UCS-2 */
- register int inLen=*inBytesLeft;
- register int outLen=*outBytesLeft;
- if (inLen <= outLen) {
- memcpy(*outBuf, *inBuf, inLen);
- (*outBytesLeft)-=inLen;
- (*inBuf)+=inLen;
- (*outBuf)+=inLen;
- *inBytesLeft=0;
- return 0;
- }
- memcpy(*outBuf, *inBuf, outLen);
- (*outBytesLeft)=0;
- (*inBuf)+=outLen;
- (*outBuf)+=outLen;
- *inBytesLeft-=outLen;
- return (*inBytesLeft);
-
- } else {
- return -1;
- }
- return 0;
-}
-
-
-#ifdef DEBUG
-inline size_t myconv(myconv_t cd ,
- char** inBuf,
- size_t* inBytesLeft,
- char** outBuf,
- size_t* outBytesLeft,
- size_t* numSub)
-{
- if (cd->converterType == CONVERTER_ICONV) {
- return myconv_iconv(cd,inBuf,inBytesLeft,outBuf,outBytesLeft,numSub);
- } else if (cd->converterType == CONVERTER_DMAP) {
- return myconv_dmap(cd,inBuf,inBytesLeft,outBuf,outBytesLeft,numSub);
- }
- return -1;
-}
-
-inline char * converterName(int32_t type)
-{
- if (type == CONVERTER_ICONV)
- return "iconv";
- else if (type == CONVERTER_DMAP)
- return "dmap";
-
- return "?????";
-}
-#else
-#define myconv(a,b,c,d,e,f) \
-(((a)->converterType == CONVERTER_ICONV)? myconv_iconv((a),(b),(c),(d),(e),(f)): (((a)->converterType == CONVERTER_DMAP)? myconv_dmap((a),(b),(c),(d),(e),(f)): -1))
-
-
-#define converterName(a) \
-(((a) == CONVERTER_ICONV)? "iconv": ((a) == CONVERTER_DMAP)? "dmap": "?????")
-#endif
-
-void initMyconv();
-void cleanupMyconv();
-
-#endif
diff --git a/storage/ibmdb2i/db2i_rir.cc b/storage/ibmdb2i/db2i_rir.cc
deleted file mode 100644
index 091c4d98383..00000000000
--- a/storage/ibmdb2i/db2i_rir.cc
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "ha_ibmdb2i.h"
-
-/* Helper function for records_in_range.
- Input: Bitmap of used key parts.
- Output: Number of used key parts. */
-
-static inline int getKeyCntFromMap(key_part_map keypart_map)
-{
- int cnt = 0;
- while (keypart_map)
- {
- keypart_map = keypart_map >> 1;
- cnt++;
- }
- return (cnt);
-}
-
-/**
- @brief
- Given a starting key and an ending key, estimate the number of rows that
- will exist between the two keys.
-
- INPUT
- inx Index to use
- min_key Min key. Is NULL if no min range
- max_key Max key. Is NULL if no max range
-
- NOTES
- min_key.flag can have one of the following values:
- HA_READ_KEY_EXACT Include the key in the range
- HA_READ_AFTER_KEY Don't include key in range
-
- max_key.flag can have one of the following values:
- HA_READ_BEFORE_KEY Don't include key in range
- HA_READ_AFTER_KEY Include all 'end_key' values in the range
-
- RETURN
- HA_POS_ERROR Error or the storage engine cannot estimate the number of rows
- 1 There are no matching keys in the given range
- n > 0 There are approximately n rows in the range
-*/
-ha_rows ha_ibmdb2i::records_in_range(uint inx,
- key_range *min_key,
- key_range *max_key)
-{
- DBUG_ENTER("ha_ibmdb2i::records_in_range");
- int rc = 0; // Return code
- ha_rows rows = 0; // Row count returned to caller of this method
- uint32 spcLen; // Length of space passed to DB2
- uint32 keyCnt; // Number of fields in the key composite
- uint32 literalCnt = 0; // Number of literals
- uint32 boundsOff; // Offset from beginning of space to range bounds
- uint32 litDefOff; // Offset from beginning of space to literal definitions
- uint32 literalsOff; // Offset from beginning of space to literal values
- uint32 cutoff = 0; // Early exit cutoff (currently not used)
- uint64 recCnt; // Row count from DB2
- uint16 rtnCode; // Return code from DB2
- Bounds* boundsPtr; // Pointer to a pair of range bounds
- Bound* boundPtr; // Pointer to a single (high or low) range bound
- LitDef* litDefPtr; // Pointer to a literal definition
- char* literalsPtr; // Pointer to the start of all literal values
- char* literalPtr; // Pointer to the start of this literal value
- char* tempPtr; // Temporary pointer
- char* tempMinPtr; // Temporary pointer into min_key
- int minKeyCnt = 0; // Number of fields in the min_key composite
- int maxKeyCnt = 0; // Number of fields in the max_key composite
- size_t tempLen = 0; // Temporary length
- uint16 DB2FieldWidth = 0; // DB2 field width
- uint32 workFieldLen = 0; // Length of workarea needed for CCSID conversions
- bool overrideInclusion; // Indicator for inclusion/exclusion
- char* endOfLiteralPtr; // Pointer to the end of this literal
- char* endOfMinPtr; // Pointer to end of min_key
- uint16 endByte = 0; // End byte of char or graphic literal (padding not included)
- bool reuseLiteral; // Indicator that hi and lo bounds use same literal
- char* minPtr = NULL; // Work pointer for traversing min_key
- char* maxPtr = NULL; // Work pointer for traversing max_key
- /*
- Handle the special case of 'x < null' anywhere in the key range. There are
- no values less than null, but return 1 so that MySQL does not assume
- the empty set for the query.
- */
- if (min_key != NULL && max_key != NULL &&
- min_key->flag == HA_READ_AFTER_KEY && max_key->flag == HA_READ_BEFORE_KEY &&
- min_key->length == max_key->length &&
- (memcmp((uchar*)min_key->key,(uchar*)max_key->key,min_key->length)==0))
- {
- DBUG_PRINT("ha_ibmdb2i::records_in_range",("Estimate 1 row for key %d; special case: < null", inx));
- DBUG_RETURN((ha_rows) 1 );
- }
- /*
- Determine the number of fields in the key composite.
- */
-
- if (min_key)
- {
- minKeyCnt = getKeyCntFromMap(min_key->keypart_map);
- minPtr = (char*)min_key->key;
- }
- if (max_key)
- {
- maxKeyCnt = getKeyCntFromMap(max_key->keypart_map);
- maxPtr = (char*)max_key->key;
- }
- keyCnt = maxKeyCnt >= minKeyCnt ? maxKeyCnt : minKeyCnt;
-
- /*
- Handle the special case where MySQL does not pass either a min or max
- key range. In this case, set the key count to 1 (knowing that there
- is at least one key field) to flow through and create one bounds structure.
- When both the min and max key ranges are nil, the bounds structure will
- specify positive and negative infinity and DB2 will estimate the total
- number of rows. */
-
- if (keyCnt == 0)
- keyCnt = 1;
-
- /*
- Allocate the space needed to pass range information to DB2. The
- space must be large enough to store the following:
- - one pair of bounds (high and low) per field in the key composite
- - one literal definition per literal value
- - the literal values
- - work area for literal CCSID conversions
- Since we don't know yet how many of these structures are needed,
- allocate enough space for the maximum that we will possibly need.
- The workarea for the literal conversion must be big enough to hold the
- largest of the DB2 key fields.
- */
- KEY& curKey = table->key_info[inx];
-
- for (int i = 0; i < keyCnt; i++)
- {
- DB2FieldWidth =
- db2Table->db2Field(curKey.key_part[i].field->field_index).getByteLengthInRecord();
- if (DB2FieldWidth > workFieldLen)
- workFieldLen = DB2FieldWidth; // Get length of largest DB2 field
- tempLen = tempLen + DB2FieldWidth; // Tally the DB2 field lengths
- }
- spcLen = (sizeof(Bounds)*keyCnt) + (sizeof(LitDef)*keyCnt*2) + (tempLen*2) + workFieldLen;
-
- ValidatedPointer<char> spcPtr(spcLen); // Pointer to space passed to DB2
- memset(spcPtr, 0, spcLen); // Clear the allocated space
- /*
- Set addressability to the various sections of the DB2 interface space.
- */
- boundsOff = 0; // Range bounds are at the start of the space
- litDefOff = sizeof(Bounds) * keyCnt; // Literal defs follow all the range bounds
- literalsOff = litDefOff + (sizeof(LitDef) * keyCnt * 2); // Literal values are last
- boundsPtr = (Bounds_t*)(void*)spcPtr; // Address first bounds structure
- tempPtr = (char*)((char*)spcPtr + litDefOff);
- litDefPtr = (LitDef_t*)tempPtr; // Address first literal definition
- tempPtr = (char*)((char*)spcPtr + literalsOff);
- literalsPtr = (char*)tempPtr; // Address start of literal values
- literalPtr = literalsPtr; // Address first literal value
- /*
- For each key part, build the low (min) and high (max) DB2 range bounds.
- If literals are specified in the MySQL range, build DB2 literal
- definitions and store the literal values for access by DB2.
-
- If no value is specified for a key part, assume infinity. Negative
- infinity will cause processing to start at the first index entry.
- Positive infinity will cause processing to end at the last index entry.
- When infinity is specified in a bound, inclusion/exclusion and position
- are ignored, and there is no literal definition or literal value for
- the bound.
-
- If the keypart value is null, the null indicator is set in the range
- bound and the other fields in the bound are ignored. When the bound is
- null, only index entries with the null value will be included in the
- estimate. If one bound is null, both bounds must be null. When the bound
- is not null, the data offset and length must be set, and the literal
- value stored for access by DB2.
- */
- for (int partsInUse = 0; partsInUse < keyCnt; ++partsInUse)
- {
- Field *field= curKey.key_part[partsInUse].field;
- overrideInclusion = false;
- reuseLiteral = false;
- endOfLiteralPtr = NULL;
- /*
- Build the low bound for the key range.
- */
- if ((partsInUse + 1) > minKeyCnt) // if no min_key info for this part
- boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where 3 between x and y
- else
- {
- if ((curKey.key_part[partsInUse].null_bit) && (char*)minPtr[0])
- { // min_key is null
- if (max_key == NULL ||
- ((partsInUse + 1) > maxKeyCnt)) // select...where x='ab' and y=null and z != 'c'
- boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where x not null or
- // select...where x > null
- else // max_key is not null
- {
- if (min_key->flag == HA_READ_KEY_EXACT)
- boundsPtr->LoBound.IsNull[0] = QMY_YES; // select...where x is null
- else
- {
- if ((char*)maxPtr[0])
- boundsPtr->LoBound.IsNull[0] = QMY_YES; // select...where a = null and b < 5 (max-before)
- // select...where a='a' and b is null and c !='a' (max-after)
- else
- boundsPtr->LoBound.Infinity[0] = QMY_NEG_INFINITY; // select...where x < y
- }
- } // end min_key is null
- }
- else // min_key is not null
- {
- if (literalCnt) litDefPtr = litDefPtr + 1;
- literalCnt = literalCnt + 1;
- boundsPtr->LoBound.Position = literalCnt;
- /*
- Determine inclusion or exclusion.
- */
- if (min_key->flag == HA_READ_KEY_EXACT || //select...where a like 'this%'
-
- /* An example for the following conditions is 'select...where a = 5 and b > null'. */
-
- (max_key &&
- (memcmp((uchar*)minPtr,(uchar*)maxPtr,
- curKey.key_part[partsInUse].store_length)==0)))
-
- {
- if ((min_key->flag != HA_READ_KEY_EXACT) ||
- (max_key &&
- (memcmp((uchar*)minPtr,(uchar*)maxPtr,
- curKey.key_part[partsInUse].store_length)==0)))
- overrideInclusion = true; // Need inclusion for both min and max
- }
- else
- boundsPtr->LoBound.Embodiment[0] = QMY_EXCLUSION;
- litDefPtr->FieldNbr = field->field_index + 1;
- DB2Field& db2Field = db2Table->db2Field(field->field_index);
- litDefPtr->DataType = db2Field.getType();
- /*
- Convert the literal to DB2 format
- */
- if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data
- (field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data
- (litDefPtr->DataType == QMY_CHAR ||
- litDefPtr->DataType == QMY_VARCHAR ||
- litDefPtr->DataType == QMY_GRAPHIC ||
- litDefPtr->DataType == QMY_VARGRAPHIC))
- {
- // Most of the code is required by the considerable wrangling needed
- // to prepare partial keys for use by DB2
- // 1. UTF8 (CCSID 1208) data can be copied across unmodified if it is
- // utf8_bin. Otherwise, we need to convert the min and max
- // characters into the min and max characters employed
- // by the DB2 sort sequence. This is complicated by the fact that
- // the character widths are not always equal.
- // 2. Likewise, UCS2 (CCSID 13488) data can be copied across unmodified
- // if it is ucs2_bin or ucs2_general_ci. Otherwise, we need to
- // convert the min and max characters into the min and max characters
- // employed by the DB2 sort sequence.
- // 3. All other data will use standard iconv conversions. If an
- // unconvertible character is encountered, we assume it is the min
- // char and fill the remainder of the DB2 key with 0s. This may not
- // always be accurate, but it is probably sufficient for range
- // estimations.
- const char* keyData = minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0);
- char* db2Data = literalPtr;
- uint16 outLen = db2Field.getByteLengthInRecord();
- uint16 inLen;
- if (litDefPtr->DataType == QMY_VARCHAR ||
- litDefPtr->DataType == QMY_VARGRAPHIC)
- {
- inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8);
- keyData += 2;
- outLen -= sizeof(uint16);
- db2Data += sizeof(uint16);
- }
- else
- {
- inLen = field->max_display_length();
- }
-
- size_t convertedBytes = 0;
- if (db2Field.getCCSID() == 1208)
- {
- DBUG_ASSERT(inLen <= outLen);
- if (strcmp(field->charset()->name, "utf8_bin"))
- {
- const char* end = keyData+inLen;
- const char* curKey = keyData;
- char* curDB2 = db2Data;
- uint32 min = field->charset()->min_sort_char;
- while ((curKey < end) && (curDB2 < db2Data+outLen-3))
- {
- my_wc_t temp;
- int len = field->charset()->cset->mb_wc(field->charset(),
- &temp,
- (const uchar*)curKey,
- (const uchar*)end);
- if (temp != min)
- {
- DBUG_ASSERT(len <= 3);
- switch (len)
- {
- case 3: *(curDB2+2) = *(curKey+2);
- case 2: *(curDB2+1) = *(curKey+1);
- case 1: *(curDB2) = *(curKey);
- }
- curDB2 += len;
- }
- else
- {
- *(curDB2++) = 0xEF;
- *(curDB2++) = 0xBF;
- *(curDB2++) = 0xBF;
- }
- curKey += len;
- }
- convertedBytes = curDB2 - db2Data;
- }
- else
- {
- memcpy(db2Data, keyData, inLen);
- convertedBytes = inLen;
- }
- rc = 0;
- }
- else if (db2Field.getCCSID() == 13488)
- {
- DBUG_ASSERT(inLen <= outLen);
- if (strcmp(field->charset()->name, "ucs2_bin") &&
- strcmp(field->charset()->name, "ucs2_general_ci"))
- {
- const char* end = keyData+inLen;
- const uint16* curKey = (uint16*)keyData;
- uint16* curDB2 = (uint16*)db2Data;
- uint16 min = field->charset()->min_sort_char;
- while (curKey < (uint16*)end)
- {
- if (*curKey != min)
- *curDB2 = *curKey;
- else
- *curDB2 = 0xFFFF;
- ++curKey;
- ++curDB2;
- }
- }
- else
- {
- memcpy(db2Data, keyData, inLen);
- }
- convertedBytes = inLen;
- rc = 0;
- }
- else
- {
- rc = convertFieldChars(toDB2,
- field->field_index,
- keyData,
- db2Data,
- inLen,
- outLen,
- &convertedBytes,
- true);
-
- if (rc == DB2I_ERR_ILL_CHAR)
- {
- // If an illegal character is encountered, we fill the remainder
- // of the key with 0x00. This was implemented as a corollary to
- // Bug#45012, though it should probably remain even after that
- // bug is fixed.
- memset(db2Data+convertedBytes, 0x00, outLen-convertedBytes);
- convertedBytes = outLen;
- rc = 0;
- }
- }
-
- if (!rc &&
- (litDefPtr->DataType == QMY_VARGRAPHIC ||
- litDefPtr->DataType == QMY_VARCHAR))
- {
- *(uint16*)(db2Data-sizeof(uint16)) =
- convertedBytes / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1);
- }
-
- }
- else // Non-character fields
- {
- rc = convertMySQLtoDB2(field,
- db2Field,
- literalPtr,
- (uchar*)minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
- }
-
- if (rc != 0) break;
- litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr);
- litDefPtr->Length = db2Field.getByteLengthInRecord();
- literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal
- }
- /* If there is a max_key value for this field, and if the max_key value is
- the same as the min_key value, then the low bound literal can be reused
- for the high bound literal. This eliminates the overhead of copying and
- converting the same value twice. */
- if (max_key && ((partsInUse + 1) <= maxKeyCnt) &&
- (memcmp((uchar*)minPtr,(uchar*)maxPtr,
- curKey.key_part[partsInUse].store_length)==0 || endOfLiteralPtr))
- reuseLiteral = true;
- minPtr += curKey.key_part[partsInUse].store_length;
- }
- /*
- Build the high bound for the key range.
- */
- if (max_key == NULL || ((partsInUse + 1) > maxKeyCnt))
- boundsPtr->HiBound.Infinity[0] = QMY_POS_INFINITY;
- else
- {
- if ((curKey.key_part[partsInUse].null_bit) && (char*)maxPtr[0])
- {
- if (min_key == NULL)
- boundsPtr->HiBound.Infinity[0] = QMY_POS_INFINITY;
- else
- boundsPtr->HiBound.IsNull[0] = QMY_YES; // select...where x is null
- }
- else // max_key field is not null
- {
- if (boundsPtr->LoBound.IsNull[0] == QMY_YES) // select where x < 10 or x is null
- {
- rc = HA_POS_ERROR;
- break;
- }
- if (!reuseLiteral)
- {
- if (literalCnt)
- litDefPtr = litDefPtr + 1;
- literalCnt = literalCnt + 1;
- litDefPtr->FieldNbr = field->field_index + 1;
- DB2Field& db2Field = db2Table->db2Field(field->field_index);
- litDefPtr->DataType = db2Field.getType();
- /*
- Convert the literal to DB2 format
- */
- if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data
- (field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data
- (litDefPtr->DataType == QMY_CHAR ||
- litDefPtr->DataType == QMY_VARCHAR ||
- litDefPtr->DataType == QMY_GRAPHIC ||
- litDefPtr->DataType == QMY_VARGRAPHIC))
- {
- // We need to handle char fields in a special way in order to account
- // for partial keys. Refer to the note above for a description of the
- // basic design.
- char* keyData = maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0);
- char* db2Data = literalPtr;
- uint16 outLen = db2Field.getByteLengthInRecord();
- uint16 inLen;
- if (litDefPtr->DataType == QMY_VARCHAR ||
- litDefPtr->DataType == QMY_VARGRAPHIC)
- {
- inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8);
- keyData += 2;
- outLen -= sizeof(uint16);
- db2Data += sizeof(uint16);
- }
- else
- {
- inLen = field->max_display_length();
- }
-
- size_t convertedBytes;
- if (db2Field.getCCSID() == 1208)
- {
- if (strcmp(field->charset()->name, "utf8_bin"))
- {
- const char* end = keyData+inLen;
- const char* curKey = keyData;
- char* curDB2 = db2Data;
- uint32 max = field->charset()->max_sort_char;
- while (curKey < end && (curDB2 < db2Data+outLen-3))
- {
- my_wc_t temp;
- int len = field->charset()->cset->mb_wc(field->charset(), &temp, (const uchar*)curKey, (const uchar*)end);
- if (temp != max)
- {
- DBUG_ASSERT(len <= 3);
- switch (len)
- {
- case 3: *(curDB2+2) = *(curKey+2);
- case 2: *(curDB2+1) = *(curKey+1);
- case 1: *(curDB2) = *(curKey);
- }
- curDB2 += len;
- }
- else
- {
- *(curDB2++) = 0xE4;
- *(curDB2++) = 0xB6;
- *(curDB2++) = 0xBF;
- }
- curKey += len;
- }
- convertedBytes = curDB2 - db2Data;
- }
- else
- {
- DBUG_ASSERT(inLen <= outLen);
- memcpy(db2Data, keyData, inLen);
- convertedBytes = inLen;
- }
- rc = 0;
- }
- else if (db2Field.getCCSID() == 13488)
- {
- if (strcmp(field->charset()->name, "ucs2_bin") &&
- strcmp(field->charset()->name, "ucs2_general_ci"))
- {
- char* end = keyData+inLen;
- uint16* curKey = (uint16*)keyData;
- uint16* curDB2 = (uint16*)db2Data;
- uint16 max = field->charset()->max_sort_char;
- while (curKey < (uint16*)end)
- {
- if (*curKey != max)
- *curDB2 = *curKey;
- else
- *curDB2 = 0x4DBF;
- ++curKey;
- ++curDB2;
- }
- }
- else
- {
- memcpy(db2Data, keyData, outLen);
- }
- rc = 0;
- }
- else
- {
- size_t substituteChars = 0;
- rc = convertFieldChars(toDB2,
- field->field_index,
- keyData,
- db2Data,
- inLen,
- outLen,
- &convertedBytes,
- true,
- &substituteChars);
-
- if (rc == DB2I_ERR_ILL_CHAR)
- {
- // If an illegal character is encountered, we fill the remainder
- // of the key with 0xFF. This was implemented to work around
- // Bug#45012, though it should probably remain even after that
- // bug is fixed.
- memset(db2Data+convertedBytes, 0xFF, outLen-convertedBytes);
- rc = 0;
- }
- else if ((substituteChars &&
- (litDefPtr->DataType == QMY_VARCHAR ||
- litDefPtr->DataType == QMY_CHAR)) ||
- strcmp(field->charset()->name, "cp1251_bulgarian_ci") == 0)
- {
- // When iconv translates the max_sort_char with a substitute
- // character, we have no way to know whether this affects
- // the sort order of the key. Therefore, to be safe, when
- // we know that substitute characters have been used in a
- // single-byte string, we traverse the translated key
- // in reverse, replacing substitue characters with 0xFF, which
- // always sorts with the greatest weight in DB2 sort sequences.
- // cp1251_bulgarian_ci is also handled this way because the
- // max_sort_char is a control character which does not sort
- // equivalently in DB2.
- DBUG_ASSERT(inLen == outLen);
- char* tmpKey = keyData + inLen - 1;
- char* tmpDB2 = db2Data + outLen - 1;
- while (*tmpKey == field->charset()->max_sort_char &&
- *tmpDB2 != 0xFF)
- {
- *tmpDB2 = 0xFF;
- --tmpKey;
- --tmpDB2;
- }
- }
- }
-
- if (!rc &&
- (litDefPtr->DataType == QMY_VARGRAPHIC ||
- litDefPtr->DataType == QMY_VARCHAR))
- {
- *(uint16*)(db2Data-sizeof(uint16)) =
- outLen / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1);
- }
- }
- else
- {
- rc = convertMySQLtoDB2(field,
- db2Field,
- literalPtr,
- (uchar*)maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
- }
- if (rc != 0) break;
- litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr);
- litDefPtr->Length = db2Field.getByteLengthInRecord();
- literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal
- }
- boundsPtr->HiBound.Position = literalCnt;
- if (max_key->flag == HA_READ_BEFORE_KEY && !overrideInclusion)
- boundsPtr->HiBound.Embodiment[0] = QMY_EXCLUSION;
- }
- maxPtr += curKey.key_part[partsInUse].store_length;
- }
- /*
- Bump to the next field in the key composite.
- */
-
- if ((partsInUse+1) < keyCnt)
- boundsPtr = boundsPtr + 1;
- }
-
- /*
- Call DB2 to estimate the number of rows in the key range.
- */
- if (rc == 0)
- {
- rc = db2i_ileBridge::getBridgeForThread()->recordsInRange((indexHandles[inx] ? indexHandles[inx] : db2Table->indexFile(inx)->getMasterDefnHandle()),
- spcPtr,
- keyCnt,
- literalCnt,
- boundsOff,
- litDefOff,
- literalsOff,
- cutoff,
- (uint32_t)(literalPtr - (char*)spcPtr),
- endByte,
- &recCnt,
- &rtnCode);
- }
- /*
- Set the row count and return.
- Beware that if this method returns a zero row count, MySQL assumes the
- result set for the query is zero; never return a zero row count.
- */
- if ((rc == 0) && (rtnCode == QMY_SUCCESS || rtnCode == QMY_EARLY_EXIT))
- {
- rows = recCnt ? (ha_rows)recCnt : 1;
- }
-
- rows = (rows > 0 ? rows : HA_POS_ERROR);
-
- setIndexReadEstimate(inx, rows);
-
- DBUG_PRINT("ha_ibmdb2i::recordsInRange",("Estimate %d rows for key %d", uint32(rows), inx));
-
- DBUG_RETURN(rows);
-}
diff --git a/storage/ibmdb2i/db2i_safeString.h b/storage/ibmdb2i/db2i_safeString.h
deleted file mode 100644
index e353316c8fc..00000000000
--- a/storage/ibmdb2i/db2i_safeString.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-
-#ifndef DB2I_SAFESTRING_H
-#define DB2I_SAFESTRING_H
-
-
-#include <my_global.h>
-#include <string.h>
-
-/**
- @class SafeString
-
- This class was designed to provide safe, but lightweight, concatenation
- operations C strings inside pre-allocated buffers.
-*/
-class SafeString
-{
-public:
- SafeString(char* buffer, size_t size) :
- allocSize(size), curPos(0), buf(buffer)
- {
- DBUG_ASSERT(size > 0);
- buf[allocSize - 1] = 0xFF; // Set an overflow indicator
- }
-
- char* ptr() { return buf; }
- operator char*() { return buf; }
-
- SafeString& strcat(const char* str)
- {
- return this->strncat(str, strlen(str));
- }
-
- SafeString& strcat(char one)
- {
- if (curPos < allocSize - 2)
- {
- buf[curPos++] = one;
- }
- buf[curPos] = 0;
-
- return *this;
- }
-
- SafeString& strncat(const char* str, size_t len)
- {
- uint64 amountToCopy = min((allocSize-1) - curPos, len);
- memcpy(buf + curPos, str, amountToCopy);
- curPos += amountToCopy;
- buf[curPos] = 0;
- return *this;
- }
-
- bool overflowed() const { return (buf[allocSize - 1] == 0);}
-
-private:
- char* buf;
- uint64 curPos;
- size_t allocSize;
-};
-
-
-#endif
diff --git a/storage/ibmdb2i/db2i_sqlStatementStream.cc b/storage/ibmdb2i/db2i_sqlStatementStream.cc
deleted file mode 100644
index 92a8b03fd00..00000000000
--- a/storage/ibmdb2i/db2i_sqlStatementStream.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#include "db2i_sqlStatementStream.h"
-#include "as400_types.h"
-
-/**
- Add a statement to the statement stream, allocating additional memory as needed.
-
- @parm stmt The statement text
- @parm length The length of the statement text
- @parm fileSortSequence The DB2 sort sequence identifier, in EBCDIC
- @parm fileSortSequenceLibrary The DB2 sort sequence library, in EBCDIC
-
- @return Reference to this object
-*/
-SqlStatementStream& SqlStatementStream::addStatementInternal(const char* stmt,
- uint32 length,
- const char* fileSortSequence,
- const char* fileSortSequenceLibrary)
-{
- uint32 storageNeeded = length + sizeof(StmtHdr_t);
- storageNeeded = (storageNeeded + 3) & ~3; // We have to be 4-byte aligned.
- if (storageNeeded > storageRemaining())
- {
- // We overallocate new storage to reduce number of times reallocation is
- // needed.
- int newSize = curSize + 2 * storageNeeded;
- DBUG_PRINT("SqlStatementStream::addStatementInternal",
- ("PERF: Had to realloc! Old size=%d. New size=%d", curSize, newSize));
- char* old_space = block;
- char* new_space = (char*)getNewSpace(newSize);
- memcpy(new_space, old_space, curSize);
- ptr = new_space + (ptr - old_space);
- curSize = newSize;
- }
-
- DBUG_ASSERT((address64_t)ptr % 4 == 0);
-
- memcpy(((StmtHdr_t*)ptr)->SrtSeqNam,
- fileSortSequence,
- sizeof(((StmtHdr_t*)ptr)->SrtSeqNam));
- memcpy(((StmtHdr_t*)ptr)->SrtSeqSch,
- fileSortSequenceLibrary,
- sizeof(((StmtHdr_t*)ptr)->SrtSeqSch));
- ((StmtHdr_t*)ptr)->Length = length;
- memcpy(ptr + sizeof(StmtHdr_t), stmt, length);
-
- ptr += storageNeeded;
- ++statements;
-
- return *this;
-}
diff --git a/storage/ibmdb2i/db2i_sqlStatementStream.h b/storage/ibmdb2i/db2i_sqlStatementStream.h
deleted file mode 100644
index 11db41a6c5d..00000000000
--- a/storage/ibmdb2i/db2i_sqlStatementStream.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-#ifndef DB2I_SQLSTATEMENTSTREAM_H
-#define DB2I_SQLSTATEMENTSTREAM_H
-
-#include "db2i_charsetSupport.h"
-#include "qmyse.h"
-
-/**
- @class SqlStatementStream
-
- This class handles building the stream of SQL statements expected by the
- QMY_EXECUTE_IMMEDIATE and QMY_PREPARE_OPEN_CURSOR APIs.
- Memory allocation is handled internally.
-*/
-class SqlStatementStream
-{
- public:
- /**
- ctor to be used when multiple strings may be appended.
- */
- SqlStatementStream(uint32 firstStringSize) : statements(0)
- {
- curSize = firstStringSize + sizeof(StmtHdr_t);
- curSize = (curSize + 3) & ~3;
- ptr = (char*) getNewSpace(curSize);
- if (ptr == NULL)
- curSize = 0;
- }
-
- /**
- ctor to be used when only a single statement will be executed.
- */
- SqlStatementStream(const String& statement) : statements(0), block(NULL), curSize(0), ptr(0)
- {
- addStatement(statement);
- }
-
- /**
- ctor to be used when only a single statement will be executed.
- */
- SqlStatementStream(const char* statement) : statements(0), block(NULL), curSize(0), ptr(0)
- {
- addStatement(statement);
- }
-
- /**
- Append an SQL statement, specifiying the DB2 sort sequence under which
- the statement should be executed. This is important for CREATE TABLE
- and CREATE INDEX statements.
- */
- SqlStatementStream& addStatement(const String& append, const char* fileSortSequence, const char* fileSortSequenceLibrary)
- {
- char sortSeqEbcdic[10];
- char sortSeqLibEbcdic[10];
-
- DBUG_ASSERT(strlen(fileSortSequence) <= 10 &&
- strlen(fileSortSequenceLibrary) <= 10);
- memset(sortSeqEbcdic, 0x40, 10);
- memset(sortSeqLibEbcdic, 0x40, 10);
- convToEbcdic(fileSortSequence, sortSeqEbcdic, strlen(fileSortSequence));
- convToEbcdic(fileSortSequenceLibrary, sortSeqLibEbcdic, strlen(fileSortSequenceLibrary));
-
- return addStatementInternal(append.ptr(), append.length(), sortSeqEbcdic, sortSeqLibEbcdic);
- }
-
- /**
- Append an SQL statement using default (*HEX) sort sequence.
- */
- SqlStatementStream& addStatement(const String& append)
- {
- const char splatHEX[] = {0x5C, 0xC8, 0xC5, 0xE7, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // *HEX
- const char blanks[] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; //
-
- return addStatementInternal(append.ptr(), append.length(), splatHEX, blanks);
- }
-
- /**
- Append an SQL statement using default (*HEX) sort sequence.
- */
- SqlStatementStream& addStatement(const char* stmt)
- {
- const char splatHEX[] = {0x5C, 0xC8, 0xC5, 0xE7, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; // *HEX
- const char blanks[] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; //
-
- return addStatementInternal(stmt, strlen(stmt), splatHEX, blanks);
- }
-
- char* getPtrToData() const { return block; }
- uint32 getStatementCount() const { return statements; }
- private:
- SqlStatementStream& addStatementInternal(const char* stmt,
- uint32 length,
- const char* fileSortSequence,
- const char* fileSortSequenceLibrary);
-
- uint32 storageRemaining() const
- {
- return (block == NULL ? 0 : curSize - (ptr - block));
- }
-
- char* getNewSpace(size_t size)
- {
- allocBase = (char*)sql_alloc(size + 15);
- block = (char*)roundToQuadWordBdy(allocBase);
- return block;
- }
-
- uint32 curSize; // The size of the usable memory.
- char* allocBase; // The allocated memory (with padding for aligment)
- char* block; // The usable memory chunck (aligned for ILE)
- char* ptr; // The current position within block.
- uint32 statements; // The number of statements that have been appended.
-};
-
-#endif
-
diff --git a/storage/ibmdb2i/db2i_validatedPointer.h b/storage/ibmdb2i/db2i_validatedPointer.h
deleted file mode 100644
index c4e31d1f11b..00000000000
--- a/storage/ibmdb2i/db2i_validatedPointer.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-#ifndef DB2I_VALIDATEDPOINTER_H
-#define DB2I_VALIDATEDPOINTER_H
-
-#include "db2i_ileBridge.h"
-
-/**
- @class ValidatedPointer
- @brief Encapsulates a pointer registered for usage by the QMYSE APIs
-
- @details As a performance optimization, to prevent pointer validation each
- time a particular pointer is thunked across to ILE, QMYSE allows us to
- "register" a pointer such that it is validated once and then subsequently
- referenced on QMYSE APIs by means of a handle value. This class should be
- used to manage memory allocation/registration/unregistration of these
- pointers. Using the alloc function guarantees that the resulting storage is
- 16-byte aligned, a requirement for many pointers passed to QMYSE.
-*/
-template <class T>
-class ValidatedPointer
-{
-public:
- ValidatedPointer<T>() : address(NULL), handle(NULL) {;}
-
- ValidatedPointer<T>(size_t size)
- {
- alloc(size);
- }
-
- ValidatedPointer<T>(T* ptr)
- {
- assign(ptr);
- }
-
- operator T*()
- {
- return address;
- };
-
- operator T*() const
- {
- return address;
- };
-
- operator void*()
- {
- return address;
- };
-
- operator ILEMemHandle()
- {
- return handle;
- }
-
- void alloc(size_t size)
- {
- address = (T*)malloc_aligned(size);
- if (address)
- db2i_ileBridge::registerPtr(address, &handle);
- mallocedHere = 1;
- }
-
- void assign(T* ptr)
- {
- address = ptr;
- db2i_ileBridge::registerPtr((void*)ptr, &handle);
- mallocedHere = 0;
- }
-
- void realloc(size_t size)
- {
- dealloc();
- alloc(size);
- }
-
- void reassign(T* ptr)
- {
- dealloc();
- assign(ptr);
- }
-
- void dealloc()
- {
- if (address)
- {
- db2i_ileBridge::unregisterPtr(handle);
-
- if (mallocedHere)
- free_aligned((void*)address);
- }
- address = NULL;
- handle = 0;
- }
-
- ~ValidatedPointer()
- {
- dealloc();
- }
-
-private:
- // Disable copy ctor and assignment operator, as these would break
- // the registration guarantees provided by the class.
- ValidatedPointer& operator= (const ValidatedPointer newVal);
- ValidatedPointer(ValidatedPointer& newCopy);
-
- ILEMemHandle handle;
- T* address;
- char mallocedHere;
-};
-
-
-/**
- @class ValidatedObject
- @brief This class allows users to instantiate and register a particular
- object in a single step.
-*/
-template<class T>
-class ValidatedObject : public ValidatedPointer<T>
-{
- public:
- ValidatedObject<T>() : ValidatedPointer<T>(&value) {;}
-
- T& operator= (const T newVal) { value = newVal; return value; }
-
- private:
- T value;
-};
-#endif
diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc
deleted file mode 100644
index e5eccad1573..00000000000
--- a/storage/ibmdb2i/ha_ibmdb2i.cc
+++ /dev/null
@@ -1,3366 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-
-/**
- @file ha_ibmdb2i.cc
-
- @brief
- The ha_ibmdb2i storage engine provides an interface from MySQL to IBM DB2 for i.
-
-*/
-
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
-#include "ha_ibmdb2i.h"
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#include "db2i_ileBridge.h"
-#include "db2i_charsetSupport.h"
-#include <sys/utsname.h>
-#include "db2i_safeString.h"
-
-static const char __NOT_NULL_VALUE_EBCDIC = 0xF0; // '0'
-static const char __NULL_VALUE_EBCDIC = 0xF1; // '1'
-static const char __DEFAULT_VALUE_EBCDIC = 0xC4; // 'D'
-static const char BlankASPName[19] = " ";
-static const int DEFAULT_MAX_ROWS_TO_BUFFER = 4096;
-
-static const char SAVEPOINT_PREFIX[] = {0xD4, 0xE8, 0xE2, 0xD7}; // MYSP (in EBCDIC)
-
-OSVersion osVersion;
-
-
-// ================================================================
-// ================================================================
-// System variables
-static char* ibmdb2i_rdb_name;
-static MYSQL_SYSVAR_STR(rdb_name, ibmdb2i_rdb_name,
- PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_READONLY,
- "The name of the RDB to use",
- NULL,
- NULL,
- BlankASPName);
-
-static MYSQL_THDVAR_BOOL(transaction_unsafe,
- 0,
- "Disable support for commitment control",
- NULL,
- NULL,
- FALSE);
-
-static MYSQL_THDVAR_UINT(lob_alloc_size,
- 0,
- "Baseline allocation for lob read buffer",
- NULL,
- NULL,
- 2*1024*1024,
- 64*1024,
- 128*1024*1024,
- 1);
-
-static MYSQL_THDVAR_UINT(max_read_buffer_size,
- 0,
- "Maximum size of buffers used for read-ahead.",
- NULL,
- NULL,
- 1*1024*1024,
- 32*1024,
- 16*1024*1024,
- 1);
-
-static MYSQL_THDVAR_UINT(max_write_buffer_size,
- 0,
- "Maximum size of buffers used for bulk writes.",
- NULL,
- NULL,
- 8*1024*1024,
- 32*1024,
- 64*1024*1024,
- 1);
-
-static MYSQL_THDVAR_BOOL(compat_opt_time_as_duration,
- 0,
- "Control how new TIME columns should be defined in DB2. 0=time-of-day (default), 1=duration.",
- NULL,
- NULL,
- FALSE);
-
-static MYSQL_THDVAR_UINT(compat_opt_year_as_int,
- 0,
- "Control how new YEAR columns should be defined in DB2. 0=CHAR(4) (default), 1=SMALLINT.",
- NULL,
- NULL,
- 0,
- 0,
- 1,
- 1);
-
-static MYSQL_THDVAR_UINT(compat_opt_blob_cols,
- 0,
- "Control how new TEXT and BLOB columns should be defined in DB2. 0=CLOB/BLOB (default), 1=VARCHAR/VARBINARY",
- NULL,
- NULL,
- 0,
- 0,
- 1,
- 1);
-
-static MYSQL_THDVAR_UINT(compat_opt_allow_zero_date_vals,
- 0,
- "Allow substitute values to be used when storing a column with a 0000-00-00 date component. 0=No substitution (default), 1=Substitute '0001-01-01'",
- NULL,
- NULL,
- 0,
- 0,
- 1,
- 1);
-
-static MYSQL_THDVAR_BOOL(propagate_default_col_vals,
- 0,
- "Should DEFAULT column values be propagated to the DB2 table definition.",
- NULL,
- NULL,
- TRUE);
-
-static my_bool ibmdb2i_assume_exclusive_use;
-static MYSQL_SYSVAR_BOOL(assume_exclusive_use, ibmdb2i_assume_exclusive_use,
- 0,
- "Can MySQL assume that this process is the only one modifying the DB2 tables. ",
- NULL,
- NULL,
- FALSE);
-
-static MYSQL_THDVAR_BOOL(async_enabled,
- 0,
- "Should reads be done asynchronously when possible",
- NULL,
- NULL,
- TRUE);
-
-static MYSQL_THDVAR_UINT(create_index_option,
- 0,
- "Control whether additional indexes are created. 0=No (default), 1=Create additional *HEX-based index",
- NULL,
- NULL,
- 0,
- 0,
- 1,
- 1);
-
-/* static MYSQL_THDVAR_UINT(discovery_mode,
- 0,
- "Unsupported",
- NULL,
- NULL,
- 0,
- 0,
- 1,
- 1); */
-
-static uint32 ibmdb2i_system_trace;
-static MYSQL_SYSVAR_UINT(system_trace_level, ibmdb2i_system_trace,
- 0,
- "Set system tracing level",
- NULL,
- NULL,
- 0,
- 0,
- 63,
- 1);
-
-
-inline uint8 ha_ibmdb2i::getCommitLevel(THD* thd)
-{
- if (!THDVAR(thd, transaction_unsafe))
- {
- switch (thd_tx_isolation(thd))
- {
- case ISO_READ_UNCOMMITTED:
- return (accessIntent == QMY_READ_ONLY ? QMY_READ_UNCOMMITTED : QMY_REPEATABLE_READ);
- case ISO_READ_COMMITTED:
- return (accessIntent == QMY_READ_ONLY ? QMY_READ_COMMITTED : QMY_REPEATABLE_READ);
- case ISO_REPEATABLE_READ:
- return QMY_REPEATABLE_READ;
- case ISO_SERIALIZABLE:
- return QMY_SERIALIZABLE;
- }
- }
-
- return QMY_NONE;
-}
-
-inline uint8 ha_ibmdb2i::getCommitLevel()
-{
- return getCommitLevel(ha_thd());
-}
-
-//=====================================================================
-
-static handler *ibmdb2i_create_handler(handlerton *hton,
- TABLE_SHARE *table,
- MEM_ROOT *mem_root);
-static void ibmdb2i_drop_database(handlerton *hton, char* path);
-static int ibmdb2i_savepoint_set(handlerton *hton, THD* thd, void *sv);
-static int ibmdb2i_savepoint_rollback(handlerton *hton, THD* thd, void *sv);
-static int ibmdb2i_savepoint_release(handlerton *hton, THD* thd, void *sv);
-static uint ibmdb2i_alter_table_flags(uint flags);
-
-handlerton *ibmdb2i_hton;
-static bool was_ILE_inited;
-
-/* Tracks the number of open tables */
-static HASH ibmdb2i_open_tables;
-
-/* Mutex used to synchronize initialization of the hash */
-static pthread_mutex_t ibmdb2i_mutex;
-
-
-/**
- Create hash key for tracking open tables.
-*/
-
-static uchar* ibmdb2i_get_key(IBMDB2I_SHARE *share,size_t *length,
- bool not_used __attribute__((unused)))
-{
- *length=share->table_name_length;
- return (uchar*) share->table_name;
-}
-
-
-int ibmdb2i_close_connection(handlerton* hton, THD *thd)
-{
- DBUG_PRINT("ha_ibmdb2i::close_connection", ("Closing %d", thd->thread_id));
- db2i_ileBridge::getBridgeForThread(thd)->closeConnection(thd->thread_id);
- db2i_ileBridge::destroyBridgeForThread(thd);
-
- return 0;
-}
-
-
-static int ibmdb2i_init_func(void *p)
-{
- DBUG_ENTER("ibmdb2i_init_func");
-
- utsname tempName;
- uname(&tempName);
- osVersion.v = atoi(tempName.version);
- osVersion.r = atoi(tempName.release);
-
- was_ILE_inited = false;
- ibmdb2i_hton= (handlerton *)p;
- VOID(pthread_mutex_init(&ibmdb2i_mutex,MY_MUTEX_INIT_FAST));
- (void) my_hash_init(&ibmdb2i_open_tables,table_alias_charset,32,0,0,
- (my_hash_get_key) ibmdb2i_get_key,0,0);
-
- ibmdb2i_hton->state= SHOW_OPTION_YES;
- ibmdb2i_hton->create= ibmdb2i_create_handler;
- ibmdb2i_hton->drop_database= ibmdb2i_drop_database;
- ibmdb2i_hton->commit= ha_ibmdb2i::doCommit;
- ibmdb2i_hton->rollback= ha_ibmdb2i::doRollback;
- ibmdb2i_hton->savepoint_offset= 0;
- ibmdb2i_hton->savepoint_set= ibmdb2i_savepoint_set;
- ibmdb2i_hton->savepoint_rollback= ibmdb2i_savepoint_rollback;
- ibmdb2i_hton->savepoint_release= ibmdb2i_savepoint_release;
- ibmdb2i_hton->alter_table_flags=ibmdb2i_alter_table_flags;
- ibmdb2i_hton->close_connection=ibmdb2i_close_connection;
-
- int rc;
-
- rc = initCharsetSupport();
-
- if (!rc)
- rc = db2i_ileBridge::setup();
-
- if (!rc)
- {
- int nameLen = strlen(ibmdb2i_rdb_name);
- for (int i = 0; i < nameLen; ++i)
- {
- ibmdb2i_rdb_name[i] = my_toupper(system_charset_info, (uchar)ibmdb2i_rdb_name[i]);
- }
-
- rc = db2i_ileBridge::initILE(ibmdb2i_rdb_name, (uint16*)(((char*)&ibmdb2i_system_trace)+2));
- if (rc == 0)
- {
- was_ILE_inited = true;
- }
- }
-
- DBUG_RETURN(rc);
-}
-
-
-static int ibmdb2i_done_func(void *p)
-{
- int error= 0;
- DBUG_ENTER("ibmdb2i_done_func");
-
- if (ibmdb2i_open_tables.records)
- error= 1;
-
- if (was_ILE_inited)
- db2i_ileBridge::exitILE();
-
- db2i_ileBridge::takedown();
-
- doneCharsetSupport();
-
- my_hash_free(&ibmdb2i_open_tables);
- pthread_mutex_destroy(&ibmdb2i_mutex);
-
- DBUG_RETURN(0);
-}
-
-
-IBMDB2I_SHARE *ha_ibmdb2i::get_share(const char *table_name, TABLE *table)
-{
- IBMDB2I_SHARE *share;
- uint length;
- char *tmp_name;
-
- pthread_mutex_lock(&ibmdb2i_mutex);
- length=(uint) strlen(table_name);
-
- if (!(share=(IBMDB2I_SHARE*) my_hash_search(&ibmdb2i_open_tables,
- (uchar*)table_name,
- length)))
- {
- if (!(share=(IBMDB2I_SHARE *)
- my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &share, sizeof(*share),
- &tmp_name, length+1,
- NullS)))
- {
- pthread_mutex_unlock(&ibmdb2i_mutex);
- return NULL;
- }
-
- share->use_count=0;
- share->table_name_length=length;
- share->table_name=tmp_name;
- strmov(share->table_name,table_name);
- if (my_hash_insert(&ibmdb2i_open_tables, (uchar*) share))
- goto error;
- thr_lock_init(&share->lock);
- pthread_mutexattr_t mutexattr = MY_MUTEX_INIT_FAST;
- pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&share->mutex, &mutexattr);
-
- share->db2Table = new db2i_table(table->s, table_name);
- int32 rc = share->db2Table->initDB2Objects(table_name);
-
- if (rc)
- {
- delete share->db2Table;
- my_hash_delete(&ibmdb2i_open_tables, (uchar*) share);
- thr_lock_delete(&share->lock);
- my_errno = rc;
- goto error;
- }
-
- memset(&share->cachedStats, 0, sizeof(share->cachedStats));
- }
- share->use_count++;
- pthread_mutex_unlock(&ibmdb2i_mutex);
-
- db2Table = share->db2Table;
-
- return share;
-
-error:
- pthread_mutex_destroy(&share->mutex);
- my_free(share);
- pthread_mutex_unlock(&ibmdb2i_mutex);
-
- return NULL;
-}
-
-
-
-int ha_ibmdb2i::free_share(IBMDB2I_SHARE *share)
-{
- pthread_mutex_lock(&ibmdb2i_mutex);
- if (!--share->use_count)
- {
- delete share->db2Table;
- db2Table = NULL;
-
- my_hash_delete(&ibmdb2i_open_tables, (uchar*) share);
- thr_lock_delete(&share->lock);
- pthread_mutex_destroy(&share->mutex);
- my_free(share);
- pthread_mutex_unlock(&ibmdb2i_mutex);
- return 1;
- }
- pthread_mutex_unlock(&ibmdb2i_mutex);
-
- return 0;
-}
-
-static handler* ibmdb2i_create_handler(handlerton *hton,
- TABLE_SHARE *table,
- MEM_ROOT *mem_root)
-{
- return new (mem_root) ha_ibmdb2i(hton, table);
-}
-
-static void ibmdb2i_drop_database(handlerton *hton, char* path)
-{
- DBUG_ENTER("ha_ibmdb2i::ibmdb2i_drop_database");
- int rc = 0;
- char queryBuffer[200];
- String query(queryBuffer, sizeof(queryBuffer), system_charset_info);
- query.length(0);
- query.append(STRING_WITH_LEN(" DROP SCHEMA \""));
- query.append(path+2, strchr(path+2, '/')-(path+2));
- query.append('"');
-
- SqlStatementStream sqlStream(query);
-
- rc = db2i_ileBridge::getBridgeForThread()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- QMY_NONE,
- FALSE,
- TRUE);
- DBUG_VOID_RETURN;
-}
-
-inline static void genSavepointName(const void* sv, char* out)
-{
- *(uint32*)out = *(uint32*)SAVEPOINT_PREFIX;
- DBUG_ASSERT(sizeof(SAVEPOINT_PREFIX) == 4);
- out += sizeof(SAVEPOINT_PREFIX);
-
- longlong2str((longlong)sv, out, 10);
- while (*out)
- {
- out += 0xF0;
- ++out;
- }
-}
-
-
-/*********************************************************************
-Sets a transaction savepoint. */
-static int ibmdb2i_savepoint_set(handlerton* hton, THD* thd, void* sv)
-{
- DBUG_ENTER("ibmdb2i_savepoint_set");
- int rc = 0;
- if (!THDVAR(thd ,transaction_unsafe))
- {
- char name[64];
- genSavepointName(sv, name);
- DBUG_PRINT("ibmdb2i_savepoint_set",("Setting %s", name));
- rc = ha_ibmdb2i::doSavepointSet(thd, name);
- }
- DBUG_RETURN(rc);
-}
-
-
-/*********************************************************************
-Rollback a savepoint. */
-static int ibmdb2i_savepoint_rollback(handlerton* hton, THD* thd, void* sv)
-{
- DBUG_ENTER("ibmdb2i_savepoint_rollback");
- int rc = 0;
- if (!THDVAR(thd,transaction_unsafe))
- {
- char name[64];
- genSavepointName(sv, name);
- DBUG_PRINT("ibmdb2i_savepoint_rollback",("Rolling back %s", name));
- rc = ha_ibmdb2i::doSavepointRollback(thd, name);
- }
- DBUG_RETURN(rc);
-}
-
-
-/*********************************************************************
-Release a savepoint. */
-static int ibmdb2i_savepoint_release(handlerton* hton, THD* thd, void* sv)
-{
- DBUG_ENTER("ibmdb2i_savepoint_release");
- int rc = 0;
- if (!THDVAR(thd,transaction_unsafe))
- {
- char name[64];
- genSavepointName(sv, name);
- DBUG_PRINT("ibmdb2i_savepoint_release",("Releasing %s", name));
- rc = ha_ibmdb2i::doSavepointRelease(thd, name);
- }
- DBUG_RETURN(rc);
-}
-
-/* Thse flags allow for the online add and drop of an index via the CREATE INDEX,
- DROP INDEX, and ALTER TABLE statements. These flags indicate that MySQL is not
- required to lock the table before calling the storage engine to add or drop the
- index(s). */
-static uint ibmdb2i_alter_table_flags(uint flags)
-{
- return (HA_ONLINE_ADD_INDEX | HA_ONLINE_DROP_INDEX |
- HA_ONLINE_ADD_UNIQUE_INDEX | HA_ONLINE_DROP_UNIQUE_INDEX |
- HA_ONLINE_ADD_PK_INDEX | HA_ONLINE_DROP_PK_INDEX);
-}
-
-ha_ibmdb2i::ha_ibmdb2i(handlerton *hton, TABLE_SHARE *table_arg)
- :share(NULL), handler(hton, table_arg),
- activeHandle(0), dataHandle(0),
- activeReadBuf(NULL), activeWriteBuf(NULL),
- blobReadBuffers(NULL), accessIntent(QMY_UPDATABLE), currentRRN(0),
- releaseRowNeeded(FALSE),
- indexReadSizeEstimates(NULL),
- outstanding_start_bulk_insert(false),
- last_rnd_init_rc(0),
- last_index_init_rc(0),
- last_start_bulk_insert_rc(0),
- autoIncLockAcquired(false),
- got_auto_inc_values(false),
- next_identity_value(0),
- indexHandles(0),
- returnDupKeysImmediately(false),
- onDupUpdate(false),
- blobWriteBuffers(NULL),
- forceSingleRowRead(false)
- {
- activeReferences = 0;
- ref_length = sizeof(currentRRN);
- if (table_share && table_share->keys > 0)
- {
- indexHandles = (FILE_HANDLE*)my_malloc(table_share->keys * sizeof(FILE_HANDLE), MYF(MY_WME | MY_ZEROFILL));
- }
- clear_alloc_root(&conversionBufferMemroot);
- }
-
-
-ha_ibmdb2i::~ha_ibmdb2i()
-{
- DBUG_ASSERT(activeReferences == 0 || outstanding_start_bulk_insert);
-
- if (indexHandles)
- my_free(indexHandles);
- if (indexReadSizeEstimates)
- my_free(indexReadSizeEstimates);
-
- cleanupBuffers();
-}
-
-
-static const char *ha_ibmdb2i_exts[] = {
- FID_EXT,
- NullS
-};
-
-const char **ha_ibmdb2i::bas_ext() const
-{
- return ha_ibmdb2i_exts;
-}
-
-
-int ha_ibmdb2i::open(const char *name, int mode, uint test_if_locked)
-{
- DBUG_ENTER("ha_ibmdb2i::open");
-
- initBridge();
-
- dataHandle = bridge()->findAndRemovePreservedHandle(name, &share);
-
- if (share)
- db2Table = share->db2Table;
-
- if (!share && (!(share = get_share(name, table))))
- DBUG_RETURN(my_errno);
- thr_lock_data_init(&share->lock,&lock,NULL);
-
- info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);
-
-
- DBUG_RETURN(0);
-}
-
-
-
-
-int ha_ibmdb2i::close(void)
-{
- DBUG_ENTER("ha_ibmdb2i::close");
- int32 rc = 0;
- bool preserveShare = false;
-
- db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread();
-
- if (dataHandle)
- {
- if (bridge->expectErrors(QMY_ERR_PEND_LOCKS)->deallocateFile(dataHandle, FALSE) == QMY_ERR_PEND_LOCKS)
- {
- bridge->preserveHandle(share->table_name, dataHandle, share);
- preserveShare = true;
- }
- dataHandle = 0;
- }
-
- for (int idx = 0; idx < table_share->keys; ++idx)
- {
- if (indexHandles[idx] != 0)
- {
- bridge->deallocateFile(indexHandles[idx], FALSE);
- }
- }
-
- cleanupBuffers();
-
- if (!preserveShare)
- {
- if (free_share(share))
- share = NULL;
- }
-
- DBUG_RETURN(rc);
-}
-
-
-
-int ha_ibmdb2i::write_row(uchar * buf)
-{
-
- DBUG_ENTER("ha_ibmdb2i::write_row");
-
- if (last_start_bulk_insert_rc)
- DBUG_RETURN( last_start_bulk_insert_rc );
-
- ha_statistic_increment(&SSV::ha_write_count);
- int rc = 0;
-
- bool fileHandleNeedsRelease = false;
-
- if (!activeHandle)
- {
- rc = useDataFile();
- if (rc) DBUG_RETURN(rc);
- fileHandleNeedsRelease = true;
- }
-
- if (!outstanding_start_bulk_insert)
- rc = prepWriteBuffer(1, getFileForActiveHandle());
-
- if (!rc)
- {
- if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
- table->timestamp_field->set_time();
-
- char* writeBuffer = activeWriteBuf->addRow();
- rc = prepareRowForWrite(writeBuffer,
- writeBuffer+activeWriteBuf->getRowNullOffset(),
- true);
- if (rc == 0)
- {
- // If we are doing block inserts, if the MI is supposed to generate an auto_increment
- // (i.e. identity column) value for this record, and if this is not the first record in
- // the block, then store the value (that the MI will generate for the identity column)
- // into the MySQL write buffer. We can predetermine the value because the file is locked.
-
- if ((autoIncLockAcquired) && (default_identity_value) && (got_auto_inc_values))
- {
- if (unlikely((next_identity_value - 1) ==
- maxValueForField(table->next_number_field)))
- {
- rc = QMY_ERR_MAXVALUE;
- }
- else
- {
- rc = table->next_number_field->store((longlong) next_identity_value, TRUE);
- next_identity_value = next_identity_value + incrementByValue;
- }
- }
- // If the buffer is full, or if we locked the file and this is the first or last row
- // of a blocked insert, then flush the buffer.
- if (!rc && (activeWriteBuf->endOfBuffer()) ||
- ((autoIncLockAcquired) &&
- ((!got_auto_inc_values))) ||
- (returnDupKeysImmediately))
- rc = flushWrite(activeHandle, buf);
- }
- else
- activeWriteBuf->deleteRow();
- }
-
- if (fileHandleNeedsRelease)
- releaseActiveHandle();
-
- DBUG_RETURN(rc);
-}
-
-/**
- @brief
- Helper function used by write_row and update_row to prepare the MySQL
- row for insertion into DB2.
-*/
-int ha_ibmdb2i::prepareRowForWrite(char* data, char* nulls, bool honorIdentCols)
-{
- int rc = 0;
-
- // set null map all to non nulls
- memset(nulls,__NOT_NULL_VALUE_EBCDIC, table->s->fields);
- default_identity_value = FALSE;
-
- ulong sql_mode = ha_thd()->variables.sql_mode;
-
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
- for (Field **field = table->field; *field && !rc; ++field)
- {
- int fieldIndex = (*field)->field_index;
- if ((*field)->Field::is_null())
- {
- nulls[fieldIndex] = __NULL_VALUE_EBCDIC;
- }
- if (honorIdentCols && ((*field)->flags & AUTO_INCREMENT_FLAG) &&
- *field == table->next_number_field)
-// && ((!autoIncLockAcquired) || (!got_auto_inc_values)))
- {
- if (sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
- {
- if (!table->auto_increment_field_not_null)
- {
- nulls[fieldIndex] = __DEFAULT_VALUE_EBCDIC;
- default_identity_value = TRUE;
- }
- }
- else if ((*field)->val_int() == 0)
- {
- nulls[fieldIndex] = __DEFAULT_VALUE_EBCDIC;
- default_identity_value = TRUE;
- }
- }
-
- DB2Field& db2Field = db2Table->db2Field(fieldIndex);
- if (nulls[fieldIndex] == __NOT_NULL_VALUE_EBCDIC ||
- db2Field.isBlob())
- {
- rc = convertMySQLtoDB2(*field, db2Field, data + db2Field.getBufferOffset());
- }
- }
-
- if (!rc && db2Table->hasBlobs())
- rc = db2i_ileBridge::getBridgeForThread()->objectOverride(activeHandle,
- activeWriteBuf->ptr());
-
- dbug_tmp_restore_column_map(table->read_set, old_map);
-
- return rc;
-}
-
-
-
-int ha_ibmdb2i::update_row(const uchar * old_data, uchar * new_data)
-{
- DBUG_ENTER("ha_ibmdb2i::update_row");
- ha_statistic_increment(&SSV::ha_update_count);
- int rc;
-
- bool fileHandleNeedsRelease = false;
-
- if (!activeHandle)
- {
- rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);
- if (rc) DBUG_RETURN(rc);
- fileHandleNeedsRelease = true;
- }
-
- if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
- table->timestamp_field->set_time();
-
- char* writeBuf = activeWriteBuf->addRow();
- rc = prepareRowForWrite(writeBuf,
- writeBuf+activeWriteBuf->getRowNullOffset(),
- onDupUpdate);
-
- char* lastDupKeyNamePtr = NULL;
- uint32 lastDupKeyNameLen = 0;
-
- if (!rc)
- {
- rc = db2i_ileBridge::getBridgeForThread()->updateRow(activeHandle,
- currentRRN,
- activeWriteBuf->ptr(),
- &lastDupKeyRRN,
- &lastDupKeyNamePtr,
- &lastDupKeyNameLen);
- }
-
- if (lastDupKeyNameLen)
- {
- lastDupKeyID = getKeyFromName(lastDupKeyNamePtr, lastDupKeyNameLen);
- rrnAssocHandle = activeHandle;
- }
-
- if (fileHandleNeedsRelease)
- releaseActiveHandle();
-
- activeWriteBuf->resetAfterWrite();
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::delete_row(const uchar * buf)
-{
- DBUG_ENTER("ha_ibmdb2i::delete_row");
- ha_statistic_increment(&SSV::ha_delete_count);
-
- bool needReleaseFile = false;
- int rc = 0;
-
- if (!activeHandle) // In some circumstances, MySQL comes here after
- { // closing the active handle. We need to re-open.
- rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);
- needReleaseFile = true;
- }
-
- if (likely(!rc))
- {
- rc = db2i_ileBridge::getBridgeForThread()->deleteRow(activeHandle,
- currentRRN);
- invalidateCachedStats();
- if (needReleaseFile)
- releaseActiveHandle();
- }
-
- DBUG_RETURN(rc);
-}
-
-
-
-int ha_ibmdb2i::index_init(uint idx, bool sorted)
-{
- DBUG_ENTER("ha_ibmdb2i::index_init");
-
- int& rc = last_index_init_rc;
- rc = 0;
-
- invalidDataFound=false;
- tweakReadSet();
-
- active_index=idx;
-
- rc = useIndexFile(idx);
-
- if (!rc)
- {
-// THD* thd = ha_thd();
-// if (accessIntent == QMY_UPDATABLE &&
-// thd_tx_isolation(thd) == ISO_REPEATABLE_READ &&
-// !THDVAR(thd, transaction_unsafe))
-// {
-// readAccessIntent = QMY_READ_ONLY;
-// }
-// else
-// {
- readAccessIntent = accessIntent;
-// }
-
- if (!rc && accessIntent != QMY_READ_ONLY)
- rc = prepWriteBuffer(1, db2Table->indexFile(idx));
-
- if (rc)
- releaseIndexFile(idx);
- }
-
- rrnAssocHandle= 0;
-
- DBUG_RETURN(rc);
-}
-
-
-
-int ha_ibmdb2i::index_read(uchar * buf, const uchar * key,
- uint key_len,
- enum ha_rkey_function find_flag)
-{
- DBUG_ENTER("ha_ibmdb2i::index_read");
-
- if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc);
-
- int rc;
-
- ha_rows estimatedRows = getIndexReadEstimate(active_index);
- rc = prepReadBuffer(estimatedRows, db2Table->indexFile(active_index), readAccessIntent);
- if (unlikely(rc)) DBUG_RETURN(rc);
-
- DBUG_ASSERT(activeReadBuf);
-
- keyBuf.allocBuf(activeReadBuf->getRowLength(),
- activeReadBuf->getRowNullOffset(),
- activeReadBuf->getRowLength());
- keyBuf.zeroBuf();
-
- char* db2KeyBufPtr = keyBuf.ptr();
- char* nullKeyMap = db2KeyBufPtr + activeReadBuf->getRowNullOffset();
-
- const uchar* keyBegin = key;
- int partsInUse;
-
- KEY& curKey = table->key_info[active_index];
-
- for (partsInUse = 0; partsInUse < curKey.key_parts, key - keyBegin < key_len; ++partsInUse)
- {
- Field* field = curKey.key_part[partsInUse].field;
- if ((curKey.key_part[partsInUse].null_bit) &&
- (char*)key[0])
- {
- if (field->flags & AUTO_INCREMENT_FLAG)
- {
- table->status = STATUS_NOT_FOUND;
- DBUG_RETURN(HA_ERR_END_OF_FILE);
- }
- else
- {
- nullKeyMap[partsInUse] = __NULL_VALUE_EBCDIC;
- }
- }
- else
- {
- nullKeyMap[partsInUse] = __NOT_NULL_VALUE_EBCDIC;
- convertMySQLtoDB2(field,
- db2Table->db2Field(field->field_index),
- db2KeyBufPtr,
- (uchar*)key+((curKey.key_part[partsInUse].null_bit)? 1 : 0) ); // + (curKey.key_parts+7) / 8);
- }
-
- db2KeyBufPtr += db2Table->db2Field(field->field_index).getByteLengthInRecord();
- key += curKey.key_part[partsInUse].store_length;
- }
-
- keyLen = db2KeyBufPtr - (char*)keyBuf.ptr();
-
- DBUG_PRINT("ha_ibmdb2i::index_read", ("find_flag: %d", find_flag));
-
- char readDirection = QMY_NEXT;
-
- switch (find_flag)
- {
- case HA_READ_AFTER_KEY:
- doInitialRead(QMY_AFTER_EQUAL, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- break;
- case HA_READ_BEFORE_KEY:
- doInitialRead(QMY_BEFORE_EQUAL, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- break;
- case HA_READ_KEY_OR_NEXT:
- doInitialRead(QMY_AFTER_OR_EQUAL, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- break;
- case HA_READ_KEY_OR_PREV:
- DBUG_ASSERT(0); // This function is unused
- doInitialRead(QMY_BEFORE_OR_EQUAL, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- break;
- case HA_READ_PREFIX_LAST_OR_PREV:
- doInitialRead(QMY_LAST_PREVIOUS, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- readDirection = QMY_PREVIOUS;
- break;
- case HA_READ_PREFIX_LAST:
- doInitialRead(QMY_PREFIX_LAST, estimatedRows,
- keyBuf.ptr(), keyLen, partsInUse);
- readDirection = QMY_PREVIOUS;
- break;
- case HA_READ_KEY_EXACT:
- doInitialRead(QMY_EQUAL, estimatedRows, keyBuf.ptr(), keyLen, partsInUse);
- break;
- default:
- DBUG_ASSERT(0);
- return HA_ERR_GENERIC;
- break;
- }
-
- ha_statistic_increment(&SSV::ha_read_key_count);
- rc = readFromBuffer(buf, readDirection);
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::index_next(uchar * buf)
-{
- DBUG_ENTER("ha_ibmdb2i::index_next");
- ha_statistic_increment(&SSV::ha_read_next_count);
-
- int rc = readFromBuffer(buf, QMY_NEXT);
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::index_next_same(uchar *buf, const uchar *key, uint keylen)
-{
- DBUG_ENTER("ha_ibmdb2i::index_next_same");
- ha_statistic_increment(&SSV::ha_read_next_count);
-
- int rc = readFromBuffer(buf, QMY_NEXT_EQUAL);
-
- if (rc == HA_ERR_KEY_NOT_FOUND)
- {
- rc = HA_ERR_END_OF_FILE;
- }
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-int ha_ibmdb2i::index_read_last(uchar * buf, const uchar * key, uint key_len)
-{
- DBUG_ENTER("ha_ibmdb2i::index_read_last");
- DBUG_RETURN(index_read(buf, key, key_len, HA_READ_PREFIX_LAST));
-}
-
-
-
-int ha_ibmdb2i::index_prev(uchar * buf)
-{
- DBUG_ENTER("ha_ibmdb2i::index_prev");
- ha_statistic_increment(&SSV::ha_read_prev_count);
-
- int rc = readFromBuffer(buf, QMY_PREVIOUS);
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::index_first(uchar * buf)
-{
- DBUG_ENTER("ha_ibmdb2i::index_first");
-
- if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc);
-
- int rc = prepReadBuffer(DEFAULT_MAX_ROWS_TO_BUFFER,
- db2Table->indexFile(active_index),
- readAccessIntent);
-
- if (rc == 0)
- {
- doInitialRead(QMY_FIRST, DEFAULT_MAX_ROWS_TO_BUFFER);
- ha_statistic_increment(&SSV::ha_read_first_count);
- rc = readFromBuffer(buf, QMY_NEXT);
- }
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::index_last(uchar * buf)
-{
- DBUG_ENTER("ha_ibmdb2i::index_last");
-
- if (unlikely(last_index_init_rc)) DBUG_RETURN(last_index_init_rc);
-
- int rc = prepReadBuffer(DEFAULT_MAX_ROWS_TO_BUFFER,
- db2Table->indexFile(active_index),
- readAccessIntent);
-
- if (rc == 0)
- {
- doInitialRead(QMY_LAST, DEFAULT_MAX_ROWS_TO_BUFFER);
- ha_statistic_increment(&SSV::ha_read_last_count);
- rc = readFromBuffer(buf, QMY_PREVIOUS);
- }
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::rnd_init(bool scan)
-{
- DBUG_ENTER("ha_ibmdb2i::rnd_init");
-
- int& rc = last_rnd_init_rc;
- rc = 0;
-
- tweakReadSet();
- invalidDataFound=false;
-
- uint32 rowsToBlockOnRead;
-
- if (!scan)
- {
- rowsToBlockOnRead = 1;
- }
- else
- {
- rowsToBlockOnRead = DEFAULT_MAX_ROWS_TO_BUFFER;
- }
-
- rc = useDataFile();
-
- if (!rc)
- {
-// THD* thd = ha_thd();
-// if (accessIntent == QMY_UPDATABLE &&
-// thd_tx_isolation(thd) == ISO_REPEATABLE_READ &&
-// !THDVAR(thd, transaction_unsafe))
-// {
-// readAccessIntent = QMY_READ_ONLY;
-// }
-// else
-// {
- readAccessIntent = accessIntent;
-// }
-
- rc = prepReadBuffer(rowsToBlockOnRead, db2Table->dataFile(), readAccessIntent);
-
- if (!rc && accessIntent != QMY_READ_ONLY)
- rc = prepWriteBuffer(1, db2Table->dataFile());
-
- if (!rc && scan)
- doInitialRead(QMY_FIRST, rowsToBlockOnRead);
-
- if (rc)
- releaseDataFile();
- }
-
- rrnAssocHandle= 0;
-
- DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing
- // an assert in ha_rnd_end later on if we return a non-zero
- // value here.
-}
-
-int ha_ibmdb2i::rnd_end()
-{
- DBUG_ENTER("ha_ibmdb2i::rnd_end");
-
- warnIfInvalidData();
- if (likely(activeReadBuf))
- activeReadBuf->endRead();
- if (last_rnd_init_rc == 0)
- releaseActiveHandle();
- last_rnd_init_rc = 0;
- DBUG_RETURN(0);
-}
-
-
-int32 ha_ibmdb2i::mungeDB2row(uchar* record, const char* dataPtr, const char* nullMapPtr, bool skipLOBs)
-{
- DBUG_ASSERT(dataPtr);
-
- my_bitmap_map *old_write_map= dbug_tmp_use_all_columns(table, table->write_set);
- my_bitmap_map *old_read_map;
-
- if (unlikely(readAllColumns))
- old_read_map = tmp_use_all_columns(table, table->read_set);
-
- resetCharacterConversionBuffers();
-
- my_ptrdiff_t old_ptr= (my_ptrdiff_t) (record - table->record[0]);
- int fieldIndex = 0;
- for (Field **field = table->field; *field; ++field, ++fieldIndex)
- {
- if (unlikely(old_ptr))
- (*field)->move_field_offset(old_ptr);
- if (nullMapPtr[fieldIndex] == __NULL_VALUE_EBCDIC ||
- (!bitmap_is_set(table->read_set, fieldIndex)) ||
- (skipLOBs && db2Table->db2Field(fieldIndex).isBlob()))
- {
- (*field)->set_null();
- }
- else
- {
- (*field)->set_notnull();
- convertDB2toMySQL(db2Table->db2Field(fieldIndex), *field, dataPtr);
- }
- if (unlikely(old_ptr))
- (*field)->move_field_offset(-old_ptr);
-
- }
-
- if (unlikely(readAllColumns))
- tmp_restore_column_map(table->read_set, old_read_map);
- dbug_tmp_restore_column_map(table->write_set, old_write_map);
-
- return 0;
-}
-
-
-int ha_ibmdb2i::rnd_next(uchar *buf)
-{
- DBUG_ENTER("ha_ibmdb2i::rnd_next");
-
- if (unlikely(last_rnd_init_rc)) DBUG_RETURN(last_rnd_init_rc);
- ha_statistic_increment(&SSV::ha_read_rnd_next_count);
-
- int rc;
-
- rc = readFromBuffer(buf, QMY_NEXT);
-
- table->status= (rc ? STATUS_NOT_FOUND: 0);
- DBUG_RETURN(rc);
-}
-
-
-void ha_ibmdb2i::position(const uchar *record)
-{
- DBUG_ENTER("ha_ibmdb2i::position");
- my_store_ptr(ref, ref_length, currentRRN);
- DBUG_VOID_RETURN;
-}
-
-
-int ha_ibmdb2i::rnd_pos(uchar * buf, uchar *pos)
-{
- DBUG_ENTER("ha_ibmdb2i::rnd_pos");
- if (unlikely(last_rnd_init_rc)) DBUG_RETURN( last_rnd_init_rc);
- ha_statistic_increment(&SSV::ha_read_rnd_count);
-
- currentRRN = my_get_ptr(pos, ref_length);
-
- tweakReadSet();
-
- int rc = 0;
-
- if (rrnAssocHandle &&
- (activeHandle != rrnAssocHandle))
- {
- if (activeHandle) releaseActiveHandle();
- rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);
- }
-
- if (likely(rc == 0))
- {
- rc = prepReadBuffer(1, getFileForActiveHandle(), accessIntent);
-
- if (likely(rc == 0) && accessIntent == QMY_UPDATABLE)
- rc = prepWriteBuffer(1, getFileForActiveHandle());
-
- if (likely(rc == 0))
- {
- rc = db2i_ileBridge::getBridgeForThread()->readByRRN(activeHandle,
- activeReadBuf->ptr(),
- currentRRN,
- accessIntent,
- getCommitLevel());
-
- if (likely(rc == 0))
- {
- rrnAssocHandle = activeHandle;
- const char* readBuf = activeReadBuf->getRowN(0);
- rc = mungeDB2row(buf, readBuf, readBuf + activeReadBuf->getRowNullOffset(), false);
- releaseRowNeeded = TRUE;
- }
- }
- }
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::info(uint flag)
-{
- DBUG_ENTER("ha_ibmdb2i::info");
-
- uint16 infoRequested = 0;
- ValidatedPointer<char> rowKeySpcPtr; // Space pointer passed to DB2
- uint32 rowKeySpcLen; // Length of space passed to DB2
- THD* thd = ha_thd();
- int command = thd_sql_command(thd);
-
- if (flag & HA_STATUS_AUTO)
- stats.auto_increment_value = (ulonglong) 0;
-
- if (flag & HA_STATUS_ERRKEY)
- {
- errkey = lastDupKeyID;
- my_store_ptr(dup_ref, ref_length, lastDupKeyRRN);
- }
-
- if (flag & HA_STATUS_TIME)
- {
- if ((flag & HA_STATUS_NO_LOCK) &&
- ibmdb2i_assume_exclusive_use &&
- share &&
- (share->cachedStats.isInited(lastModTime)))
- stats.update_time = share->cachedStats.getUpdateTime();
- else
- infoRequested |= lastModTime;
- }
-
- if (flag & HA_STATUS_CONST)
- {
- stats.block_size=4096;
- infoRequested |= createTime;
-
- if (table->s->keys)
- {
- infoRequested |= rowsPerKey;
- rowKeySpcLen = (table->s->keys) * MAX_DB2_KEY_PARTS * sizeof(uint64);
- rowKeySpcPtr.alloc(rowKeySpcLen);
- memset(rowKeySpcPtr, 0, rowKeySpcLen); // Clear the allocated space
- }
- }
-
- if (flag & HA_STATUS_VARIABLE)
- {
- if ((flag & HA_STATUS_NO_LOCK) &&
- (command != SQLCOM_SHOW_TABLE_STATUS) &&
- ibmdb2i_assume_exclusive_use &&
- share &&
- (share->cachedStats.isInited(rowCount | deletedRowCount | meanRowLen | ioCount)) &&
- (share->cachedStats.getRowCount() >= 2))
- {
- stats.records = share->cachedStats.getRowCount();
- stats.deleted = share->cachedStats.getDelRowCount();
- stats.mean_rec_length = share->cachedStats.getMeanLength();
- stats.data_file_length = share->cachedStats.getAugmentedDataLength();
- }
- else
- {
- infoRequested |= rowCount | deletedRowCount | meanRowLen;
- if (command == SQLCOM_SHOW_TABLE_STATUS)
- infoRequested |= objLength;
- else
- infoRequested |= ioCount;
- }
- }
-
- int rc = 0;
-
- if (infoRequested)
- {
- DBUG_PRINT("ha_ibmdb2i::info",("Retrieving fresh stats %d", flag));
-
- initBridge(thd);
- rc = bridge()->retrieveTableInfo((dataHandle ? dataHandle : db2Table->dataFile()->getMasterDefnHandle()),
- infoRequested,
- stats,
- rowKeySpcPtr);
-
- if (!rc)
- {
- if ((flag & HA_STATUS_VARIABLE) &&
- (command != SQLCOM_SHOW_TABLE_STATUS))
- stats.data_file_length = stats.data_file_length * IO_SIZE;
-
- if ((ibmdb2i_assume_exclusive_use) &&
- (share) &&
- (command != SQLCOM_SHOW_TABLE_STATUS))
- {
- if (flag & HA_STATUS_VARIABLE)
- {
- share->cachedStats.cacheRowCount(stats.records);
- share->cachedStats.cacheDelRowCount(stats.deleted);
- share->cachedStats.cacheMeanLength(stats.mean_rec_length);
- share->cachedStats.cacheAugmentedDataLength(stats.data_file_length);
- }
-
- if (flag & HA_STATUS_TIME)
- {
- share->cachedStats.cacheUpdateTime(stats.update_time);
- }
- }
-
- if (flag & HA_STATUS_CONST)
- {
- ulong i; // Loop counter for indexes
- ulong j; // Loop counter for key parts
- RowKey* rowKeyPtr; // Pointer to 'number of unique rows' array for this index
-
- rowKeyPtr = (RowKey_t*)(void*)rowKeySpcPtr; // Address first array of DB2 row counts
- for (i = 0; i < table->s->keys; i++) // Do for each index, including primary
- {
- for (j = 0; j < table->key_info[i].key_parts; j++)
- {
- table->key_info[i].rec_per_key[j]= rowKeyPtr->RowKeyArray[j];
- }
- rowKeyPtr = rowKeyPtr + 1; // Address next array of DB2 row counts
- }
- }
- }
- else if (rc == HA_ERR_LOCK_WAIT_TIMEOUT && share)
- {
- // If we couldn't retrieve the info because the object was locked,
- // we'll do our best by returning the most recently cached data.
- if ((infoRequested & rowCount) &&
- share->cachedStats.isInited(rowCount))
- stats.records = share->cachedStats.getRowCount();
- if ((infoRequested & deletedRowCount) &&
- share->cachedStats.isInited(deletedRowCount))
- stats.deleted = share->cachedStats.getDelRowCount();
- if ((infoRequested & meanRowLen) &&
- share->cachedStats.isInited(meanRowLen))
- stats.mean_rec_length = share->cachedStats.getMeanLength();
- if ((infoRequested & lastModTime) &&
- share->cachedStats.isInited(lastModTime))
- stats.update_time = share->cachedStats.getUpdateTime();
-
- rc = 0;
- }
- }
-
- DBUG_RETURN(rc);
-}
-
-
-ha_rows ha_ibmdb2i::records()
-{
- DBUG_ENTER("ha_ibmdb2i::records");
- int rc;
- rc = bridge()->retrieveTableInfo((dataHandle ? dataHandle : db2Table->dataFile()->getMasterDefnHandle()),
- rowCount,
- stats);
-
- if (unlikely(rc))
- {
- if (rc == HA_ERR_LOCK_WAIT_TIMEOUT &&
- share &&
- (share->cachedStats.isInited(rowCount)))
- DBUG_RETURN(share->cachedStats.getRowCount());
- else
- DBUG_RETURN(HA_POS_ERROR);
- }
- else if (share)
- {
- share->cachedStats.cacheRowCount(stats.records);
- }
-
- DBUG_RETURN(stats.records);
-}
-
-
-int ha_ibmdb2i::extra(enum ha_extra_function operation)
-{
- DBUG_ENTER("ha_ibmdb2i::extra");
-
- switch(operation)
- {
- // Can these first five flags be replaced by attending to HA_EXTRA_WRITE_CACHE?
- case HA_EXTRA_NO_IGNORE_DUP_KEY:
- case HA_EXTRA_WRITE_CANNOT_REPLACE:
- {
- returnDupKeysImmediately = false;
- onDupUpdate = false;
- }
- break;
- case HA_EXTRA_INSERT_WITH_UPDATE:
- {
- returnDupKeysImmediately = true;
- onDupUpdate = true;
- }
- break;
- case HA_EXTRA_IGNORE_DUP_KEY:
- case HA_EXTRA_WRITE_CAN_REPLACE:
- returnDupKeysImmediately = true;
- break;
- case HA_EXTRA_FLUSH_CACHE:
- if (outstanding_start_bulk_insert)
- finishBulkInsert();
- break;
- }
-
-
- DBUG_RETURN(0);
-}
-
-/**
- @brief
- The DB2 storage engine will ignore a MySQL generated value and will generate
- a new value in SLIC. We arbitrarily set first_value to 1, and set the
- interval to infinity for better performance on multi-row inserts.
-*/
-void ha_ibmdb2i::get_auto_increment(ulonglong offset, ulonglong increment,
- ulonglong nb_desired_values,
- ulonglong *first_value,
- ulonglong *nb_reserved_values)
-{
- DBUG_ENTER("ha_ibmdb2i::get_auto_increment");
- *first_value= 1;
- *nb_reserved_values= ULONGLONG_MAX;
-}
-
-
-
-void ha_ibmdb2i::update_create_info(HA_CREATE_INFO *create_info)
-{
- DBUG_ENTER("ha_ibmdb2i::update_create_info");
-
- if ((!(create_info->used_fields & HA_CREATE_USED_AUTO)) &&
- (table->found_next_number_field != NULL))
- {
- initBridge();
-
- create_info->auto_increment_value= 1;
-
- ha_rows rowCount = records();
-
- if (rowCount == 0)
- {
- create_info->auto_increment_value = db2Table->getStartId();
- DBUG_VOID_RETURN;
- }
- else if (rowCount == HA_POS_ERROR)
- {
- DBUG_VOID_RETURN;
- }
-
- getNextIdVal(&create_info->auto_increment_value);
- }
- DBUG_VOID_RETURN;
-}
-
-
-int ha_ibmdb2i::getNextIdVal(ulonglong *value)
-{
- DBUG_ENTER("ha_ibmdb2i::getNextIdVal");
-
- char queryBuffer[MAX_DB2_COLNAME_LENGTH + MAX_DB2_QUALIFIEDNAME_LENGTH + 64];
- strcpy(queryBuffer, " SELECT CAST(MAX( ");
- convertMySQLNameToDB2Name(table->found_next_number_field->field_name,
- strend(queryBuffer),
- MAX_DB2_COLNAME_LENGTH+1);
- strcat(queryBuffer, ") AS BIGINT) FROM ");
- db2Table->getDB2QualifiedName(strend(queryBuffer));
- DBUG_ASSERT(strlen(queryBuffer) < sizeof(queryBuffer));
-
- SqlStatementStream sqlStream(queryBuffer);
- DBUG_PRINT("ha_ibmdb2i::getNextIdVal", ("Sent to DB2: %s",queryBuffer));
-
- int rc = 0;
- FILE_HANDLE fileHandle2;
- uint32 db2RowDataLen2;
- rc = bridge()->prepOpen(sqlStream.getPtrToData(),
- &fileHandle2,
- &db2RowDataLen2);
- if (likely(rc == 0))
- {
- IOReadBuffer rowBuffer(1, db2RowDataLen2);
- rc = bridge()->read(fileHandle2,
- rowBuffer.ptr(),
- QMY_READ_ONLY,
- QMY_NONE,
- QMY_FIRST);
-
- if (likely(rc == 0))
- {
- /* This check is here for the case where the table is not empty,
- but the auto_increment starting value has been changed since
- the last record was written. */
-
- longlong maxIdVal = *(longlong*)(rowBuffer.getRowN(0));
- if ((maxIdVal + 1) > db2Table->getStartId())
- *value = maxIdVal + 1;
- else
- *value = db2Table->getStartId();
- }
-
- bridge()->deallocateFile(fileHandle2);
- }
- DBUG_RETURN(rc);
-}
-
-
-/*
- Updates index cardinalities.
-*/
-int ha_ibmdb2i::analyze(THD* thd, HA_CHECK_OPT *check_opt)
-{
- DBUG_ENTER("ha_ibmdb2i::analyze");
- info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
- DBUG_RETURN(0);
-}
-
-int ha_ibmdb2i::optimize(THD* thd, HA_CHECK_OPT *check_opt)
-{
- DBUG_ENTER("ha_ibmdb2i::optimize");
-
- initBridge(thd);
-
- if (unlikely(records() == 0))
- DBUG_RETURN(0); // DB2 doesn't like to reorganize a table with no data.
-
- quiesceAllFileHandles();
-
- int32 rc = bridge()->optimizeTable(db2Table->dataFile()->getMasterDefnHandle());
- info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
-
- DBUG_RETURN(rc);
-}
-
-
-/**
- @brief
- Determines if an ALTER TABLE is allowed to switch the storage engine
- for this table. If the table has a foreign key or is referenced by a
- foreign key, then it cannot be switched.
-*/
-bool ha_ibmdb2i::can_switch_engines(void)
-/*=================================*/
-{
- DBUG_ENTER("ha_ibmdb2i::can_switch_engines");
-
- int rc = 0;
- FILE_HANDLE queryFile = 0;
- uint32 resultRowLen;
- uint count = 0;
- bool can_switch = FALSE; // 1 if changing storage engine is allowed
-
- const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL);
- const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL);
-
- String query(256);
- query.append(STRING_WITH_LEN(" SELECT COUNT(*) FROM SYSIBM.SQLFOREIGNKEYS WHERE ((PKTABLE_SCHEM = '"));
- query.append(libName+1, strlen(libName)-2); // Remove quotes from parent schema name
- query.append(STRING_WITH_LEN("' AND PKTABLE_NAME = '"));
- query.append(fileName+1,strlen(fileName)-2); // Remove quotes from file name
- query.append(STRING_WITH_LEN("') OR (FKTABLE_SCHEM = '"));
- query.append(libName+1,strlen(libName)-2); // Remove quotes from child schema
- query.append(STRING_WITH_LEN("' AND FKTABLE_NAME = '"));
- query.append(fileName+1,strlen(fileName)-2); // Remove quotes from child name
- query.append(STRING_WITH_LEN("'))"));
-
- SqlStatementStream sqlStream(query);
-
- rc = bridge()->prepOpen(sqlStream.getPtrToData(),
- &queryFile,
- &resultRowLen);
- if (rc == 0)
- {
- IOReadBuffer rowBuffer(1, resultRowLen);
-
- rc = bridge()->read(queryFile,
- rowBuffer.ptr(),
- QMY_READ_ONLY,
- QMY_NONE,
- QMY_FIRST);
- if (!rc)
- {
- count = *(uint*)(rowBuffer.getRowN(0));
- if (count == 0)
- can_switch = TRUE;
- }
-
- bridge()->deallocateFile(queryFile);
- }
- DBUG_RETURN(can_switch);
-}
-
-
-
-bool ha_ibmdb2i::check_if_incompatible_data(HA_CREATE_INFO *info,
- uint table_changes)
-{
- DBUG_ENTER("ha_ibmdb2i::check_if_incompatible_data");
- uint i;
- /* Check that auto_increment value and field definitions were
- not changed. */
- if ((info->used_fields & HA_CREATE_USED_AUTO &&
- info->auto_increment_value != 0) ||
- table_changes != IS_EQUAL_YES)
- DBUG_RETURN(COMPATIBLE_DATA_NO);
- /* Check if any fields were renamed. */
- for (i= 0; i < table->s->fields; i++)
- {
- Field *field= table->field[i];
- if (field->flags & FIELD_IS_RENAMED)
- {
- DBUG_PRINT("info", ("Field has been renamed, copy table"));
- DBUG_RETURN(COMPATIBLE_DATA_NO);
- }
- }
- DBUG_RETURN(COMPATIBLE_DATA_YES);
-}
-
-int ha_ibmdb2i::reset_auto_increment(ulonglong value)
- {
- DBUG_ENTER("ha_ibmdb2i::reset_auto_increment");
-
- int rc = 0;
-
- quiesceAllFileHandles();
-
- const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL);
- const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL);
-
- String query(512);
- query.append(STRING_WITH_LEN(" ALTER TABLE "));
- query.append(libName);
- query.append('.');
- query.append(fileName);
- query.append(STRING_WITH_LEN(" ALTER COLUMN "));
- char colName[MAX_DB2_COLNAME_LENGTH+1];
- convertMySQLNameToDB2Name(table->found_next_number_field->field_name,
- colName,
- sizeof(colName));
- query.append(colName);
-
- char restart_value[22];
- CHARSET_INFO *cs= &my_charset_bin;
- uint len = (uint)(cs->cset->longlong10_to_str)(cs,restart_value,sizeof(restart_value), 10, value);
- restart_value[len] = 0;
-
- query.append(STRING_WITH_LEN(" RESTART WITH "));
- query.append(restart_value);
-
- SqlStatementStream sqlStream(query);
- DBUG_PRINT("ha_ibmdb2i::reset_auto_increment", ("Sent to DB2: %s",query.c_ptr()));
-
- rc = db2i_ileBridge::getBridgeForThread()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- QMY_NONE, //getCommitLevel(),
- FALSE,
- FALSE,
- TRUE, //FALSE,
- dataHandle);
- if (rc == 0)
- db2Table->updateStartId(value);
-
- DBUG_RETURN(rc);
-}
-
-
-/**
- @brief
- This function receives an error code that was previously set by the handler.
- It returns to MySQL the error string associated with that error.
-*/
-bool ha_ibmdb2i::get_error_message(int error, String *buf)
-{
- DBUG_ENTER("ha_ibmdb2i::get_error_message");
- if ((error >= DB2I_FIRST_ERR && error <= DB2I_LAST_ERR) ||
- (error >= QMY_ERR_MIN && error <= QMY_ERR_MAX))
- {
- db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(ha_thd());
- char* errMsg = bridge->getErrorStorage();
- buf->copy(errMsg, strlen(errMsg),system_charset_info);
- bridge->freeErrorStorage();
- }
- DBUG_RETURN(FALSE);
-}
-
-
-int ha_ibmdb2i::delete_all_rows()
-{
- DBUG_ENTER("ha_ibmdb2i::delete_all_rows");
- int rc = 0;
- char queryBuffer[MAX_DB2_QUALIFIEDNAME_LENGTH + 64];
- strcpy(queryBuffer, " DELETE FROM ");
- db2Table->getDB2QualifiedName(strend(queryBuffer));
- DBUG_ASSERT(strlen(queryBuffer) < sizeof(queryBuffer));
-
- SqlStatementStream sqlStream(queryBuffer);
- DBUG_PRINT("ha_ibmdb2i::delete_all_rows", ("Sent to DB2: %s",queryBuffer));
- rc = bridge()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- getCommitLevel(),
- false,
- false,
- true,
- dataHandle);
-
- /* If this method was called on behalf of a TRUNCATE TABLE statement, and if */
- /* the table has an auto_increment field, then reset the starting value for */
- /* the auto_increment field to 1.
- */
- if (rc == 0 && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE &&
- table->found_next_number_field )
- rc = reset_auto_increment(1);
-
- invalidateCachedStats();
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::truncate()
-{
- int error = delete_all_rows();
- return error ? error : reset_auto_increment(0);
-}
-
-
-int ha_ibmdb2i::external_lock(THD *thd, int lock_type)
-{
- int rc = 0;
-
- DBUG_ENTER("ha_ibmdb2i::external_lock");
- DBUG_PRINT("ha_ibmdb2i::external_lock",("Lock type: %d", lock_type));
-
- if (lock_type == F_RDLCK)
- accessIntent = QMY_READ_ONLY;
- else if (lock_type == F_WRLCK)
- accessIntent = QMY_UPDATABLE;
-
- initBridge(thd);
- int command = thd_sql_command(thd);
-
- if (!THDVAR(thd,transaction_unsafe))
- {
- if (lock_type != F_UNLCK)
- {
- if (autoCommitIsOn(thd) == QMY_YES)
- {
- trans_register_ha(thd, FALSE, ibmdb2i_hton);
- }
- else
- {
- trans_register_ha(thd, TRUE, ibmdb2i_hton);
- if (likely(command != SQLCOM_CREATE_TABLE))
- {
- trans_register_ha(thd, FALSE, ibmdb2i_hton);
- bridge()->beginStmtTx();
- }
- }
- }
- }
-
- if (command == SQLCOM_LOCK_TABLES ||
- command == SQLCOM_ALTER_TABLE ||
- command == SQLCOM_UNLOCK_TABLES ||
- (accessIntent == QMY_UPDATABLE &&
- (command == SQLCOM_UPDATE ||
- command == SQLCOM_UPDATE_MULTI ||
- command == SQLCOM_DELETE ||
- command == SQLCOM_DELETE_MULTI ||
- command == SQLCOM_REPLACE ||
- command == SQLCOM_REPLACE_SELECT) &&
- getCommitLevel(thd) == QMY_NONE))
- {
- char action;
- char type;
- if (lock_type == F_UNLCK)
- {
- action = QMY_UNLOCK;
- type = accessIntent == QMY_READ_ONLY ? QMY_LSRD : QMY_LENR;
- }
- else
- {
- action = QMY_LOCK;
- type = lock_type == F_RDLCK ? QMY_LSRD : QMY_LENR;
- }
-
- DBUG_PRINT("ha_ibmdb2i::external_lock",("%socking table", action==QMY_LOCK ? "L" : "Unl"));
-
- if (!dataHandle)
- rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection);
-
- rc = bridge()->lockObj(dataHandle,
- 0,
- action,
- type,
- (command == SQLCOM_LOCK_TABLES ? QMY_NO : QMY_YES));
-
- }
-
- // Cache this away so we don't have to access it on each row operation
- cachedZeroDateOption = (enum_ZeroDate)THDVAR(thd, compat_opt_allow_zero_date_vals);
-
- DBUG_RETURN(rc);
-}
-
-
-THR_LOCK_DATA **ha_ibmdb2i::store_lock(THD *thd,
- THR_LOCK_DATA **to,
- enum thr_lock_type lock_type)
-{
- if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
- {
- if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
- lock_type <= TL_WRITE) && !(thd->in_lock_tables && thd_sql_command(thd) == SQLCOM_LOCK_TABLES))
- lock_type= TL_WRITE_ALLOW_WRITE;
- lock.type=lock_type;
- }
- *to++= &lock;
- return to;
-}
-
-
-int ha_ibmdb2i::delete_table(const char *name)
-{
- DBUG_ENTER("ha_ibmdb2i::delete_table");
- THD* thd = ha_thd();
- db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread(thd);
-
- char db2Name[MAX_DB2_QUALIFIEDNAME_LENGTH];
- db2i_table::getDB2QualifiedNameFromPath(name, db2Name);
-
- String query(128);
- query.append(STRING_WITH_LEN(" DROP TABLE "));
- query.append(db2Name);
-
- if (thd_sql_command(thd) == SQLCOM_DROP_TABLE &&
- thd->lex->drop_mode == DROP_RESTRICT)
- query.append(STRING_WITH_LEN(" RESTRICT "));
- DBUG_PRINT("ha_ibmdb2i::delete_table", ("Sent to DB2: %s",query.c_ptr()));
-
- SqlStatementStream sqlStream(query);
-
- db2i_table::getDB2LibNameFromPath(name, db2Name);
- bool isTemporary = (strcmp(db2Name, DB2I_TEMP_TABLE_SCHEMA) == 0 ? TRUE : FALSE);
-
- int rc = bridge->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- (isTemporary ? QMY_NONE : getCommitLevel(thd)),
- FALSE,
- FALSE,
- isTemporary);
-
- if (rc == HA_ERR_NO_SUCH_TABLE)
- {
- warning(thd, DB2I_ERR_TABLE_NOT_FOUND, name);
- rc = 0;
- }
-
- if (rc == 0)
- {
- db2i_table::deleteAssocFiles(name);
- }
-
- FILE_HANDLE savedHandle = bridge->findAndRemovePreservedHandle(name, &share);
- while (savedHandle)
- {
- bridge->deallocateFile(savedHandle, TRUE);
- DBUG_ASSERT(share);
- if (free_share(share))
- share = NULL;
- savedHandle = bridge->findAndRemovePreservedHandle(name, &share);
- }
-
- my_errno = rc;
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::rename_table(const char * from, const char * to)
-{
- DBUG_ENTER("ha_ibmdb2i::rename_table ");
-
- char db2FromFileName[MAX_DB2_FILENAME_LENGTH + 1];
- char db2ToFileName[MAX_DB2_FILENAME_LENGTH+1];
- char db2FromLibName[MAX_DB2_SCHEMANAME_LENGTH+1];
- char db2ToLibName[MAX_DB2_SCHEMANAME_LENGTH+1];
-
- db2i_table::getDB2LibNameFromPath(from, db2FromLibName);
- db2i_table::getDB2LibNameFromPath(to, db2ToLibName);
-
- if (strcmp(db2FromLibName, db2ToLibName) != 0 )
- {
- getErrTxt(DB2I_ERR_RENAME_MOVE,from,to);
- DBUG_RETURN(DB2I_ERR_RENAME_MOVE);
- }
-
- db2i_table::getDB2FileNameFromPath(from, db2FromFileName, db2i_table::ASCII_NATIVE);
- db2i_table::getDB2FileNameFromPath(to, db2ToFileName);
-
- char escapedFromFileName[2 * MAX_DB2_FILENAME_LENGTH + 1];
-
- uint o = 0;
- uint i = 1;
- do
- {
- escapedFromFileName[o++] = db2FromFileName[i];
- if (db2FromFileName[i] == '+')
- escapedFromFileName[o++] = '+';
- } while (db2FromFileName[++i]);
- escapedFromFileName[o-1] = 0;
-
-
- int rc = 0;
-
- char queryBuffer[sizeof(db2FromLibName) + 2 * sizeof(db2FromFileName) + 256];
- SafeString selectQuery(queryBuffer, sizeof(queryBuffer));
- selectQuery.strncat(STRING_WITH_LEN("SELECT CAST(INDEX_NAME AS VARCHAR(128) CCSID 1208) FROM QSYS2.SYSINDEXES WHERE INDEX_NAME LIKE '%+_+_+_%"));
- selectQuery.strcat(escapedFromFileName);
- selectQuery.strncat(STRING_WITH_LEN("' ESCAPE '+' AND TABLE_NAME='"));
- selectQuery.strncat(db2FromFileName+1, strlen(db2FromFileName)-2);
- selectQuery.strncat(STRING_WITH_LEN("' AND TABLE_SCHEMA='"));
- selectQuery.strncat(db2FromLibName+1, strlen(db2FromLibName)-2);
- selectQuery.strcat('\'');
- DBUG_ASSERT(!selectQuery.overflowed());
-
- SqlStatementStream indexQuery(selectQuery.ptr());
-
- FILE_HANDLE queryFile = 0;
- uint32 resultRowLen;
-
- initBridge();
- rc = bridge()->prepOpen(indexQuery.getPtrToData(),
- &queryFile,
- &resultRowLen);
-
- if (unlikely(rc))
- DBUG_RETURN(rc);
-
- IOReadBuffer rowBuffer(1, resultRowLen);
-
- int tableNameLen = strlen(db2FromFileName) - 2;
-
- SqlStatementStream renameQuery(64);
- String query;
- while (rc == 0)
- {
- query.length(0);
-
- rc = bridge()->read(queryFile,
- rowBuffer.ptr(),
- QMY_READ_ONLY,
- QMY_NONE,
- QMY_NEXT);
-
- if (!rc)
- {
- const char* rowData = rowBuffer.getRowN(0);
- char indexFileName[MAX_DB2_FILENAME_LENGTH];
- memset(indexFileName, 0, sizeof(indexFileName));
-
- uint16 fileNameLen = *(uint16*)(rowData);
- strncpy(indexFileName, rowData + sizeof(uint16), fileNameLen);
-
- int bytesToRetain = fileNameLen - tableNameLen;
- if (bytesToRetain <= 0)
- /* We can't handle index names in which the MySQL index name and
- the table name together are longer than the max index name. */
- {
- getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*");
- DBUG_RETURN(DB2I_ERR_INVALID_NAME);
- }
- char indexName[MAX_DB2_FILENAME_LENGTH];
- memset(indexName, 0, sizeof(indexName));
-
- strncpy(indexName,
- indexFileName,
- bytesToRetain);
-
- char db2IndexName[MAX_DB2_FILENAME_LENGTH+1];
-
- convertMySQLNameToDB2Name(indexFileName, db2IndexName, sizeof(db2IndexName));
-
- query.append(STRING_WITH_LEN("RENAME INDEX "));
- query.append(db2FromLibName);
- query.append('.');
- query.append(db2IndexName);
- query.append(STRING_WITH_LEN(" TO "));
- if (db2i_table::appendQualifiedIndexFileName(indexName, db2ToFileName, query, db2i_table::ASCII_SQL, typeNone) == -1)
- {
- getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*");
- DBUG_RETURN(DB2I_ERR_INVALID_NAME );
- }
- renameQuery.addStatement(query);
- DBUG_PRINT("ha_ibmdb2i::rename_table", ("Sent to DB2: %s",query.c_ptr_safe()));
- }
- }
-
-
- if (queryFile)
- bridge()->deallocateFile(queryFile);
-
- if (rc != HA_ERR_END_OF_FILE)
- DBUG_RETURN(rc);
-
- char db2Name[MAX_DB2_QUALIFIEDNAME_LENGTH];
-
- /* Rename the table */
- query.length(0);
- query.append(STRING_WITH_LEN(" RENAME TABLE "));
- db2i_table::getDB2QualifiedNameFromPath(from, db2Name);
- query.append(db2Name);
- query.append(STRING_WITH_LEN(" TO "));
- query.append(db2ToFileName);
- DBUG_PRINT("ha_ibmdb2i::rename_table", ("Sent to DB2: %s",query.c_ptr_safe()));
- renameQuery.addStatement(query);
- rc = bridge()->execSQL(renameQuery.getPtrToData(),
- renameQuery.getStatementCount(),
- getCommitLevel());
-
- if (!rc)
- db2i_table::renameAssocFiles(from, to);
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::create(const char *name, TABLE *table_arg,
- HA_CREATE_INFO *create_info)
-{
- DBUG_ENTER("ha_ibmdb2i::create");
-
- int rc;
- char fileSortSequence[11] = "*HEX";
- char fileSortSequenceLibrary[11] = "";
- char fileSortSequenceType = ' ';
- char libName[MAX_DB2_SCHEMANAME_LENGTH+1];
- char fileName[MAX_DB2_FILENAME_LENGTH+1];
- char colName[MAX_DB2_COLNAME_LENGTH+1];
- bool isTemporary;
- ulong auto_inc_value;
-
- db2i_table::getDB2LibNameFromPath(name, libName);
- db2i_table::getDB2FileNameFromPath(name, fileName);
-
- if (osVersion.v < 6)
- {
- if (strlen(libName) >
- MAX_DB2_V5R4_LIBNAME_LENGTH + (isOrdinaryIdentifier(libName) ? 2 : 0))
- {
- getErrTxt(DB2I_ERR_TOO_LONG_SCHEMA,libName, MAX_DB2_V5R4_LIBNAME_LENGTH);
- DBUG_RETURN(DB2I_ERR_TOO_LONG_SCHEMA);
- }
- }
- else if (strlen(libName) > MAX_DB2_V6R1_LIBNAME_LENGTH)
- {
- getErrTxt(DB2I_ERR_TOO_LONG_SCHEMA,libName, MAX_DB2_V6R1_LIBNAME_LENGTH);
- DBUG_RETURN(DB2I_ERR_TOO_LONG_SCHEMA);
- }
-
- String query(256);
-
- if (strcmp(libName, DB2I_TEMP_TABLE_SCHEMA))
- {
- query.append(STRING_WITH_LEN("CREATE TABLE "));
- query.append(libName);
- query.append('.');
- query.append(fileName);
- isTemporary = FALSE;
- }
- else
- {
- query.append(STRING_WITH_LEN("DECLARE GLOBAL TEMPORARY TABLE "));
- query.append(fileName);
- isTemporary = TRUE;
- }
- query.append(STRING_WITH_LEN(" ("));
-
- THD* thd = ha_thd();
- enum_TimeFormat timeFormat = (enum_TimeFormat)(THDVAR(thd, compat_opt_time_as_duration));
- enum_YearFormat yearFormat = (enum_YearFormat)(THDVAR(thd, compat_opt_year_as_int));
- enum_BlobMapping blobMapping = (enum_BlobMapping)(THDVAR(thd, compat_opt_blob_cols));
- enum_ZeroDate zeroDate = (enum_ZeroDate)(THDVAR(thd, compat_opt_allow_zero_date_vals));
- bool propagateDefaults = THDVAR(thd, propagate_default_col_vals);
-
- Field **field;
- for (field= table_arg->field; *field; field++)
- {
- if ( field != table_arg->field ) // Not the first one
- query.append(STRING_WITH_LEN(" , "));
-
- if (!convertMySQLNameToDB2Name((*field)->field_name, colName, sizeof(colName)))
- {
- getErrTxt(DB2I_ERR_INVALID_NAME,"field",(*field)->field_name);
- DBUG_RETURN(DB2I_ERR_INVALID_NAME );
- }
-
- query.append(colName);
- query.append(' ');
-
- if (rc = getFieldTypeMapping(*field,
- query,
- timeFormat,
- blobMapping,
- zeroDate,
- propagateDefaults,
- yearFormat))
- DBUG_RETURN(rc);
-
- if ( (*field)->flags & NOT_NULL_FLAG )
- {
- query.append(STRING_WITH_LEN(" NOT NULL "));
- }
- if ( (*field)->flags & AUTO_INCREMENT_FLAG )
- {
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (table_arg->part_info)
- {
- getErrTxt(DB2I_ERR_PART_AUTOINC);
- DBUG_RETURN(DB2I_ERR_PART_AUTOINC);
- }
-#endif
- query.append(STRING_WITH_LEN(" GENERATED BY DEFAULT AS IDENTITY ") );
- if (create_info->auto_increment_value != 0)
- {
- /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
- CREATE TABLE ...AUTO_INCREMENT = x; Set the starting
- value for the auto_increment column. */
- char stringValue[22];
- CHARSET_INFO *cs= &my_charset_bin;
- uint len = (uint)(cs->cset->longlong10_to_str)(cs,stringValue,sizeof(stringValue), 10, create_info->auto_increment_value);
- stringValue[len] = 0;
- query.append(STRING_WITH_LEN(" (START WITH "));
- query.append(stringValue);
-
- uint64 maxValue=maxValueForField(*field);
-
- if (maxValue)
- {
- len = (uint)(cs->cset->longlong10_to_str)(cs,stringValue,sizeof(stringValue), 10, maxValue);
- stringValue[len] = 0;
- query.append(STRING_WITH_LEN(" MAXVALUE "));
- query.append(stringValue);
- }
-
- query.append(STRING_WITH_LEN(") "));
- }
-
- }
- }
-
- String fieldDefinition(128);
-
- if (table_arg->s->primary_key != MAX_KEY && !isTemporary)
- {
- query.append(STRING_WITH_LEN(", PRIMARY KEY "));
- rc = buildIndexFieldList(fieldDefinition,
- table_arg->key_info[table_arg->s->primary_key],
- true,
- &fileSortSequenceType,
- fileSortSequence,
- fileSortSequenceLibrary);
- if (rc) DBUG_RETURN(rc);
- query.append(fieldDefinition);
- }
-
- rc = buildDB2ConstraintString(thd->lex,
- query,
- name,
- table_arg->field,
- &fileSortSequenceType,
- fileSortSequence,
- fileSortSequenceLibrary);
- if (rc) DBUG_RETURN (rc);
-
- query.append(STRING_WITH_LEN(" ) "));
-
- if (isTemporary)
- query.append(STRING_WITH_LEN(" ON COMMIT PRESERVE ROWS "));
-
- if (create_info->alias)
- generateAndAppendRCDFMT(create_info->alias, query);
- else if (((TABLE_LIST*)(thd->lex->select_lex.table_list.first))->table_name)
- generateAndAppendRCDFMT((char*)((TABLE_LIST*)(thd->lex->select_lex.table_list.first))->table_name, query);
-
- DBUG_PRINT("ha_ibmdb2i::create", ("Sent to DB2: %s",query.c_ptr()));
- SqlStatementStream sqlStream(query.length());
- sqlStream.addStatement(query,fileSortSequence,fileSortSequenceLibrary);
-
- if (table_arg->s->primary_key != MAX_KEY &&
- !isTemporary &&
- (THDVAR(thd, create_index_option)==1) &&
- (fileSortSequenceType != 'B') &&
- (fileSortSequenceType != ' '))
- {
- rc = generateShadowIndex(sqlStream,
- table_arg->key_info[table_arg->s->primary_key],
- libName,
- fileName,
- fieldDefinition);
- if (rc) DBUG_RETURN(rc);
- }
- for (uint i = 0; i < table_arg->s->keys; ++i)
- {
- if (i != table_arg->s->primary_key || isTemporary)
- {
- rc = buildCreateIndexStatement(sqlStream,
- table_arg->key_info[i],
- false,
- libName,
- fileName);
- if (rc) DBUG_RETURN (rc);
- }
- }
-
- bool noCommit = isTemporary || ((!autoCommitIsOn(thd)) && (thd_sql_command(thd) == SQLCOM_ALTER_TABLE));
-
- initBridge();
-
-// if (THDVAR(thd, discovery_mode) == 1)
-// bridge()->expectErrors(QMY_ERR_TABLE_EXISTS);
-
- rc = bridge()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- (isTemporary ? QMY_NONE : getCommitLevel(thd)),
- TRUE,
- FALSE,
- noCommit );
-
- if (unlikely(rc == QMY_ERR_MSGID) &&
- memcmp(bridge()->getErrorMsgID(), DB2I_SQL0350, 7) == 0)
- {
- my_error(ER_BLOB_USED_AS_KEY, MYF(0), "*unknown*");
- rc = ER_BLOB_USED_AS_KEY;
- }
-/* else if (unlikely(rc == QMY_ERR_TABLE_EXISTS) &&
- THDVAR(thd, discovery_mode) == 1)
- {
- db2i_table* temp = new db2i_table(table_arg->s, name);
- int32 rc = temp->fastInitForCreate(name);
- delete temp;
-
- if (!rc)
- warning(thd, DB2I_ERR_WARN_CREATE_DISCOVER);
-
- DBUG_RETURN(rc);
- }
-*/
-
- if (!rc && !isTemporary)
- {
- db2i_table* temp = new db2i_table(table_arg->s, name);
- rc = temp->fastInitForCreate(name);
- delete temp;
- if (rc)
- delete_table(name);
- }
-
- DBUG_RETURN(rc);
-}
-
-
-/**
- @brief
- Add an index on-line to a table. This method is called on behalf of
- a CREATE INDEX or ALTER TABLE statement.
- It is implemented via a composed DDL statement passed to DB2.
-*/
-int ha_ibmdb2i::add_index(TABLE *table_arg,
- KEY *key_info,
- uint num_of_keys)
-{
- DBUG_ENTER("ha_ibmdb2i::add_index");
-
- int rc;
- SqlStatementStream sqlStream(256);
- const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL);
- const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL);
-
- quiesceAllFileHandles();
-
- uint primaryKey = MAX_KEY;
- if (table_arg->s->primary_key >= MAX_KEY && !db2Table->isTemporary())
- {
- for (int i = 0; i < num_of_keys; ++i)
- {
- if (strcmp(key_info[i].name, "PRIMARY") == 0)
- {
- primaryKey = i;
- break;
- }
- else if (primaryKey == MAX_KEY &&
- key_info[i].flags & HA_NOSAME)
- {
- primaryKey = i;
- for (int j=0 ; j < key_info[i].key_parts ;j++)
- {
- uint fieldnr= key_info[i].key_part[j].fieldnr;
- if (table_arg->s->field[fieldnr]->null_ptr ||
- table_arg->s->field[fieldnr]->key_length() !=
- key_info[i].key_part[j].length)
- {
- primaryKey = MAX_KEY;
- break;
- }
- }
- }
- }
- }
-
-
- for (int i = 0; i < num_of_keys; ++i)
- {
- KEY& curKey= key_info[i];
- rc = buildCreateIndexStatement(sqlStream,
- curKey,
- (i == primaryKey),
- libName,
- fileName);
- if (rc) DBUG_RETURN (rc);
- }
-
- rc = bridge()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- getCommitLevel(),
- FALSE,
- FALSE,
- FALSE,
- dataHandle);
-
- /* Handle the case where a unique index is being created but an error occurs
- because the file contains duplicate key values. */
- if (rc == ER_DUP_ENTRY)
- print_keydup_error(MAX_KEY,ER(ER_DUP_ENTRY_WITH_KEY_NAME));
-
- DBUG_RETURN(rc);
-}
-
-/**
- @brief
- Drop an index on-line from a table. This method is called on behalf of
- a DROP INDEX or ALTER TABLE statement.
- It is implemented via a composed DDL statement passed to DB2.
-*/
-int ha_ibmdb2i::prepare_drop_index(TABLE *table_arg,
- uint *key_num, uint num_of_keys)
-{
- DBUG_ENTER("ha_ibmdb2i::prepare_drop_index");
- int rc;
- int i = 0;
- String query(64);
- SqlStatementStream sqlStream(64 * num_of_keys);
- SqlStatementStream shadowStream(64 * num_of_keys);
-
- quiesceAllFileHandles();
-
- const char* libName = db2Table->getDB2LibName(db2i_table::ASCII_SQL);
- const char* fileName = db2Table->getDB2TableName(db2i_table::ASCII_SQL);
-
- while (i < num_of_keys)
- {
- query.length(0);
- DBUG_PRINT("info", ("ha_ibmdb2i::prepare_drop_index %u", key_num[i]));
- KEY& curKey= table_arg->key_info[key_num[i]];
- if (key_num[i] == table->s->primary_key && !db2Table->isTemporary())
- {
- query.append(STRING_WITH_LEN("ALTER TABLE "));
- query.append(libName);
- query.append(STRING_WITH_LEN("."));
- query.append(fileName);
- query.append(STRING_WITH_LEN(" DROP PRIMARY KEY"));
- }
- else
- {
- query.append(STRING_WITH_LEN("DROP INDEX "));
- query.append(libName);
- query.append(STRING_WITH_LEN("."));
- db2i_table::appendQualifiedIndexFileName(curKey.name, fileName, query);
- }
- DBUG_PRINT("ha_ibmdb2i::prepare_drop_index", ("Sent to DB2: %s",query.c_ptr_safe()));
- sqlStream.addStatement(query);
-
- query.length(0);
- query.append(STRING_WITH_LEN("DROP INDEX "));
- query.append(libName);
- query.append(STRING_WITH_LEN("."));
- db2i_table::appendQualifiedIndexFileName(curKey.name, fileName, query, db2i_table::ASCII_SQL, typeHex);
-
- DBUG_PRINT("ha_ibmdb2i::prepare_drop_index", ("Sent to DB2: %s",query.c_ptr_safe()));
- shadowStream.addStatement(query);
-
- ++i;
- }
-
- rc = bridge()->execSQL(sqlStream.getPtrToData(),
- sqlStream.getStatementCount(),
- getCommitLevel(),
- FALSE,
- FALSE,
- FALSE,
- dataHandle);
-
- if (rc == 0)
- bridge()->execSQL(shadowStream.getPtrToData(),
- shadowStream.getStatementCount(),
- getCommitLevel());
-
- DBUG_RETURN(rc);
-}
-
-
-void
-ha_ibmdb2i::unlock_row()
-{
- DBUG_ENTER("ha_ibmdb2i::unlock_row");
- DBUG_VOID_RETURN;
-}
-
-int
-ha_ibmdb2i::index_end()
-{
- DBUG_ENTER("ha_ibmdb2i::index_end");
- warnIfInvalidData();
- last_index_init_rc = 0;
- if (likely(activeReadBuf))
- activeReadBuf->endRead();
- if (likely(!last_index_init_rc))
- releaseIndexFile(active_index);
- active_index= MAX_KEY;
- DBUG_RETURN (0);
-}
-
-int ha_ibmdb2i::doCommit(handlerton *hton, THD *thd, bool all)
-{
- if (!THDVAR(thd, transaction_unsafe))
- {
- if (all || autoCommitIsOn(thd))
- {
- DBUG_PRINT("ha_ibmdb2i::doCommit",("Committing all"));
- return (db2i_ileBridge::getBridgeForThread(thd)->commitmentControl(QMY_COMMIT));
- }
- else
- {
- DBUG_PRINT("ha_ibmdb2i::doCommit",("Committing stmt"));
- return (db2i_ileBridge::getBridgeForThread(thd)->commitStmtTx());
- }
- }
-
- return (0);
-}
-
-
-int ha_ibmdb2i::doRollback(handlerton *hton, THD *thd, bool all)
-{
- if (!THDVAR(thd,transaction_unsafe))
- {
- if (all || autoCommitIsOn(thd))
- {
- DBUG_PRINT("ha_ibmdb2i::doRollback",("Rolling back all"));
- return ( db2i_ileBridge::getBridgeForThread(thd)->commitmentControl(QMY_ROLLBACK));
- }
- else
- {
- DBUG_PRINT("ha_ibmdb2i::doRollback",("Rolling back stmt"));
- return (db2i_ileBridge::getBridgeForThread(thd)->rollbackStmtTx());
- }
- }
- return (0);
-}
-
-
-void ha_ibmdb2i::start_bulk_insert(ha_rows rows)
-{
- DBUG_ENTER("ha_ibmdb2i::start_bulk_insert");
- DBUG_PRINT("ha_ibmdb2i::start_bulk_insert",("Rows hinted %d", rows));
- int rc;
- THD* thd = ha_thd();
- int command = thd_sql_command(thd);
-
- if (db2Table->hasBlobs() ||
- (command == SQLCOM_REPLACE || command == SQLCOM_REPLACE_SELECT))
- rows = 1;
- else if (rows == 0)
- rows = DEFAULT_MAX_ROWS_TO_BUFFER; // Shoot the moon
-
- // If we're doing a multi-row insert, binlogging is active, and the table has an
- // auto_increment column, then we'll attempt to lock the file while we perform a 'fast path' blocked
- // insert. If we can't get the lock, then we'll do a row-by-row 'slow path' insert instead. The reason is
- // because the MI generates the auto_increment (identity value), and if we can't lock the file,
- // then we can't predetermine what that value will be for insertion into the MySQL write buffer.
-
- if ((rows > 1) && // Multi-row insert
- (thd->options & OPTION_BIN_LOG) && // Binlogging is on
- (table->found_next_number_field)) // Table has an auto_increment column
- {
- if (!dataHandle)
- rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection);
-
- rc = bridge()->lockObj(dataHandle, 1, QMY_LOCK, QMY_LEAR, QMY_YES);
- if (rc==0) // Got the lock
- {
- autoIncLockAcquired = TRUE;
- got_auto_inc_values = FALSE;
- }
- else // Didn't get the lock
- rows = 1; // No problem, but don't block inserts
- }
-
- if (activeHandle == 0)
- {
- last_start_bulk_insert_rc = useDataFile();
- if (last_start_bulk_insert_rc == 0)
- last_start_bulk_insert_rc = prepWriteBuffer(rows, db2Table->dataFile());
- }
-
- if (last_start_bulk_insert_rc == 0)
- outstanding_start_bulk_insert = true;
- else
- {
- if (autoIncLockAcquired == TRUE)
- {
- bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LEAR, QMY_YES);
- autoIncLockAcquired = FALSE;
- }
- }
-
- DBUG_VOID_RETURN;
-}
-
-
-int ha_ibmdb2i::end_bulk_insert()
-{
- DBUG_ENTER("ha_ibmdb2i::end_bulk_insert");
- int rc = 0;
-
- if (outstanding_start_bulk_insert)
- {
- rc = finishBulkInsert();
- }
-
- my_errno = rc;
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::prepReadBuffer(ha_rows rowsToRead, const db2i_file* file, char intent)
-{
- DBUG_ENTER("ha_ibmdb2i::prepReadBuffer");
- DBUG_ASSERT(rowsToRead > 0);
-
- THD* thd = ha_thd();
- char cmtLvl = getCommitLevel(thd);
-
- const db2i_file::RowFormat* format;
- int rc = file->obtainRowFormat(activeHandle, intent, cmtLvl, &format);
-
- if (unlikely(rc)) DBUG_RETURN(rc);
-
- if (lobFieldsRequested())
- {
- forceSingleRowRead = true;
- rowsToRead = 1;
- }
-
- rowsToRead = min(stats.records+1,min(rowsToRead, DEFAULT_MAX_ROWS_TO_BUFFER));
-
- uint bufSize = min((format->readRowLen * rowsToRead), THDVAR(thd, max_read_buffer_size));
- multiRowReadBuf.allocBuf(format->readRowLen, format->readRowNullOffset, bufSize);
- activeReadBuf = &multiRowReadBuf;
-
- if (db2Table->hasBlobs())
- {
- if (!blobReadBuffers)
- blobReadBuffers = new BlobCollection(db2Table, THDVAR(thd, lob_alloc_size));
- rc = prepareReadBufferForLobs();
- if (rc) DBUG_RETURN(rc);
- }
-
-// if (accessIntent == QMY_UPDATABLE &&
-// thd_tx_isolation(thd) == ISO_REPEATABLE_READ &&
-// !THDVAR(thd, transaction_unsafe))
-// activeReadBuf->update(QMY_READ_ONLY, &releaseRowNeeded, QMY_REPEATABLE_READ);
-// else
- activeReadBuf->update(intent, &releaseRowNeeded, cmtLvl);
-
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::prepWriteBuffer(ha_rows rowsToWrite, const db2i_file* file)
-{
- DBUG_ENTER("ha_ibmdb2i::prepWriteBuffer");
- DBUG_ASSERT(accessIntent == QMY_UPDATABLE && rowsToWrite > 0);
-
- const db2i_file::RowFormat* format;
- int rc = file->obtainRowFormat(activeHandle,
- QMY_UPDATABLE,
- getCommitLevel(ha_thd()),
- &format);
-
- if (unlikely(rc)) DBUG_RETURN(rc);
-
- rowsToWrite = min(rowsToWrite, DEFAULT_MAX_ROWS_TO_BUFFER);
-
- uint bufSize = min((format->writeRowLen * rowsToWrite), THDVAR(ha_thd(), max_write_buffer_size));
- multiRowWriteBuf.allocBuf(format->writeRowLen, format->writeRowNullOffset, bufSize);
- activeWriteBuf = &multiRowWriteBuf;
-
- if (!blobWriteBuffers && db2Table->hasBlobs())
- {
- blobWriteBuffers = new ValidatedPointer<char>[db2Table->getBlobCount()];
- }
- DBUG_RETURN(rc);
-}
-
-
-int ha_ibmdb2i::flushWrite(FILE_HANDLE fileHandle, uchar* buf )
-{
- DBUG_ENTER("ha_ibmdb2i::flushWrite");
- int rc;
- int64 generatedIdValue = 0;
- bool IdValueWasGenerated = FALSE;
- char* lastDupKeyNamePtr = NULL;
- uint32 lastDupKeyNameLen = 0;
- int loopCnt = 0;
- bool retry_dup = FALSE;
-
- while (loopCnt == 0 || retry_dup == TRUE)
- {
- rc = bridge()->writeRows(fileHandle,
- activeWriteBuf->ptr(),
- getCommitLevel(),
- &generatedIdValue,
- &IdValueWasGenerated,
- &lastDupKeyRRN,
- &lastDupKeyNamePtr,
- &lastDupKeyNameLen,
- &incrementByValue);
- loopCnt++;
- retry_dup = FALSE;
- invalidateCachedStats();
- if (lastDupKeyNameLen)
- {
- rrnAssocHandle = fileHandle;
-
- int command = thd_sql_command(ha_thd());
-
- if (command == SQLCOM_REPLACE ||
- command == SQLCOM_REPLACE_SELECT)
- lastDupKeyID = 0;
- else
- {
- lastDupKeyID = getKeyFromName(lastDupKeyNamePtr, lastDupKeyNameLen);
-
- if (likely(lastDupKeyID != MAX_KEY))
- {
- uint16 failedRow = activeWriteBuf->rowsWritten()+1;
-
- if (buf && (failedRow != activeWriteBuf->rowCount()))
- {
- const char* badRow = activeWriteBuf->getRowN(failedRow-1);
- bool savedReadAllColumns = readAllColumns;
- readAllColumns = true;
- mungeDB2row(buf,
- badRow,
- badRow + activeWriteBuf->getRowNullOffset(),
- true);
- readAllColumns = savedReadAllColumns;
-
- if (table->found_next_number_field)
- {
- table->next_number_field->store(next_identity_value - (incrementByValue * (activeWriteBuf->rowCount() - (failedRow - 1))));
- }
- }
-
- if (default_identity_value && // Table has ID colm and generating a value
- (!autoIncLockAcquired || !got_auto_inc_values) &&
- // Writing first or only row in block
- loopCnt == 1 && // Didn't already retry
- lastDupKeyID == table->s->next_number_index) // Autoinc column is in failed index
- {
- if (alterStartWith() == 0) // Reset next Identity value to max+1
- retry_dup = TRUE; // Rtry the write operation
- }
- }
- else
- {
- char unknownIndex[MAX_DB2_FILENAME_LENGTH+1];
- convFromEbcdic(lastDupKeyNamePtr, unknownIndex, min(lastDupKeyNameLen, MAX_DB2_FILENAME_LENGTH));
- unknownIndex[min(lastDupKeyNameLen, MAX_DB2_FILENAME_LENGTH)] = 0;
- getErrTxt(DB2I_ERR_UNKNOWN_IDX, unknownIndex);
- }
- }
- }
- }
-
- if ((rc == 0 || rc == HA_ERR_FOUND_DUPP_KEY)
- && default_identity_value && IdValueWasGenerated &&
- (!autoIncLockAcquired || !got_auto_inc_values))
- {
- /* Save the generated identity value for the MySQL last_insert_id() function. */
- insert_id_for_cur_row = generatedIdValue;
-
- /* Store the value into MySQL's buf for row-based replication
- or for an 'on duplicate key update' clause. */
- table->next_number_field->store((longlong) generatedIdValue, TRUE);
- if (autoIncLockAcquired)
- {
- got_auto_inc_values = TRUE;
- next_identity_value = generatedIdValue + incrementByValue;
- }
- }
- else
- {
- if (!autoIncLockAcquired) // Don't overlay value for first row of a block
- insert_id_for_cur_row = 0;
- }
-
-
- activeWriteBuf->resetAfterWrite();
- DBUG_RETURN(rc);
-}
-
-int ha_ibmdb2i::alterStartWith()
-{
- DBUG_ENTER("ha_ibmdb2i::alterStartWith");
- int rc = 0;
- ulonglong nextIdVal;
- if (!dataHandle)
- rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection);
- if (!rc) {rc = bridge()->lockObj(dataHandle, 1, QMY_LOCK, QMY_LENR, QMY_YES);}
- if (!rc)
- {
- rc = getNextIdVal(&nextIdVal);
- if (!rc) {rc = reset_auto_increment(nextIdVal);}
- bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LENR, QMY_YES);
- }
- DBUG_RETURN(rc);
-}
-
-bool ha_ibmdb2i::lobFieldsRequested()
-{
- if (!db2Table->hasBlobs())
- {
- DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("No LOBs"));
- return (false);
- }
-
- if (readAllColumns)
- {
- DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("All cols requested"));
- return (true);
- }
-
- for (int i = 0; i < db2Table->getBlobCount(); ++i)
- {
- if (bitmap_is_set(table->read_set, db2Table->blobFields[i]))
- {
- DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("LOB requested"));
- return (true);
- }
- }
-
- DBUG_PRINT("ha_ibmdb2i::lobFieldsRequested",("No LOBs requested"));
- return (false);
-}
-
-
-int ha_ibmdb2i::prepareReadBufferForLobs()
-{
- DBUG_ENTER("ha_ibmdb2i::prepareReadBufferForLobs");
- DBUG_ASSERT(db2Table->hasBlobs());
-
- uint32 activeLobFields = 0;
- DB2LobField* lobField;
- uint16 blobCount = db2Table->getBlobCount();
-
- char* readBuf = activeReadBuf->getRowN(0);
-
- for (int i = 0; i < blobCount; ++i)
- {
- int fieldID = db2Table->blobFields[i];
- DB2Field& db2Field = db2Table->db2Field(fieldID);
- lobField = db2Field.asBlobField(readBuf);
- if (readAllColumns ||
- bitmap_is_set(table->read_set, fieldID))
- {
- lobField->dataHandle = (ILEMemHandle)blobReadBuffers->getBufferPtr(fieldID);
- activeLobFields++;
- }
- else
- {
- lobField->dataHandle = NULL;
- }
- }
-
- if (activeLobFields == 0)
- {
- for (int i = 0; i < blobCount; ++i)
- {
- DB2Field& db2Field = db2Table->db2Field(db2Table->blobFields[i]);
- uint16 offset = db2Field.getBufferOffset() + db2Field.calcBlobPad();
-
- for (int r = 1; r < activeReadBuf->getRowCapacity(); ++r)
- {
- lobField = (DB2LobField*)(activeReadBuf->getRowN(r) + offset);
- lobField->dataHandle = NULL;
- }
- }
- }
-
- activeReadBuf->setRowsToProcess((activeLobFields ? 1 : activeReadBuf->getRowCapacity()));
- int rc = bridge()->objectOverride(activeHandle,
- activeReadBuf->ptr(),
- activeReadBuf->getRowLength());
- DBUG_RETURN(rc);
-}
-
-
-uint32 ha_ibmdb2i::adjustLobBuffersForRead()
-{
- DBUG_ENTER("ha_ibmdb2i::adjustLobBuffersForRead");
-
- char* readBuf = activeReadBuf->getRowN(0);
-
- for (int i = 0; i < db2Table->getBlobCount(); ++i)
- {
- DB2Field& db2Field = db2Table->db2Field(db2Table->blobFields[i]);
- DB2LobField* lobField = db2Field.asBlobField(readBuf);
- if (readAllColumns ||
- bitmap_is_set(table->read_set, db2Table->blobFields[i]))
- {
- lobField->dataHandle = (ILEMemHandle)blobReadBuffers->reallocBuffer(db2Table->blobFields[i], lobField->length);
-
- if (lobField->dataHandle == NULL)
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- else
- {
- lobField->dataHandle = 0;
- }
- }
-
- int32 rc = bridge()->objectOverride(activeHandle,
- activeReadBuf->ptr());
- DBUG_RETURN(rc);
-}
-
-
-
-int ha_ibmdb2i::reset()
-{
- DBUG_ENTER("ha_ibmdb2i::reset");
-
- if (outstanding_start_bulk_insert)
- {
- finishBulkInsert();
- }
-
- if (activeHandle != 0)
- {
- releaseActiveHandle();
- }
-
- cleanupBuffers();
-
- db2i_ileBridge::getBridgeForThread(ha_thd())->freeErrorStorage();
-
- last_rnd_init_rc = last_index_init_rc = last_start_bulk_insert_rc = 0;
-
- returnDupKeysImmediately = false;
- onDupUpdate = false;
- forceSingleRowRead = false;
-
-#ifndef DBUG_OFF
- cachedBridge=NULL;
-#endif
-
- DBUG_RETURN(0);
-}
-
-
-int32 ha_ibmdb2i::buildCreateIndexStatement(SqlStatementStream& sqlStream,
- KEY& key,
- bool isPrimary,
- const char* db2LibName,
- const char* db2FileName)
-{
- DBUG_ENTER("ha_ibmdb2i::buildCreateIndexStatement");
-
- char fileSortSequence[11] = "*HEX";
- char fileSortSequenceLibrary[11] = "";
- char fileSortSequenceType = ' ';
- String query(256);
- query.length(0);
- int rc = 0;
-
- if (isPrimary)
- {
- query.append(STRING_WITH_LEN("ALTER TABLE "));
- query.append(db2LibName);
- query.append('.');
- query.append(db2FileName);
- query.append(STRING_WITH_LEN(" ADD PRIMARY KEY "));
- }
- else
- {
- query.append(STRING_WITH_LEN("CREATE"));
-
- if (key.flags & HA_NOSAME)
- query.append(STRING_WITH_LEN(" UNIQUE WHERE NOT NULL"));
-
- query.append(STRING_WITH_LEN(" INDEX "));
-
- query.append(db2LibName);
- query.append('.');
- if (db2i_table::appendQualifiedIndexFileName(key.name, db2FileName, query))
- {
- getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*");
- DBUG_RETURN(DB2I_ERR_INVALID_NAME );
- }
-
- query.append(STRING_WITH_LEN(" ON "));
-
- query.append(db2LibName);
- query.append('.');
- query.append(db2FileName);
- }
-
- String fieldDefinition(128);
- rc = buildIndexFieldList(fieldDefinition,
- key,
- isPrimary,
- &fileSortSequenceType,
- fileSortSequence,
- fileSortSequenceLibrary);
-
- if (rc) DBUG_RETURN(rc);
-
- query.append(fieldDefinition);
-
- if ((THDVAR(ha_thd(), create_index_option)==1) &&
- (fileSortSequenceType != 'B') &&
- (fileSortSequenceType != ' '))
- {
- rc = generateShadowIndex(sqlStream,
- key,
- db2LibName,
- db2FileName,
- fieldDefinition);
- if (rc) DBUG_RETURN(rc);
- }
-
- DBUG_PRINT("ha_ibmdb2i::buildCreateIndexStatement", ("Sent to DB2: %s",query.c_ptr_safe()));
- sqlStream.addStatement(query,fileSortSequence,fileSortSequenceLibrary);
-
- DBUG_RETURN(0);
-}
-
-/**
- Generate the SQL syntax for the list of fields to be assigned to the
- specified key. The corresponding sort sequence is also calculated.
-
- @param[out] appendHere The string to receive the generated SQL
- @param key The key to evaluate
- @param isPrimary True if this is being generated on behalf of the primary key
- @param[out] fileSortSequenceType The type of the associated sort sequence
- @param[out] fileSortSequence The name of the associated sort sequence
- @param[out] fileSortSequenceLibrary The library of the associated sort sequence
-
- @return 0 if successful; error value otherwise
-*/
-int32 ha_ibmdb2i::buildIndexFieldList(String& appendHere,
- const KEY& key,
- bool isPrimary,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary)
-{
- DBUG_ENTER("ha_ibmdb2i::buildIndexFieldList");
- appendHere.append(STRING_WITH_LEN(" ( "));
- for (int j = 0; j < key.key_parts; ++j)
- {
- char colName[MAX_DB2_COLNAME_LENGTH+1];
- if (j != 0)
- {
- appendHere.append(STRING_WITH_LEN(" , "));
- }
-
- KEY_PART_INFO& kpi = key.key_part[j];
- Field* field = kpi.field;
-
- convertMySQLNameToDB2Name(field->field_name,
- colName,
- sizeof(colName));
- appendHere.append(colName);
-
- int32 rc;
- rc = updateAssociatedSortSequence(field->charset(),
- fileSortSequenceType,
- fileSortSequence,
- fileSortSequenceLibrary);
- if (rc) DBUG_RETURN (rc);
- }
-
- appendHere.append(STRING_WITH_LEN(" ) "));
-
- DBUG_RETURN(0);
-}
-
-
-/**
- Generate an SQL statement that defines a *HEX sorted index to implement
- the ibmdb2i_create_index.
-
- @param[out] stream The stream to append the generated statement to
- @param key The key to evaluate
- @param[out] libName The library containg the table
- @param[out] fileName The DB2-compatible name of the table
- @param[out] fieldDefinition The list of the fields in the index, in SQL syntax
-
- @return 0 if successful; error value otherwise
-*/
-int32 ha_ibmdb2i::generateShadowIndex(SqlStatementStream& stream,
- const KEY& key,
- const char* libName,
- const char* fileName,
- const String& fieldDefinition)
-{
- String shadowQuery(256);
- shadowQuery.length(0);
- shadowQuery.append(STRING_WITH_LEN("CREATE INDEX "));
- shadowQuery.append(libName);
- shadowQuery.append('.');
- if (db2i_table::appendQualifiedIndexFileName(key.name, fileName, shadowQuery, db2i_table::ASCII_SQL, typeHex))
- {
- getErrTxt(DB2I_ERR_INVALID_NAME,"index","*generated*");
- return DB2I_ERR_INVALID_NAME;
- }
- shadowQuery.append(STRING_WITH_LEN(" ON "));
- shadowQuery.append(libName);
- shadowQuery.append('.');
- shadowQuery.append(fileName);
- shadowQuery.append(fieldDefinition);
- DBUG_PRINT("ha_ibmdb2i::generateShadowIndex", ("Sent to DB2: %s",shadowQuery.c_ptr_safe()));
- stream.addStatement(shadowQuery,"*HEX","QSYS");
- return 0;
-}
-
-
-void ha_ibmdb2i::doInitialRead(char orientation,
- uint32 rowsToBuffer,
- ILEMemHandle key,
- int keyLength,
- int keyParts)
-{
- DBUG_ENTER("ha_ibmdb2i::doInitialRead");
-
- if (forceSingleRowRead)
- rowsToBuffer = 1;
- else
- rowsToBuffer = min(rowsToBuffer, activeReadBuf->getRowCapacity());
-
- activeReadBuf->newReadRequest(activeHandle,
- orientation,
- rowsToBuffer,
- THDVAR(ha_thd(), async_enabled),
- key,
- keyLength,
- keyParts);
- DBUG_VOID_RETURN;
-}
-
-
-int ha_ibmdb2i::start_stmt(THD *thd, thr_lock_type lock_type)
-{
- DBUG_ENTER("ha_ibmdb2i::start_stmt");
- initBridge(thd);
- if (!THDVAR(thd, transaction_unsafe))
- {
- trans_register_ha(thd, FALSE, ibmdb2i_hton);
-
- if (!autoCommitIsOn(thd))
- {
- bridge()->beginStmtTx();
- }
- }
-
- DBUG_RETURN(0);
-}
-
-int32 ha_ibmdb2i::handleLOBReadOverflow()
-{
- DBUG_ENTER("ha_ibmdb2i::handleLOBReadOverflow");
- DBUG_ASSERT(db2Table->hasBlobs() && (activeReadBuf->getRowCapacity() == 1));
-
- int32 rc = adjustLobBuffersForRead();
-
- if (!rc)
- {
- activeReadBuf->rewind();
- rc = bridge()->expectErrors(QMY_ERR_END_OF_BLOCK)
- ->read(activeHandle,
- activeReadBuf->ptr(),
- accessIntent,
- getCommitLevel(),
- QMY_SAME);
- releaseRowNeeded = TRUE;
-
- }
- DBUG_RETURN(rc);
-}
-
-
-int32 ha_ibmdb2i::finishBulkInsert()
-{
- int32 rc = 0;
-
- if (activeWriteBuf->rowCount() && activeHandle)
- rc = flushWrite(activeHandle, table->record[0]);
-
- if (activeHandle)
- releaseActiveHandle();
-
- if (autoIncLockAcquired == TRUE)
- {
- // We could check the return code on the unlock, but beware not
- // to overlay the return code from the flushwrite or we will mask
- // duplicate key errors..
- bridge()->lockObj(dataHandle, 0, QMY_UNLOCK, QMY_LEAR, QMY_YES);
- autoIncLockAcquired = FALSE;
- }
- outstanding_start_bulk_insert = false;
- multiRowWriteBuf.freeBuf();
- last_start_bulk_insert_rc = 0;
-
- resetCharacterConversionBuffers();
-
- return rc;
-}
-
-int ha_ibmdb2i::getKeyFromName(const char* name, size_t len)
-{
- for (int i = 0; i < table_share->keys; ++i)
- {
- const char* indexName = db2Table->indexFile(i)->getDB2FileName();
- if ((strncmp(name, indexName, len) == 0) &&
- (strlen(indexName) == len))
- {
- return i;
- }
- }
- return MAX_KEY;
-}
-
-/*
-Determine the number of I/O's it takes to read through the table.
- */
-double ha_ibmdb2i::scan_time()
- {
- DBUG_ENTER("ha_ibmdb2i::scan_time");
- DBUG_RETURN(ulonglong2double((stats.data_file_length)/IO_SIZE));
- }
-
-
-/**
- Estimate the number of I/O's it takes to read a set of ranges through
- an index.
-
- @param index
- @param ranges
- @param rows
-
- @return The estimate number of I/Os
-*/
-
-double ha_ibmdb2i::read_time(uint index, uint ranges, ha_rows rows)
-{
- DBUG_ENTER("ha_ibmdb2i::read_time");
- int rc;
- uint64 idxPageCnt = 0;
- double cost;
-
- if (unlikely(rows == HA_POS_ERROR))
- DBUG_RETURN(double(rows) + ranges);
-
- rc = bridge()->retrieveIndexInfo(db2Table->indexFile(index)->getMasterDefnHandle(),
- &idxPageCnt);
- if (!rc)
- {
- if ((idxPageCnt == 1) || // Retrieving rows in requested order or
- (ranges == rows)) // 'Sweep' full records retrieval
- cost = idxPageCnt/4;
- else
- {
- uint64 totalRecords = stats.records + 1;
- double dataPageCount = stats.data_file_length/IO_SIZE;
-
- cost = (rows * dataPageCount / totalRecords) +
- min(idxPageCnt, (log_2(idxPageCnt) * ranges +
- rows * (log_2(idxPageCnt) + log_2(rows) - log_2(totalRecords))));
- }
- }
- else
- {
- cost = rows2double(ranges+rows); // Use default costing
- }
- DBUG_RETURN(cost);
-}
-
-int ha_ibmdb2i::useIndexFile(int idx)
-{
- DBUG_ENTER("ha_ibmdb2i::useIndexFile");
-
- if (activeHandle)
- releaseActiveHandle();
-
- int rc = 0;
-
- if (!indexHandles[idx])
- rc = db2Table->indexFile(idx)->allocateNewInstance(&indexHandles[idx], curConnection);
-
- if (rc == 0)
- {
- activeHandle = indexHandles[idx];
- bumpInUseCounter(1);
- }
-
- DBUG_RETURN(rc);
-}
-
-
-ulong ha_ibmdb2i::index_flags(uint inx, uint part, bool all_parts) const
-{
- return HA_READ_NEXT | HA_READ_PREV | HA_KEYREAD_ONLY | HA_READ_ORDER | HA_READ_RANGE;
-}
-
-
-static struct st_mysql_sys_var* ibmdb2i_system_variables[] = {
- MYSQL_SYSVAR(rdb_name),
- MYSQL_SYSVAR(transaction_unsafe),
- MYSQL_SYSVAR(lob_alloc_size),
- MYSQL_SYSVAR(max_read_buffer_size),
- MYSQL_SYSVAR(max_write_buffer_size),
- MYSQL_SYSVAR(async_enabled),
- MYSQL_SYSVAR(assume_exclusive_use),
- MYSQL_SYSVAR(compat_opt_blob_cols),
- MYSQL_SYSVAR(compat_opt_time_as_duration),
- MYSQL_SYSVAR(compat_opt_allow_zero_date_vals),
- MYSQL_SYSVAR(compat_opt_year_as_int),
- MYSQL_SYSVAR(propagate_default_col_vals),
- MYSQL_SYSVAR(create_index_option),
-// MYSQL_SYSVAR(discovery_mode),
- MYSQL_SYSVAR(system_trace_level),
- NULL
-};
-
-
-struct st_mysql_storage_engine ibmdb2i_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION };
-
-mysql_declare_plugin(ibmdb2i)
-{
- MYSQL_STORAGE_ENGINE_PLUGIN,
- &ibmdb2i_storage_engine,
- "IBMDB2I",
- "The IBM development team in Rochester, Minnesota",
- "IBM DB2 for i Storage Engine",
- PLUGIN_LICENSE_GPL,
- ibmdb2i_init_func, /* Plugin Init */
- ibmdb2i_done_func, /* Plugin Deinit */
- 0x0100 /* 1.0 */,
- NULL, /* status variables */
- ibmdb2i_system_variables, /* system variables */
- NULL /* config options */
-}
-mysql_declare_plugin_end;
diff --git a/storage/ibmdb2i/ha_ibmdb2i.h b/storage/ibmdb2i/ha_ibmdb2i.h
deleted file mode 100644
index b2a43232f2d..00000000000
--- a/storage/ibmdb2i/ha_ibmdb2i.h
+++ /dev/null
@@ -1,822 +0,0 @@
-/*
-Licensed Materials - Property of IBM
-DB2 Storage Engine Enablement
-Copyright IBM Corporation 2007,2008
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
- (a) Redistributions of source code must retain this list of conditions, the
- copyright notice in section {d} below, and the disclaimer following this
- list of conditions.
- (b) Redistributions in binary form must reproduce this list of conditions, the
- copyright notice in section (d) below, and the disclaimer following this
- list of conditions, in the documentation and/or other materials provided
- with the distribution.
- (c) The name of IBM may not be used to endorse or promote products derived from
- this software without specific prior written permission.
- (d) The text of the required copyright notice is:
- Licensed Materials - Property of IBM
- DB2 Storage Engine Enablement
- Copyright IBM Corporation 2007,2008
- All rights reserved
-
-THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGE.
-*/
-
-/** @file ha_ibmdb2i.h
-
- @brief
-
- @note
-
- @see
-*/
-
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
-#include "as400_types.h"
-#include "as400_protos.h"
-#include "db2i_global.h"
-#include "db2i_ileBridge.h"
-#include "builtins.h"
-#include "db2i_misc.h"
-#include "db2i_file.h"
-#include "db2i_blobCollection.h"
-#include "db2i_collationSupport.h"
-#include "db2i_validatedPointer.h"
-#include "db2i_ioBuffers.h"
-#include "db2i_errors.h"
-#include "db2i_sqlStatementStream.h"
-
-/** @brief
- IBMDB2I_SHARE is a structure that will be shared among all open handlers.
- It is used to describe the underlying table definition, and it caches
- table statistics.
-*/
-struct IBMDB2I_SHARE {
- char *table_name;
- uint table_name_length,use_count;
- pthread_mutex_t mutex;
- THR_LOCK lock;
-
- db2i_table* db2Table;
-
- class CStats
- {
- public:
- void cacheUpdateTime(time_t time)
- {update_time = time; initFlag |= lastModTime;}
- time_t getUpdateTime() const
- {return update_time;}
- void cacheRowCount(ha_rows rows)
- {records = rows; initFlag |= rowCount;}
- ha_rows getRowCount() const
- {return records;}
- void cacheDelRowCount(ha_rows rows)
- {deleted = rows; initFlag |= deletedRowCount;}
- ha_rows getDelRowCount() const
- {return deleted;}
- void cacheMeanLength(ulong len)
- {mean_rec_length = len; initFlag |= meanRowLen;}
- ulong getMeanLength()
- {return mean_rec_length;}
- void cacheAugmentedDataLength(ulong len)
- {data_file_length = len; initFlag |= ioCount;}
- ulong getAugmentedDataLength()
- {return data_file_length;}
- bool isInited(uint flags)
- {return initFlag & flags;}
- void invalidate(uint flags)
- {initFlag &= ~flags;}
-
- private:
- uint initFlag;
- time_t update_time;
- ha_rows records;
- ha_rows deleted;
- ulong mean_rec_length;
- ulong data_file_length;
- } cachedStats;
-
-};
-
-class ha_ibmdb2i: public handler
-{
- THR_LOCK_DATA lock; ///< MySQL lock
- IBMDB2I_SHARE *share; ///< Shared lock info
-
- // The record we are positioned on, together with the handle used to get
- // i.
- uint32 currentRRN;
- uint32 rrnAssocHandle;
-
- // Dup key values needed by info()
- uint32 lastDupKeyRRN;
- uint32 lastDupKeyID;
-
- bool returnDupKeysImmediately;
-
- // Dup key value need by update()
- bool onDupUpdate;
-
-
- db2i_table* db2Table;
-
- // The file handle of the PF or LF being accessed by the current operation.
- FILE_HANDLE activeHandle;
-
- // The file handle of the underlying PF
- FILE_HANDLE dataHandle;
-
- // Array of file handles belonging to the underlying LFs
- FILE_HANDLE* indexHandles;
-
- // Flag to indicate whether a call needs to be made to unlock a row when
- // a read operation has ended. DB2 will handle row unlocking as we move
- // through rows, but if an operation ends before we reach the end of a file,
- // DB2 needs to know to unlock the last row read.
- bool releaseRowNeeded;
-
- // Pointer to a definition of the layout of the row buffer for the file
- // described by activeHandle
- const db2i_file::RowFormat* activeFormat;
-
- IORowBuffer keyBuf;
- uint32 keyLen;
-
- IOWriteBuffer multiRowWriteBuf;
- IOAsyncReadBuffer multiRowReadBuf;
-
- IOAsyncReadBuffer* activeReadBuf;
- IOWriteBuffer* activeWriteBuf;
-
- BlobCollection* blobReadBuffers; // Dynamically allocated per query and used
- // to manage the buffers used for reading LOBs
- ValidatedPointer<char>* blobWriteBuffers;
-
- // Return codes are not used/honored by rnd_init and start_bulk_insert
- // so we need a way to signal the failure "downstream" to subsequent
- // functions.
- int last_rnd_init_rc;
- int last_index_init_rc;
- int last_start_bulk_insert_rc;
-
- // end_bulk_insert may get called twice for a single start_bulk_insert
- // This is our way to do cleanup only once.
- bool outstanding_start_bulk_insert;
-
- // Auto_increment 'increment by' value needed by write_row()
- uint32 incrementByValue;
- bool default_identity_value;
-
- // Flags and values used during write operations for auto_increment processing
- bool autoIncLockAcquired;
- bool got_auto_inc_values;
- uint64 next_identity_value;
-
- // The access intent indicated by the last external_locks() call.
- // May be either QMY_READ or QMY_UPDATABLE
- char accessIntent;
- char readAccessIntent;
-
- ha_rows* indexReadSizeEstimates;
-
- MEM_ROOT conversionBufferMemroot;
-
- bool forceSingleRowRead;
-
- bool readAllColumns;
-
- bool invalidDataFound;
-
- db2i_ileBridge* cachedBridge;
-
- ValidatedObject<volatile uint32> curConnection;
- uint16 activeReferences;
-
-public:
-
- ha_ibmdb2i(handlerton *hton, TABLE_SHARE *table_arg);
- ~ha_ibmdb2i();
-
- const char *table_type() const { return "IBMDB2I"; }
- const char *index_type(uint inx) { return "RADIX"; }
- const key_map *keys_to_use_for_scanning() { return &key_map_full; }
- const char **bas_ext() const;
-
- ulonglong table_flags() const
- {
- return HA_NULL_IN_KEY | HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY |
- HA_PARTIAL_COLUMN_READ |
- HA_DUPLICATE_POS | HA_NO_PREFIX_CHAR_KEYS |
- HA_HAS_RECORDS | HA_BINLOG_ROW_CAPABLE | HA_REQUIRES_KEY_COLUMNS_FOR_DELETE |
- HA_CAN_INDEX_BLOBS;
- }
-
- ulong index_flags(uint inx, uint part, bool all_parts) const;
-
-// Note that we do not implement max_supported_record_length.
-// We'll let create fail accordingly if the row is
-// too long. This allows us to hide the fact that varchars > 32K are being
-// implemented as DB2 LOBs.
-
- uint max_supported_keys() const { return 4000; }
- uint max_supported_key_parts() const { return MAX_DB2_KEY_PARTS; }
- uint max_supported_key_length() const { return 32767; }
- uint max_supported_key_part_length() const { return 32767; }
- double read_time(uint index, uint ranges, ha_rows rows);
- double scan_time();
- int open(const char *name, int mode, uint test_if_locked);
- int close(void);
- int write_row(uchar * buf);
- int update_row(const uchar * old_data, uchar * new_data);
- int delete_row(const uchar * buf);
- int index_init(uint idx, bool sorted);
- int index_read(uchar * buf, const uchar * key,
- uint key_len, enum ha_rkey_function find_flag);
- int index_next(uchar * buf);
- int index_read_last(uchar * buf, const uchar * key, uint key_len);
- int index_next_same(uchar *buf, const uchar *key, uint keylen);
- int index_prev(uchar * buf);
- int index_first(uchar * buf);
- int index_last(uchar * buf);
- int rnd_init(bool scan);
- int rnd_end();
- int rnd_next(uchar *buf);
- int rnd_pos(uchar * buf, uchar *pos);
- void position(const uchar *record);
- int info(uint);
- ha_rows records();
- int extra(enum ha_extra_function operation);
- int external_lock(THD *thd, int lock_type);
- int delete_all_rows(void);
- ha_rows records_in_range(uint inx, key_range *min_key,
- key_range *max_key);
- int delete_table(const char *from);
- int rename_table(const char * from, const char * to);
- int create(const char *name, TABLE *form,
- HA_CREATE_INFO *create_info);
- int updateFrm(TABLE *table_def, File file);
- int openTableDef(TABLE *table_def);
- int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
- int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
- int final_drop_index(TABLE *table_arg) {return 0;}
- void get_auto_increment(ulonglong offset, ulonglong increment,
- ulonglong nb_desired_values,
- ulonglong *first_value,
- ulonglong *nb_reserved_values);
- int reset_auto_increment(ulonglong value);
- void restore_auto_increment(ulonglong prev_insert_id) {return;}
- void update_create_info(HA_CREATE_INFO *create_info);
- int getNextIdVal(ulonglong *value);
- int analyze(THD* thd,HA_CHECK_OPT* check_opt);
- int optimize(THD* thd, HA_CHECK_OPT* check_opt);
- bool can_switch_engines();
- void free_foreign_key_create_info(char* str);
- char* get_foreign_key_create_info();
- int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
- uint referenced_by_foreign_key();
- bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
- virtual bool get_error_message(int error, String *buf);
-
- THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
- enum thr_lock_type lock_type);
-
- bool low_byte_first() const { return 0; }
- void unlock_row();
- int index_end();
- int reset();
- static int doCommit(handlerton *hton, THD *thd, bool all);
- static int doRollback(handlerton *hton, THD *thd, bool all);
- void start_bulk_insert(ha_rows rows);
- int end_bulk_insert();
- int start_stmt(THD *thd, thr_lock_type lock_type);
-
- void initBridge(THD* thd = NULL)
- {
- if (thd == NULL) thd = ha_thd();
- DBUG_PRINT("ha_ibmdb2i::initBridge",("Initing bridge. Conn ID=%d", thd->thread_id));
- cachedBridge = db2i_ileBridge::getBridgeForThread(thd);
- }
-
- db2i_ileBridge* bridge() {DBUG_ASSERT(cachedBridge); return cachedBridge;}
-
- static uint8 autoCommitIsOn(THD* thd)
- { return (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) ? QMY_NO : QMY_YES); }
-
- uint8 getCommitLevel();
- uint8 getCommitLevel(THD* thd);
-
- static int doSavepointSet(THD* thd, char* name)
- {
- return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_SET_SAVEPOINT,
- name);
- }
-
- static int doSavepointRollback(THD* thd, char* name)
- {
- return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_ROLLBACK_SAVEPOINT,
- name);
- }
-
- static int doSavepointRelease(THD* thd, char* name)
- {
- return db2i_ileBridge::getBridgeForThread(thd)->savepoint(QMY_RELEASE_SAVEPOINT,
- name);
- }
-
- // We can't guarantee that the rows we know about when this is called
- // will be the same number of rows that read returns (since DB2 activity
- // may insert additional rows). Therefore, we do as the Federated SE and
- // return the max possible.
- ha_rows estimate_rows_upper_bound()
- {
- return HA_POS_ERROR;
- }
-
-
-private:
-
- enum enum_TimeFormat
- {
- TIME_OF_DAY,
- DURATION
- };
-
- enum enum_BlobMapping
- {
- AS_BLOB,
- AS_VARCHAR
- };
-
- enum enum_ZeroDate
- {
- NO_SUBSTITUTE,
- SUBSTITUTE_0001_01_01
- };
-
- enum enum_YearFormat
- {
- CHAR4,
- SMALLINT
- };
-
- enum_ZeroDate cachedZeroDateOption;
-
- IBMDB2I_SHARE *get_share(const char *table_name, TABLE *table);
- int free_share(IBMDB2I_SHARE *share);
- int32 mungeDB2row(uchar* record, const char* dataPtr, const char* nullMapPtr, bool skipLOBs);
- int prepareRowForWrite(char* data, char* nulls, bool honorIdentCols);
- int prepareReadBufferForLobs();
- int32 prepareWriteBufferForLobs();
- uint32 adjustLobBuffersForRead();
- bool lobFieldsRequested();
- int convertFieldChars(enum_conversionDirection direction,
- uint16 fieldID,
- const char* input,
- char* output,
- size_t ilen,
- size_t olen,
- size_t* outDataLen,
- bool tacitErrors=FALSE,
- size_t* substChars=NULL);
-
- /**
- Fast integer log2 function
- */
- uint64 log_2(uint64 val)
- {
- uint64 exp = 0;
- while( (val >> exp) != 0)
- {
- exp++;
- }
- DBUG_ASSERT(exp-1 == (uint64)log2(val));
- return exp-1;
- }
-
- void bumpInUseCounter(uint16 amount)
- {
- activeReferences += amount;
- DBUG_PRINT("ha_ibmdb2i::bumpInUseCounter", ("activeReferences = %d", activeReferences));
- if (activeReferences)
- curConnection = (uint32)(ha_thd()->thread_id);
- else
- curConnection = 0;
- }
-
-
- int useDataFile()
- {
- DBUG_ENTER("ha_ibmdb2i::useDataFile");
-
- int rc = 0;
- if (!dataHandle)
- rc = db2Table->dataFile()->allocateNewInstance(&dataHandle, curConnection);
- else if (activeHandle == dataHandle)
- DBUG_RETURN(0);
-
- DBUG_ASSERT(activeHandle == 0);
-
- if (likely(rc == 0))
- {
- activeHandle = dataHandle;
- bumpInUseCounter(1);
- }
-
- DBUG_RETURN(rc);
- }
-
- void releaseAnyLockedRows()
- {
- if (releaseRowNeeded)
- {
- DBUG_PRINT("ha_ibmdb2i::releaseAnyLockedRows", ("Releasing rows"));
- db2i_ileBridge::getBridgeForThread()->rrlslck(activeHandle, accessIntent);
- releaseRowNeeded = FALSE;
- }
- }
-
-
- void releaseDataFile()
- {
- DBUG_ENTER("ha_ibmdb2i::releaseDataFile");
- releaseAnyLockedRows();
- bumpInUseCounter(-1);
- DBUG_ASSERT((volatile int)activeReferences >= 0);
- activeHandle = 0;
- DBUG_VOID_RETURN;
- }
-
- int useIndexFile(int idx);
-
- void releaseIndexFile(int idx)
- {
- DBUG_ENTER("ha_ibmdb2i::releaseIndexFile");
- releaseAnyLockedRows();
- bumpInUseCounter(-1);
- DBUG_ASSERT((volatile int)activeReferences >= 0);
- activeHandle = 0;
- DBUG_VOID_RETURN;
- }
-
- FILE_HANDLE allocateFileHandle(char* database, char* table, int* activityReference, bool hasBlobs);
-
- int updateBuffers(const db2i_file::RowFormat* format, uint rowsToRead, uint rowsToWrite);
-
- int flushWrite(FILE_HANDLE fileHandle, uchar* buf = NULL);
-
- int alterStartWith();
-
- int buildDB2ConstraintString(LEX* lex,
- String& appendHere,
- const char* database,
- Field** fields,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary);
-
- void releaseWriteBuffer();
-
- void setIndexReadEstimate(uint index, ha_rows rows)
- {
- if (!indexReadSizeEstimates)
- {
- indexReadSizeEstimates = (ha_rows*)my_malloc(sizeof(ha_rows) * table->s->keys, MYF(MY_WME | MY_ZEROFILL));
- }
- indexReadSizeEstimates[index] = rows;
- }
-
- ha_rows getIndexReadEstimate(uint index)
- {
- if (indexReadSizeEstimates)
- return max(indexReadSizeEstimates[index], 1);
-
- return 10000; // Assume index scan if no estimate exists.
- }
-
-
- void quiesceAllFileHandles()
- {
- db2i_ileBridge* bridge = db2i_ileBridge::getBridgeForThread();
- if (dataHandle)
- {
- bridge->quiesceFileInstance(dataHandle);
- }
-
- for (int idx = 0; idx < table_share->keys; ++idx)
- {
- if (indexHandles[idx] != 0)
- {
- bridge->quiesceFileInstance(indexHandles[idx]);
- }
- }
- }
-
- int32 buildCreateIndexStatement(SqlStatementStream& sqlStream,
- KEY& key,
- bool isPrimary,
- const char* db2LibName,
- const char* db2FileName);
-
- int32 buildIndexFieldList(String& appendHere,
- const KEY& key,
- bool isPrimary,
- char* fileSortSequenceType,
- char* fileSortSequence,
- char* fileSortSequenceLibrary);
-
- // Specify NULL for data when using the data pointed to by field
- int32 convertMySQLtoDB2(Field* field, const DB2Field& db2Field, char* db2Buf, const uchar* data = NULL);
-
- int32 convertDB2toMySQL(const DB2Field& db2Field, Field* field, const char* buf);
- int getFieldTypeMapping(Field* field,
- String& mapping,
- enum_TimeFormat timeFormate,
- enum_BlobMapping blobMapping,
- enum_ZeroDate zeroDateHandling,
- bool propagateDefaults,
- enum_YearFormat yearFormat);
-
- int getKeyFromName(const char* name, size_t len);
-
- void releaseActiveHandle()
- {
- if (activeHandle == dataHandle)
- releaseDataFile();
- else
- releaseIndexFile(active_index);
- }
-
-
- int32 finishBulkInsert();
-
- void doInitialRead(char orientation,
- uint32 rowsToBuffer,
- ILEMemHandle key = 0,
- int keyLength = 0,
- int keyParts = 0);
-
-
- int32 readFromBuffer(uchar* destination, char orientation)
- {
- char* row;
- int32 rc = 0;
- row = activeReadBuf->readNextRow(orientation, currentRRN);
-
- if (unlikely(!row))
- {
- rc = activeReadBuf->lastrc();
- if (rc == QMY_ERR_LOB_SPACE_TOO_SMALL)
- {
- rc = handleLOBReadOverflow();
- if (rc == 0)
- {
- DBUG_ASSERT(activeReadBuf->rowCount() == 1);
- row = activeReadBuf->readNextRow(orientation, currentRRN);
-
- if (unlikely(!row))
- rc = activeReadBuf->lastrc();
- }
- }
- }
-
- if (likely(rc == 0))
- {
- rrnAssocHandle = activeHandle;
- rc = mungeDB2row(destination, row, row+activeReadBuf->getRowNullOffset(), false);
- }
- return rc;
- }
-
- int32 handleLOBReadOverflow();
-
- char* getCharacterConversionBuffer(int fieldId, int length)
- {
- if (unlikely(!alloc_root_inited(&conversionBufferMemroot)))
- init_alloc_root(&conversionBufferMemroot, 8192, 0);
-
- return (char*)alloc_root(&conversionBufferMemroot, length);;
- }
-
- void resetCharacterConversionBuffers()
- {
- if (alloc_root_inited(&conversionBufferMemroot))
- {
- free_root(&conversionBufferMemroot, MYF(MY_MARK_BLOCKS_FREE));
- }
- }
-
- void tweakReadSet()
- {
- THD* thd = ha_thd();
- int command = thd_sql_command(thd);
- if ((command == SQLCOM_UPDATE ||
- command == SQLCOM_UPDATE_MULTI) ||
- ((command == SQLCOM_DELETE ||
- command == SQLCOM_DELETE_MULTI) &&
- thd->options & OPTION_BIN_LOG))
- readAllColumns = TRUE;
- else
- readAllColumns = FALSE;
- }
-
- /**
-
- */
- int useFileByHandle(char intent,
- FILE_HANDLE handle)
- {
- DBUG_ENTER("ha_ibmdb2i::useFileByHandle");
-
- const db2i_file* file;
- if (handle == dataHandle)
- file = db2Table->dataFile();
- else
- {
- for (uint i = 0; i < table_share->keys; ++i)
- {
- if (indexHandles[i] == handle)
- {
- file = db2Table->indexFile(i);
- active_index = i;
- }
- }
- }
-
- int rc = file->obtainRowFormat(handle, intent, getCommitLevel(), &activeFormat);
- if (likely(rc == 0))
- {
- activeHandle = handle;
- bumpInUseCounter(1);
- }
-
- DBUG_RETURN(rc);
- }
-
- const db2i_file* getFileForActiveHandle() const
- {
- if (activeHandle == dataHandle)
- return db2Table->dataFile();
- else
- for (uint i = 0; i < table_share->keys; ++i)
- if (indexHandles[i] == activeHandle)
- return db2Table->indexFile(i);
- DBUG_ASSERT(0);
- return NULL;
- }
-
- int prepReadBuffer(ha_rows rowsToRead, const db2i_file* file, char intent);
- int prepWriteBuffer(ha_rows rowsToWrite, const db2i_file* file);
-
- void invalidateCachedStats()
- {
- share->cachedStats.invalidate(rowCount | deletedRowCount | objLength |
- meanRowLen | ioCount);
- }
-
- void warnIfInvalidData()
- {
- if (unlikely(invalidDataFound))
- {
- warning(ha_thd(), DB2I_ERR_INVALID_DATA, table->alias);
- }
- }
-
- /**
- Calculate the maximum value that a particular field can hold.
-
- This is used to anticipate overflows in the auto_increment processing.
-
- @param field The Field to be analyzed
-
- @return The maximum value
- */
- static uint64 maxValueForField(const Field* field)
- {
- uint64 maxValue=0;
- switch (field->type())
- {
- case MYSQL_TYPE_TINY:
- if (((const Field_num*)field)->unsigned_flag)
- maxValue = (1 << 8) - 1;
- else
- maxValue = (1 << 7) - 1;
- break;
- case MYSQL_TYPE_SHORT:
- if (((const Field_num*)field)->unsigned_flag)
- maxValue = (1 << 16) - 1;
- else
- maxValue = (1 << 15) - 1;
- break;
- case MYSQL_TYPE_INT24:
- if (((const Field_num*)field)->unsigned_flag)
- maxValue = (1 << 24) - 1;
- else
- maxValue = (1 << 23) - 1;
- break;
- case MYSQL_TYPE_LONG:
- if (((const Field_num*)field)->unsigned_flag)
- maxValue = (1LL << 32) - 1;
- else
- maxValue = (1 << 31) - 1;
- break;
- case MYSQL_TYPE_LONGLONG:
- if (((const Field_num*)field)->unsigned_flag)
- maxValue = ~(0LL);
- else
- maxValue = 1 << 63 - 1;
- break;
- }
-
- return maxValue;
- }
-
- void cleanupBuffers()
- {
- if (blobReadBuffers)
- {
- delete blobReadBuffers;
- blobReadBuffers = NULL;
- }
- if (blobWriteBuffers)
- {
- delete[] blobWriteBuffers;
- blobWriteBuffers = NULL;
- }
- if (alloc_root_inited(&conversionBufferMemroot))
- {
- free_root(&conversionBufferMemroot, MYF(0));
- }
- }
-
-
-/**
- Generate a valid RCDFMT name based on the name of the table.
-
- The RCDFMT name is devised by munging the name of the table,
- uppercasing all ascii alpha-numeric characters and replacing all other
- characters with underscores until up to ten characters have been generated.
-
- @param tableName The name of the table, as given on the MySQL
- CREATE TABLE statement
- @param[out] query The string to receive the generated RCDFMT name
-*/
- static void generateAndAppendRCDFMT(const char* tableName, String& query)
- {
- char rcdfmt[11];
-
- // The RCDFMT name must begin with an alpha character.
- // We enforce this by skipping to the first alpha character in the table
- // name. If no alpha character exists, we use 'X' for the RCDFMT name;
-
- while (*tableName &&
- (!my_isascii(*tableName) ||
- !my_isalpha(system_charset_info, *tableName)))
- {
- tableName += my_mbcharlen(system_charset_info, *tableName);
- }
-
- if (unlikely(!(*tableName)))
- {
- rcdfmt[0]= 'X';
- rcdfmt[1]= 0;
- }
- else
- {
- int r= 0;
- while ((r < sizeof(rcdfmt)-1) && *tableName)
- {
- if (my_isascii(*tableName) &&
- my_isalnum(system_charset_info, *tableName))
- rcdfmt[r] = my_toupper(system_charset_info, *tableName);
- else
- rcdfmt[r] = '_';
-
- ++r;
- tableName += my_mbcharlen(system_charset_info, *tableName);
- }
- rcdfmt[r]= 0;
- }
- query.append(STRING_WITH_LEN(" RCDFMT "));
- query.append(rcdfmt);
- }
-
- int32 generateShadowIndex(SqlStatementStream& stream,
- const KEY& key,
- const char* libName,
- const char* fileName,
- const String& fieldDefinition);
-};
diff --git a/storage/ibmdb2i/plug.in b/storage/ibmdb2i/plug.in
deleted file mode 100644
index 0913d72aabf..00000000000
--- a/storage/ibmdb2i/plug.in
+++ /dev/null
@@ -1,12 +0,0 @@
-MYSQL_STORAGE_ENGINE([ibmdb2i], [], [IBM DB2 for i Storage Engine],
- [IBM DB2 for i Storage Engine], [max,max-no-ndb])
-MYSQL_PLUGIN_DYNAMIC([ibmdb2i], [ha_ibmdb2i.la])
-
-AC_CHECK_HEADER([qlgusr.h],
- # qlgusr.h is just one of the headers from the i5/OS PASE environment; the
- # EBCDIC headers are in /QIBM/include, and have to be converted to ASCII
- # before cpp gets to them
- [:],
- # Missing PASE environment, can't build this engine
- [mysql_plugin_ibmdb2i=no
- with_plugin_ibmdb2i=no])
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 587e39dcf3c..fa45cc96687 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -13,7 +13,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# This is the CMakeLists for InnoDB Plugin
+# This is the CMakeLists for InnoDB
INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles)
@@ -125,9 +125,13 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
CHECK_FUNCTION_EXISTS(atomic_cas_ulong HAVE_ATOMIC_CAS_ULONG)
CHECK_FUNCTION_EXISTS(atomic_cas_32 HAVE_ATOMIC_CAS_32)
CHECK_FUNCTION_EXISTS(atomic_cas_64 HAVE_ATOMIC_CAS_64)
- CHECK_FUNCTION_EXISTS(atomic_add_long HAVE_ATOMIC_ADD_LONG)
- IF(HAVE_ATOMIC_CAS_ULONG AND HAVE_ATOMIC_CAS_32 AND
- HAVE_ATOMIC_CAS_64 AND HAVE_ATOMIC_ADD_LONG)
+ CHECK_FUNCTION_EXISTS(atomic_add_long_nv HAVE_ATOMIC_ADD_LONG_NV)
+ CHECK_FUNCTION_EXISTS(atomic_swap_uchar HAVE_ATOMIC_SWAP_UCHAR)
+ IF(HAVE_ATOMIC_CAS_ULONG AND
+ HAVE_ATOMIC_CAS_32 AND
+ HAVE_ATOMIC_CAS_64 AND
+ HAVE_ATOMIC_ADD_LONG_NV AND
+ HAVE_ATOMIC_SWAP_UCHAR)
SET(HAVE_IB_SOLARIS_ATOMICS 1)
ENDIF()
@@ -231,7 +235,7 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
page/page0cur.c page/page0page.c page/page0zip.c
que/que0que.c
- handler/ha_innodb.cc handler/handler0alter.cc handler/i_s.cc handler/mysql_addons.cc
+ handler/ha_innodb.cc handler/handler0alter.cc handler/i_s.cc
read/read0read.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ext.c row/row0ins.c row/row0merge.c row/row0mysql.c row/row0purge.c row/row0row.c
@@ -250,29 +254,7 @@ IF(WITH_INNODB)
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
ENDIF()
-
-#The plugin's CMakeLists.txt still needs to work with previous versions of MySQL.
-IF(EXISTS ${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
- # Old plugin support on Windows only,
- # use tricks to force ha_innodb.dll name for DLL
- INCLUDE(${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
- MYSQL_STORAGE_ENGINE(INNOBASE)
- GET_TARGET_PROPERTY(LIB_LOCATION ha_innobase LOCATION)
- IF(LIB_LOCATION)
- SET_TARGET_PROPERTIES(ha_innobase PROPERTIES OUTPUT_NAME ha_innodb)
- ENDIF()
-ELSEIF (MYSQL_VERSION_ID LESS "50137")
- # Windows only, no plugin support
- IF (NOT SOURCE_SUBLIBS)
- ADD_DEFINITIONS(-DMYSQL_SERVER)
- ADD_LIBRARY(innobase STATIC ${INNOBASE_SOURCES})
- # Require mysqld_error.h, which is built as part of the GenError
- ADD_DEPENDENCIES(innobase GenError)
- ENDIF()
-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()
+MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
+ DEFAULT
+ MODULE_OUTPUT_NAME ha_innodb
+ LINK_LIBRARIES ${ZLIB_LIBRARY})
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
deleted file mode 100644
index 460abddb11e..00000000000
--- a/storage/innobase/Makefile.am
+++ /dev/null
@@ -1,338 +0,0 @@
-# Copyright (C) 2001, 2004, 2006 MySQL AB & Innobase Oy
-#
-# This 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
-
-# Process this file with automake to create Makefile.in
-
-MYSQLDATAdir= $(localstatedir)
-MYSQLSHAREdir= $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir= $(pkglibdir)/plugin
-INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(srcdir)/include \
- -I$(top_srcdir)/sql \
- -I$(srcdir) @ZLIB_INCLUDES@
-
-DEFS= @DEFS@
-
-noinst_HEADERS= \
- handler/ha_innodb.h \
- handler/i_s.h \
- include/btr0btr.h \
- include/btr0btr.ic \
- include/btr0cur.h \
- include/btr0cur.ic \
- include/btr0pcur.h \
- include/btr0pcur.ic \
- include/btr0sea.h \
- include/btr0sea.ic \
- include/btr0types.h \
- include/buf0buddy.h \
- include/buf0buddy.ic \
- include/buf0buf.h \
- include/buf0buf.ic \
- include/buf0flu.h \
- include/buf0flu.ic \
- include/buf0lru.h \
- include/buf0lru.ic \
- include/buf0rea.h \
- include/buf0types.h \
- include/data0data.h \
- include/data0data.ic \
- include/data0type.h \
- include/data0type.ic \
- include/data0types.h \
- include/db0err.h \
- include/dict0boot.h \
- include/dict0boot.ic \
- include/dict0crea.h \
- include/dict0crea.ic \
- include/dict0dict.h \
- include/dict0dict.ic \
- include/dict0load.h \
- include/dict0load.ic \
- include/dict0mem.h \
- include/dict0mem.ic \
- include/dict0types.h \
- include/dyn0dyn.h \
- include/dyn0dyn.ic \
- include/eval0eval.h \
- include/eval0eval.ic \
- include/eval0proc.h \
- include/eval0proc.ic \
- include/fil0fil.h \
- include/fsp0fsp.h \
- include/fsp0fsp.ic \
- include/fsp0types.h \
- include/fut0fut.h \
- include/fut0fut.ic \
- include/fut0lst.h \
- include/fut0lst.ic \
- include/ha0ha.h \
- include/ha0ha.ic \
- include/ha0storage.h \
- include/ha0storage.ic \
- include/ha_prototypes.h \
- include/handler0alter.h \
- include/hash0hash.h \
- include/hash0hash.ic \
- include/ibuf0ibuf.h \
- include/ibuf0ibuf.ic \
- include/ibuf0types.h \
- include/lock0iter.h \
- include/lock0lock.h \
- include/lock0lock.ic \
- include/lock0priv.h \
- include/lock0priv.ic \
- include/lock0types.h \
- include/log0log.h \
- include/log0log.ic \
- include/log0recv.h \
- include/log0recv.ic \
- include/mach0data.h \
- include/mach0data.ic \
- include/mem0dbg.h \
- include/mem0dbg.ic \
- include/mem0mem.h \
- include/mem0mem.ic \
- include/mem0pool.h \
- include/mem0pool.ic \
- include/mtr0log.h \
- include/mtr0log.ic \
- include/mtr0mtr.h \
- include/mtr0mtr.ic \
- include/mtr0types.h \
- include/mysql_addons.h \
- include/os0file.h \
- include/os0file.ic \
- include/os0proc.h \
- include/os0proc.ic \
- include/os0sync.h \
- include/os0sync.ic \
- include/os0thread.h \
- include/os0thread.ic \
- include/page0cur.h \
- include/page0cur.ic \
- include/page0page.h \
- include/page0page.ic \
- include/page0types.h \
- include/page0zip.h \
- include/page0zip.ic \
- include/pars0grm.h \
- include/pars0opt.h \
- include/pars0opt.ic \
- include/pars0pars.h \
- include/pars0pars.ic \
- include/pars0sym.h \
- include/pars0sym.ic \
- include/pars0types.h \
- include/que0que.h \
- include/que0que.ic \
- include/que0types.h \
- include/read0read.h \
- include/read0read.ic \
- include/read0types.h \
- include/rem0cmp.h \
- include/rem0cmp.ic \
- include/rem0rec.h \
- include/rem0rec.ic \
- include/rem0types.h \
- include/row0ext.h \
- include/row0ext.ic \
- include/row0ins.h \
- include/row0ins.ic \
- include/row0merge.h \
- include/row0mysql.h \
- include/row0mysql.ic \
- include/row0purge.h \
- include/row0purge.ic \
- include/row0row.h \
- include/row0row.ic \
- include/row0sel.h \
- include/row0sel.ic \
- include/row0types.h \
- include/row0uins.h \
- include/row0uins.ic \
- include/row0umod.h \
- include/row0umod.ic \
- include/row0undo.h \
- include/row0undo.ic \
- include/row0upd.h \
- include/row0upd.ic \
- include/row0vers.h \
- include/row0vers.ic \
- include/srv0srv.h \
- include/srv0srv.ic \
- include/srv0start.h \
- include/sync0arr.h \
- include/sync0arr.ic \
- include/sync0rw.h \
- include/sync0rw.ic \
- include/sync0sync.h \
- include/sync0sync.ic \
- include/sync0types.h \
- include/thr0loc.h \
- include/thr0loc.ic \
- include/trx0i_s.h \
- include/trx0purge.h \
- include/trx0purge.ic \
- include/trx0rec.h \
- include/trx0rec.ic \
- include/trx0roll.h \
- include/trx0roll.ic \
- include/trx0rseg.h \
- include/trx0rseg.ic \
- include/trx0sys.h \
- include/trx0sys.ic \
- include/trx0trx.h \
- include/trx0trx.ic \
- include/trx0types.h \
- include/trx0undo.h \
- include/trx0undo.ic \
- include/trx0xa.h \
- include/univ.i \
- include/usr0sess.h \
- include/usr0sess.ic \
- include/usr0types.h \
- include/ut0byte.h \
- include/ut0byte.ic \
- include/ut0dbg.h \
- include/ut0list.h \
- include/ut0list.ic \
- include/ut0lst.h \
- include/ut0mem.h \
- include/ut0mem.ic \
- include/ut0rbt.h \
- include/ut0rnd.h \
- include/ut0rnd.ic \
- include/ut0sort.h \
- include/ut0ut.h \
- include/ut0ut.ic \
- include/ut0vec.h \
- include/ut0vec.ic \
- include/ut0wqueue.h \
- mem/mem0dbg.c
-
-EXTRA_LIBRARIES= libinnobase.a
-noinst_LIBRARIES= @plugin_innobase_static_target@
-libinnobase_a_SOURCES= \
- btr/btr0btr.c \
- btr/btr0cur.c \
- btr/btr0pcur.c \
- btr/btr0sea.c \
- buf/buf0buddy.c \
- buf/buf0buf.c \
- buf/buf0flu.c \
- buf/buf0lru.c \
- buf/buf0rea.c \
- data/data0data.c \
- data/data0type.c \
- dict/dict0boot.c \
- dict/dict0crea.c \
- dict/dict0dict.c \
- dict/dict0load.c \
- dict/dict0mem.c \
- dyn/dyn0dyn.c \
- eval/eval0eval.c \
- eval/eval0proc.c \
- fil/fil0fil.c \
- fsp/fsp0fsp.c \
- fut/fut0fut.c \
- fut/fut0lst.c \
- ha/ha0ha.c \
- ha/ha0storage.c \
- ha/hash0hash.c \
- handler/ha_innodb.cc \
- handler/handler0alter.cc \
- handler/i_s.cc \
- handler/mysql_addons.cc \
- ibuf/ibuf0ibuf.c \
- lock/lock0iter.c \
- lock/lock0lock.c \
- log/log0log.c \
- log/log0recv.c \
- mach/mach0data.c \
- mem/mem0mem.c \
- mem/mem0pool.c \
- mtr/mtr0log.c \
- mtr/mtr0mtr.c \
- os/os0file.c \
- os/os0proc.c \
- os/os0sync.c \
- os/os0thread.c \
- page/page0cur.c \
- page/page0page.c \
- page/page0zip.c \
- pars/lexyy.c \
- pars/pars0grm.c \
- pars/pars0opt.c \
- pars/pars0pars.c \
- pars/pars0sym.c \
- que/que0que.c \
- read/read0read.c \
- rem/rem0cmp.c \
- rem/rem0rec.c \
- row/row0ext.c \
- row/row0ins.c \
- row/row0merge.c \
- row/row0mysql.c \
- row/row0purge.c \
- row/row0row.c \
- row/row0sel.c \
- row/row0uins.c \
- row/row0umod.c \
- row/row0undo.c \
- row/row0upd.c \
- row/row0vers.c \
- srv/srv0srv.c \
- srv/srv0start.c \
- sync/sync0arr.c \
- sync/sync0rw.c \
- sync/sync0sync.c \
- thr/thr0loc.c \
- trx/trx0i_s.c \
- trx/trx0purge.c \
- trx/trx0rec.c \
- trx/trx0roll.c \
- trx/trx0rseg.c \
- trx/trx0sys.c \
- trx/trx0trx.c \
- trx/trx0undo.c \
- usr/usr0sess.c \
- ut/ut0byte.c \
- ut/ut0dbg.c \
- ut/ut0list.c \
- ut/ut0mem.c \
- ut/ut0rbt.c \
- ut/ut0rnd.c \
- ut/ut0ut.c \
- ut/ut0vec.c \
- ut/ut0wqueue.c
-
-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_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS)
-ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
-ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES)
-
-EXTRA_DIST= CMakeLists.txt plug.in \
- pars/make_bison.sh pars/make_flex.sh \
- pars/pars0grm.y pars/pars0lex.l
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index 64790e87bef..50489ae4cc6 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -1071,7 +1071,7 @@ btr_cur_ins_lock_and_undo(
not zero, the parameters index and thr
should be specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert */
- const dtuple_t* entry, /*!< in: entry to insert */
+ dtuple_t* entry, /*!< in/out: entry to insert */
que_thr_t* thr, /*!< in: query thread or NULL */
mtr_t* mtr, /*!< in/out: mini-transaction */
ibool* inherit)/*!< out: TRUE if the inserted new record maybe
@@ -1744,7 +1744,7 @@ func_exit:
See if there is enough place in the page modification log to log
an update-in-place.
@return TRUE if enough place */
-static
+UNIV_INTERN
ibool
btr_cur_update_alloc_zip(
/*=====================*/
@@ -3248,7 +3248,7 @@ btr_estimate_n_rows_in_range_on_level(
performance with this code which is just an estimation. If we read
this many pages before reaching slot2->page_no then we estimate the
average from the pages scanned so far */
- #define N_PAGES_READ_LIMIT 10
+# define N_PAGES_READ_LIMIT 10
page_no = slot1->page_no;
level = slot1->page_level;
@@ -3277,6 +3277,7 @@ btr_estimate_n_rows_in_range_on_level(
|| btr_page_get_level_low(page) != level) {
/* The page got reused for something else */
+ mtr_commit(&mtr);
goto inexact;
}
@@ -3632,8 +3633,6 @@ btr_estimate_number_of_different_key_vals(
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
- dict_index_stat_mutex_enter(index);
-
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
= ((n_diff[j]
@@ -3663,8 +3662,6 @@ btr_estimate_number_of_different_key_vals(
index->stat_n_diff_key_vals[j] += add_on;
}
- dict_index_stat_mutex_exit(index);
-
mem_free(n_diff);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -4072,7 +4069,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or error */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
ulint
btr_store_big_rec_extern_fields(
diff --git a/storage/innobase/buf/buf0buddy.c b/storage/innobase/buf/buf0buddy.c
index 5dc0780cbdd..787b4e652a0 100644
--- a/storage/innobase/buf/buf0buddy.c
+++ b/storage/innobase/buf/buf0buddy.c
@@ -281,7 +281,7 @@ buf_buddy_alloc_from(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index ab3c1abf490..b79b5634957 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -172,7 +172,7 @@ The chain of modified blocks (buf_pool->flush_list) contains the blocks
holding file pages that have been modified in the memory
but not written to disk yet. The block with the oldest modification
which has not yet been written to disk is at the end of the chain.
-The access to this list is protected by flush_list_mutex.
+The access to this list is protected by buf_pool->flush_list_mutex.
The chain of unmodified compressed blocks (buf_pool->zip_clean)
contains the control blocks (buf_page_t) of those compressed pages
@@ -246,8 +246,8 @@ static const int WAIT_FOR_READ = 5000;
/** Number of attemtps made to read in a page in the buffer pool */
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
-/** The buffer buf_pool of the database */
-UNIV_INTERN buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS];
+/** The buffer pools of the database */
+UNIV_INTERN buf_pool_t* buf_pool_ptr;
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
static ulint buf_dbg_counter = 0; /*!< This is used to insert validation
@@ -858,7 +858,7 @@ buf_block_init(
block->frame = frame;
- block->page.buf_pool = buf_pool;
+ block->page.buf_pool_index = buf_pool_index(buf_pool);
block->page.state = BUF_BLOCK_NOT_USED;
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
@@ -1280,8 +1280,6 @@ buf_pool_free_instance(
mem_free(buf_pool->chunks);
hash_table_free(buf_pool->page_hash);
hash_table_free(buf_pool->zip_hash);
- mem_free(buf_pool);
- buf_pool = NULL;
}
/********************************************************************//**
@@ -1294,25 +1292,23 @@ buf_pool_init(
ulint total_size, /*!< in: size of the total pool in bytes */
ulint n_instances) /*!< in: number of instances */
{
- ulint i;
+ ulint i;
+ const ulint size = total_size / n_instances;
+
+ ut_ad(n_instances > 0);
+ ut_ad(n_instances <= MAX_BUFFER_POOLS);
+ ut_ad(n_instances == srv_buf_pool_instances);
/* We create an extra buffer pool instance, this instance is used
for flushing the flush lists, to keep track of n_flush for all
the buffer pools and also used as a waiting object during flushing. */
- for (i = 0; i < n_instances; i++) {
- buf_pool_t* ptr;
- ulint size;
-
- ptr = mem_zalloc(sizeof(*ptr));
-
- size = total_size / n_instances;
+ buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr);
- buf_pool_ptr[i] = ptr;
+ for (i = 0; i < n_instances; i++) {
+ buf_pool_t* ptr = &buf_pool_ptr[i];
if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {
- mem_free(buf_pool_ptr[i]);
-
/* Free all the instances created so far. */
buf_pool_free(i);
@@ -1341,8 +1337,10 @@ buf_pool_free(
for (i = 0; i < n_instances; i++) {
buf_pool_free_instance(buf_pool_from_array(i));
- buf_pool_ptr[i] = NULL;
}
+
+ mem_free(buf_pool_ptr);
+ buf_pool_ptr = NULL;
}
/********************************************************************//**
@@ -1882,8 +1880,8 @@ buf_pool_watch_set(
ut_ad(!bpage->in_page_hash);
ut_ad(bpage->buf_fix_count == 0);
- /* bpage is pointing to buf_pool_watch[],
- which is protected by buf_pool_mutex.
+ /* bpage is pointing to buf_pool->watch[],
+ which is protected by buf_pool->mutex.
Normally, buf_page_t objects are protected by
buf_block_t::mutex or buf_pool->zip_mutex or both. */
@@ -3008,6 +3006,46 @@ wait_until_unfixed:
bytes. */
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
#endif
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if ((mode == BUF_GET_IF_IN_POOL || mode == BUF_GET_IF_IN_POOL_OR_WATCH)
+ && ibuf_debug) {
+ /* Try to evict the block from the buffer pool, to use the
+ insert buffer (change buffer) as much as possible. */
+
+ if (buf_LRU_free_block(&block->page, TRUE, NULL)
+ == BUF_LRU_FREED) {
+ mutex_exit(&block->mutex);
+ if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
+ /* Set the watch, as it would have
+ been set if the page were not in the
+ buffer pool in the first place. */
+ block = (buf_block_t*) buf_pool_watch_set(
+ space, offset, fold);
+
+ if (UNIV_LIKELY_NULL(block)) {
+
+ /* The page entered the buffer
+ pool for some reason. Try to
+ evict it again. */
+ goto got_block;
+ }
+ }
+ buf_pool_mutex_exit(buf_pool);
+ fprintf(stderr,
+ "innodb_change_buffering_debug evict %u %u\n",
+ (unsigned) space, (unsigned) offset);
+ return(NULL);
+ } else if (buf_flush_page_try(buf_pool, block)) {
+ fprintf(stderr,
+ "innodb_change_buffering_debug flush %u %u\n",
+ (unsigned) space, (unsigned) offset);
+ guess = block;
+ goto loop;
+ }
+
+ /* Failed to evict the page; change it directly */
+ }
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
buf_block_buf_fix_inc(block, file, line);
@@ -3645,7 +3683,7 @@ err_exit:
bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru);
/* Initialize the buf_pool pointer. */
- bpage->buf_pool = buf_pool;
+ bpage->buf_pool_index = buf_pool_index(buf_pool);
/* If buf_buddy_alloc() allocated storage from the LRU list,
it released and reacquired buf_pool->mutex. Thus, we must
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 70ed3efaf4a..5b0617f17b1 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -321,7 +321,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_flush_list_mutex_enter(buf_pool);
- /* The field in_LRU_list is protected by buf_pool_mutex, which
+ /* The field in_LRU_list is protected by buf_pool->mutex, which
we are not holding. However, while a block is in the flush
list, it is dirty and cannot be discarded, not from the
page_hash or from the LRU list. At most, the uncompressed
@@ -1061,7 +1061,7 @@ buf_flush_write_block_low(
ut_ad(buf_page_in_file(bpage));
- /* We are not holding buf_pool_mutex or block_mutex here.
+ /* We are not holding buf_pool->mutex or block_mutex here.
Nevertheless, it is safe to access bpage, because it is
io_fixed and oldest_modification != 0. Thus, it cannot be
relocated in the buffer pool or removed from flush_list or
@@ -1132,6 +1132,83 @@ buf_flush_write_block_low(
}
}
+# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/********************************************************************//**
+Writes a flushable page asynchronously from the buffer pool to a file.
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
+function, and they will be released by this function after flushing.
+This is loosely based on buf_flush_batch() and buf_flush_page().
+@return TRUE if the page was flushed and the mutexes released */
+UNIV_INTERN
+ibool
+buf_flush_page_try(
+/*===============*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_block_t* block) /*!< in/out: buffer control block */
+{
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ ut_ad(mutex_own(&block->mutex));
+
+ if (!buf_flush_ready_for_flush(&block->page, BUF_FLUSH_LRU)) {
+ return(FALSE);
+ }
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU] > 0
+ || buf_pool->init_flush[BUF_FLUSH_LRU]) {
+ /* There is already a flush batch of the same type running */
+ return(FALSE);
+ }
+
+ buf_pool->init_flush[BUF_FLUSH_LRU] = TRUE;
+
+ buf_page_set_io_fix(&block->page, BUF_IO_WRITE);
+
+ buf_page_set_flush_type(&block->page, BUF_FLUSH_LRU);
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU]++ == 0) {
+
+ os_event_reset(buf_pool->no_flush[BUF_FLUSH_LRU]);
+ }
+
+ /* VERY IMPORTANT:
+ Because any thread may call the LRU flush, even when owning
+ locks on pages, to avoid deadlocks, we must make sure that the
+ s-lock is acquired on the page without waiting: this is
+ accomplished because buf_flush_ready_for_flush() must hold,
+ and that requires the page not to be bufferfixed. */
+
+ rw_lock_s_lock_gen(&block->lock, BUF_IO_WRITE);
+
+ /* Note that the s-latch is acquired before releasing the
+ buf_pool mutex: this ensures that the latch is acquired
+ immediately. */
+
+ mutex_exit(&block->mutex);
+ buf_pool_mutex_exit(buf_pool);
+
+ /* Even though block is not protected by any mutex at this
+ point, it is safe to access block, because it is io_fixed and
+ oldest_modification != 0. Thus, it cannot be relocated in the
+ buffer pool or removed from flush_list or LRU_list. */
+
+ buf_flush_write_block_low(&block->page);
+
+ buf_pool_mutex_enter(buf_pool);
+ buf_pool->init_flush[BUF_FLUSH_LRU] = FALSE;
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU] == 0) {
+ /* The running flush batch has ended */
+ os_event_set(buf_pool->no_flush[BUF_FLUSH_LRU]);
+ }
+
+ buf_pool_mutex_exit(buf_pool);
+ buf_flush_buffered_writes();
+
+ return(TRUE);
+}
+# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
NOTE: in simulated aio we must call
@@ -2116,12 +2193,12 @@ buf_flush_validate_low(
ut_ad(bpage->in_flush_list);
- /* A page in flush_list can be in BUF_BLOCK_REMOVE_HASH
- state. This happens when a page is in the middle of
- being relocated. In that case the original descriptor
- can have this state and still be in the flush list
- waiting to acquire the flush_list_mutex to complete
- the relocation. */
+ /* A page in buf_pool->flush_list can be in
+ BUF_BLOCK_REMOVE_HASH state. This happens when a page
+ is in the middle of being relocated. In that case the
+ original descriptor can have this state and still be
+ in the flush list waiting to acquire the
+ buf_pool->flush_list_mutex to complete the relocation. */
ut_a(buf_page_in_file(bpage)
|| buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH);
ut_a(om > 0);
diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
index e1d4b5081b8..8ad5f2dad83 100644
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
@@ -356,8 +356,8 @@ scan_again:
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
/* bpage->space and bpage->io_fix are protected by
- buf_pool_mutex and block_mutex. It is safe to check
- them while holding buf_pool_mutex only. */
+ buf_pool->mutex and block_mutex. It is safe to check
+ them while holding buf_pool->mutex only. */
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
@@ -403,7 +403,7 @@ scan_again:
/* Descriptors of uncompressed
blocks will not be relocated,
because we are holding the
- buf_pool_mutex. */
+ buf_pool->mutex. */
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
@@ -1443,10 +1443,10 @@ Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
-release buf_pool_mutex. Furthermore, the page frame will no longer be
+release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
-The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
+The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
release these two mutexes after the call. No other
buf_page_get_mutex() may be held when calling this function.
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index 1a332ea9329..d0344e72703 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -828,7 +828,7 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */
- btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
+ btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
btr_free_root(space, zip_size, root_page_no, mtr);
create:
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 2512f199875..0d15ad8b716 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -91,9 +91,18 @@ UNIV_INTERN mysql_pfs_key_t dict_foreign_err_mutex_key;
/** Identifies generated InnoDB foreign key names */
static char dict_ibfk[] = "_ibfk_";
-/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
-#define DICT_INDEX_STAT_MUTEX_SIZE 32
-mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+/** array of rw locks protecting
+dict_table_t::stat_initialized
+dict_table_t::stat_n_rows (*)
+dict_table_t::stat_clustered_index_size
+dict_table_t::stat_sum_of_other_index_sizes
+dict_table_t::stat_modified_counter (*)
+dict_table_t::indexes*::stat_n_diff_key_vals[]
+dict_table_t::indexes*::stat_index_size
+dict_table_t::indexes*::stat_n_leaf_pages
+(*) those are not always protected for performance reasons */
+#define DICT_TABLE_STATS_LATCHES_SIZE 64
+static rw_lock_t dict_table_stats_latches[DICT_TABLE_STATS_LATCHES_SIZE];
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
@@ -254,43 +263,65 @@ dict_mutex_exit_for_mysql(void)
mutex_exit(&(dict_sys->mutex));
}
-/** Get the mutex that protects index->stat_n_diff_key_vals[] */
-#define GET_INDEX_STAT_MUTEX(index) \
- (&dict_index_stat_mutex[ut_fold_ull(index->id) \
- % DICT_INDEX_STAT_MUTEX_SIZE])
+/** Get the latch that protects the stats of a given table */
+#define GET_TABLE_STATS_LATCH(table) \
+ (&dict_table_stats_latches[ut_fold_ull(table->id) \
+ % DICT_TABLE_STATS_LATCHES_SIZE])
/**********************************************************************//**
-Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
-index->id is used to pick the right mutex and it should not change
-before dict_index_stat_mutex_exit() is called on this index. */
+Lock the appropriate latch to protect a given table's statistics.
+table->id is used to pick the corresponding latch from a global array of
+latches. */
UNIV_INTERN
void
-dict_index_stat_mutex_enter(
-/*========================*/
- const dict_index_t* index) /*!< in: index */
+dict_table_stats_lock(
+/*==================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode) /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
{
- ut_ad(index != NULL);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(index->cached);
- ut_ad(!index->to_be_dropped);
+ ut_ad(table != NULL);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- mutex_enter(GET_INDEX_STAT_MUTEX(index));
+ switch (latch_mode) {
+ case RW_S_LATCH:
+ rw_lock_s_lock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_X_LATCH:
+ rw_lock_x_lock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_NO_LATCH:
+ /* fall through */
+ default:
+ ut_error;
+ }
}
/**********************************************************************//**
-Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+Unlock the latch that has been locked by dict_table_stats_lock() */
UNIV_INTERN
void
-dict_index_stat_mutex_exit(
-/*=======================*/
- const dict_index_t* index) /*!< in: index */
+dict_table_stats_unlock(
+/*====================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode) /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
{
- ut_ad(index != NULL);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(index->cached);
- ut_ad(!index->to_be_dropped);
+ ut_ad(table != NULL);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- mutex_exit(GET_INDEX_STAT_MUTEX(index));
+ switch (latch_mode) {
+ case RW_S_LATCH:
+ rw_lock_s_unlock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_X_LATCH:
+ rw_lock_x_unlock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_NO_LATCH:
+ /* fall through */
+ default:
+ ut_error;
+ }
}
/********************************************************************//**
@@ -682,9 +713,9 @@ dict_init(void)
mutex_create(dict_foreign_err_mutex_key,
&dict_foreign_err_mutex, SYNC_ANY_LATCH);
- for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
- mutex_create(PFS_NOT_INSTRUMENTED,
- &dict_index_stat_mutex[i], SYNC_INDEX_TREE);
+ for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
+ rw_lock_create(PFS_NOT_INSTRUMENTED,
+ &dict_table_stats_latches[i], SYNC_INDEX_TREE);
}
}
@@ -715,12 +746,11 @@ dict_table_get(
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
- if (!table->stat_initialized) {
- /* If table->ibd_file_missing == TRUE, this will
- print an error message and return without doing
- anything. */
- dict_update_statistics(table);
- }
+ /* If table->ibd_file_missing == TRUE, this will
+ print an error message and return without doing
+ anything. */
+ dict_update_statistics(table, TRUE /* only update stats
+ if they have not been initialized */);
}
return(table);
@@ -3453,7 +3483,7 @@ col_loop1:
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ return(DB_CHILD_NO_INDEX);
}
ptr = dict_accept(cs, ptr, "REFERENCES", &success);
@@ -3734,7 +3764,7 @@ try_find_index:
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ return(DB_PARENT_NO_INDEX);
}
} else {
ut_a(trx->check_foreigns == FALSE);
@@ -4198,12 +4228,13 @@ Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
void
-dict_update_statistics_low(
-/*=======================*/
+dict_update_statistics(
+/*===================*/
dict_table_t* table, /*!< in/out: table */
- ibool has_dict_mutex __attribute__((unused)))
- /*!< in: TRUE if the caller has the
- dictionary mutex */
+ ibool only_calc_if_missing_stats)/*!< in: only
+ update/recalc the stats if they have
+ not been initialized yet, otherwise
+ do nothing */
{
dict_index_t* index;
ulint sum_of_index_sizes = 0;
@@ -4231,6 +4262,12 @@ dict_update_statistics_low(
return;
}
+ dict_table_stats_lock(table, RW_X_LATCH);
+
+ if (only_calc_if_missing_stats && table->stat_initialized) {
+ dict_table_stats_unlock(table, RW_X_LATCH);
+ return;
+ }
do {
if (UNIV_LIKELY
@@ -4276,13 +4313,9 @@ dict_update_statistics_low(
index = dict_table_get_first_index(table);
- dict_index_stat_mutex_enter(index);
-
table->stat_n_rows = index->stat_n_diff_key_vals[
dict_index_get_n_unique(index)];
- dict_index_stat_mutex_exit(index);
-
table->stat_clustered_index_size = index->stat_index_size;
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
@@ -4291,18 +4324,8 @@ dict_update_statistics_low(
table->stat_initialized = TRUE;
table->stat_modified_counter = 0;
-}
-/*********************************************************************//**
-Calculates new estimates for table and index statistics. The statistics
-are used in query optimization. */
-UNIV_INTERN
-void
-dict_update_statistics(
-/*===================*/
- dict_table_t* table) /*!< in/out: table */
-{
- dict_update_statistics_low(table, FALSE);
+ dict_table_stats_unlock(table, RW_X_LATCH);
}
/**********************************************************************//**
@@ -4382,7 +4405,9 @@ dict_table_print_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
- dict_update_statistics_low(table, TRUE);
+ dict_update_statistics(table, FALSE /* update even if initialized */);
+
+ dict_table_stats_lock(table, RW_S_LATCH);
fprintf(stderr,
"--------------------------------------\n"
@@ -4410,6 +4435,8 @@ dict_table_print_low(
index = UT_LIST_GET_NEXT(indexes, index);
}
+ dict_table_stats_unlock(table, RW_S_LATCH);
+
foreign = UT_LIST_GET_FIRST(table->foreign_list);
while (foreign != NULL) {
@@ -4458,8 +4485,6 @@ dict_index_print_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
- dict_index_stat_mutex_enter(index);
-
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
index->n_user_defined_cols];
@@ -4467,8 +4492,6 @@ dict_index_print_low(
n_vals = index->stat_n_diff_key_vals[1];
}
- dict_index_stat_mutex_exit(index);
-
fprintf(stderr,
" INDEX: name %s, id %llu, fields %lu/%lu,"
" uniq %lu, type %lu\n"
@@ -4811,7 +4834,8 @@ void
dict_table_replace_index_in_foreign_list(
/*=====================================*/
dict_table_t* table, /*!< in/out: table */
- dict_index_t* index) /*!< in: index to be replaced */
+ dict_index_t* index, /*!< in: index to be replaced */
+ const trx_t* trx) /*!< in: transaction handle */
{
dict_foreign_t* foreign;
@@ -4822,7 +4846,13 @@ dict_table_replace_index_in_foreign_list(
if (foreign->foreign_index == index) {
dict_index_t* new_index
= dict_foreign_find_equiv_index(foreign);
- ut_a(new_index);
+
+ /* There must exist an alternative index if
+ check_foreigns (FOREIGN_KEY_CHECKS) is on,
+ since ha_innobase::prepare_drop_index had done
+ the check before we reach here. */
+
+ ut_a(new_index || !trx->check_foreigns);
foreign->foreign_index = new_index;
}
@@ -4955,8 +4985,8 @@ dict_close(void)
mem_free(dict_sys);
dict_sys = NULL;
- for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
- mutex_free(&dict_index_stat_mutex[i]);
+ for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
+ rw_lock_free(&dict_table_stats_latches[i]);
}
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
index 74f108fcf8e..5b01669af29 100644
--- a/storage/innobase/dict/dict0load.c
+++ b/storage/innobase/dict/dict0load.c
@@ -346,7 +346,8 @@ dict_process_sys_tables_rec(
/* Update statistics if DICT_TABLE_UPDATE_STATS
is set */
- dict_update_statistics_low(*table, TRUE);
+ dict_update_statistics(*table, FALSE /* update even if
+ initialized */);
}
return(NULL);
@@ -1733,13 +1734,13 @@ err_exit:
if (err != DB_SUCCESS) {
dict_table_remove_from_cache(table);
table = NULL;
+ } else {
+ table->fk_max_recusive_level = 0;
}
} else if (!srv_force_recovery) {
dict_table_remove_from_cache(table);
table = NULL;
}
-
- table->fk_max_recusive_level = 0;
#if 0
if (err != DB_SUCCESS && table != NULL) {
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 710f0ac8603..cb4ccc005b5 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -339,14 +339,15 @@ fil_get_space_id_for_table(
/*******************************************************************//**
Frees a space object from the tablespace memory cache. Closes the files in
the chain but does not delete them. There must not be any pending i/o's or
-flushes on the files. */
+flushes on the files.
+@return TRUE on success */
static
ibool
fil_space_free(
/*===========*/
- /* out: TRUE if success */
- ulint id, /* in: space id */
- ibool own_mutex);/* in: TRUE if own system->mutex */
+ ulint id, /* in: space id */
+ ibool x_latched); /* in: TRUE if caller has space->latch
+ in X mode */
/********************************************************************//**
Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
@@ -1140,6 +1141,7 @@ try_again:
space = fil_space_get_by_name(name);
if (UNIV_LIKELY_NULL(space)) {
+ ibool success;
ulint namesake_id;
ut_print_timestamp(stderr);
@@ -1178,9 +1180,10 @@ try_again:
namesake_id = space->id;
- mutex_exit(&fil_system->mutex);
+ success = fil_space_free(namesake_id, FALSE);
+ ut_a(success);
- fil_space_free(namesake_id, FALSE);
+ mutex_exit(&fil_system->mutex);
goto try_again;
}
@@ -1331,15 +1334,14 @@ fil_space_free(
/*===========*/
/* out: TRUE if success */
ulint id, /* in: space id */
- ibool own_mutex) /* in: TRUE if own system->mutex */
+ ibool x_latched) /* in: TRUE if caller has space->latch
+ in X mode */
{
fil_space_t* space;
fil_space_t* namespace;
fil_node_t* fil_node;
- if (!own_mutex) {
- mutex_enter(&fil_system->mutex);
- }
+ ut_ad(mutex_own(&fil_system->mutex));
space = fil_space_get_by_id(id);
@@ -1350,8 +1352,6 @@ fil_space_free(
" from the cache but\n"
"InnoDB: it is not there.\n", (ulong) id);
- mutex_exit(&fil_system->mutex);
-
return(FALSE);
}
@@ -1386,8 +1386,8 @@ fil_space_free(
ut_a(0 == UT_LIST_GET_LEN(space->chain));
- if (!own_mutex) {
- mutex_exit(&fil_system->mutex);
+ if (x_latched) {
+ rw_lock_x_unlock(&space->latch);
}
rw_lock_free(&(space->latch));
@@ -1633,25 +1633,27 @@ fil_close_all_files(void)
/*=====================*/
{
fil_space_t* space;
- fil_node_t* node;
mutex_enter(&fil_system->mutex);
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space != NULL) {
+ fil_node_t* node;
fil_space_t* prev_space = space;
- node = UT_LIST_GET_FIRST(space->chain);
+ for (node = UT_LIST_GET_FIRST(space->chain);
+ node != NULL;
+ node = UT_LIST_GET_NEXT(chain, node)) {
- while (node != NULL) {
if (node->open) {
fil_node_close_file(node, fil_system);
}
- node = UT_LIST_GET_NEXT(chain, node);
}
+
space = UT_LIST_GET_NEXT(space_list, space);
- fil_space_free(prev_space->id, TRUE);
+
+ fil_space_free(prev_space->id, FALSE);
}
mutex_exit(&fil_system->mutex);
@@ -2271,6 +2273,19 @@ try_again:
path = mem_strdup(space->name);
mutex_exit(&fil_system->mutex);
+
+ /* Important: We rely on the data dictionary mutex to ensure
+ that a race is not possible here. It should serialize the tablespace
+ drop/free. We acquire an X latch only to avoid a race condition
+ when accessing the tablespace instance via:
+
+ fsp_get_available_space_in_free_extents().
+
+ There our main motivation is to reduce the contention on the
+ dictionary mutex. */
+
+ rw_lock_x_lock(&space->latch);
+
#ifndef UNIV_HOTBACKUP
/* Invalidate in the buffer pool all pages belonging to the
tablespace. Since we have set space->is_being_deleted = TRUE, readahead
@@ -2283,7 +2298,11 @@ try_again:
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
- success = fil_space_free(id, FALSE);
+ mutex_enter(&fil_system->mutex);
+
+ success = fil_space_free(id, TRUE);
+
+ mutex_exit(&fil_system->mutex);
if (success) {
success = os_file_delete(path);
@@ -2291,6 +2310,8 @@ try_again:
if (!success) {
success = os_file_delete_if_exists(path);
}
+ } else {
+ rw_lock_x_unlock(&space->latch);
}
if (success) {
@@ -2318,6 +2339,31 @@ try_again:
return(FALSE);
}
+/*******************************************************************//**
+Returns TRUE if a single-table tablespace is being deleted.
+@return TRUE if being deleted */
+UNIV_INTERN
+ibool
+fil_tablespace_is_being_deleted(
+/*============================*/
+ ulint id) /*!< in: space id */
+{
+ fil_space_t* space;
+ ibool is_being_deleted;
+
+ mutex_enter(&fil_system->mutex);
+
+ space = fil_space_get_by_id(id);
+
+ ut_a(space != NULL);
+
+ is_being_deleted = space->is_being_deleted;
+
+ mutex_exit(&fil_system->mutex);
+
+ return(is_being_deleted);
+}
+
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
Discards a single-table tablespace. The tablespace must be cached in the
@@ -4788,7 +4834,7 @@ fil_page_get_type(
return(mach_read_from_2(page + FIL_PAGE_TYPE));
}
-/********************************************************************
+/****************************************************************//**
Initializes the tablespace memory cache. */
UNIV_INTERN
void
diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
index 3efe147b998..ffe2b21b80c 100644
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
@@ -3097,13 +3097,63 @@ fsp_get_available_space_in_free_extents(
ut_ad(!mutex_own(&kernel_mutex));
+ /* The convoluted mutex acquire is to overcome latching order
+ issues: The problem is that the fil_mutex is at a lower level
+ than the tablespace latch and the buffer pool mutex. We have to
+ first prevent any operations on the file system by acquiring the
+ dictionary mutex. Then acquire the tablespace latch to obey the
+ latching order and then release the dictionary mutex. That way we
+ ensure that the tablespace instance can't be freed while we are
+ examining its contents (see fil_space_free()).
+
+ However, there is one further complication, we release the fil_mutex
+ when we need to invalidate the the pages in the buffer pool and we
+ reacquire the fil_mutex when deleting and freeing the tablespace
+ instance in fil0fil.c. Here we need to account for that situation
+ too. */
+
+ mutex_enter(&dict_sys->mutex);
+
+ /* At this stage there is no guarantee that the tablespace even
+ exists in the cache. */
+
+ if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
+
+ mutex_exit(&dict_sys->mutex);
+
+ return(ULLINT_UNDEFINED);
+ }
+
mtr_start(&mtr);
latch = fil_space_get_latch(space, &flags);
+
+ /* This should ensure that the tablespace instance can't be freed
+ by another thread. However, the tablespace pages can still be freed
+ from the buffer pool. We need to check for that again. */
+
zip_size = dict_table_flags_to_zip_size(flags);
mtr_x_lock(latch, &mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ /* At this point it is possible for the tablespace to be deleted and
+ its pages removed from the buffer pool. We need to check for that
+ situation. However, the tablespace instance can't be deleted because
+ our latching above should ensure that. */
+
+ if (fil_tablespace_is_being_deleted(space)) {
+
+ mtr_commit(&mtr);
+
+ return(ULLINT_UNDEFINED);
+ }
+
+ /* From here on even if the user has dropped the tablespace, the
+ pages _must_ still exist in the buffer pool and the tablespace
+ instance _must_ be in the file system hash table. */
+
space_header = fsp_get_space_header(space, zip_size, &mtr);
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, &mtr);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 7f2e8a44a09..b0d620c060d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -32,7 +32,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/* TODO list for the InnoDB handler in 5.0:
- - Remove the flag trx->active_trans and look at trx->conc_state
- fix savepoint functions to use savepoint storage area
- Find out what kind of problems the OS X case-insensitivity causes to
table and database names; should we 'normalize' the names like we do
@@ -96,10 +95,6 @@ extern "C" {
# define MYSQL_PLUGIN_IMPORT /* nothing */
# endif /* MYSQL_PLUGIN_IMPORT */
-#if MYSQL_VERSION_ID < 50124
-bool check_global_access(THD *thd, ulong want_access);
-#endif /* MYSQL_VERSION_ID < 50124 */
-
/** to protect innobase_open_files */
static mysql_mutex_t innobase_share_mutex;
/** to force correct commit order in binlog */
@@ -241,7 +236,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
{&ibuf_mutex_key, "ibuf_mutex", 0},
{&ibuf_pessimistic_insert_mutex_key,
"ibuf_pessimistic_insert_mutex", 0},
- {&ios_mutex_key, "ios_mutex", 0},
{&kernel_mutex_key, "kernel_mutex", 0},
{&log_sys_mutex_key, "log_sys_mutex", 0},
# ifdef UNIV_MEM_DEBUG
@@ -966,6 +960,8 @@ convert_error_code_to_mysql(
return(HA_ERR_ROW_IS_REFERENCED);
case DB_CANNOT_ADD_CONSTRAINT:
+ case DB_CHILD_NO_INDEX:
+ case DB_PARENT_NO_INDEX:
return(HA_ERR_CANNOT_ADD_FOREIGN);
case DB_CANNOT_DROP_CONSTRAINT:
@@ -1513,7 +1509,7 @@ Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
lacks one.
@return InnoDB transaction handle */
-static
+static inline
trx_t*
check_trx_exists(
/*=============*/
@@ -1535,6 +1531,77 @@ check_trx_exists(
return(trx);
}
+/*********************************************************************//**
+Note that a transaction has been registered with MySQL.
+@return true if transaction is registered with MySQL 2PC coordinator */
+static inline
+bool
+trx_is_registered_for_2pc(
+/*=========================*/
+ const trx_t* trx) /* in: transaction */
+{
+ return(trx->is_registered == 1);
+}
+
+/*********************************************************************//**
+Note that a transaction owns the prepare_commit_mutex. */
+static inline
+void
+trx_owns_prepare_commit_mutex_set(
+/*==============================*/
+ trx_t* trx) /* in: transaction */
+{
+ ut_a(trx_is_registered_for_2pc(trx));
+ trx->owns_prepare_mutex = 1;
+}
+
+/*********************************************************************//**
+Note that a transaction has been registered with MySQL 2PC coordinator. */
+static inline
+void
+trx_register_for_2pc(
+/*==================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx->is_registered = 1;
+ ut_ad(trx->owns_prepare_mutex == 0);
+}
+
+/*********************************************************************//**
+Note that a transaction has been deregistered. */
+static inline
+void
+trx_deregister_from_2pc(
+/*====================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx->is_registered = 0;
+ trx->owns_prepare_mutex = 0;
+}
+
+/*********************************************************************//**
+Check whether atransaction owns the prepare_commit_mutex.
+@return true if transaction owns the prepare commit mutex */
+static inline
+bool
+trx_has_prepare_commit_mutex(
+/*=========================*/
+ const trx_t* trx) /* in: transaction */
+{
+ return(trx->owns_prepare_mutex == 1);
+}
+
+/*********************************************************************//**
+Check if transaction is started.
+@reutrn true if transaction is in state started */
+static
+bool
+trx_is_started(
+/*===========*/
+ trx_t* trx) /* in: transaction */
+{
+ return(trx->conc_state != TRX_NOT_STARTED);
+}
/*********************************************************************//**
Construct ha_innobase handler. */
@@ -1598,48 +1665,31 @@ ha_innobase::update_thd()
}
/*********************************************************************//**
-Registers that InnoDB takes part in an SQL statement, so that MySQL knows to
-roll back the statement if the statement results in an error. This MUST be
-called for every SQL statement that may be rolled back by MySQL. Calling this
-several times to register the same statement is allowed, too. */
+Registers an InnoDB transaction with the MySQL 2PC coordinator, so that
+the MySQL XA code knows to call the InnoDB prepare and commit, or rollback
+for the transaction. This MUST be called for every transaction for which
+the user may call commit or rollback. Calling this several times to register
+the same transaction is allowed, too. This function also registers the
+current SQL statement. */
static inline
void
-innobase_register_stmt(
-/*===================*/
- handlerton* hton, /*!< in: Innobase hton */
- THD* thd) /*!< in: MySQL thd (connection) object */
+innobase_register_trx(
+/*==================*/
+ handlerton* hton, /* in: Innobase handlerton */
+ THD* thd, /* in: MySQL thd (connection) object */
+ trx_t* trx) /* in: transaction to register */
{
- DBUG_ASSERT(hton == innodb_hton_ptr);
- /* Register the statement */
trans_register_ha(thd, FALSE, hton);
-}
-
-/*********************************************************************//**
-Registers an InnoDB transaction in MySQL, so that the MySQL XA code knows
-to call the InnoDB prepare and commit, or rollback for the transaction. This
-MUST be called for every transaction for which the user may call commit or
-rollback. Calling this several times to register the same transaction is
-allowed, too.
-This function also registers the current SQL statement. */
-static inline
-void
-innobase_register_trx_and_stmt(
-/*===========================*/
- handlerton *hton, /*!< in: Innobase handlerton */
- THD* thd) /*!< in: MySQL thd (connection) object */
-{
- /* NOTE that actually innobase_register_stmt() registers also
- the transaction in the AUTOCOMMIT=1 mode. */
-
- innobase_register_stmt(hton, thd);
- if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ if (!trx_is_registered_for_2pc(trx)
+ && thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
- /* No autocommit mode, register for a transaction */
trans_register_ha(thd, TRUE, hton);
}
-}
+ trx_register_for_2pc(trx);
+}
+
/* BACKGROUND INFO: HOW THE MYSQL QUERY CACHE WORKS WITH INNODB
------------------------------------------------------------
@@ -1785,14 +1835,8 @@ innobase_query_caching_of_table_permitted(
#ifdef __WIN__
innobase_casedn_str(norm_name);
#endif
- /* The call of row_search_.. will start a new transaction if it is
- not yet started */
-
- if (trx->active_trans == 0) {
- innobase_register_trx_and_stmt(innodb_hton_ptr, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(innodb_hton_ptr, thd, trx);
if (row_search_check_if_query_cache_permitted(trx, norm_name)) {
@@ -1852,11 +1896,7 @@ innobase_convert_identifier(
FALSE=id is an UTF-8 string */
{
char nz[NAME_LEN + 1];
-#if MYSQL_VERSION_ID >= 50141
char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
-#else /* MYSQL_VERSION_ID >= 50141 */
- char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix];
-#endif /* MYSQL_VERSION_ID >= 50141 */
const char* s = id;
int q;
@@ -1874,13 +1914,9 @@ innobase_convert_identifier(
nz[idlen] = 0;
s = nz2;
-#if MYSQL_VERSION_ID >= 50141
idlen = explain_filename((THD*) thd, nz, nz2, sizeof nz2,
EXPLAIN_PARTITIONS_AS_COMMENT);
goto no_quote;
-#else /* MYSQL_VERSION_ID >= 50141 */
- idlen = filename_to_tablename(nz, nz2, sizeof nz2);
-#endif /* MYSQL_VERSION_ID >= 50141 */
}
/* See if the identifier needs to be quoted. */
@@ -1891,9 +1927,7 @@ innobase_convert_identifier(
}
if (q == EOF) {
-#if MYSQL_VERSION_ID >= 50141
no_quote:
-#endif /* MYSQL_VERSION_ID >= 50141 */
if (UNIV_UNLIKELY(idlen > buflen)) {
idlen = buflen;
}
@@ -2059,14 +2093,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
trx_assign_read_view(prebuilt->trx);
- /* Set the MySQL flag to mark that there is an active transaction */
-
- if (prebuilt->trx->active_trans == 0) {
-
- innobase_register_trx_and_stmt(ht, user_thd);
-
- prebuilt->trx->active_trans = 1;
- }
+ innobase_register_trx(ht, user_thd, prebuilt->trx);
/* We did the necessary inits in this function, no need to repeat them
in row_search_for_mysql */
@@ -2561,12 +2588,10 @@ innobase_commit_low(
/*================*/
trx_t* trx) /*!< in: transaction handle */
{
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx_is_started(trx)) {
- return;
+ trx_commit_for_mysql(trx);
}
-
- trx_commit_for_mysql(trx);
}
/*****************************************************************//**
@@ -2608,10 +2633,7 @@ innobase_start_trx_and_assign_read_view(
/* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
- innobase_register_trx_and_stmt(hton, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(hton, current_thd, trx);
DBUG_RETURN(0);
}
@@ -2645,29 +2667,19 @@ innobase_commit(
trx_search_latch_release_if_reserved(trx);
}
- /* The flag trx->active_trans is set to 1 in
-
- 1. ::external_lock(),
- 2. ::start_stmt(),
- 3. innobase_query_caching_of_table_permitted(),
- 4. innobase_savepoint(),
- 5. ::init_table_handle_for_HANDLER(),
- 6. innobase_start_trx_and_assign_read_view(),
- 7. ::transactional_table_lock()
+ /* Transaction is deregistered only in a commit or a rollback. If
+ it is deregistered we know there cannot be resources to be freed
+ and we could return immediately. For the time being, we play safe
+ and do the cleanup though there should be nothing to clean up. */
- and it is only set to 0 in a commit or a rollback. If it is 0 we know
- there cannot be resources to be freed and we could return immediately.
- For the time being, we play safe and do the cleanup though there should
- be nothing to clean up. */
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- if (trx->active_trans == 0
- && trx->conc_state != TRX_NOT_STARTED) {
-
- sql_print_error("trx->active_trans == 0, but"
- " trx->conc_state != TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
+
if (all
- || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
+ || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* We were instructed to commit the whole transaction, or
this is an SQL statement end and autocommit is on */
@@ -2722,15 +2734,15 @@ retry:
mysql_mutex_unlock(&commit_cond_m);
}
- if (trx->active_trans == 2) {
-
+ if (trx_has_prepare_commit_mutex(trx)) {
+
mysql_mutex_unlock(&prepare_commit_mutex);
- }
+ }
+
+ trx_deregister_from_2pc(trx);
/* Now do a write + flush of logs. */
trx_commit_complete_for_mysql(trx);
- trx->active_trans = 0;
-
} else {
/* We just mark the SQL statement ended and do not do a
transaction commit */
@@ -2799,10 +2811,10 @@ innobase_rollback(
row_unlock_table_autoinc_for_mysql(trx);
if (all
- || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
error = trx_rollback_for_mysql(trx);
- trx->active_trans = 0;
+ trx_deregister_from_2pc(trx);
} else {
error = trx_rollback_last_sql_stat_for_mysql(trx);
}
@@ -2945,8 +2957,8 @@ innobase_savepoint(
innobase_release_stat_resources(trx);
- /* cannot happen outside of transaction */
- DBUG_ASSERT(trx->active_trans);
+ /* Cannot happen outside of transaction */
+ DBUG_ASSERT(trx_is_registered_for_2pc(trx));
/* TODO: use provided savepoint data area to store savepoint data */
char name[64];
@@ -2976,16 +2988,15 @@ innobase_close_connection(
ut_a(trx);
- if (trx->active_trans == 0
- && trx->conc_state != TRX_NOT_STARTED) {
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- sql_print_error("trx->active_trans == 0, but"
- " trx->conc_state != TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
- if (trx->conc_state != TRX_NOT_STARTED &&
- global_system_variables.log_warnings) {
+ if (trx_is_started(trx) && global_system_variables.log_warnings) {
+
sql_print_warning(
"MySQL is closing a connection that has an active "
"InnoDB transaction. %llu row modifications will "
@@ -4628,17 +4639,18 @@ include_field:
n_requested_fields++;
templ->col_no = i;
+ templ->clust_rec_field_no = dict_col_get_clust_pos(
+ col, clust_index);
+ ut_ad(templ->clust_rec_field_no != ULINT_UNDEFINED);
if (index == clust_index) {
- templ->rec_field_no = dict_col_get_clust_pos(
- col, index);
+ templ->rec_field_no = templ->clust_rec_field_no;
} else {
templ->rec_field_no = dict_index_get_nth_col_pos(
index, i);
- }
-
- if (templ->rec_field_no == ULINT_UNDEFINED) {
- prebuilt->need_to_access_clustered = TRUE;
+ if (templ->rec_field_no == ULINT_UNDEFINED) {
+ prebuilt->need_to_access_clustered = TRUE;
+ }
}
if (field->null_ptr) {
@@ -4688,9 +4700,7 @@ skip_field:
for (i = 0; i < n_requested_fields; i++) {
templ = prebuilt->mysql_template + i;
- templ->rec_field_no = dict_col_get_clust_pos(
- &index->table->cols[templ->col_no],
- clust_index);
+ templ->rec_field_no = templ->clust_rec_field_no;
}
}
}
@@ -4886,7 +4896,7 @@ no_commit:
/* Altering to InnoDB format */
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
- prebuilt->trx->active_trans = 1;
+ trx_register_for_2pc(prebuilt->trx);
/* We will need an IX lock on the destination table. */
prebuilt->sql_stat_start = TRUE;
} else {
@@ -4902,7 +4912,7 @@ no_commit:
locks, so they have to be acquired again. */
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
- prebuilt->trx->active_trans = 1;
+ trx_register_for_2pc(prebuilt->trx);
/* Re-acquire the table lock on the source table. */
row_lock_table_for_mysql(prebuilt, src_table, mode);
/* We will need an IX lock on the destination table. */
@@ -6486,6 +6496,33 @@ create_clustered_index_when_no_primary(
}
/*****************************************************************//**
+Return a display name for the row format
+@return row format name */
+
+const char *get_row_format_name(
+/*============================*/
+enum row_type row_format) /*!< in: Row Format */
+{
+ switch (row_format) {
+ case ROW_TYPE_COMPACT:
+ return("COMPACT");
+ case ROW_TYPE_COMPRESSED:
+ return("COMPRESSED");
+ case ROW_TYPE_DYNAMIC:
+ return("DYNAMIC");
+ case ROW_TYPE_REDUNDANT:
+ return("REDUNDANT");
+ case ROW_TYPE_DEFAULT:
+ return("DEFAULT");
+ case ROW_TYPE_FIXED:
+ return("FIXED");
+ default:
+ break;
+ }
+ return("NOT USED");
+}
+
+/*****************************************************************//**
Validates the create options. We may build on this function
in future. For now, it checks two specifiers:
KEY_BLOCK_SIZE and ROW_FORMAT
@@ -6500,9 +6537,9 @@ create_options_are_valid(
columns and indexes */
HA_CREATE_INFO* create_info) /*!< in: create info. */
{
- ibool kbs_specified = FALSE;
+ ibool kbs_specified = FALSE;
ibool ret = TRUE;
-
+ enum row_type row_type = form->s->row_type;
ut_ad(thd != NULL);
@@ -6511,13 +6548,28 @@ create_options_are_valid(
return(TRUE);
}
+ /* Check for a valid Innodb ROW_FORMAT specifier. For example,
+ ROW_TYPE_FIXED can be sent to Innodb */
+ switch (row_type) {
+ case ROW_TYPE_COMPACT:
+ case ROW_TYPE_COMPRESSED:
+ case ROW_TYPE_DYNAMIC:
+ case ROW_TYPE_REDUNDANT:
+ case ROW_TYPE_DEFAULT:
+ break;
+ default:
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: invalid ROW_FORMAT specifier.");
+ ret = FALSE;
+ }
+
ut_ad(form != NULL);
ut_ad(create_info != NULL);
- /* First check if KEY_BLOCK_SIZE was specified. */
- if (create_info->key_block_size
- || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
-
+ /* First check if a non-zero KEY_BLOCK_SIZE was specified. */
+ if (create_info->key_block_size) {
kbs_specified = TRUE;
switch (create_info->key_block_size) {
case 1:
@@ -6528,13 +6580,12 @@ create_options_are_valid(
/* Valid value. */
break;
default:
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: invalid"
- " KEY_BLOCK_SIZE = %lu."
- " Valid values are"
- " [1, 2, 4, 8, 16]",
- create_info->key_block_size);
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: invalid KEY_BLOCK_SIZE = %lu."
+ " Valid values are [1, 2, 4, 8, 16]",
+ create_info->key_block_size);
ret = FALSE;
}
}
@@ -6542,110 +6593,67 @@ create_options_are_valid(
/* If KEY_BLOCK_SIZE was specified, check for its
dependencies. */
if (kbs_specified && !srv_file_per_table) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_per_table.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_per_table.");
ret = FALSE;
}
if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_format >"
- " Antelope.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_format > Antelope.");
ret = FALSE;
}
- /* Now check for ROW_FORMAT specifier. */
- if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) {
- switch (form->s->row_type) {
- const char* row_format_name;
- case ROW_TYPE_COMPRESSED:
- case ROW_TYPE_DYNAMIC:
- row_format_name
- = form->s->row_type == ROW_TYPE_COMPRESSED
- ? "COMPRESSED"
- : "DYNAMIC";
-
- /* These two ROW_FORMATs require
- srv_file_per_table and srv_file_format */
- if (!srv_file_per_table) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_per_table.",
- row_format_name);
- ret = FALSE;
-
- }
-
- if (srv_file_format < DICT_TF_FORMAT_ZIP) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_format >"
- " Antelope.",
- row_format_name);
- ret = FALSE;
- }
-
- /* Cannot specify KEY_BLOCK_SIZE with
- ROW_FORMAT = DYNAMIC.
- However, we do allow COMPRESSED to be
- specified with KEY_BLOCK_SIZE. */
- if (kbs_specified
- && form->s->row_type == ROW_TYPE_DYNAMIC) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: cannot specify"
- " ROW_FORMAT = DYNAMIC with"
- " KEY_BLOCK_SIZE.");
- ret = FALSE;
- }
-
- break;
-
- case ROW_TYPE_REDUNDANT:
- case ROW_TYPE_COMPACT:
- case ROW_TYPE_DEFAULT:
- /* Default is COMPACT. */
- row_format_name
- = form->s->row_type == ROW_TYPE_REDUNDANT
- ? "REDUNDANT"
- : "COMPACT";
-
- /* Cannot specify KEY_BLOCK_SIZE with these
- format specifiers. */
- if (kbs_specified) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: cannot specify"
- " ROW_FORMAT = %s with"
- " KEY_BLOCK_SIZE.",
- row_format_name);
- ret = FALSE;
- }
-
- break;
+ switch (row_type) {
+ case ROW_TYPE_COMPRESSED:
+ case ROW_TYPE_DYNAMIC:
+ /* These two ROW_FORMATs require srv_file_per_table
+ and srv_file_format > Antelope */
+ if (!srv_file_per_table) {
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_per_table.",
+ get_row_format_name(row_type));
+ ret = FALSE;
+ }
- default:
- push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: invalid ROW_FORMAT specifier.");
- ret = FALSE;
+ if (srv_file_format < DICT_TF_FORMAT_ZIP) {
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_format > Antelope.",
+ get_row_format_name(row_type));
+ ret = FALSE;
+ }
+ default:
+ break;
+ }
+ switch (row_type) {
+ case ROW_TYPE_REDUNDANT:
+ case ROW_TYPE_COMPACT:
+ case ROW_TYPE_DYNAMIC:
+ /* KEY_BLOCK_SIZE is only allowed with Compressed or Default */
+ if (kbs_specified) {
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: cannot specify ROW_FORMAT = %s"
+ " with KEY_BLOCK_SIZE.",
+ get_row_format_name(row_type));
+ ret = FALSE;
}
+ default:
+ break;
}
return(ret);
@@ -6771,14 +6779,15 @@ ha_innobase::create(
goto cleanup;
}
- if (create_info->key_block_size
- || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
+ if (create_info->key_block_size) {
/* Determine the page_zip.ssize corresponding to the
requested page size (key_block_size) in kilobytes. */
ulint ssize, ksize;
ulint key_block_size = create_info->key_block_size;
+ /* Set 'flags' to the correct key_block_size.
+ It will be zero if key_block_size is an invalid number.*/
for (ssize = ksize = 1; ssize <= DICT_TF_ZSSIZE_MAX;
ssize++, ksize <<= 1) {
if (key_block_size == ksize) {
@@ -6791,38 +6800,39 @@ ha_innobase::create(
}
if (!srv_file_per_table) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_per_table.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_per_table.");
flags = 0;
}
if (file_format < DICT_TF_FORMAT_ZIP) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_format >"
- " Antelope.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_format > Antelope.");
flags = 0;
}
if (!flags) {
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ignoring"
- " KEY_BLOCK_SIZE=%lu.",
- create_info->key_block_size);
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ignoring"
+ " KEY_BLOCK_SIZE=%lu.",
+ create_info->key_block_size);
}
}
row_type = form->s->row_type;
if (flags) {
- /* KEY_BLOCK_SIZE was specified. */
- if (!(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) {
- /* ROW_FORMAT was not specified;
- default to ROW_FORMAT=COMPRESSED */
+ /* if ROW_FORMAT is set to default,
+ automatically change it to COMPRESSED.*/
+ if (row_type == ROW_TYPE_DEFAULT) {
row_type = ROW_TYPE_COMPRESSED;
} else if (row_type != ROW_TYPE_COMPRESSED) {
/* ROW_FORMAT other than COMPRESSED
@@ -6832,8 +6842,7 @@ ha_innobase::create(
such combinations can be obtained
with ALTER TABLE anyway. */
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
" unless ROW_FORMAT=COMPRESSED.",
@@ -6841,7 +6850,7 @@ ha_innobase::create(
flags = 0;
}
} else {
- /* No KEY_BLOCK_SIZE */
+ /* flags == 0 means no KEY_BLOCK_SIZE.*/
if (row_type == ROW_TYPE_COMPRESSED) {
/* ROW_FORMAT=COMPRESSED without
KEY_BLOCK_SIZE implies half the
@@ -6858,33 +6867,24 @@ ha_innobase::create(
}
switch (row_type) {
- const char* row_format_name;
case ROW_TYPE_REDUNDANT:
break;
case ROW_TYPE_COMPRESSED:
case ROW_TYPE_DYNAMIC:
- row_format_name
- = row_type == ROW_TYPE_COMPRESSED
- ? "COMPRESSED"
- : "DYNAMIC";
-
if (!srv_file_per_table) {
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_per_table.",
- row_format_name);
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_per_table.",
+ get_row_format_name(row_type));
} else if (file_format < DICT_TF_FORMAT_ZIP) {
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_format >"
- " Antelope.",
- row_format_name);
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_format > Antelope.",
+ get_row_format_name(row_type));
} else {
flags |= DICT_TF_COMPACT
| (DICT_TF_FORMAT_ZIP
@@ -6896,10 +6896,10 @@ ha_innobase::create(
case ROW_TYPE_NOT_USED:
case ROW_TYPE_FIXED:
default:
- push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: assuming ROW_FORMAT=COMPACT.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: assuming ROW_FORMAT=COMPACT.");
case ROW_TYPE_DEFAULT:
case ROW_TYPE_COMPACT:
flags = DICT_TF_COMPACT;
@@ -6979,6 +6979,29 @@ ha_innobase::create(
trx, stmt, stmt_len, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
+ switch (error) {
+
+ case DB_PARENT_NO_INDEX:
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ HA_ERR_CANNOT_ADD_FOREIGN,
+ "Create table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns.\n", norm_name);
+ break;
+
+ case DB_CHILD_NO_INDEX:
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ HA_ERR_CANNOT_ADD_FOREIGN,
+ "Create table '%s' with foreign key constraint"
+ " failed. There is no index in the referencing"
+ " table where referencing columns appear"
+ " as the first columns.\n", norm_name);
+ break;
+ }
+
error = convert_error_code_to_mysql(error, flags, NULL);
if (error) {
@@ -7525,6 +7548,7 @@ ha_innobase::estimate_rows_upper_bound(void)
dict_index_t* index;
ulonglong estimate;
ulonglong local_data_file_length;
+ ulint stat_n_leaf_pages;
DBUG_ENTER("estimate_rows_upper_bound");
@@ -7544,10 +7568,12 @@ ha_innobase::estimate_rows_upper_bound(void)
index = dict_table_get_first_index(prebuilt->table);
- ut_a(index->stat_n_leaf_pages > 0);
+ stat_n_leaf_pages = index->stat_n_leaf_pages;
+
+ ut_a(stat_n_leaf_pages > 0);
local_data_file_length =
- ((ulonglong) index->stat_n_leaf_pages) * UNIV_PAGE_SIZE;
+ ((ulonglong) stat_n_leaf_pages) * UNIV_PAGE_SIZE;
/* Calculate a minimum length for a clustered index record and from
@@ -7701,9 +7727,12 @@ Returns statistics information of the table to the MySQL interpreter,
in various fields of the handle object. */
UNIV_INTERN
int
-ha_innobase::info(
-/*==============*/
- uint flag) /*!< in: what information MySQL requests */
+ha_innobase::info_low(
+/*==================*/
+ uint flag, /*!< in: what information MySQL
+ requests */
+ bool called_from_analyze) /* in: TRUE if called from
+ ::analyze() */
{
dict_table_t* ib_table;
dict_index_t* index;
@@ -7734,13 +7763,15 @@ ha_innobase::info(
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
- if (innobase_stats_on_metadata) {
+ if (called_from_analyze || innobase_stats_on_metadata) {
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
prebuilt->trx->op_info = "updating table statistics";
- dict_update_statistics(ib_table);
+ dict_update_statistics(ib_table,
+ FALSE /* update even if stats
+ are initialized */);
prebuilt->trx->op_info = "returning various info to MySQL";
}
@@ -7759,6 +7790,9 @@ ha_innobase::info(
}
if (flag & HA_STATUS_VARIABLE) {
+
+ dict_table_stats_lock(ib_table, RW_S_LATCH);
+
n_rows = ib_table->stat_n_rows;
/* Because we do not protect stat_n_rows by any mutex in a
@@ -7808,6 +7842,8 @@ ha_innobase::info(
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
+ dict_table_stats_unlock(ib_table, RW_S_LATCH);
+
/* Since fsp_get_available_space_in_free_extents() is
acquiring latches inside InnoDB, we do not call it if we
are asked by MySQL to avoid locking. Another reason to
@@ -7824,19 +7860,12 @@ ha_innobase::info(
innodb_crash_recovery is set to a high value. */
stats.delete_length = 0;
} else {
- /* lock the data dictionary to avoid races with
- ibd_file_missing and tablespace_discarded */
- row_mysql_lock_data_dictionary(prebuilt->trx);
-
- /* ib_table->space must be an existent tablespace */
- if (!ib_table->ibd_file_missing
- && !ib_table->tablespace_discarded) {
+ ullint avail_space;
- stats.delete_length =
- fsp_get_available_space_in_free_extents(
- ib_table->space) * 1024;
- } else {
+ avail_space = fsp_get_available_space_in_free_extents(
+ ib_table->space);
+ if (avail_space == ULLINT_UNDEFINED) {
THD* thd;
thd = ha_thd();
@@ -7853,9 +7882,9 @@ ha_innobase::info(
ib_table->name);
stats.delete_length = 0;
+ } else {
+ stats.delete_length = avail_space * 1024;
}
-
- row_mysql_unlock_data_dictionary(prebuilt->trx);
}
stats.check_time = 0;
@@ -7884,6 +7913,8 @@ ha_innobase::info(
table->s->keys);
}
+ dict_table_stats_lock(ib_table, RW_S_LATCH);
+
for (i = 0; i < table->s->keys; i++) {
ulong j;
/* We could get index quickly through internal
@@ -7921,8 +7952,6 @@ ha_innobase::info(
break;
}
- dict_index_stat_mutex_enter(index);
-
if (index->stat_n_diff_key_vals[j + 1] == 0) {
rec_per_key = stats.records;
@@ -7931,8 +7960,6 @@ ha_innobase::info(
index->stat_n_diff_key_vals[j + 1]);
}
- dict_index_stat_mutex_exit(index);
-
/* Since MySQL seems to favor table scans
too much over index searches, we pretend
index selectivity is 2 times better than
@@ -7949,6 +7976,8 @@ ha_innobase::info(
(ulong) rec_per_key;
}
}
+
+ dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -7982,6 +8011,18 @@ func_exit:
DBUG_RETURN(0);
}
+/*********************************************************************//**
+Returns statistics information of the table to the MySQL interpreter,
+in various fields of the handle object. */
+UNIV_INTERN
+int
+ha_innobase::info(
+/*==============*/
+ uint flag) /*!< in: what information MySQL requests */
+{
+ return(info_low(flag, false /* not called from analyze */));
+}
+
/**********************************************************************//**
Updates index cardinalities of the table, based on 8 random dives into
each index tree. This does NOT calculate exact statistics on the table.
@@ -7994,7 +8035,8 @@ ha_innobase::analyze(
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
/* Simply call ::info() with all the flags */
- info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
+ info_low(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE,
+ true /* called from analyze */);
return(0);
}
@@ -8295,8 +8337,6 @@ ha_innobase::get_foreign_key_create_info(void)
flen = ftell(srv_dict_tmpfile);
if (flen < 0) {
flen = 0;
- } else if (flen > 64000 - 1) {
- flen = 64000 - 1;
}
/* allocate buffer for the string, and
@@ -8353,7 +8393,7 @@ get_foreign_key_info(
/* Referenced (parent) table name */
ptr = dict_remove_db_name(foreign->referenced_table_name);
- len = filename_to_tablename(ptr, name_buff, sizeof(name));
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
f_key_info.referenced_table = thd_make_lex_string(thd, 0, name_buff, len, 1);
/* Dependent (child) database name */
@@ -8459,7 +8499,7 @@ ha_innobase::get_foreign_key_list(
for (foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
foreign != NULL;
- foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
pf_key_info = get_foreign_key_info(thd, foreign);
if (pf_key_info) {
f_key_list->push_back(pf_key_info);
@@ -8699,39 +8739,30 @@ ha_innobase::start_stmt(
prepared for an update of a row */
prebuilt->select_lock_type = LOCK_X;
- } else {
- if (trx->isolation_level != TRX_ISO_SERIALIZABLE
- && thd_sql_command(thd) == SQLCOM_SELECT
- && lock_type == TL_READ) {
- /* For other than temporary tables, we obtain
- no lock for consistent read (plain SELECT). */
+ } else if (trx->isolation_level != TRX_ISO_SERIALIZABLE
+ && thd_sql_command(thd) == SQLCOM_SELECT
+ && lock_type == TL_READ) {
- prebuilt->select_lock_type = LOCK_NONE;
- } else {
- /* Not a consistent read: restore the
- select_lock_type value. The value of
- stored_select_lock_type was decided in:
- 1) ::store_lock(),
- 2) ::external_lock(),
- 3) ::init_table_handle_for_HANDLER(), and
- 4) ::transactional_table_lock(). */
+ /* For other than temporary tables, we obtain
+ no lock for consistent read (plain SELECT). */
- prebuilt->select_lock_type =
- prebuilt->stored_select_lock_type;
- }
- }
+ prebuilt->select_lock_type = LOCK_NONE;
+ } else {
+ /* Not a consistent read: restore the
+ select_lock_type value. The value of
+ stored_select_lock_type was decided in:
+ 1) ::store_lock(),
+ 2) ::external_lock(),
+ 3) ::init_table_handle_for_HANDLER(), and
+ 4) ::transactional_table_lock(). */
- trx->detailed_error[0] = '\0';
+ prebuilt->select_lock_type = prebuilt->stored_select_lock_type;
+ }
- /* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
+ *trx->detailed_error = 0;
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- } else {
- innobase_register_stmt(ht, thd);
- }
+ innobase_register_trx(ht, thd, trx);
return(0);
}
@@ -8820,22 +8851,14 @@ ha_innobase::external_lock(
if (lock_type != F_UNLCK) {
/* MySQL is setting a new table lock */
- trx->detailed_error[0] = '\0';
-
- /* Set the MySQL flag to mark that there is an active
- transaction */
- if (trx->active_trans == 0) {
+ *trx->detailed_error = 0;
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- } else if (trx->n_mysql_tables_in_use == 0) {
- innobase_register_stmt(ht, thd);
- }
+ innobase_register_trx(ht, thd, trx);
if (trx->isolation_level == TRX_ISO_SERIALIZABLE
- && prebuilt->select_lock_type == LOCK_NONE
- && thd_test_options(thd,
- OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ && prebuilt->select_lock_type == LOCK_NONE
+ && thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* To get serializable execution, we let InnoDB
conceptually add 'LOCK IN SHARE MODE' to all SELECTs
@@ -8905,19 +8928,20 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0;
prebuilt->used_in_HANDLER = FALSE;
- if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
- if (trx->active_trans != 0) {
+ if (!thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+
+ if (trx_is_started(trx)) {
innobase_commit(ht, thd, TRUE);
}
- } else {
- if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && trx->global_read_view) {
- /* At low transaction isolation levels we let
- each consistent read set its own snapshot */
+ } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ && trx->global_read_view) {
- read_view_close_for_mysql(trx);
- }
+ /* At low transaction isolation levels we let
+ each consistent read set its own snapshot */
+
+ read_view_close_for_mysql(trx);
}
}
@@ -8986,12 +9010,7 @@ ha_innobase::transactional_table_lock(
/* MySQL is setting a new transactional table lock */
- /* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
-
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(ht, thd, trx);
if (THDVAR(thd, table_locks) && thd_in_lock_tables(thd)) {
ulint error = DB_SUCCESS;
@@ -9004,7 +9023,8 @@ ha_innobase::transactional_table_lock(
DBUG_RETURN((int) error);
}
- if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ if (thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* Store the current undo_no of the transaction
so that we know where to roll back if we have
@@ -10045,19 +10065,19 @@ innobase_xa_prepare(
innobase_release_stat_resources(trx);
- if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) {
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- sql_print_error("trx->active_trans == 0, but trx->conc_state != "
- "TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
if (all
- || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
+ || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* We were instructed to prepare the whole transaction, or
this is an SQL statement end and autocommit is on */
- ut_ad(trx->active_trans);
+ ut_ad(trx_is_registered_for_2pc(trx));
error = (int) trx_prepare_for_mysql(trx);
} else {
@@ -10081,9 +10101,10 @@ innobase_xa_prepare(
srv_active_wake_master_thread();
- if (thd_sql_command(thd) != SQLCOM_XA_PREPARE &&
- (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
- {
+ if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
+ && (all
+ || !thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation
@@ -10104,7 +10125,7 @@ innobase_xa_prepare(
will be between XA PREPARE and XA COMMIT, and we don't want
to block for undefined period of time. */
mysql_mutex_lock(&prepare_commit_mutex);
- trx->active_trans = 2;
+ trx_owns_prepare_commit_mutex_set(trx);
}
return(error);
@@ -10139,8 +10160,8 @@ static
int
innobase_commit_by_xid(
/*===================*/
- handlerton *hton,
- XID* xid) /*!< in: X/Open XA transaction identification */
+ handlerton* hton,
+ XID* xid) /*!< in: X/Open XA transaction identification */
{
trx_t* trx;
@@ -11160,6 +11181,13 @@ static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
innodb_change_buffering_validate,
innodb_change_buffering_update, "all");
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
+ PLUGIN_VAR_RQCMDARG,
+ "Debug flags for InnoDB change buffering (0=none)",
+ NULL, NULL, 0, 0, 1, 0);
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG,
"Number of pages that must be accessed sequentially for InnoDB to "
@@ -11223,6 +11251,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ MYSQL_SYSVAR(change_buffering_debug),
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(purge_threads),
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 4e128178f2b..f05ea8801f0 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -109,6 +109,7 @@ class ha_innobase: public handler
ulint innobase_update_autoinc(ulonglong auto_inc);
void innobase_initialize_autoinc();
dict_index_t* innobase_get_index(uint keynr);
+ int info_low(uint flag, bool called_from_analyze);
/* Init values for the class: */
public:
@@ -275,14 +276,13 @@ int thd_binlog_format(const MYSQL_THD thd);
*/
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
-#if MYSQL_VERSION_ID > 50140
/**
Check if binary logging is filtered for thread's current db.
@param thd Thread handle
@retval 1 the query is not filtered, 0 otherwise.
*/
bool thd_binlog_filter_ok(const MYSQL_THD thd);
-#endif /* MYSQL_VERSION_ID > 50140 */
+
/**
Check if the query may generate row changes which
may end up in the binary.
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 3744d16570c..c0bd3121c9c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1016,12 +1016,13 @@ ha_innobase::prepare_drop_index(
index->to_be_dropped = TRUE;
}
- /* If FOREIGN_KEY_CHECK = 1 you may not drop an index defined
+ /* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined
for a foreign key constraint because InnoDB requires that both
- tables contain indexes for the constraint. Note that CREATE
- INDEX id ON table does a CREATE INDEX and DROP INDEX, and we
- can ignore here foreign keys because a new index for the
- foreign key has already been created.
+ tables contain indexes for the constraint. Such index can
+ be dropped only if FOREIGN_KEY_CHECKS is set to 0.
+ Note that CREATE INDEX id ON table does a CREATE INDEX and
+ DROP INDEX, and we can ignore here foreign keys because a
+ new index for the foreign key has already been created.
We check for the foreign key constraints after marking the
candidate indexes for deletion, because when we check for an
diff --git a/storage/innobase/handler/mysql_addons.cc b/storage/innobase/handler/mysql_addons.cc
deleted file mode 100644
index ae6306e5db9..00000000000
--- a/storage/innobase/handler/mysql_addons.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file handler/mysql_addons.cc
-This file contains functions that need to be added to
-MySQL code but have not been added yet.
-
-Whenever you add a function here submit a MySQL bug
-report (feature request) with the implementation. Then
-write the bug number in the comment before the
-function in this file.
-
-When MySQL commits the function it can be deleted from
-here. In a perfect world this file exists but is empty.
-
-Created November 07, 2007 Vasil Dimov
-*******************************************************/
-
-#ifndef MYSQL_SERVER
-#define MYSQL_SERVER
-#endif /* MYSQL_SERVER */
-
-#include <sql_priv.h>
-
-#include "mysql_addons.h"
-#include "univ.i"
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index d560f936cb9..ab42f1ad4f3 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -49,6 +49,7 @@ Created 7/19/1997 Heikki Tuuri
#include "btr0cur.h"
#include "btr0pcur.h"
#include "btr0btr.h"
+#include "row0upd.h"
#include "sync0sync.h"
#include "dict0boot.h"
#include "fut0lst.h"
@@ -192,6 +193,11 @@ access order rules. */
/** Operations that can currently be buffered. */
UNIV_INTERN ibuf_use_t ibuf_use = IBUF_USE_ALL;
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Flag to control insert buffer debugging. */
+UNIV_INTERN uint ibuf_debug;
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
/** The insert buffer control structure */
UNIV_INTERN ibuf_t* ibuf = NULL;
@@ -1357,12 +1363,12 @@ ibuf_add_ops(
const ulint* ops) /*!< in: operation counts */
{
+ ulint i;
+
#ifndef HAVE_ATOMIC_BUILTINS
ut_ad(mutex_own(&ibuf_mutex));
#endif /* !HAVE_ATOMIC_BUILTINS */
- ulint i;
-
for (i = 0; i < IBUF_OP_COUNT; i++) {
#ifdef HAVE_ATOMIC_BUILTINS
os_atomic_increment_ulint(&arr[i], ops[i]);
@@ -2761,9 +2767,8 @@ ibuf_get_volume_buffered_count(
switch (ibuf_op) {
case IBUF_OP_INSERT:
- /* Inserts can be done by
- btr_cur_set_deleted_flag_for_ibuf(). Because
- delete-mark and insert operations can be pointing to
+ /* Inserts can be done by updating a delete-marked record.
+ Because delete-mark and insert operations can be pointing to
the same records, we must not count duplicates. */
case IBUF_OP_DELETE_MARK:
/* There must be a record to delete-mark.
@@ -3748,9 +3753,80 @@ During merge, inserts to an index page a secondary index entry extracted
from the insert buffer. */
static
void
+ibuf_insert_to_index_page_low(
+/*==========================*/
+ const dtuple_t* entry, /*!< in: buffered entry to insert */
+ buf_block_t* block, /*!< in/out: index page where the buffered
+ entry should be placed */
+ dict_index_t* index, /*!< in: record descriptor */
+ mtr_t* mtr, /*!< in/out: mtr */
+ page_cur_t* page_cur)/*!< in/out: cursor positioned on the record
+ after which to insert the buffered entry */
+{
+ const page_t* page;
+ ulint space;
+ ulint page_no;
+ ulint zip_size;
+ const page_t* bitmap_page;
+ ulint old_bits;
+
+ if (UNIV_LIKELY
+ (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) {
+ return;
+ }
+
+ /* If the record did not fit, reorganize */
+
+ btr_page_reorganize(block, index, mtr);
+ page_cur_search(block, index, entry, PAGE_CUR_LE, page_cur);
+
+ /* This time the record must fit */
+
+ if (UNIV_LIKELY
+ (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) {
+ return;
+ }
+
+ page = buf_block_get_frame(block);
+
+ ut_print_timestamp(stderr);
+
+ fprintf(stderr,
+ " InnoDB: Error: Insert buffer insert fails;"
+ " page free %lu, dtuple size %lu\n",
+ (ulong) page_get_max_insert_size(page, 1),
+ (ulong) rec_get_converted_size(index, entry, 0));
+ fputs("InnoDB: Cannot insert index record ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\nInnoDB: The table where this index record belongs\n"
+ "InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
+ "InnoDB: that table.\n", stderr);
+
+ space = page_get_space_id(page);
+ zip_size = buf_block_get_zip_size(block);
+ page_no = page_get_page_no(page);
+
+ bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr);
+ old_bits = ibuf_bitmap_page_get_bits(bitmap_page, page_no, zip_size,
+ IBUF_BITMAP_FREE, mtr);
+
+ fprintf(stderr,
+ "InnoDB: space %lu, page %lu, zip_size %lu, bitmap bits %lu\n",
+ (ulong) space, (ulong) page_no,
+ (ulong) zip_size, (ulong) old_bits);
+
+ fputs("InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
+}
+
+/************************************************************************
+During merge, inserts to an index page a secondary index entry extracted
+from the insert buffer. */
+static
+void
ibuf_insert_to_index_page(
/*======================*/
- dtuple_t* entry, /*!< in: buffered entry to insert */
+ const dtuple_t* entry, /*!< in: buffered entry to insert */
buf_block_t* block, /*!< in/out: index page where the buffered entry
should be placed */
dict_index_t* index, /*!< in: record descriptor */
@@ -3760,11 +3836,10 @@ ibuf_insert_to_index_page(
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
- page_t* bitmap_page;
- ulint old_bits;
ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry));
+ ut_ad(!buf_block_align(page)->is_hashed);
if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
!= (ibool)!!page_is_comp(page))) {
@@ -3810,71 +3885,87 @@ dump:
low_match = page_cur_search(block, index, entry,
PAGE_CUR_LE, &page_cur);
- if (low_match == dtuple_get_n_fields(entry)) {
+ if (UNIV_UNLIKELY(low_match == dtuple_get_n_fields(entry))) {
+ mem_heap_t* heap;
+ upd_t* update;
+ ulint* offsets;
page_zip_des_t* page_zip;
rec = page_cur_get_rec(&page_cur);
- page_zip = buf_block_get_page_zip(block);
- btr_cur_set_deleted_flag_for_ibuf(rec, page_zip, FALSE, mtr);
- } else {
- rec = page_cur_tuple_insert(&page_cur, entry, index, 0, mtr);
+ /* This is based on
+ row_ins_sec_index_entry_by_modify(BTR_MODIFY_LEAF). */
+ ut_ad(rec_get_deleted_flag(rec, page_is_comp(page)));
+
+ heap = mem_heap_create(1024);
+
+ offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED,
+ &heap);
+ update = row_upd_build_sec_rec_difference_binary(
+ index, entry, rec, NULL, heap);
- if (UNIV_LIKELY(rec != NULL)) {
+ page_zip = buf_block_get_page_zip(block);
+
+ if (update->n_fields == 0) {
+ /* The records only differ in the delete-mark.
+ Clear the delete-mark, like we did before
+ Bug #56680 was fixed. */
+ btr_cur_set_deleted_flag_for_ibuf(
+ rec, page_zip, FALSE, mtr);
+updated_in_place:
+ mem_heap_free(heap);
return;
}
- /* If the record did not fit, reorganize */
-
- btr_page_reorganize(block, index, mtr);
- page_cur_search(block, index, entry, PAGE_CUR_LE, &page_cur);
+ /* Copy the info bits. Clear the delete-mark. */
+ update->info_bits = rec_get_info_bits(rec, page_is_comp(page));
+ update->info_bits &= ~REC_INFO_DELETED_FLAG;
+
+ /* We cannot invoke btr_cur_optimistic_update() here,
+ because we do not have a btr_cur_t or que_thr_t,
+ as the insert buffer merge occurs at a very low level. */
+ if (!row_upd_changes_field_size_or_external(index, offsets,
+ update)
+ && (!page_zip || btr_cur_update_alloc_zip(
+ page_zip, block, index,
+ rec_offs_size(offsets), FALSE, mtr))) {
+ /* This is the easy case. Do something similar
+ to btr_cur_update_in_place(). */
+ row_upd_rec_in_place(rec, index, offsets,
+ update, page_zip);
+ goto updated_in_place;
+ }
- /* This time the record must fit */
- if (UNIV_UNLIKELY
- (!page_cur_tuple_insert(&page_cur, entry, index,
- 0, mtr))) {
- ulint space;
- ulint page_no;
- ulint zip_size;
+ /* A collation may identify values that differ in
+ storage length.
+ Some examples (1 or 2 bytes):
+ utf8_turkish_ci: I = U+0131 LATIN SMALL LETTER DOTLESS I
+ utf8_general_ci: S = U+00DF LATIN SMALL LETTER SHARP S
+ utf8_general_ci: A = U+00E4 LATIN SMALL LETTER A WITH DIAERESIS
- ut_print_timestamp(stderr);
+ latin1_german2_ci: SS = U+00DF LATIN SMALL LETTER SHARP S
- fprintf(stderr,
- " InnoDB: Error: Insert buffer insert"
- " fails; page free %lu,"
- " dtuple size %lu\n",
- (ulong) page_get_max_insert_size(
- page, 1),
- (ulong) rec_get_converted_size(
- index, entry, 0));
- fputs("InnoDB: Cannot insert index record ",
- stderr);
- dtuple_print(stderr, entry);
- fputs("\nInnoDB: The table where"
- " this index record belongs\n"
- "InnoDB: is now probably corrupt."
- " Please run CHECK TABLE on\n"
- "InnoDB: that table.\n", stderr);
+ Examples of a character (3-byte UTF-8 sequence)
+ identified with 2 or 4 characters (1-byte UTF-8 sequences):
- space = page_get_space_id(page);
- zip_size = buf_block_get_zip_size(block);
- page_no = page_get_page_no(page);
+ utf8_unicode_ci: 'II' = U+2171 SMALL ROMAN NUMERAL TWO
+ utf8_unicode_ci: '(10)' = U+247D PARENTHESIZED NUMBER TEN
+ */
- bitmap_page = ibuf_bitmap_get_map_page(
- space, page_no, zip_size, mtr);
- old_bits = ibuf_bitmap_page_get_bits(
- bitmap_page, page_no, zip_size,
- IBUF_BITMAP_FREE, mtr);
+ /* Delete the different-length record, and insert the
+ buffered one. */
- fprintf(stderr,
- "InnoDB: space %lu, page %lu,"
- " zip_size %lu, bitmap bits %lu\n",
- (ulong) space, (ulong) page_no,
- (ulong) zip_size, (ulong) old_bits);
+ lock_rec_store_on_page_infimum(block, rec);
+ page_cur_delete_rec(&page_cur, index, offsets, mtr);
+ page_cur_move_to_prev(&page_cur);
+ mem_heap_free(heap);
- fputs("InnoDB: Submit a detailed bug report"
- " to http://bugs.mysql.com\n", stderr);
- }
+ ibuf_insert_to_index_page_low(entry, block, index, mtr,
+ &page_cur);
+ lock_rec_restore_from_page_infimum(block, rec, block);
+ } else {
+ ibuf_insert_to_index_page_low(entry, block, index, mtr,
+ &page_cur);
}
}
@@ -3906,9 +3997,32 @@ ibuf_set_del_mark(
rec = page_cur_get_rec(&page_cur);
page_zip = page_cur_get_page_zip(&page_cur);
- btr_cur_set_deleted_flag_for_ibuf(rec, page_zip, TRUE, mtr);
+ /* Delete mark the old index record. According to a
+ comment in row_upd_sec_index_entry(), it can already
+ have been delete marked if a lock wait occurred in
+ row_ins_index_entry() in a previous invocation of
+ row_upd_sec_index_entry(). */
+
+ if (UNIV_LIKELY
+ (!rec_get_deleted_flag(
+ rec, dict_table_is_comp(index->table)))) {
+ btr_cur_set_deleted_flag_for_ibuf(rec, page_zip,
+ TRUE, mtr);
+ }
} else {
- /* This can happen benignly in some situations. */
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: unable to find a record to delete-mark\n",
+ stderr);
+ fputs("InnoDB: tuple ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\n"
+ "InnoDB: record ", stderr);
+ rec_print(stderr, page_cur_get_rec(&page_cur), index);
+ putc('\n', stderr);
+ fputs("\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
}
}
@@ -3983,10 +4097,7 @@ ibuf_delete(
mem_heap_free(heap);
}
} else {
- /* This can happen benignly in some situations: either when
- we crashed at just the right time, or on database startup
- when we redo some old log entries (due to worse stored
- position granularity on disk than in memory). */
+ /* The record must have been purged already. */
}
}
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 3912f315f2a..e213c22937f 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -105,26 +105,35 @@ btr_root_get(
Gets a buffer page and declares its latching order level. */
UNIV_INLINE
buf_block_t*
-btr_block_get(
-/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr); /*!< in: mtr */
-/**************************************************************//**
-Gets a buffer page and declares its latching order level. */
-UNIV_INLINE
-page_t*
-btr_page_get(
-/*=========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr); /*!< in: mtr */
+btr_block_get_func(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number */
+ ulint mode, /*!< in: latch mode */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in/out: mtr */
+ __attribute__((nonnull));
+/** Gets a buffer page and declares its latching order level.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes or 0 for uncompressed pages
+@param page_no page number
+@param mode latch mode
+@param mtr mini-transaction handle
+@return the block descriptor */
+# define btr_block_get(space,zip_size,page_no,mode,mtr) \
+ btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
+/** Gets a buffer page and declares its latching order level.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes or 0 for uncompressed pages
+@param page_no page number
+@param mode latch mode
+@param mtr mini-transaction handle
+@return the uncompressed page frame */
+# define btr_page_get(space,zip_size,page_no,mode,mtr) \
+ buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
Gets the index id field of a page.
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index 6c580a0bd6e..ccf41904fd0 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -39,18 +39,21 @@ Created 6/2/1994 Heikki Tuuri
Gets a buffer page and declares its latching order level. */
UNIV_INLINE
buf_block_t*
-btr_block_get(
-/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr) /*!< in: mtr */
+btr_block_get_func(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number */
+ ulint mode, /*!< in: latch mode */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in/out: mtr */
{
buf_block_t* block;
- block = buf_page_get(space, zip_size, page_no, mode, mtr);
+ block = buf_page_get_gen(space, zip_size, page_no, mode,
+ NULL, BUF_GET, file, line, mtr);
if (mode != RW_NO_LATCH) {
@@ -61,23 +64,6 @@ btr_block_get(
}
/**************************************************************//**
-Gets a buffer page and declares its latching order level. */
-UNIV_INLINE
-page_t*
-btr_page_get(
-/*=========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr) /*!< in: mtr */
-{
- return(buf_block_get_frame(btr_block_get(space, zip_size, page_no,
- mode, mtr)));
-}
-
-/**************************************************************//**
Sets the index id field of a page. */
UNIV_INLINE
void
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 16a557850a3..9865ebfbfc2 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -243,6 +243,22 @@ btr_cur_pessimistic_insert(
que_thr_t* thr, /*!< in: query thread or NULL */
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
+See if there is enough place in the page modification log to log
+an update-in-place.
+@return TRUE if enough place */
+UNIV_INTERN
+ibool
+btr_cur_update_alloc_zip(
+/*=====================*/
+ page_zip_des_t* page_zip,/*!< in/out: compressed page */
+ buf_block_t* block, /*!< in/out: buffer page */
+ dict_index_t* index, /*!< in: the index corresponding to the block */
+ ulint length, /*!< in: size needed */
+ ibool create, /*!< in: TRUE=delete-and-insert,
+ FALSE=update-in-place */
+ mtr_t* mtr) /*!< in: mini-transaction */
+ __attribute__((nonnull, warn_unused_result));
+/*************************************************************//**
Updates a record when the update causes no size changes in its fields.
@return DB_SUCCESS or error number */
UNIV_INTERN
@@ -492,7 +508,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or error */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
ulint
btr_store_big_rec_extern_fields(
diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h
index 03588d18197..b255d8c9351 100644
--- a/storage/innobase/include/buf0buddy.h
+++ b/storage/innobase/include/buf0buddy.h
@@ -36,7 +36,7 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
diff --git a/storage/innobase/include/buf0buddy.ic b/storage/innobase/include/buf0buddy.ic
index 387eacc754a..e50c33ea15a 100644
--- a/storage/innobase/include/buf0buddy.ic
+++ b/storage/innobase/include/buf0buddy.ic
@@ -35,7 +35,7 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
@@ -86,7 +86,7 @@ buf_buddy_get_slot(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index f33ef65ddf2..a42eba57fd2 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -69,7 +69,7 @@ Created 11/5/1995 Heikki Tuuri
#define BUF_POOL_WATCH_SIZE 1 /*!< Maximum number of concurrent
buffer pool watches */
-extern buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS]; /*!< The buffer pools
+extern buf_pool_t* buf_pool_ptr; /*!< The buffer pools
of the database */
#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/*!< If this is set TRUE, the program
@@ -96,7 +96,7 @@ enum buf_page_state {
BUF_BLOCK_ZIP_FREE = 0, /*!< contains a free
compressed page */
BUF_BLOCK_POOL_WATCH = 0, /*!< a sentinel for the buffer pool
- watch, element of buf_pool_watch[] */
+ watch, element of buf_pool->watch[] */
BUF_BLOCK_ZIP_PAGE, /*!< contains a clean
compressed page */
BUF_BLOCK_ZIP_DIRTY, /*!< contains a compressed
@@ -1034,6 +1034,15 @@ buf_page_address_fold(
ulint space, /*!< in: space id */
ulint offset) /*!< in: offset of the page within space */
__attribute__((const));
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+ const buf_pool_t* buf_pool) /*!< in: buffer pool */
+ __attribute__((nonnull, const));
/******************************************************************//**
Returns the buffer pool instance given a page instance
@return buf_pool */
@@ -1065,8 +1074,9 @@ Returns the buffer pool instance given its array index
UNIV_INLINE
buf_pool_t*
buf_pool_from_array(
-/*====================*/
- ulint index); /*!< in: array index to get buffer pool instance from */
+/*================*/
+ ulint index); /*!< in: array index to get
+ buffer pool instance from */
/******************************************************************//**
Returns the control block of a file page, NULL if not found.
@return block, NULL if not found */
@@ -1204,16 +1214,21 @@ struct buf_page_struct{
unsigned io_fix:2; /*!< type of pending I/O operation;
also protected by buf_pool->mutex
@see enum buf_io_fix */
- unsigned buf_fix_count:25;/*!< count of how manyfold this block
+ unsigned buf_fix_count:19;/*!< count of how manyfold this block
is currently bufferfixed */
+ unsigned buf_pool_index:6;/*!< index number of the buffer pool
+ that this block belongs to */
+# if MAX_BUFFER_POOLS > 64
+# error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
+# endif
/* @} */
#endif /* !UNIV_HOTBACKUP */
page_zip_des_t zip; /*!< compressed page; zip.data
(but not the data it points to) is
- also protected by buf_pool_mutex;
+ also protected by buf_pool->mutex;
state == BUF_BLOCK_ZIP_PAGE and
zip.data == NULL means an active
- buf_pool_watch */
+ buf_pool->watch */
#ifndef UNIV_HOTBACKUP
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
@@ -1224,15 +1239,16 @@ struct buf_page_struct{
#endif /* UNIV_DEBUG */
/** @name Page flushing fields
- All these are protected by buf_pool_mutex. */
+ All these are protected by buf_pool->mutex. */
/* @{ */
UT_LIST_NODE_T(buf_page_t) list;
/*!< based on state, this is a
list node, protected either by
- buf_pool_mutex or by
- flush_list_mutex, in one of the
- following lists in buf_pool:
+ buf_pool->mutex or by
+ buf_pool->flush_list_mutex,
+ in one of the following lists in
+ buf_pool:
- BUF_BLOCK_NOT_USED: free
- BUF_BLOCK_FILE_PAGE: flush_list
@@ -1242,9 +1258,9 @@ struct buf_page_struct{
If bpage is part of flush_list
then the node pointers are
- covered by flush_list_mutex.
+ covered by buf_pool->flush_list_mutex.
Otherwise these pointers are
- protected by buf_pool_mutex.
+ protected by buf_pool->mutex.
The contents of the list node
is undefined if !in_flush_list
@@ -1256,17 +1272,18 @@ struct buf_page_struct{
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
- when flush_list_mutex is free, the
- following should hold: in_flush_list
+ when buf_pool->flush_list_mutex is
+ free, the following should hold:
+ in_flush_list
== (state == BUF_BLOCK_FILE_PAGE
|| state == BUF_BLOCK_ZIP_DIRTY)
Writes to this field must be
covered by both block->mutex
- and flush_list_mutex. Hence
+ and buf_pool->flush_list_mutex. Hence
reads can happen while holding
any one of the two mutexes */
ibool in_free_list; /*!< TRUE if in buf_pool->free; when
- buf_pool_mutex is free, the following
+ buf_pool->mutex is free, the following
should hold: in_free_list
== (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */
@@ -1286,7 +1303,7 @@ struct buf_page_struct{
modifications are on disk.
Writes to this field must be
covered by both block->mutex
- and flush_list_mutex. Hence
+ and buf_pool->flush_list_mutex. Hence
reads can happen while holding
any one of the two mutexes */
/* @} */
@@ -1322,8 +1339,6 @@ struct buf_page_struct{
frees a page in buffer pool */
# endif /* UNIV_DEBUG_FILE_ACCESSES */
#endif /* !UNIV_HOTBACKUP */
- buf_pool_t* buf_pool; /*!< buffer pool instance this
- page belongs to */
};
/** The buffer control block structure */
@@ -1661,20 +1676,13 @@ struct buf_pool_struct{
/* @} */
};
-/** mutex protecting the buffer pool struct and control blocks, except the
-read-write lock in them */
-extern mutex_t buf_pool_mutex;
-/** mutex protecting the control blocks of compressed-only pages
-(of type buf_page_t, not buf_block_t) */
-extern mutex_t buf_pool_zip_mutex;
-
-/** @name Accessors for buf_pool_mutex.
-Use these instead of accessing buf_pool_mutex directly. */
+/** @name Accessors for buf_pool->mutex.
+Use these instead of accessing buf_pool->mutex directly. */
/* @{ */
-/** Test if buf_pool_mutex is owned. */
+/** Test if a buffer pool mutex is owned. */
#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
-/** Acquire the buffer pool mutex. */
+/** Acquire a buffer pool mutex. */
#define buf_pool_mutex_enter(b) do { \
ut_ad(!mutex_own(&b->zip_mutex)); \
mutex_enter(&b->mutex); \
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 713b7cb990d..e2e83de0a78 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -46,6 +46,48 @@ buf_pool_get_curr_size(void)
return(srv_buf_pool_curr_size);
}
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+ const buf_pool_t* buf_pool) /*!< in: buffer pool */
+{
+ ulint i = buf_pool - buf_pool_ptr;
+ ut_ad(i < MAX_BUFFER_POOLS);
+ ut_ad(i < srv_buf_pool_instances);
+ return(i);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a page instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_bpage(
+/*================*/
+ const buf_page_t* bpage) /*!< in: buffer pool page */
+{
+ ulint i;
+ i = bpage->buf_pool_index;
+ ut_ad(i < srv_buf_pool_instances);
+ return(&buf_pool_ptr[i]);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a block instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_block(
+/*================*/
+ const buf_block_t* block) /*!< in: block */
+{
+ return(buf_pool_from_bpage(&block->page));
+}
+
/*********************************************************************//**
Gets the current size of buffer buf_pool in pages.
@return size in pages*/
@@ -886,33 +928,6 @@ buf_block_buf_fix_dec(
}
/******************************************************************//**
-Returns the buffer pool instance given a page instance
-@return buf_pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_from_bpage(
-/*================*/
- const buf_page_t* bpage) /*!< in: buffer pool page */
-{
- /* Every page must be in some buffer pool. */
- ut_ad(bpage->buf_pool != NULL);
-
- return(bpage->buf_pool);
-}
-
-/******************************************************************//**
-Returns the buffer pool instance given a block instance
-@return buf_pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_from_block(
-/*================*/
- const buf_block_t* block) /*!< in: block */
-{
- return(buf_pool_from_bpage(&block->page));
-}
-
-/******************************************************************//**
Returns the buffer pool instance given space and offset of page
@return buffer pool */
UNIV_INLINE
@@ -929,7 +944,7 @@ buf_pool_get(
ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
fold = buf_page_address_fold(space, ignored_offset);
index = fold % srv_buf_pool_instances;
- return buf_pool_ptr[index];
+ return(&buf_pool_ptr[index]);
}
/******************************************************************//**
@@ -939,10 +954,12 @@ UNIV_INLINE
buf_pool_t*
buf_pool_from_array(
/*================*/
- ulint index) /*!< in: array index to get
+ ulint index) /*!< in: array index to get
buffer pool instance from */
{
- return buf_pool_ptr[index];
+ ut_ad(index < MAX_BUFFER_POOLS);
+ ut_ad(index < srv_buf_pool_instances);
+ return(&buf_pool_ptr[index]);
}
/******************************************************************//**
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index 366063ab105..28d9b90e755 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -84,6 +84,21 @@ buf_flush_init_for_writing(
ib_uint64_t newest_lsn); /*!< in: newest modification lsn
to the page */
#ifndef UNIV_HOTBACKUP
+# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/********************************************************************//**
+Writes a flushable page asynchronously from the buffer pool to a file.
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
+function, and they will be released by this function after flushing.
+This is loosely based on buf_flush_batch() and buf_flush_page().
+@return TRUE if the page was flushed and the mutexes released */
+UNIV_INTERN
+ibool
+buf_flush_page_try(
+/*===============*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_block_t* block) /*!< in/out: buffer control block */
+ __attribute__((nonnull, warn_unused_result));
+# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
/*******************************************************************//**
This utility flushes dirty blocks from the end of the LRU list.
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h
index 850cf2e2975..d7fa0b9cd44 100644
--- a/storage/innobase/include/data0type.h
+++ b/storage/innobase/include/data0type.h
@@ -174,10 +174,13 @@ store the charset-collation number; one byte is left unused, though */
/* Pack mbminlen, mbmaxlen to mbminmaxlen. */
#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \
((mbmaxlen) * DATA_MBMAX + (mbminlen))
-/* Get mbminlen from mbminmaxlen. */
-#define DATA_MBMINLEN(mbminmaxlen) UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), 1)
+/* Get mbminlen from mbminmaxlen. Cast the result of UNIV_EXPECT to ulint
+because in GCC it returns a long. */
+#define DATA_MBMINLEN(mbminmaxlen) ((ulint) \
+ UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), \
+ 1))
/* Get mbmaxlen from mbminmaxlen. */
-#define DATA_MBMAXLEN(mbminmaxlen) ((mbminmaxlen) / DATA_MBMAX)
+#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX))
#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 01bb1b80754..8a71fa6511a 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -104,6 +104,12 @@ enum db_err {
DB_FOREIGN_EXCEED_MAX_CASCADE, /* Foreign key constraint related
cascading delete/update exceeds
maximum allowed depth */
+ DB_CHILD_NO_INDEX, /* the child (foreign) table does not
+ have an index that contains the
+ foreign keys as its prefix columns */
+ DB_PARENT_NO_INDEX, /* the parent table does not
+ have an index that contains the
+ foreign keys as its prefix columns */
/* The following are partial failure codes */
DB_FAIL = 1000,
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 029cf408141..033c435bf16 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -345,7 +345,8 @@ void
dict_table_replace_index_in_foreign_list(
/*=====================================*/
dict_table_t* table, /*!< in/out: table */
- dict_index_t* index); /*!< in: index to be replaced */
+ dict_index_t* index, /*!< in: index to be replaced */
+ const trx_t* trx); /*!< in: transaction handle */
/*********************************************************************//**
Checks if a index is defined for a foreign key constraint. Index is a part
of a foreign key constraint if the index is referenced by foreign key
@@ -1080,19 +1081,13 @@ Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
void
-dict_update_statistics_low(
-/*=======================*/
- dict_table_t* table, /*!< in/out: table */
- ibool has_dict_mutex);/*!< in: TRUE if the caller has the
- dictionary mutex */
-/*********************************************************************//**
-Calculates new estimates for table and index statistics. The statistics
-are used in query optimization. */
-UNIV_INTERN
-void
dict_update_statistics(
/*===================*/
- dict_table_t* table); /*!< in/out: table */
+ dict_table_t* table, /*!< in/out: table */
+ ibool only_calc_if_missing_stats);/*!< in: only
+ update/recalc the stats if they have
+ not been initialized yet, otherwise
+ do nothing */
/********************************************************************//**
Reserves the dictionary system mutex for MySQL. */
UNIV_INTERN
@@ -1106,21 +1101,25 @@ void
dict_mutex_exit_for_mysql(void);
/*===========================*/
/**********************************************************************//**
-Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
-index->id is used to pick the right mutex and it should not change
-before dict_index_stat_mutex_exit() is called on this index. */
+Lock the appropriate latch to protect a given table's statistics.
+table->id is used to pick the corresponding latch from a global array of
+latches. */
UNIV_INTERN
void
-dict_index_stat_mutex_enter(
-/*========================*/
- const dict_index_t* index); /*!< in: index */
+dict_table_stats_lock(
+/*==================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode); /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
/**********************************************************************//**
-Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+Unlock the latch that has been locked by dict_table_stats_lock() */
UNIV_INTERN
void
-dict_index_stat_mutex_exit(
-/*=======================*/
- const dict_index_t* index); /*!< in: index */
+dict_table_stats_unlock(
+/*====================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode); /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
/********************************************************************//**
Checks if the database name in two table names is the same.
@return TRUE if same db name */
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d7d98787bcf..3a6336f1a01 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -717,6 +717,14 @@ fil_page_get_type(
/*==============*/
const byte* page); /*!< in: file page */
+/*******************************************************************//**
+Returns TRUE if a single-table tablespace is being deleted.
+@return TRUE if being deleted */
+UNIV_INTERN
+ibool
+fil_tablespace_is_being_deleted(
+/*============================*/
+ ulint id); /*!< in: space id */
typedef struct fil_space_struct fil_space_t;
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index 4bb59be6a3e..dd05bcb0608 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -63,6 +63,11 @@ typedef enum {
/** Operations that can currently be buffered. */
extern ibuf_use_t ibuf_use;
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Flag to control insert buffer debugging. */
+extern uint ibuf_debug;
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
/** The insert buffer control structure */
extern ibuf_t* ibuf;
diff --git a/storage/innobase/include/mysql_addons.h b/storage/innobase/include/mysql_addons.h
deleted file mode 100644
index 17660c18710..00000000000
--- a/storage/innobase/include/mysql_addons.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/mysql_addons.h
-This file contains functions that need to be added to
-MySQL code but have not been added yet.
-
-Whenever you add a function here submit a MySQL bug
-report (feature request) with the implementation. Then
-write the bug number in the comment before the
-function in this file.
-
-When MySQL commits the function it can be deleted from
-here. In a perfect world this file exists but is empty.
-
-Created November 07, 2007 Vasil Dimov
-*******************************************************/
diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h
index ec5ccee3e27..b294d7421c8 100644
--- a/storage/innobase/include/os0sync.h
+++ b/storage/innobase/include/os0sync.h
@@ -76,6 +76,12 @@ struct os_event_struct {
/*!< list of all created events */
};
+/** Denotes an infinite delay for os_event_wait_time() */
+#define OS_SYNC_INFINITE_TIME ULINT_UNDEFINED
+
+/** Return value of os_event_wait_time() when the time is exceeded */
+#define OS_SYNC_TIME_EXCEEDED 1
+
/** Operating system mutex */
typedef struct os_mutex_struct os_mutex_str_t;
/** Operating system mutex handle */
@@ -173,7 +179,23 @@ os_event_wait_low(
os_event_reset(). */
#define os_event_wait(event) os_event_wait_low(event, 0)
+#define os_event_wait_time(e, t) os_event_wait_time_low(event, t, 0)
+/**********************************************************//**
+Waits for an event object until it is in the signaled state or
+a timeout is exceeded. In Unix the timeout is always infinite.
+@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
+UNIV_INTERN
+ulint
+os_event_wait_time_low(
+/*===================*/
+ os_event_t event, /*!< in: event to wait */
+ ulint time_in_usec, /*!< in: timeout in
+ microseconds, or
+ OS_SYNC_INFINITE_TIME */
+ ib_int64_t reset_sig_count); /*!< in: zero or the value
+ returned by previous call of
+ os_event_reset(). */
/*********************************************************//**
Creates an operating system mutex semaphore. Because these are slow, the
mutex semaphore of InnoDB itself (mutex_t) should be used where possible.
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index 5a3dd609ea5..9ffb5c7d9e5 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -801,9 +801,9 @@ UNIV_INTERN
void
rec_print(
/*======*/
- FILE* file, /*!< in: file where to print */
- const rec_t* rec, /*!< in: physical record */
- dict_index_t* index); /*!< in: record descriptor */
+ FILE* file, /*!< in: file where to print */
+ const rec_t* rec, /*!< in: physical record */
+ const dict_index_t* index); /*!< in: record descriptor */
#endif /* UNIV_HOTBACKUP */
/* Maximum lengths for the data in a physical record if the offsets
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 9f93565ddb7..810973e61a7 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -84,9 +84,10 @@ ulint
row_ins_index_entry(
/*================*/
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
- ibool foreign,/*!< in: TRUE=check foreign key constraints */
+ ibool foreign,/*!< in: TRUE=check foreign key constraints
+ (foreign=FALSE only during CREATE INDEX) */
que_thr_t* thr); /*!< in: query thread */
/***********************************************************//**
Inserts a row to a table. This is a high-level function used in
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index d9c26a2ee3b..dd619406ab9 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -538,6 +538,10 @@ struct mysql_row_templ_struct {
Innobase record in the current index;
not defined if template_type is
ROW_MYSQL_WHOLE_ROW */
+ ulint clust_rec_field_no; /*!< field number of the column in an
+ Innobase record in the clustered index;
+ not defined if template_type is
+ ROW_MYSQL_WHOLE_ROW */
ulint mysql_col_offset; /*!< offset of the column in the MySQL
row format */
ulint mysql_col_len; /*!< length of the column in the MySQL
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index f7bec6f7561..051beb09277 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -126,8 +126,8 @@ UNIV_INTERN
void
row_upd_index_entry_sys_field(
/*==========================*/
- const dtuple_t* entry, /*!< in: index entry, where the memory buffers
- for sys fields are already allocated:
+ dtuple_t* entry, /*!< in/out: index entry, where the memory
+ buffers for sys fields are already allocated:
the function just copies the new values to
them */
dict_index_t* index, /*!< in: clustered index */
@@ -167,8 +167,11 @@ row_upd_changes_field_size_or_external(
const upd_t* update);/*!< in: update vector */
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
-Replaces the new column values stored in the update vector to the record
-given. No field size changes are allowed. */
+Replaces the new column values stored in the update vector to the
+record given. No field size changes are allowed. This function is
+usually invoked on a clustered index. The only use case for a
+secondary index is row_ins_sec_index_entry_by_modify() or its
+counterpart in ibuf_insert_to_index_page(). */
UNIV_INTERN
void
row_upd_rec_in_place(
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 5d2fb808dc9..98b07f5e893 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -57,6 +57,15 @@ extern const char srv_mysql50_table_name_prefix[9];
thread starts running */
extern os_event_t srv_lock_timeout_thread_event;
+/* The monitor thread waits on this event. */
+extern os_event_t srv_monitor_event;
+
+/* The lock timeout thread waits on this event. */
+extern os_event_t srv_timeout_event;
+
+/* The error monitor thread waits on this event. */
+extern os_event_t srv_error_event;
+
/* If the last data file is auto-extended, we add this many pages to it
at a time */
#define SRV_AUTO_EXTEND_INCREMENT \
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 940e583350a..fb3a24c5ee5 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -85,7 +85,6 @@ extern mysql_pfs_key_t hash_table_mutex_key;
extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
extern mysql_pfs_key_t ibuf_mutex_key;
extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
-extern mysql_pfs_key_t ios_mutex_key;
extern mysql_pfs_key_t log_sys_mutex_key;
extern mysql_pfs_key_t log_flush_order_mutex_key;
extern mysql_pfs_key_t kernel_mutex_key;
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 6a817ccdc8e..b4a4aa0ca44 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -470,6 +470,20 @@ struct trx_struct{
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
+ /*------------------------------*/
+ /* MySQL has a transaction coordinator to coordinate two phase
+ commit between multiple storage engines and the binary log. When
+ an engine participates in a transaction, it's responsible for
+ registering itself using the trans_register_ha() API. */
+ unsigned is_registered:1;/* This flag is set to 1 after the
+ transaction has been registered with
+ the coordinator using the XA API, and
+ is set to 0 after commit or rollback. */
+ unsigned owns_prepare_mutex:1;/* 1 if owns prepare mutex, if
+ this is set to 1 then registered should
+ also be set to 1. This is used in the
+ XA code */
+ /*------------------------------*/
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
ulint check_foreigns; /* normally TRUE, but if the user
wants to suppress foreign key checks,
@@ -500,9 +514,6 @@ struct trx_struct{
in that case we must flush the log
in trx_commit_complete_for_mysql() */
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
- ulint active_trans; /*!< 1 - if a transaction in MySQL
- is active. 2 - if prepare_commit_mutex
- was taken */
ulint has_search_latch;
/* TRUE if this trx has latched the
search system latch in S-mode */
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index 54809f9c2d5..937e9d7ef79 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -262,8 +262,6 @@ UNIV_INTERN
page_t*
trx_undo_set_state_at_finish(
/*=========================*/
- trx_rseg_t* rseg, /*!< in: rollback segment memory object */
- trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 1e8e60fea52..9cf823c2ff3 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 1
-#define INNODB_VERSION_BUGFIX 3
+#define INNODB_VERSION_BUGFIX 4
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -374,6 +374,9 @@ typedef unsigned long long int ullint;
/** The generic InnoDB system object identifier data type */
typedef ib_uint64_t ib_id_t;
+/* The 'undefined' value for a ullint */
+#define ULLINT_UNDEFINED ((ullint)(-1))
+
/* This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
#define ibool ulint
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index dcfca1b6315..f38ef48df4e 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -4859,11 +4859,11 @@ loop:
ut_a(rec);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
-
+#if 0
fprintf(stderr,
"Validating %lu %lu\n",
(ulong) space, (ulong) page_no);
-
+#endif
lock_mutex_exit_kernel();
/* If this thread is holding the file space
diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
index 401cede1d8f..3fef4ee4fc5 100644
--- a/storage/innobase/log/log0log.c
+++ b/storage/innobase/log/log0log.c
@@ -3098,10 +3098,15 @@ loop:
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
- || srv_lock_timeout_active || srv_monitor_active)) {
+ || srv_lock_timeout_active
+ || srv_monitor_active)) {
mutex_exit(&kernel_mutex);
+ os_event_set(srv_error_event);
+ os_event_set(srv_monitor_event);
+ os_event_set(srv_timeout_event);
+
goto loop;
}
@@ -3128,6 +3133,8 @@ loop:
log_buffer_flush_to_disk();
+ mutex_exit(&kernel_mutex);
+
return; /* We SKIP ALL THE REST !! */
}
diff --git a/storage/innobase/mysql-test/patches/README b/storage/innobase/mysql-test/patches/README
deleted file mode 100644
index 122d756e9e3..00000000000
--- a/storage/innobase/mysql-test/patches/README
+++ /dev/null
@@ -1,30 +0,0 @@
-This directory contains patches that need to be applied to the MySQL
-source tree in order to get the mysql-test suite to succeed (when
-storage/innobase is replaced with this InnoDB branch). Things to keep
-in mind when adding new patches here:
-
-* The patch must be appliable from the mysql top-level source directory.
-
-* The patch filename must end in ".diff".
-
-* All patches here are expected to apply cleanly to the latest MySQL 5.1
- tree when storage/innobase is replaced with this InnoDB branch. If
- changes to either of those cause the patch to fail, then please check
- whether the patch is still needed and, if yes, adjust it so it applies
- cleanly.
-
-* If applicable, always submit the patch at http://bugs.mysql.com and
- name the file here like bug%d.diff. Once the patch is committed to
- MySQL remove the file from here.
-
-* If the patch cannot be proposed for inclusion in the MySQL source tree
- (via http://bugs.mysql.com) then add a comment at the beginning of the
- patch, explaining the problem it is solving, how it does solve it and
- why it is not applicable for inclusion in the MySQL source tree.
- Obviously this is a very bad situation and should be avoided at all
- costs, especially for files that are in the MySQL source repository
- (not in storage/innobase).
-
-* If you ever need to add a patch here that is not related to mysql-test
- suite, then please move this directory from ./mysql-test/patches to
- ./patches and remove this text.
diff --git a/storage/innobase/mysql-test/patches/index_merge_innodb-explain.diff b/storage/innobase/mysql-test/patches/index_merge_innodb-explain.diff
deleted file mode 100644
index d1ed8afc778..00000000000
--- a/storage/innobase/mysql-test/patches/index_merge_innodb-explain.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-InnoDB's estimate for the index cardinality depends on a pseudo random
-number generator (it picks up random pages to sample). After an
-optimization that was made in r2625 the following EXPLAINs started
-returning a different number of rows (3 instead of 4).
-
-This patch adjusts the result file.
-
-This patch cannot be proposed to MySQL because the failures occur only
-in this tree and do not occur in the standard InnoDB 5.1. Furthermore,
-the file index_merge2.inc is used by other engines too.
-
---- mysql-test/r/index_merge_innodb.result.orig 2008-09-30 18:32:13.000000000 +0300
-+++ mysql-test/r/index_merge_innodb.result 2008-09-30 18:33:01.000000000 +0300
-@@ -111,7 +111,7 @@
- explain select count(*) from t1 where
- key1a = 2 and key1b is null and key2a = 2 and key2b is null;
- id select_type table type possible_keys key key_len ref rows Extra
--1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 4 Using intersect(i1,i2); Using where; Using index
-+1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 3 Using intersect(i1,i2); Using where; Using index
- select count(*) from t1 where
- key1a = 2 and key1b is null and key2a = 2 and key2b is null;
- count(*)
-@@ -119,7 +119,7 @@
- explain select count(*) from t1 where
- key1a = 2 and key1b is null and key3a = 2 and key3b is null;
- id select_type table type possible_keys key key_len ref rows Extra
--1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 4 Using intersect(i1,i3); Using where; Using index
-+1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 3 Using intersect(i1,i3); Using where; Using index
- select count(*) from t1 where
- key1a = 2 and key1b is null and key3a = 2 and key3b is null;
- count(*)
diff --git a/storage/innobase/mysql-test/patches/information_schema.diff b/storage/innobase/mysql-test/patches/information_schema.diff
deleted file mode 100644
index a3a21f7a08d..00000000000
--- a/storage/innobase/mysql-test/patches/information_schema.diff
+++ /dev/null
@@ -1,124 +0,0 @@
---- mysql-test/r/information_schema.result.orig 2009-01-31 03:38:50.000000000 +0200
-+++ mysql-test/r/information_schema.result 2009-01-31 07:51:58.000000000 +0200
-@@ -71,6 +71,13 @@
- TRIGGERS
- USER_PRIVILEGES
- VIEWS
-+INNODB_CMP_RESET
-+INNODB_TRX
-+INNODB_CMPMEM_RESET
-+INNODB_LOCK_WAITS
-+INNODB_CMPMEM
-+INNODB_CMP
-+INNODB_LOCKS
- columns_priv
- db
- event
-@@ -799,6 +806,8 @@
- TABLES UPDATE_TIME datetime
- TABLES CHECK_TIME datetime
- TRIGGERS CREATED datetime
-+INNODB_TRX trx_started datetime
-+INNODB_TRX trx_wait_started datetime
- event execute_at datetime
- event last_executed datetime
- event starts datetime
-@@ -852,7 +861,7 @@
- flush privileges;
- SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
- table_schema count(*)
--information_schema 28
-+information_schema 35
- mysql 22
- create table t1 (i int, j int);
- create trigger trg1 before insert on t1 for each row
-@@ -1267,6 +1276,13 @@
- TRIGGERS TRIGGER_SCHEMA
- USER_PRIVILEGES GRANTEE
- VIEWS TABLE_SCHEMA
-+INNODB_CMP_RESET page_size
-+INNODB_TRX trx_id
-+INNODB_CMPMEM_RESET page_size
-+INNODB_LOCK_WAITS requesting_trx_id
-+INNODB_CMPMEM page_size
-+INNODB_CMP page_size
-+INNODB_LOCKS lock_id
- SELECT t.table_name, c1.column_name
- FROM information_schema.tables t
- INNER JOIN
-@@ -1310,6 +1326,13 @@
- TRIGGERS TRIGGER_SCHEMA
- USER_PRIVILEGES GRANTEE
- VIEWS TABLE_SCHEMA
-+INNODB_CMP_RESET page_size
-+INNODB_TRX trx_id
-+INNODB_CMPMEM_RESET page_size
-+INNODB_LOCK_WAITS requesting_trx_id
-+INNODB_CMPMEM page_size
-+INNODB_CMP page_size
-+INNODB_LOCKS lock_id
- SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
- MAX(table_name)
- VIEWS
-@@ -1386,6 +1409,13 @@
- FILES information_schema.FILES 1
- GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
- GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
-+INNODB_CMP information_schema.INNODB_CMP 1
-+INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
-+INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
-+INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
-+INNODB_LOCKS information_schema.INNODB_LOCKS 1
-+INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
-+INNODB_TRX information_schema.INNODB_TRX 1
- KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
- PARTITIONS information_schema.PARTITIONS 1
- PLUGINS information_schema.PLUGINS 1
-diff mysql-test/r/information_schema_db.result.orig mysql-test/r/information_schema_db.result
---- mysql-test/r/information_schema_db.result.orig 2008-08-04 09:27:49.000000000 +0300
-+++ mysql-test/r/information_schema_db.result 2008-10-07 12:26:31.000000000 +0300
-@@ -33,6 +33,13 @@
- TRIGGERS
- USER_PRIVILEGES
- VIEWS
-+INNODB_CMP_RESET
-+INNODB_TRX
-+INNODB_CMPMEM_RESET
-+INNODB_LOCK_WAITS
-+INNODB_CMPMEM
-+INNODB_CMP
-+INNODB_LOCKS
- show tables from INFORMATION_SCHEMA like 'T%';
- Tables_in_information_schema (T%)
- TABLES
-diff mysql-test/r/mysqlshow.result.orig mysql-test/r/mysqlshow.result
---- mysql-test/r/mysqlshow.result.orig 2008-08-04 09:27:51.000000000 +0300
-+++ mysql-test/r/mysqlshow.result 2008-10-07 12:35:39.000000000 +0300
-@@ -107,6 +107,13 @@
- | TRIGGERS |
- | USER_PRIVILEGES |
- | VIEWS |
-+| INNODB_CMP_RESET |
-+| INNODB_TRX |
-+| INNODB_CMPMEM_RESET |
-+| INNODB_LOCK_WAITS |
-+| INNODB_CMPMEM |
-+| INNODB_CMP |
-+| INNODB_LOCKS |
- +---------------------------------------+
- Database: INFORMATION_SCHEMA
- +---------------------------------------+
-@@ -140,6 +147,13 @@
- | TRIGGERS |
- | USER_PRIVILEGES |
- | VIEWS |
-+| INNODB_CMP_RESET |
-+| INNODB_TRX |
-+| INNODB_CMPMEM_RESET |
-+| INNODB_LOCK_WAITS |
-+| INNODB_CMPMEM |
-+| INNODB_CMP |
-+| INNODB_LOCKS |
- +---------------------------------------+
- Wildcard: inf_rmation_schema
- +--------------------+
diff --git a/storage/innobase/mysql-test/patches/innodb_change_buffering_basic.diff b/storage/innobase/mysql-test/patches/innodb_change_buffering_basic.diff
deleted file mode 100644
index bfa1609a97c..00000000000
--- a/storage/innobase/mysql-test/patches/innodb_change_buffering_basic.diff
+++ /dev/null
@@ -1,60 +0,0 @@
---- mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test.orig Mon Mar 15 16:15:22 2010
-+++ mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test Fri Mar 19 01:19:09 2010
-@@ -11,8 +11,8 @@
- #
- # exists as global only
- #
----echo Valid values are 'inserts' and 'none'
--select @@global.innodb_change_buffering in ('inserts', 'none');
-+--echo Valid values are 'inserts', 'deletes', 'changes', 'purges', 'all', and 'none'
-+select @@global.innodb_change_buffering in ('inserts', 'deletes', 'changes', 'purges', 'all', 'none');
- select @@global.innodb_change_buffering;
- --error ER_INCORRECT_GLOBAL_LOCAL_VAR
- select @@session.innodb_change_buffering;
-
---- mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result.orig Mon Mar 15 16:15:22 2010
-+++ mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result Fri Mar 19 01:23:58 2010
-@@ -1,28 +1,28 @@
- SET @start_global_value = @@global.innodb_change_buffering;
- SELECT @start_global_value;
- @start_global_value
--inserts
--Valid values are 'inserts' and 'none'
--select @@global.innodb_change_buffering in ('inserts', 'none');
--@@global.innodb_change_buffering in ('inserts', 'none')
-+all
-+Valid values are 'inserts', 'deletes', 'changes', 'purges', 'all', and 'none'
-+select @@global.innodb_change_buffering in ('inserts', 'deletes', 'changes', 'purges', 'all', 'none');
-+@@global.innodb_change_buffering in ('inserts', 'deletes', 'changes', 'purges', 'all', 'none')
- 1
- select @@global.innodb_change_buffering;
- @@global.innodb_change_buffering
--inserts
-+all
- select @@session.innodb_change_buffering;
- ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable
- show global variables like 'innodb_change_buffering';
- Variable_name Value
--innodb_change_buffering inserts
-+innodb_change_buffering all
- show session variables like 'innodb_change_buffering';
- Variable_name Value
--innodb_change_buffering inserts
-+innodb_change_buffering all
- select * from information_schema.global_variables where variable_name='innodb_change_buffering';
- VARIABLE_NAME VARIABLE_VALUE
--INNODB_CHANGE_BUFFERING inserts
-+INNODB_CHANGE_BUFFERING all
- select * from information_schema.session_variables where variable_name='innodb_change_buffering';
- VARIABLE_NAME VARIABLE_VALUE
--INNODB_CHANGE_BUFFERING inserts
-+INNODB_CHANGE_BUFFERING all
- set global innodb_change_buffering='none';
- select @@global.innodb_change_buffering;
- @@global.innodb_change_buffering
-@@ -60,4 +60,4 @@
- SET @@global.innodb_change_buffering = @start_global_value;
- SELECT @@global.innodb_change_buffering;
- @@global.innodb_change_buffering
--inserts
-+all
diff --git a/storage/innobase/mysql-test/patches/innodb_file_per_table.diff b/storage/innobase/mysql-test/patches/innodb_file_per_table.diff
deleted file mode 100644
index 8b7ae2036c9..00000000000
--- a/storage/innobase/mysql-test/patches/innodb_file_per_table.diff
+++ /dev/null
@@ -1,47 +0,0 @@
-diff mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test.orig mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test
---- mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test.orig 2008-10-07 11:32:30.000000000 +0300
-+++ mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test 2008-10-07 11:52:14.000000000 +0300
-@@ -37,10 +37,6 @@
- # Check if Value can set #
- ####################################################################
-
----error ER_INCORRECT_GLOBAL_LOCAL_VAR
--SET @@GLOBAL.innodb_file_per_table=1;
----echo Expected error 'Read only variable'
--
- SELECT COUNT(@@GLOBAL.innodb_file_per_table);
- --echo 1 Expected
-
-@@ -52,7 +48,7 @@
- # Check if the value in GLOBAL Table matches value in variable #
- #################################################################
-
--SELECT @@GLOBAL.innodb_file_per_table = VARIABLE_VALUE
-+SELECT IF(@@GLOBAL.innodb_file_per_table,'ON','OFF') = VARIABLE_VALUE
- FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE VARIABLE_NAME='innodb_file_per_table';
- --echo 1 Expected
-diff mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result.orig mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result
---- mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result.orig 2008-10-07 11:32:02.000000000 +0300
-+++ mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result 2008-10-07 11:52:47.000000000 +0300
-@@ -4,18 +4,15 @@
- 1
- 1 Expected
- '#---------------------BS_STVARS_028_02----------------------#'
--SET @@GLOBAL.innodb_file_per_table=1;
--ERROR HY000: Variable 'innodb_file_per_table' is a read only variable
--Expected error 'Read only variable'
- SELECT COUNT(@@GLOBAL.innodb_file_per_table);
- COUNT(@@GLOBAL.innodb_file_per_table)
- 1
- 1 Expected
- '#---------------------BS_STVARS_028_03----------------------#'
--SELECT @@GLOBAL.innodb_file_per_table = VARIABLE_VALUE
-+SELECT IF(@@GLOBAL.innodb_file_per_table,'ON','OFF') = VARIABLE_VALUE
- FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE VARIABLE_NAME='innodb_file_per_table';
--@@GLOBAL.innodb_file_per_table = VARIABLE_VALUE
-+IF(@@GLOBAL.innodb_file_per_table,'ON','OFF') = VARIABLE_VALUE
- 1
- 1 Expected
- SELECT COUNT(@@GLOBAL.innodb_file_per_table);
diff --git a/storage/innobase/mysql-test/patches/innodb_lock_wait_timeout.diff b/storage/innobase/mysql-test/patches/innodb_lock_wait_timeout.diff
deleted file mode 100644
index bc61a0f5841..00000000000
--- a/storage/innobase/mysql-test/patches/innodb_lock_wait_timeout.diff
+++ /dev/null
@@ -1,55 +0,0 @@
---- mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test.orig 2008-08-04 09:28:16.000000000 +0300
-+++ mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test 2008-10-07 11:14:15.000000000 +0300
-@@ -37,10 +37,6 @@
- # Check if Value can set #
- ####################################################################
-
----error ER_INCORRECT_GLOBAL_LOCAL_VAR
--SET @@GLOBAL.innodb_lock_wait_timeout=1;
----echo Expected error 'Read only variable'
--
- SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
- --echo 1 Expected
-
-@@ -84,13 +80,9 @@
- SELECT COUNT(@@innodb_lock_wait_timeout);
- --echo 1 Expected
-
----Error ER_INCORRECT_GLOBAL_LOCAL_VAR
- SELECT COUNT(@@local.innodb_lock_wait_timeout);
----echo Expected error 'Variable is a GLOBAL variable'
-
----Error ER_INCORRECT_GLOBAL_LOCAL_VAR
- SELECT COUNT(@@SESSION.innodb_lock_wait_timeout);
----echo Expected error 'Variable is a GLOBAL variable'
-
- SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
- --echo 1 Expected
---- mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result.orig 2008-08-04 09:27:50.000000000 +0300
-+++ mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result 2008-10-07 11:15:14.000000000 +0300
-@@ -4,9 +4,6 @@
- 1
- 1 Expected
- '#---------------------BS_STVARS_032_02----------------------#'
--SET @@GLOBAL.innodb_lock_wait_timeout=1;
--ERROR HY000: Variable 'innodb_lock_wait_timeout' is a read only variable
--Expected error 'Read only variable'
- SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
- COUNT(@@GLOBAL.innodb_lock_wait_timeout)
- 1
-@@ -39,11 +36,11 @@
- 1
- 1 Expected
- SELECT COUNT(@@local.innodb_lock_wait_timeout);
--ERROR HY000: Variable 'innodb_lock_wait_timeout' is a GLOBAL variable
--Expected error 'Variable is a GLOBAL variable'
-+COUNT(@@local.innodb_lock_wait_timeout)
-+1
- SELECT COUNT(@@SESSION.innodb_lock_wait_timeout);
--ERROR HY000: Variable 'innodb_lock_wait_timeout' is a GLOBAL variable
--Expected error 'Variable is a GLOBAL variable'
-+COUNT(@@SESSION.innodb_lock_wait_timeout)
-+1
- SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
- COUNT(@@GLOBAL.innodb_lock_wait_timeout)
- 1
diff --git a/storage/innobase/mysql-test/patches/innodb_thread_concurrency_basic.diff b/storage/innobase/mysql-test/patches/innodb_thread_concurrency_basic.diff
deleted file mode 100644
index 72e5457905f..00000000000
--- a/storage/innobase/mysql-test/patches/innodb_thread_concurrency_basic.diff
+++ /dev/null
@@ -1,31 +0,0 @@
---- mysql-test/suite/sys_vars/r/innodb_thread_concurrency_basic.result.orig 2008-12-04 18:45:52 -06:00
-+++ mysql-test/suite/sys_vars/r/innodb_thread_concurrency_basic.result 2009-02-12 02:05:48 -06:00
-@@ -1,19 +1,19 @@
- SET @global_start_value = @@global.innodb_thread_concurrency;
- SELECT @global_start_value;
- @global_start_value
--8
-+0
- '#--------------------FN_DYNVARS_046_01------------------------#'
- SET @@global.innodb_thread_concurrency = 0;
- SET @@global.innodb_thread_concurrency = DEFAULT;
- SELECT @@global.innodb_thread_concurrency;
- @@global.innodb_thread_concurrency
--8
-+0
- '#---------------------FN_DYNVARS_046_02-------------------------#'
- SET innodb_thread_concurrency = 1;
- ERROR HY000: Variable 'innodb_thread_concurrency' is a GLOBAL variable and should be set with SET GLOBAL
- SELECT @@innodb_thread_concurrency;
- @@innodb_thread_concurrency
--8
-+0
- SELECT local.innodb_thread_concurrency;
- ERROR 42S02: Unknown table 'local' in field list
- SET global innodb_thread_concurrency = 0;
-@@ -93,4 +93,4 @@
- SET @@global.innodb_thread_concurrency = @global_start_value;
- SELECT @@global.innodb_thread_concurrency;
- @@global.innodb_thread_concurrency
--8
-+0
diff --git a/storage/innobase/mysql-test/patches/partition_innodb.diff b/storage/innobase/mysql-test/patches/partition_innodb.diff
deleted file mode 100644
index 01bc073008e..00000000000
--- a/storage/innobase/mysql-test/patches/partition_innodb.diff
+++ /dev/null
@@ -1,59 +0,0 @@
-The partition_innodb test only fails if run immediately after innodb_trx_weight.
-The reason for this failure is that innodb_trx_weight creates deadlocks and
-leaves something like this in the SHOW ENGINE INNODB STATUS output:
-
- ------------------------
- LATEST DETECTED DEADLOCK
- ------------------------
- 090213 10:26:25
- *** (1) TRANSACTION:
- TRANSACTION 313, ACTIVE 0 sec, OS thread id 13644672 inserting
- mysql tables in use 1, locked 1
- LOCK WAIT 4 lock struct(s), heap size 488, 3 row lock(s)
- MySQL thread id 3, query id 36 localhost root update
-
-The regular expressions that partition_innodb is using are intended to extract
-the lock structs and row locks numbers from another part of the output:
-
- ------------
- TRANSACTIONS
- ------------
- Trx id counter 31D
- Purge done for trx's n:o < 0 undo n:o < 0
- History list length 4
- LIST OF TRANSACTIONS FOR EACH SESSION:
- ---TRANSACTION 0, not started, OS thread id 13645056
- 0 lock struct(s), heap size 488, 0 row lock(s)
- MySQL thread id 8, query id 81 localhost root
-
-In the InnoDB Plugin a transaction id is not printed as 2 consecutive
-decimal integers (as it is in InnoDB 5.1) but rather as a single
-hexadecimal integer. Thus the regular expressions somehow pick the wrong
-part of the SHOW ENGINE INNODB STATUS output.
-
-So after the regular expressions are adjusted to the InnoDB Plugin's variant
-of trx_id prinout, then they pick the expected part of the output.
-
-This patch cannot be proposed to MySQL because the failures occur only
-in this tree and do not occur in the standard InnoDB 5.1.
-
---- mysql-test/t/partition_innodb.test 2008-11-14 22:51:17 +0000
-+++ mysql-test/t/partition_innodb.test 2009-02-13 07:36:07 +0000
-@@ -27,14 +27,14 @@
-
- # grouping/referencing in replace_regex is very slow on long strings,
- # removing all before/after the interesting row before grouping/referencing
----replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
-+--replace_regex /.*---TRANSACTION [0-9A-F]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
- SHOW ENGINE InnoDB STATUS;
-
- UPDATE t1 SET data = data*2 WHERE data = 2;
-
- # grouping/referencing in replace_regex is very slow on long strings,
- # removing all before/after the interesting row before grouping/referencing
----replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
-+--replace_regex /.*---TRANSACTION [0-9A-F]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
- SHOW ENGINE InnoDB STATUS;
-
- SET @@session.tx_isolation = @old_tx_isolation;
-
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 6c17ded0073..93d2f72746d 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -1295,10 +1295,12 @@ UNIV_INTERN
void
os_file_set_nocache(
/*================*/
- int fd, /*!< in: file descriptor to alter */
- const char* file_name, /*!< in: file name, used in the
- diagnostic message */
- const char* operation_name) /*!< in: "open" or "create"; used in the
+ int fd /*!< in: file descriptor to alter */
+ __attribute__((unused)),
+ const char* file_name /*!< in: used in the diagnostic message */
+ __attribute__((unused)),
+ const char* operation_name __attribute__((unused)))
+ /*!< in: "open" or "create"; used in the
diagnostic message */
{
/* some versions of Solaris may not have DIRECTIO_ON */
@@ -2398,7 +2400,10 @@ os_file_read_func(
ulint i;
#endif /* !UNIV_HOTBACKUP */
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
os_bytes_read_since_printout += n;
@@ -2524,7 +2529,10 @@ os_file_read_no_error_handling_func(
ulint i;
#endif /* !UNIV_HOTBACKUP */
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
os_bytes_read_since_printout += n;
@@ -2656,7 +2664,10 @@ os_file_write_func(
ulint i;
#endif /* !UNIV_HOTBACKUP */
- ut_a((offset & 0xFFFFFFFF) == offset);
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
+ ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_writes++;
@@ -3619,6 +3630,10 @@ os_aio_array_reserve_slot(
ulint slots_per_seg;
ulint local_seg;
+#ifdef WIN_ASYNC_IO
+ ut_a((len & 0xFFFFFFFFUL) == len);
+#endif
+
/* No need of a mutex. Only reading constant fields */
slots_per_seg = array->n_slots / array->n_segments;
@@ -3994,6 +4009,9 @@ os_aio_func(
ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(os_aio_validate());
+#ifdef WIN_ASYNC_IO
+ ut_ad((n & 0xFFFFFFFFUL) == n);
+#endif
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
@@ -4269,16 +4287,18 @@ os_aio_windows_handle(
__FILE__, __LINE__);
#endif
+ ut_a((slot->len & 0xFFFFFFFFUL) == slot->len);
+
switch (slot->type) {
case OS_FILE_WRITE:
ret = WriteFile(slot->file, slot->buf,
- slot->len, &len,
+ (DWORD) slot->len, &len,
&(slot->control));
break;
case OS_FILE_READ:
ret = ReadFile(slot->file, slot->buf,
- slot->len, &len,
+ (DWORD) slot->len, &len,
&(slot->control));
break;
diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c
index 3c70e93aae0..b461f9b7c78 100644
--- a/storage/innobase/os/os0sync.c
+++ b/storage/innobase/os/os0sync.c
@@ -72,6 +72,9 @@ UNIV_INTERN ulint os_event_count = 0;
UNIV_INTERN ulint os_mutex_count = 0;
UNIV_INTERN ulint os_fast_mutex_count = 0;
+/* The number of microsecnds in a second. */
+static const ulint MICROSECS_IN_A_SECOND = 1000000;
+
/* Because a mutex is embedded inside an event and there is an
event embedded inside a mutex, on free, this generates a recursive call.
This version of the free event function doesn't acquire the global lock */
@@ -122,6 +125,70 @@ os_cond_init(
}
/*********************************************************//**
+Do a timed wait on condition variable.
+@return TRUE if timed out, FALSE otherwise */
+UNIV_INLINE
+ibool
+os_cond_wait_timed(
+/*===============*/
+ os_cond_t* cond, /*!< in: condition variable. */
+ os_fast_mutex_t* mutex, /*!< in: fast mutex */
+#ifndef __WIN__
+ const struct timespec* abstime /*!< in: timeout */
+#else
+ DWORD time_in_ms /*!< in: timeout in
+ milliseconds*/
+#endif /* !__WIN__ */
+)
+{
+#ifdef __WIN__
+ BOOL ret;
+ DWORD err;
+
+ ut_a(sleep_condition_variable != NULL);
+
+ ret = sleep_condition_variable(cond, mutex, time_in_ms);
+
+ if (!ret) {
+ err = GetLastError();
+ /* From http://msdn.microsoft.com/en-us/library/ms686301%28VS.85%29.aspx,
+ "Condition variables are subject to spurious wakeups
+ (those not associated with an explicit wake) and stolen wakeups
+ (another thread manages to run before the woken thread)."
+ Check for both types of timeouts.
+ Conditions are checked by the caller.*/
+ if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
+ return(TRUE);
+ }
+ }
+
+ ut_a(ret);
+
+ return(FALSE);
+#else
+ int ret;
+
+ ret = pthread_cond_timedwait(cond, mutex, abstime);
+
+ switch (ret) {
+ case 0:
+ case ETIMEDOUT:
+ /* We play it safe by checking for EINTR even though
+ according to the POSIX documentation it can't return EINTR. */
+ case EINTR:
+ break;
+
+ default:
+ fprintf(stderr, " InnoDB: pthread_cond_timedwait() returned: "
+ "%d: abstime={%lu,%lu}\n",
+ ret, (ulong) abstime->tv_sec, (ulong) abstime->tv_nsec);
+ ut_error;
+ }
+
+ return(ret == ETIMEDOUT);
+#endif
+}
+/*********************************************************//**
Wait on condition variable */
UNIV_INLINE
void
@@ -572,6 +639,128 @@ os_event_wait_low(
}
}
+/**********************************************************//**
+Waits for an event object until it is in the signaled state or
+a timeout is exceeded.
+@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
+UNIV_INTERN
+ulint
+os_event_wait_time_low(
+/*===================*/
+ os_event_t event, /*!< in: event to wait */
+ ulint time_in_usec, /*!< in: timeout in
+ microseconds, or
+ OS_SYNC_INFINITE_TIME */
+ ib_int64_t reset_sig_count) /*!< in: zero or the value
+ returned by previous call of
+ os_event_reset(). */
+
+{
+ ibool timed_out = FALSE;
+ ib_int64_t old_signal_count;
+
+#ifdef __WIN__
+ DWORD time_in_ms;
+
+ if (!srv_use_native_conditions) {
+ DWORD err;
+
+ ut_a(event);
+
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ time_in_ms = time_in_usec / 1000;
+ err = WaitForSingleObject(event->handle, time_in_ms);
+ } else {
+ err = WaitForSingleObject(event->handle, INFINITE);
+ }
+
+ if (err == WAIT_OBJECT_0) {
+ return(0);
+ } else if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
+ return(OS_SYNC_TIME_EXCEEDED);
+ }
+
+ ut_error;
+ /* Dummy value to eliminate compiler warning. */
+ return(42);
+ } else {
+ ut_a(sleep_condition_variable != NULL);
+
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ time_in_ms = time_in_usec / 1000;
+ } else {
+ time_in_ms = INFINITE;
+ }
+ }
+#else
+ struct timespec abstime;
+
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ struct timeval tv;
+ int ret;
+ ulint sec;
+ ulint usec;
+
+ ret = ut_usectime(&sec, &usec);
+ ut_a(ret == 0);
+
+ tv.tv_sec = sec;
+ tv.tv_usec = usec;
+
+ tv.tv_usec += time_in_usec;
+
+ if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) {
+ tv.tv_sec += time_in_usec / MICROSECS_IN_A_SECOND;
+ tv.tv_usec %= MICROSECS_IN_A_SECOND;
+ }
+
+ abstime.tv_sec = tv.tv_sec;
+ abstime.tv_nsec = tv.tv_usec * 1000;
+ } else {
+ abstime.tv_nsec = 999999999;
+ abstime.tv_sec = (time_t) ULINT_MAX;
+ }
+
+ ut_a(abstime.tv_nsec <= 999999999);
+
+#endif /* __WIN__ */
+
+ os_fast_mutex_lock(&event->os_mutex);
+
+ if (reset_sig_count) {
+ old_signal_count = reset_sig_count;
+ } else {
+ old_signal_count = event->signal_count;
+ }
+
+ do {
+ if (event->is_set == TRUE
+ || event->signal_count != old_signal_count) {
+
+ break;
+ }
+
+ timed_out = os_cond_wait_timed(
+ &event->cond_var, &event->os_mutex,
+#ifndef __WIN__
+ &abstime
+#else
+ time_in_ms
+#endif /* !__WIN__ */
+ );
+
+ } while (!timed_out);
+
+ os_fast_mutex_unlock(&event->os_mutex);
+
+ if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
+
+ os_thread_exit(NULL);
+ }
+
+ return(timed_out ? OS_SYNC_TIME_EXCEEDED : 0);
+}
+
/*********************************************************//**
Creates an operating system mutex semaphore. Because these are slow, the
mutex semaphore of InnoDB itself (mutex_t) should be used where possible.
diff --git a/storage/innobase/plug.in b/storage/innobase/plug.in
deleted file mode 100644
index 9367b70c52e..00000000000
--- a/storage/innobase/plug.in
+++ /dev/null
@@ -1,233 +0,0 @@
-#
-# Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# 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
-#
-
-MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine],
- [Transactional Tables using InnoDB], [default,max,max-no-ndb])
-MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
-MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a])
-MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la])
-MYSQL_PLUGIN_ACTIONS(innobase, [
- AC_CHECK_HEADERS(sched.h)
- AC_CHECK_SIZEOF(int, 4)
- AC_CHECK_SIZEOF(long, 4)
- AC_CHECK_SIZEOF(void*, 4)
- AC_CHECK_FUNCS(sched_yield fdatasync localtime_r)
- AC_C_BIGENDIAN
- case "$target_os" in
- lin*)
- AC_CHECK_HEADER(libaio.h,
- AC_CHECK_LIB(aio, io_setup,
- LIBS="$LIBS -laio"
- AC_DEFINE(LINUX_NATIVE_AIO, [1],
- [Linux native async I/O support]),
- AC_MSG_WARN([No Linux native async I/O])),
- AC_MSG_WARN([No Linux native async I/O]))
-
- CFLAGS="$CFLAGS -DUNIV_LINUX";;
- hpux10*)
- CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
- hp*)
- CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
- aix*)
- CFLAGS="$CFLAGS -DUNIV_AIX";;
- irix*|osf*|sysv5uw7*|openbsd*)
- CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
- *solaris*|*SunOS*)
- CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
- esac
-
- INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN"
-
- case "$target_cpu" in
- x86_64)
- # The AMD64 ABI forbids absolute addresses in shared libraries
- ;;
- *86)
- # Use absolute addresses on IA-32
- INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
- ;;
- esac
- AC_SUBST(INNODB_DYNAMIC_CFLAGS)
-
- AC_MSG_CHECKING(whether GCC atomic builtins are available)
- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
- AC_TRY_RUN(
- [
- int main()
- {
- long x;
- long y;
- long res;
- char c;
-
- x = 10;
- y = 123;
- res = __sync_bool_compare_and_swap(&x, x, y);
- if (!res || x != y) {
- return(1);
- }
-
- x = 10;
- y = 123;
- res = __sync_bool_compare_and_swap(&x, x + 1, y);
- if (res || x != 10) {
- return(1);
- }
-
- x = 10;
- y = 123;
- res = __sync_add_and_fetch(&x, y);
- if (res != 123 + 10 || x != 123 + 10) {
- return(1);
- }
-
- c = 10;
- res = __sync_lock_test_and_set(&c, 123);
- if (res != 10 || c != 123) {
- return(1);
- }
-
- return(0);
- }
- ],
- [
- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
- [GCC atomic builtins are available])
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_RESULT(no)
- ]
- )
-
- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
- AC_TRY_RUN(
- [
- #include <pthread.h>
- #include <string.h>
-
- int main(int argc, char** argv) {
- pthread_t x1;
- pthread_t x2;
- pthread_t x3;
-
- memset(&x1, 0x0, sizeof(x1));
- memset(&x2, 0x0, sizeof(x2));
- memset(&x3, 0x0, sizeof(x3));
-
- __sync_bool_compare_and_swap(&x1, x2, x3);
-
- return(0);
- }
- ],
- [
- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
- [pthread_t can be used by GCC atomic builtins])
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_RESULT(no)
- ]
- )
-
- AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
- # either define HAVE_IB_SOLARIS_ATOMICS or not
- AC_CHECK_FUNCS(atomic_add_long \
- atomic_cas_32 \
- atomic_cas_64 \
- atomic_cas_ulong,
-
- AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
- [Define to 1 if Solaris libc atomic functions \
- are available])
- )
-
- AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
- # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
- AC_TRY_RUN(
- [
- #include <pthread.h>
- #include <string.h>
-
- int main(int argc, char** argv) {
- pthread_t x1;
- pthread_t x2;
- pthread_t x3;
-
- memset(&x1, 0x0, sizeof(x1));
- memset(&x2, 0x0, sizeof(x2));
- memset(&x3, 0x0, sizeof(x3));
-
- if (sizeof(pthread_t) == 4) {
-
- atomic_cas_32(&x1, x2, x3);
-
- } else if (sizeof(pthread_t) == 8) {
-
- atomic_cas_64(&x1, x2, x3);
-
- } else {
-
- return(1);
- }
-
- return(0);
- }
- ],
- [
- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
- [pthread_t can be used by solaris atomics])
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_RESULT(no)
- ]
- )
-
- # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
- # to use in the source
- AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
-
- # Check for x86 PAUSE instruction
- AC_MSG_CHECKING(for x86 PAUSE instruction)
- # We have to actually try running the test program, because of a bug
- # in Solaris on x86_64, where it wrongly reports that PAUSE is not
- # supported when trying to run an application. See
- # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
- # We use ib_ prefix to avoid collisoins if this code is added to
- # mysql's configure.in.
- AC_TRY_RUN(
- [
- int main() {
- __asm__ __volatile__ ("pause");
- return(0);
- }
- ],
- [
- AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_RESULT(no)
- ],
- [
- AC_MSG_RESULT(no)
- ]
- )
- ])
-
-# vim: set ft=config:
diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c
index 37ba8ca2ffe..a54b5013155 100644
--- a/storage/innobase/rem/rem0rec.c
+++ b/storage/innobase/rem/rem0rec.c
@@ -1749,9 +1749,9 @@ UNIV_INTERN
void
rec_print(
/*======*/
- FILE* file, /*!< in: file where to print */
- const rec_t* rec, /*!< in: physical record */
- dict_index_t* index) /*!< in: record descriptor */
+ FILE* file, /*!< in: file where to print */
+ const rec_t* rec, /*!< in: physical record */
+ const dict_index_t* index) /*!< in: record descriptor */
{
ut_ad(index);
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index 8fd8c4f8532..09ae80adff4 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -1768,7 +1768,7 @@ ulint
row_ins_duplicate_error_in_clust(
/*=============================*/
btr_cur_t* cursor, /*!< in: B-tree cursor */
- dtuple_t* entry, /*!< in: entry to insert */
+ const dtuple_t* entry, /*!< in: entry to insert */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
{
@@ -1964,7 +1964,7 @@ row_ins_index_entry_low(
depending on whether we wish optimistic or
pessimistic descent down the index tree */
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr) /*!< in: query thread */
{
@@ -2150,9 +2150,10 @@ ulint
row_ins_index_entry(
/*================*/
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
- ibool foreign,/*!< in: TRUE=check foreign key constraints */
+ ibool foreign,/*!< in: TRUE=check foreign key constraints
+ (foreign=FALSE only during CREATE INDEX) */
que_thr_t* thr) /*!< in: query thread */
{
ulint err;
diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
index 1b96ff50e66..0c68d6477a4 100644
--- a/storage/innobase/row/row0merge.c
+++ b/storage/innobase/row/row0merge.c
@@ -2042,7 +2042,7 @@ row_merge_drop_index(
/* Replace this index with another equivalent index for all
foreign key constraints on this table where this index is used */
- dict_table_replace_index_in_foreign_list(table, index);
+ dict_table_replace_index_in_foreign_list(table, index, trx);
dict_index_remove_from_cache(table, index);
trx->op_info = "";
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 75c33587198..9b2c348a349 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -503,7 +503,7 @@ row_mysql_convert_row_to_innobase(
row is used, as row may contain
pointers to this record! */
{
- mysql_row_templ_t* templ;
+ const mysql_row_templ_t*templ;
dfield_t* dfield;
ulint i;
@@ -930,7 +930,8 @@ row_update_statistics_if_needed(
if (counter > 2000000000
|| ((ib_int64_t)counter > 16 + table->stat_n_rows / 16)) {
- dict_update_statistics(table);
+ dict_update_statistics(table, FALSE /* update even if stats
+ are initialized */);
}
}
@@ -1938,15 +1939,13 @@ err_exit:
err = trx->error_state;
- if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
+ switch (err) {
+ case DB_SUCCESS:
+ break;
+ case DB_OUT_OF_FILE_SPACE:
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, NULL);
- /* TO DO: free table? The code below will dereference
- table->name, though. */
- }
- switch (err) {
- case DB_OUT_OF_FILE_SPACE:
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: cannot create table ",
stderr);
@@ -1961,9 +1960,13 @@ err_exit:
break;
case DB_DUPLICATE_KEY:
+ default:
/* We may also get err == DB_ERROR if the .ibd file for the
table already exists */
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, NULL);
+ dict_mem_table_free(table);
break;
}
@@ -2839,15 +2842,6 @@ row_truncate_table_for_mysql(
trx->table_id = table->id;
- /* Lock all index trees for this table, as we will
- truncate the table/index and possibly change their metadata.
- All DML/DDL are blocked by table level lock, with
- a few exceptions such as queries into information schema
- about the table, MySQL could try to access index stats
- for this kind of query, we need to use index locks to
- sync up */
- dict_table_x_lock_indexes(table);
-
if (table->space && !table->dir_path_of_temp_table) {
/* Discard and create the single-table tablespace. */
ulint space = table->space;
@@ -2860,6 +2854,11 @@ row_truncate_table_for_mysql(
dict_hdr_get_new_id(NULL, NULL, &space);
+ /* Lock all index trees for this table. We must
+ do so after dict_hdr_get_new_id() to preserve
+ the latch order */
+ dict_table_x_lock_indexes(table);
+
if (space == ULINT_UNDEFINED
|| fil_create_new_single_table_tablespace(
space, table->name, FALSE, flags,
@@ -2893,6 +2892,15 @@ row_truncate_table_for_mysql(
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
mtr_commit(&mtr);
}
+ } else {
+ /* Lock all index trees for this table, as we will
+ truncate the table/index and possibly change their metadata.
+ All DML/DDL are blocked by table level lock, with
+ a few exceptions such as queries into information schema
+ about the table, MySQL could try to access index stats
+ for this kind of query, we need to use index locks to
+ sync up */
+ dict_table_x_lock_indexes(table);
}
/* scan SYS_INDEXES for all indexes of the table */
@@ -3015,7 +3023,8 @@ next_rec:
dict_table_autoinc_lock(table);
dict_table_autoinc_initialize(table, 1);
dict_table_autoinc_unlock(table);
- dict_update_statistics(table);
+ dict_update_statistics(table, FALSE /* update even if stats are
+ initialized */);
trx_commit_for_mysql(trx);
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 480fc11fb6e..14deff2d465 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -104,6 +104,18 @@ row_sel_sec_rec_is_for_blob(
ulint len;
byte buf[DICT_MAX_INDEX_COL_LEN];
+ ut_a(clust_len >= BTR_EXTERN_FIELD_REF_SIZE);
+
+ if (UNIV_UNLIKELY
+ (!memcmp(clust_field + clust_len - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) {
+ /* The externally stored field was not written yet.
+ This record should only be seen by
+ recv_recovery_rollback_active() or any
+ TRX_ISO_READ_UNCOMMITTED transactions. */
+ return(FALSE);
+ }
+
len = btr_copy_externally_stored_field_prefix(buf, sizeof buf,
zip_size,
clust_field, clust_len);
@@ -2667,21 +2679,22 @@ row_sel_store_mysql_rec(
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
const rec_t* rec, /*!< in: Innobase record in the index
which was described in prebuilt's
- template; must be protected by
- a page latch */
+ template, or in the clustered index;
+ must be protected by a page latch */
+ ibool rec_clust, /*!< in: TRUE if rec is in the
+ clustered index instead of
+ prebuilt->index */
const ulint* offsets) /*!< in: array returned by
- rec_get_offsets() */
+ rec_get_offsets(rec) */
{
- mysql_row_templ_t* templ;
- mem_heap_t* extern_field_heap = NULL;
- mem_heap_t* heap;
- const byte* data;
- ulint len;
- ulint i;
+ mem_heap_t* extern_field_heap = NULL;
+ mem_heap_t* heap;
+ ulint i;
ut_ad(prebuilt->mysql_template);
ut_ad(prebuilt->default_rec);
ut_ad(rec_offs_validate(rec, NULL, offsets));
+ ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
mem_heap_free(prebuilt->blob_heap);
@@ -2690,10 +2703,15 @@ row_sel_store_mysql_rec(
for (i = 0; i < prebuilt->n_template; i++) {
- templ = prebuilt->mysql_template + i;
+ const mysql_row_templ_t*templ = prebuilt->mysql_template + i;
+ const byte* data;
+ ulint len;
+ ulint field_no;
+
+ field_no = rec_clust
+ ? templ->clust_rec_field_no : templ->rec_field_no;
- if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
- templ->rec_field_no))) {
+ if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
/* Copy an externally stored field to the temporary
heap */
@@ -2721,7 +2739,7 @@ row_sel_store_mysql_rec(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(prebuilt->table),
- templ->rec_field_no, &len, heap);
+ field_no, &len, heap);
if (UNIV_UNLIKELY(!data)) {
/* The externally stored field
@@ -2742,8 +2760,7 @@ row_sel_store_mysql_rec(
} else {
/* Field is stored in the row. */
- data = rec_get_nth_field(rec, offsets,
- templ->rec_field_no, &len);
+ data = rec_get_nth_field(rec, offsets, field_no, &len);
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)
&& len != UNIV_SQL_NULL) {
@@ -3105,7 +3122,7 @@ row_sel_pop_cached_row_for_mysql(
row_prebuilt_t* prebuilt) /*!< in: prebuilt struct */
{
ulint i;
- mysql_row_templ_t* templ;
+ const mysql_row_templ_t*templ;
byte* cached_rec;
ut_ad(prebuilt->n_fetch_cached > 0);
ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
@@ -3162,15 +3179,21 @@ ibool
row_sel_push_cache_row_for_mysql(
/*=============================*/
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
- const rec_t* rec, /*!< in: record to push; must
- be protected by a page latch */
- const ulint* offsets) /*!< in: rec_get_offsets() */
+ const rec_t* rec, /*!< in: record to push, in the index
+ which was described in prebuilt's
+ template, or in the clustered index;
+ must be protected by a page latch */
+ ibool rec_clust, /*!< in: TRUE if rec is in the
+ clustered index instead of
+ prebuilt->index */
+ const ulint* offsets) /*!< in: rec_get_offsets(rec) */
{
byte* buf;
ulint i;
ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
ut_ad(rec_offs_validate(rec, NULL, offsets));
+ ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
ut_a(!prebuilt->templ_contains_blob);
if (prebuilt->fetch_cache[0] == NULL) {
@@ -3199,7 +3222,7 @@ row_sel_push_cache_row_for_mysql(
if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
prebuilt->fetch_cache[
prebuilt->n_fetch_cached],
- prebuilt, rec, offsets))) {
+ prebuilt, rec, rec_clust, offsets))) {
return(FALSE);
}
@@ -3600,7 +3623,8 @@ row_search_for_mysql(
ut_ad(!rec_get_deleted_flag(rec, comp));
if (!row_sel_store_mysql_rec(buf, prebuilt,
- rec, offsets)) {
+ rec, FALSE,
+ offsets)) {
/* Only fresh inserts may contain
incomplete externally stored
columns. Pretend that such
@@ -4234,7 +4258,6 @@ no_gap_lock:
is necessary, because we can only get the undo
information via the clustered index record. */
- ut_ad(index != clust_index);
ut_ad(!dict_index_is_clust(index));
if (!lock_sec_rec_cons_read_sees(
@@ -4350,26 +4373,10 @@ requires_clust_rec:
goto next_rec;
}
- if (prebuilt->need_to_access_clustered) {
-
- result_rec = clust_rec;
-
- ut_ad(rec_offs_validate(result_rec, clust_index,
- offsets));
- } else {
- /* We used 'offsets' for the clust rec, recalculate
- them for 'rec' */
- offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
- result_rec = rec;
- }
-
- /* result_rec can legitimately be delete-marked
- now that it has been established that it points to a
- clustered index record that exists in the read view. */
+ result_rec = clust_rec;
+ ut_ad(rec_offs_validate(result_rec, clust_index, offsets));
} else {
result_rec = rec;
- ut_ad(!rec_get_deleted_flag(rec, comp));
}
/* We found a qualifying record 'result_rec'. At this point,
@@ -4378,6 +4385,7 @@ requires_clust_rec:
ut_ad(rec_offs_validate(result_rec,
result_rec != rec ? clust_index : index,
offsets));
+ ut_ad(!rec_get_deleted_flag(result_rec, comp));
/* At this point, the clustered index record is protected
by a page latch that was acquired when pcur was positioned.
@@ -4402,6 +4410,7 @@ requires_clust_rec:
cursor. */
if (!row_sel_push_cache_row_for_mysql(prebuilt, result_rec,
+ result_rec != rec,
offsets)) {
/* Only fresh inserts may contain incomplete
externally stored columns. Pretend that such
@@ -4419,15 +4428,31 @@ requires_clust_rec:
goto next_rec;
} else {
- if (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE) {
+ if (UNIV_UNLIKELY
+ (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE)) {
+ /* CHECK TABLE: fetch the row */
+
+ if (result_rec != rec
+ && !prebuilt->need_to_access_clustered) {
+ /* We used 'offsets' for the clust
+ rec, recalculate them for 'rec' */
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED,
+ &heap);
+ result_rec = rec;
+ }
+
memcpy(buf + 4, result_rec
- rec_offs_extra_size(offsets),
rec_offs_size(offsets));
mach_write_to_4(buf,
rec_offs_extra_size(offsets) + 4);
} else {
- if (!row_sel_store_mysql_rec(buf, prebuilt,
- result_rec, offsets)) {
+ /* Returning a row to MySQL */
+
+ if (!row_sel_store_mysql_rec(buf, prebuilt, result_rec,
+ result_rec != rec,
+ offsets)) {
/* Only fresh inserts may contain
incomplete externally stored
columns. Pretend that such records do
diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
index a1004c0d2cf..81750938f58 100644
--- a/storage/innobase/row/row0upd.c
+++ b/storage/innobase/row/row0upd.c
@@ -371,8 +371,8 @@ UNIV_INTERN
void
row_upd_index_entry_sys_field(
/*==========================*/
- const dtuple_t* entry, /*!< in: index entry, where the memory buffers
- for sys fields are already allocated:
+ dtuple_t* entry, /*!< in/out: index entry, where the memory
+ buffers for sys fields are already allocated:
the function just copies the new values to
them */
dict_index_t* index, /*!< in: clustered index */
@@ -466,8 +466,11 @@ row_upd_changes_field_size_or_external(
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
-Replaces the new column values stored in the update vector to the record
-given. No field size changes are allowed. */
+Replaces the new column values stored in the update vector to the
+record given. No field size changes are allowed. This function is
+usually invoked on a clustered index. The only use case for a
+secondary index is row_ins_sec_index_entry_by_modify() or its
+counterpart in ibuf_insert_to_index_page(). */
UNIV_INTERN
void
row_upd_rec_in_place(
@@ -1612,12 +1615,12 @@ static
ulint
row_upd_clust_rec_by_insert(
/*========================*/
- upd_node_t* node, /*!< in: row update node */
+ upd_node_t* node, /*!< in/out: row update node */
dict_index_t* index, /*!< in: clustered index of the record */
que_thr_t* thr, /*!< in: query thread */
ibool referenced,/*!< in: TRUE if index may be referenced in
a foreign key constraint */
- mtr_t* mtr) /*!< in: mtr; gets committed here */
+ mtr_t* mtr) /*!< in/out: mtr; gets committed here */
{
mem_heap_t* heap = NULL;
btr_pcur_t* pcur;
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 83355bd1322..2ac5c8ce4fc 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -695,6 +695,12 @@ struct srv_slot_struct{
/* Table for MySQL threads where they will be suspended to wait for locks */
UNIV_INTERN srv_slot_t* srv_mysql_table = NULL;
+UNIV_INTERN os_event_t srv_timeout_event;
+
+UNIV_INTERN os_event_t srv_monitor_event;
+
+UNIV_INTERN os_event_t srv_error_event;
+
UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
UNIV_INTERN srv_sys_t* srv_sys = NULL;
@@ -1012,6 +1018,12 @@ srv_init(void)
ut_a(slot->event);
}
+ srv_error_event = os_event_create(NULL);
+
+ srv_timeout_event = os_event_create(NULL);
+
+ srv_monitor_event = os_event_create(NULL);
+
srv_lock_timeout_thread_event = os_event_create(NULL);
for (i = 0; i < SRV_MASTER + 1; i++) {
@@ -2049,6 +2061,7 @@ srv_monitor_thread(
/*!< in: a dummy parameter required by
os_thread_create */
{
+ ib_int64_t sig_count;
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
@@ -2067,26 +2080,28 @@ srv_monitor_thread(
#endif
UT_NOT_USED(arg);
- srv_last_monitor_time = time(NULL);
- last_table_monitor_time = time(NULL);
- last_tablespace_monitor_time = time(NULL);
- last_monitor_time = time(NULL);
+ srv_last_monitor_time = ut_time();
+ last_table_monitor_time = ut_time();
+ last_tablespace_monitor_time = ut_time();
+ last_monitor_time = ut_time();
mutex_skipped = 0;
last_srv_print_monitor = srv_print_innodb_monitor;
loop:
srv_monitor_active = TRUE;
/* Wake up every 5 seconds to see if we need to print
- monitor information. */
+ monitor information or if signalled at shutdown. */
- os_thread_sleep(5000000);
+ sig_count = os_event_reset(srv_monitor_event);
- current_time = time(NULL);
+ os_event_wait_time_low(srv_monitor_event, 5000000, sig_count);
+
+ current_time = ut_time();
time_elapsed = difftime(current_time, last_monitor_time);
if (time_elapsed > 15) {
- last_monitor_time = time(NULL);
+ last_monitor_time = ut_time();
if (srv_print_innodb_monitor) {
/* Reset mutex_skipped counter everytime
@@ -2130,7 +2145,7 @@ loop:
if (srv_print_innodb_tablespace_monitor
&& difftime(current_time,
last_tablespace_monitor_time) > 60) {
- last_tablespace_monitor_time = time(NULL);
+ last_tablespace_monitor_time = ut_time();
fputs("========================"
"========================\n",
@@ -2156,7 +2171,7 @@ loop:
if (srv_print_innodb_table_monitor
&& difftime(current_time, last_table_monitor_time) > 60) {
- last_table_monitor_time = time(NULL);
+ last_table_monitor_time = ut_time();
fputs("===========================================\n",
stderr);
@@ -2216,16 +2231,20 @@ srv_lock_timeout_thread(
ibool some_waits;
double wait_time;
ulint i;
+ ib_int64_t sig_count;
#ifdef UNIV_PFS_THREAD
pfs_register_thread(srv_lock_timeout_thread_key);
#endif
loop:
+
/* When someone is waiting for a lock, we wake up every second
and check if a timeout has passed for a lock wait */
- os_thread_sleep(1000000);
+ sig_count = os_event_reset(srv_timeout_event);
+
+ os_event_wait_time_low(srv_timeout_event, 1000000, sig_count);
srv_lock_timeout_active = TRUE;
@@ -2320,6 +2339,7 @@ srv_error_monitor_thread(
ulint fatal_cnt = 0;
ib_uint64_t old_lsn;
ib_uint64_t new_lsn;
+ ib_int64_t sig_count;
old_lsn = srv_start_lsn;
@@ -2395,7 +2415,9 @@ loop:
fflush(stderr);
- os_thread_sleep(1000000);
+ sig_count = os_event_reset(srv_error_event);
+
+ os_event_wait_time_low(srv_error_event, 1000000, sig_count);
if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
@@ -2646,6 +2668,21 @@ loop:
for (i = 0; i < 10; i++) {
ulint cur_time = ut_time_ms();
+ /* ALTER TABLE in MySQL requires on Unix that the table handler
+ can drop tables lazily after there no longer are SELECT
+ queries to them. */
+
+ srv_main_thread_op_info = "doing background drop tables";
+
+ row_drop_tables_for_mysql_in_background();
+
+ srv_main_thread_op_info = "";
+
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+
+ goto background_loop;
+ }
+
buf_get_total_stat(&buf_stat);
n_ios_old = log_sys->n_log_ios + buf_stat.n_pages_read
@@ -2654,7 +2691,8 @@ loop:
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
- if (next_itr_time > cur_time) {
+ if (next_itr_time > cur_time
+ && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
/* Get sleep interval in micro seconds. We use
ut_min() to avoid long sleep in case of
@@ -2668,21 +2706,6 @@ loop:
/* Each iteration should happen at 1 second interval. */
next_itr_time = ut_time_ms() + 1000;
- /* ALTER TABLE in MySQL requires on Unix that the table handler
- can drop tables lazily after there no longer are SELECT
- queries to them. */
-
- srv_main_thread_op_info = "doing background drop tables";
-
- row_drop_tables_for_mysql_in_background();
-
- srv_main_thread_op_info = "";
-
- if (srv_fast_shutdown && srv_shutdown_state > 0) {
-
- goto background_loop;
- }
-
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
@@ -2860,7 +2883,9 @@ background_loop:
MySQL tries to drop a table while there are still open handles
to it and we had to put it to the background drop queue.) */
- os_thread_sleep(100000);
+ if (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ os_thread_sleep(100000);
+ }
}
if (srv_n_purge_threads == 0) {
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 9bf18b8db9e..d7ea3d5d3da 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -120,11 +120,6 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
/** Files comprising the system tablespace */
static os_file_t files[1000];
-/** Mutex protecting the ios count */
-static mutex_t ios_mutex;
-/** Count of I/O operations in io_handler_thread() */
-static ulint ios;
-
/** io_handler_thread parameters for thread identification */
static ulint n[SRV_MAX_N_IO_THREADS + 6];
/** io_handler_thread identifiers */
@@ -152,11 +147,6 @@ UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;
#endif /* UNIV_PFS_THREAD */
-#ifdef UNIV_PFS_MUTEX
-/* Key to register ios_mutex_key with performance schema */
-UNIV_INTERN mysql_pfs_key_t ios_mutex_key;
-#endif /* UNIV_PFS_MUTEX */
-
/*********************************************************************//**
Convert a numeric string that optionally ends in G or M, to a number
containing megabytes.
@@ -477,7 +467,6 @@ io_handler_thread(
the aio array */
{
ulint segment;
- ulint i;
segment = *((ulint*)arg);
@@ -490,16 +479,10 @@ io_handler_thread(
pfs_register_thread(io_handler_thread_key);
#endif /* UNIV_PFS_THREAD */
- for (i = 0;; i++) {
+ while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
fil_aio_wait(segment);
-
- mutex_enter(&ios_mutex);
- ios++;
- mutex_exit(&ios_mutex);
}
- thr_local_free(os_thread_get_curr_id());
-
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
The thread actually never comes here because it is exited in an
@@ -1001,10 +984,6 @@ skip_size_check:
srv_data_file_is_raw_partition[i] != 0);
}
- ios = 0;
-
- mutex_create(ios_mutex_key, &ios_mutex, SYNC_NO_ORDER_CHECK);
-
return(DB_SUCCESS);
}
diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
index 4dbaaa97bd9..783cff3bf82 100644
--- a/storage/innobase/sync/sync0rw.c
+++ b/storage/innobase/sync/sync0rw.c
@@ -1002,7 +1002,7 @@ rw_lock_debug_print(
rwt = info->lock_type;
- fprintf(stderr, "Locked: thread %ld file %s line %ld ",
+ fprintf(stderr, "Locked: thread %lu file %s line %lu ",
(ulong) os_thread_pf(info->thread_id), info->file_name,
(ulong) info->line);
if (rwt == RW_LOCK_SHARED) {
diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
index 8062d9e902e..761cc4c805e 100644
--- a/storage/innobase/sync/sync0sync.c
+++ b/storage/innobase/sync/sync0sync.c
@@ -1207,8 +1207,8 @@ sync_thread_add_level(
case SYNC_BUF_BLOCK:
/* Either the thread must own the buffer pool mutex
- (buf_pool_mutex), or it is allowed to latch only ONE
- buffer block (block->mutex or buf_pool_zip_mutex). */
+ (buf_pool->mutex), or it is allowed to latch only ONE
+ buffer block (block->mutex or buf_pool->zip_mutex). */
if (!sync_thread_levels_g(array, level, FALSE)) {
ut_a(sync_thread_levels_g(array, level - 1, TRUE));
ut_a(sync_thread_levels_contain(array, SYNC_BUF_POOL));
diff --git a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c
index 045ff3e9fb1..2bd3e4b1c43 100644
--- a/storage/innobase/thr/thr0loc.c
+++ b/storage/innobase/thr/thr0loc.c
@@ -76,6 +76,24 @@ struct thr_local_struct{
/** The value of thr_local_struct::magic_n */
#define THR_LOCAL_MAGIC_N 1231234
+#ifdef UNIV_DEBUG
+/*******************************************************************//**
+Validates thread local data.
+@return TRUE if valid */
+static
+ibool
+thr_local_validate(
+/*===============*/
+ const thr_local_t* local) /*!< in: data to validate */
+{
+ ut_ad(local->magic_n == THR_LOCAL_MAGIC_N);
+ ut_ad(local->slot_no == ULINT_UNDEFINED
+ || local->slot_no < OS_THREAD_MAX_N);
+ ut_ad(local->in_ibuf == FALSE || local->in_ibuf == TRUE);
+ return(TRUE);
+}
+#endif /* UNIV_DEBUG */
+
/*******************************************************************//**
Returns the local storage struct for a thread.
@return local storage */
@@ -96,7 +114,8 @@ try_again:
local = NULL;
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- thr_local_t*, local,, os_thread_eq(local->id, id));
+ thr_local_t*, local, ut_ad(thr_local_validate(local)),
+ os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
@@ -107,7 +126,7 @@ try_again:
goto try_again;
}
- ut_ad(local->magic_n == THR_LOCAL_MAGIC_N);
+ ut_ad(thr_local_validate(local));
return(local);
}
@@ -193,7 +212,7 @@ thr_local_create(void)
local->id = os_thread_get_curr_id();
local->handle = os_thread_get_curr();
local->magic_n = THR_LOCAL_MAGIC_N;
-
+ local->slot_no = ULINT_UNDEFINED;
local->in_ibuf = FALSE;
mutex_enter(&thr_local_mutex);
@@ -220,7 +239,8 @@ thr_local_free(
/* Look for the local struct in the hash table */
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- thr_local_t*, local,, os_thread_eq(local->id, id));
+ thr_local_t*, local, ut_ad(thr_local_validate(local)),
+ os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
@@ -233,6 +253,7 @@ thr_local_free(
mutex_exit(&thr_local_mutex);
ut_a(local->magic_n == THR_LOCAL_MAGIC_N);
+ ut_ad(thr_local_validate(local));
mem_free(local);
}
@@ -276,6 +297,7 @@ thr_local_close(void)
local = HASH_GET_NEXT(hash, prev_local);
ut_a(prev_local->magic_n == THR_LOCAL_MAGIC_N);
+ ut_ad(thr_local_validate(prev_local));
mem_free(prev_local);
}
}
diff --git a/storage/innobase/trx/trx0i_s.c b/storage/innobase/trx/trx0i_s.c
index 1ad074769c7..8b11e706180 100644
--- a/storage/innobase/trx/trx0i_s.c
+++ b/storage/innobase/trx/trx0i_s.c
@@ -38,8 +38,6 @@ Created July 17, 2007 Vasil Dimov
#include <mysql/plugin.h>
-#include "mysql_addons.h"
-
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
@@ -417,6 +415,42 @@ table_cache_create_empty_row(
return(row);
}
+#ifdef UNIV_DEBUG
+/*******************************************************************//**
+Validates a row in the locks cache.
+@return TRUE if valid */
+static
+ibool
+i_s_locks_row_validate(
+/*===================*/
+ const i_s_locks_row_t* row) /*!< in: row to validate */
+{
+ ut_ad(row->lock_trx_id != 0);
+ ut_ad(row->lock_mode != NULL);
+ ut_ad(row->lock_type != NULL);
+ ut_ad(row->lock_table != NULL);
+ ut_ad(row->lock_table_id != 0);
+
+ if (row->lock_space == ULINT_UNDEFINED) {
+ /* table lock */
+ ut_ad(!strcmp("TABLE", row->lock_type));
+ ut_ad(row->lock_index == NULL);
+ ut_ad(row->lock_data == NULL);
+ ut_ad(row->lock_page == ULINT_UNDEFINED);
+ ut_ad(row->lock_rec == ULINT_UNDEFINED);
+ } else {
+ /* record lock */
+ ut_ad(!strcmp("RECORD", row->lock_type));
+ ut_ad(row->lock_index != NULL);
+ ut_ad(row->lock_data != NULL);
+ ut_ad(row->lock_page != ULINT_UNDEFINED);
+ ut_ad(row->lock_rec != ULINT_UNDEFINED);
+ }
+
+ return(TRUE);
+}
+#endif /* UNIV_DEBUG */
+
/*******************************************************************//**
Fills i_s_trx_row_t object.
If memory can not be allocated then FALSE is returned.
@@ -447,18 +481,15 @@ fill_trx_row(
row->trx_id = trx->id;
row->trx_started = (ib_time_t) trx->start_time;
row->trx_state = trx_get_que_state_str(trx);
+ row->requested_lock_row = requested_lock_row;
+ ut_ad(requested_lock_row == NULL
+ || i_s_locks_row_validate(requested_lock_row));
if (trx->wait_lock != NULL) {
-
ut_a(requested_lock_row != NULL);
-
- row->requested_lock_row = requested_lock_row;
row->trx_wait_started = (ib_time_t) trx->wait_started;
} else {
-
ut_a(requested_lock_row == NULL);
-
- row->requested_lock_row = NULL;
row->trx_wait_started = 0;
}
@@ -814,6 +845,7 @@ fill_locks_row(
row->lock_table_id = lock_get_table_id(lock);
row->hash_chain.value = row;
+ ut_ad(i_s_locks_row_validate(row));
return(TRUE);
}
@@ -834,6 +866,9 @@ fill_lock_waits_row(
relevant blocking lock
row in innodb_locks */
{
+ ut_ad(i_s_locks_row_validate(requested_lock_row));
+ ut_ad(i_s_locks_row_validate(blocking_lock_row));
+
row->requested_lock_row = requested_lock_row;
row->blocking_lock_row = blocking_lock_row;
@@ -905,6 +940,7 @@ locks_row_eq_lock(
or ULINT_UNDEFINED if the lock
is a table lock */
{
+ ut_ad(i_s_locks_row_validate(row));
#ifdef TEST_NO_LOCKS_ROW_IS_EVER_EQUAL_TO_LOCK_T
return(0);
#else
@@ -962,7 +998,7 @@ search_innodb_locks(
/* auxiliary variable */
hash_chain,
/* assertion on every traversed item */
- ,
+ ut_ad(i_s_locks_row_validate(hash_chain->value)),
/* this determines if we have found the lock */
locks_row_eq_lock(hash_chain->value, lock, heap_no));
@@ -1002,6 +1038,7 @@ add_lock_to_cache(
dst_row = search_innodb_locks(cache, lock, heap_no);
if (dst_row != NULL) {
+ ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
#endif
@@ -1039,6 +1076,7 @@ add_lock_to_cache(
} /* for()-loop */
#endif
+ ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
index 6ef47a8dc16..7f2ca1f1471 100644
--- a/storage/innobase/trx/trx0trx.c
+++ b/storage/innobase/trx/trx0trx.c
@@ -105,7 +105,11 @@ trx_create(
trx->is_purge = 0;
trx->is_recovered = 0;
trx->conc_state = TRX_NOT_STARTED;
- trx->start_time = time(NULL);
+
+ trx->is_registered = 0;
+ trx->owns_prepare_mutex = 0;
+
+ trx->start_time = ut_time();
trx->isolation_level = TRX_ISO_REPEATABLE_READ;
@@ -124,7 +128,6 @@ trx_create(
trx->table_id = 0;
trx->mysql_thd = NULL;
- trx->active_trans = 0;
trx->duplicates = 0;
trx->n_mysql_tables_in_use = 0;
@@ -750,8 +753,7 @@ trx_commit_off_kernel(
mutex_enter(&(rseg->mutex));
if (trx->insert_undo != NULL) {
- trx_undo_set_state_at_finish(
- rseg, trx, trx->insert_undo, &mtr);
+ trx_undo_set_state_at_finish(trx->insert_undo, &mtr);
}
undo = trx->update_undo;
@@ -766,7 +768,7 @@ trx_commit_off_kernel(
transaction commit for this transaction. */
update_hdr_page = trx_undo_set_state_at_finish(
- rseg, trx, undo, &mtr);
+ undo, &mtr);
/* We have to do the cleanup for the update log while
holding the rseg mutex because update log headers
diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c
index 9162c82e423..4021a2ed573 100644
--- a/storage/innobase/trx/trx0undo.c
+++ b/storage/innobase/trx/trx0undo.c
@@ -1798,8 +1798,6 @@ UNIV_INTERN
page_t*
trx_undo_set_state_at_finish(
/*=========================*/
- trx_rseg_t* rseg, /*!< in: rollback segment memory object */
- trx_t* trx __attribute__((unused)), /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr) /*!< in: mtr */
{
@@ -1808,10 +1806,8 @@ trx_undo_set_state_at_finish(
page_t* undo_page;
ulint state;
- ut_ad(trx);
ut_ad(undo);
ut_ad(mtr);
- ut_ad(mutex_own(&rseg->mutex));
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
@@ -1830,19 +1826,7 @@ trx_undo_set_state_at_finish(
&& mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE)
< TRX_UNDO_PAGE_REUSE_LIMIT) {
- /* This is a heuristic to avoid the problem of all UNDO
- slots ending up in one of the UNDO lists. Previously if
- the server crashed with all the slots in one of the lists,
- transactions that required the slots of a different type
- would fail for lack of slots. */
-
- if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500
- && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) {
-
- state = TRX_UNDO_CACHED;
- } else {
- state = TRX_UNDO_TO_FREE;
- }
+ state = TRX_UNDO_CACHED;
} else if (undo->type == TRX_UNDO_INSERT) {
diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c
index 39c60d2bc2f..4f4dfc5eed8 100644
--- a/storage/innobase/ut/ut0ut.c
+++ b/storage/innobase/ut/ut0ut.c
@@ -715,6 +715,10 @@ ut_strerr(
return("Zip overflow");
case DB_RECORD_NOT_FOUND:
return("Record not found");
+ case DB_CHILD_NO_INDEX:
+ return("No index on referencing keys in referencing table");
+ case DB_PARENT_NO_INDEX:
+ return("No index on referenced keys in referenced table");
case DB_END_OF_INDEX:
return("End of index");
/* do not add default: in order to produce a warning if new code
diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am
deleted file mode 100644
index 5c3370ac6c5..00000000000
--- a/storage/myisam/Makefile.am
+++ /dev/null
@@ -1,169 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-EXTRA_DIST = mi_test_all.sh mi_test_all.res CMakeLists.txt plug.in
-pkgdata_DATA = mi_test_all mi_test_all.res
-
-pkglib_LIBRARIES = libmyisam.a
-bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
-myisamchk_DEPENDENCIES= $(LIBRARIES)
-myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisamlog_DEPENDENCIES= $(LIBRARIES)
-myisamlog_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisampack_DEPENDENCIES=$(LIBRARIES)
-myisampack_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-noinst_PROGRAMS = mi_test1 mi_test2 mi_test3 rt_test sp_test
-noinst_HEADERS = myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h \
- fulltext.h ftdefs.h ha_myisam.h mi_extrafunc.h
-mi_test1_DEPENDENCIES= $(LIBRARIES)
-mi_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-mi_test2_DEPENDENCIES= $(LIBRARIES)
-mi_test2_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-mi_test3_DEPENDENCIES= $(LIBRARIES)
-mi_test3_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisam_ftdump_DEPENDENCIES= $(LIBRARIES)
-myisam_ftdump_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-rt_test_DEPENDENCIES= $(LIBRARIES)
-rt_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-sp_test_DEPENDENCIES= $(LIBRARIES)
-sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \
- mi_rnext.c mi_rnext_same.c \
- mi_search.c mi_page.c mi_key.c mi_locking.c \
- mi_rrnd.c mi_scan.c mi_cache.c \
- mi_statrec.c mi_packrec.c mi_dynrec.c \
- mi_update.c mi_write.c mi_unique.c \
- mi_delete.c \
- mi_rprev.c mi_rfirst.c mi_rlast.c mi_rsame.c \
- mi_rsamepos.c mi_panic.c mi_close.c mi_create.c\
- mi_range.c mi_dbug.c mi_checksum.c mi_log.c \
- mi_changed.c mi_static.c mi_delete_all.c \
- mi_delete_table.c mi_rename.c mi_check.c \
- mi_keycache.c mi_preload.c \
- ft_parser.c ft_stopwords.c ft_static.c \
- ft_update.c ft_boolean_search.c ft_nlq_search.c sort.c \
- ha_myisam.cc \
- rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c
-CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY?
-
-# Move to automake rules ?
-prolint:; plparse -b -u -hF1 "-width(0,0)" "-format=%f:%l:\s%t:%n\s%m" \
- "-elib(????)" "+elib(?3??)" my.lnt $(nisam_SOURCES)
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''CC''@!@CC@!'\
- -e 's!@''CXX''@!@CXX@!'\
- -e 's!@''GXX''@!@GXX@!'\
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
- -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
- -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
- -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
- -e 's!@''HOSTNAME''@!@HOSTNAME@!' \
- -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \
- -e 's!@''CHECK_PID''@!@CHECK_PID@!' \
- -e 's!@''FIND_PROC''@!@FIND_PROC@!' \
- -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
- -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- -e 's!@''sysconfdir''@!@sysconfdir@!' \
- -e 's!@''SHORT_MYSQL_INTRO''@!@SHORT_MYSQL_INTRO@!' \
- -e 's!@''SHARED_LIB_VERSION''@!@SHARED_LIB_VERSION@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''PERL_DBI_VERSION''@!@PERL_DBI_VERSION@!' \
- -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \
- -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
-if HAVE_DTRACE_DASH_G
-libmyisam_a_LIBADD = probes_mysql.o
-libmyisam_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES += probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = ha_myisam.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 937bb6ffe19..a2e29d90897 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int UNINIT_VAR(subkeys), r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 2ba62d03c6b..c4bb6d7dbd4 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1499,8 +1499,6 @@ bool ha_myisam::check_and_repair(THD *thd)
{
int error=0;
int marked_crashed;
- char *old_query;
- uint old_query_length;
HA_CHECK_OPT check_opt;
DBUG_ENTER("ha_myisam::check_and_repair");
@@ -1511,10 +1509,9 @@ bool ha_myisam::check_and_repair(THD *thd)
check_opt.flags|=T_QUICK;
sql_print_warning("Checking table: '%s'",table->s->path.str);
- old_query= thd->query();
- old_query_length= thd->query_length();
+ const CSET_STRING query_backup= thd->query_string;
thd->set_query(table->s->table_name.str,
- (uint) table->s->table_name.length);
+ (uint) table->s->table_name.length, system_charset_info);
if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
{
@@ -1527,7 +1524,7 @@ bool ha_myisam::check_and_repair(THD *thd)
if (repair(thd, &check_opt))
error=1;
}
- thd->set_query(old_query, old_query_length);
+ thd->set_query(query_backup);
DBUG_RETURN(error);
}
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 4df76e31872..35b68fe00df 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -671,8 +671,7 @@ get_one_option(int optid,
case OPT_STATS_METHOD:
{
int method;
- enum_mi_stats_method method_conv;
- LINT_INIT(method_conv);
+ enum_mi_stats_method UNINIT_VAR(method_conv);
myisam_stats_method_str= argument;
if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
{
diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in
deleted file mode 100644
index 051ec2d54aa..00000000000
--- a/storage/myisam/plug.in
+++ /dev/null
@@ -1,7 +0,0 @@
-MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine],
- [Traditional non-transactional MySQL tables])
-MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam])
-MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a])
-MYSQL_PLUGIN_MANDATORY(myisam) dnl Default
-MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc])
-
diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am
deleted file mode 100644
index 43dec3ae3d9..00000000000
--- a/storage/myisammrg/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 2000-2002, 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-pkglib_LIBRARIES = libmyisammrg.a
-noinst_HEADERS = myrg_def.h ha_myisammrg.h
-noinst_LIBRARIES = libmyisammrg.a
-libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
- myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \
- myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \
- myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \
- myrg_rprev.c myrg_queue.c myrg_write.c myrg_range.c \
- ha_myisammrg.cc \
- myrg_rnext_same.c myrg_records.c
-
-
-EXTRA_DIST = CMakeLists.txt plug.in
-
-if HAVE_DTRACE_DASH_G
-libmyisammrg_a_LIBADD = probes_mysql.o
-libmyisammrg_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = ha_myisammrg.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index b8e86b89181..c545aff912f 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -220,7 +220,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
int (*callback)(void*, const char*),
void *callback_param)
{
- MYRG_INFO *m_info;
+ MYRG_INFO *UNINIT_VAR(m_info);
int rc;
int errpos;
int save_errno;
diff --git a/storage/myisammrg/plug.in b/storage/myisammrg/plug.in
deleted file mode 100644
index 1f94e07d881..00000000000
--- a/storage/myisammrg/plug.in
+++ /dev/null
@@ -1,6 +0,0 @@
-MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine],
- [Merge multiple MySQL tables into one])
-MYSQL_PLUGIN_DIRECTORY(myisammrg,[storage/myisammrg])
-MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg.a])
-MYSQL_PLUGIN_MANDATORY(myisammrg)
-MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisammrg, [ha_myisammrg.cc])
diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
index 560a9559999..7493e5e9c89 100644
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -702,7 +702,7 @@ load_defaults(Vector<struct my_option>& options, const char* groups[])
BaseString group_suffix;
const char *save_file = my_defaults_file;
- char *save_extra_file = my_defaults_extra_file;
+ const char *save_extra_file = my_defaults_extra_file;
const char *save_group_suffix = my_defaults_group_suffix;
if (my_defaults_file)
diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am
deleted file mode 100644
index 762f5b85790..00000000000
--- a/storage/perfschema/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-#called from the top level Makefile
-
-SUBDIRS = . unittest
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = -DMYSQL_SERVER @DEFS@
-
-
-noinst_HEADERS = ha_perfschema.h pfs_engine_table.h pfs.h pfs_server.h \
- pfs_global.h pfs_instr_class.h pfs_instr.h \
- pfs_column_types.h pfs_column_values.h \
- table_setup_instruments.h table_performance_timers.h \
- table_setup_timers.h \
- table_setup_consumers.h table_events_waits.h \
- pfs_events_waits.h pfs_timer.h table_threads.h \
- table_sync_instances.h \
- table_events_waits_summary.h pfs_stat.h \
- table_ews_global_by_event_name.h table_all_instr.h \
- table_file_instances.h table_file_summary.h \
- pfs_lock.h pfs_atomic.h
-
-PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
- pfs_global.cc pfs_instr_class.cc pfs_instr.cc \
- pfs_column_values.cc \
- table_setup_instruments.cc table_performance_timers.cc \
- table_setup_timers.cc \
- table_setup_consumers.cc table_events_waits.cc \
- pfs_events_waits.cc pfs_timer.cc table_threads.cc \
- table_sync_instances.cc \
- table_events_waits_summary.cc \
- table_ews_global_by_event_name.cc table_all_instr.cc \
- table_file_instances.cc table_file_summary.cc \
- pfs_atomic.cc pfs_check.cc
-
-EXTRA_LIBRARIES = libperfschema.a
-noinst_LIBRARIES = @plugin_perfschema_static_target@
-
-libperfschema_a_SOURCES= $(PSE_SOURCES)
-
-EXTRA_DIST = plug.in CMakeLists.txt
-
-unittests = unittest
-
-test:
- perl $(top_srcdir)/unittest/unit.pl run $(unittests)
-
-test-verbose:
- HARNESS_VERBOSE=1 perl $(top_srcdir)/unittest/unit.pl run $(unittests)
-
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index 6050612e24c..c0c0490a380 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -79,5 +79,21 @@ inline uint randomized_index(const void *ptr, uint max_size)
void pfs_print_error(const char *format, ...);
+/**
+ Given an array defined as T ARRAY[MAX],
+ check that an UNSAFE pointer actually points to an element
+ within the array.
+*/
+#define SANITIZE_ARRAY_BODY(T, ARRAY, MAX, UNSAFE) \
+ intptr offset; \
+ if ((&ARRAY[0] <= UNSAFE) && \
+ (UNSAFE < &ARRAY[MAX])) \
+ { \
+ offset= ((intptr) UNSAFE - (intptr) ARRAY) % sizeof(T); \
+ if (offset == 0) \
+ return UNSAFE; \
+ } \
+ return NULL
+
#endif
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 0c7b25a03de..904efc2aff4 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -758,9 +758,26 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
*/
PFS_thread *sanitize_thread(PFS_thread *unsafe)
{
- if ((&thread_array[0] <= unsafe) &&
- (unsafe < &thread_array[thread_max]))
- return unsafe;
+ SANITIZE_ARRAY_BODY(PFS_thread, thread_array, thread_max, unsafe);
+}
+
+const char *sanitize_file_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &file_array[0];
+ intptr last= (intptr) &file_array[file_max];
+
+ /* Check if unsafe points inside file_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ /* Check if unsafe points to PFS_file::m_filename */
+ intptr offset= (ptr - first) % sizeof(PFS_file);
+ intptr valid_offset= my_offsetof(PFS_file, m_filename[0]);
+ if (likely(offset == valid_offset))
+ {
+ return unsafe;
+ }
+ }
return NULL;
}
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index 791e2cd1f8d..2f6b729628e 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -227,6 +227,7 @@ struct PFS_thread
};
PFS_thread *sanitize_thread(PFS_thread *unsafe);
+const char *sanitize_file_name(const char *unsafe);
PFS_single_stat_chain*
find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index 48547f73628..d99ca4d513c 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -543,15 +543,9 @@ PFS_mutex_class *find_mutex_class(PFS_sync_key key)
FIND_CLASS_BODY(key, mutex_class_allocated_count, mutex_class_array);
}
-#define SANITIZE_ARRAY_BODY(ARRAY, MAX, UNSAFE) \
- if ((&ARRAY[0] <= UNSAFE) && \
- (UNSAFE < &ARRAY[MAX])) \
- return UNSAFE; \
- return NULL
-
PFS_mutex_class *sanitize_mutex_class(PFS_mutex_class *unsafe)
{
- SANITIZE_ARRAY_BODY(mutex_class_array, mutex_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_mutex_class, mutex_class_array, mutex_class_max, unsafe);
}
/**
@@ -566,7 +560,7 @@ PFS_rwlock_class *find_rwlock_class(PFS_sync_key key)
PFS_rwlock_class *sanitize_rwlock_class(PFS_rwlock_class *unsafe)
{
- SANITIZE_ARRAY_BODY(rwlock_class_array, rwlock_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_rwlock_class, rwlock_class_array, rwlock_class_max, unsafe);
}
/**
@@ -581,7 +575,7 @@ PFS_cond_class *find_cond_class(PFS_sync_key key)
PFS_cond_class *sanitize_cond_class(PFS_cond_class *unsafe)
{
- SANITIZE_ARRAY_BODY(cond_class_array, cond_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_cond_class, cond_class_array, cond_class_max, unsafe);
}
/**
@@ -636,7 +630,7 @@ PFS_thread_class *find_thread_class(PFS_sync_key key)
PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe)
{
- SANITIZE_ARRAY_BODY(thread_class_array, thread_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_thread_class, thread_class_array, thread_class_max, unsafe);
}
/**
@@ -687,7 +681,7 @@ PFS_file_class *find_file_class(PFS_file_key key)
PFS_file_class *sanitize_file_class(PFS_file_class *unsafe)
{
- SANITIZE_ARRAY_BODY(file_class_array, file_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_file_class, file_class_array, file_class_max, unsafe);
}
/**
@@ -820,7 +814,59 @@ search:
PFS_table_share *sanitize_table_share(PFS_table_share *unsafe)
{
- SANITIZE_ARRAY_BODY(table_share_array, table_share_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_table_share, table_share_array, table_share_max, unsafe);
+}
+
+const char *sanitize_table_schema_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &table_share_array[0];
+ intptr last= (intptr) &table_share_array[table_share_max];
+
+ PFS_table_share dummy;
+
+ /* Check if unsafe points inside table_share_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ intptr offset= (ptr - first) % sizeof(PFS_table_share);
+ intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
+ intptr len= sizeof(dummy.m_key.m_hash_key);
+ /* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
+ if (likely((from <= offset) && (offset < from + len)))
+ {
+ PFS_table_share *base= (PFS_table_share*) (ptr - offset);
+ /* Check if unsafe really is the schema name */
+ if (likely(base->m_schema_name == unsafe))
+ return unsafe;
+ }
+ }
+ return NULL;
+}
+
+const char *sanitize_table_object_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &table_share_array[0];
+ intptr last= (intptr) &table_share_array[table_share_max];
+
+ PFS_table_share dummy;
+
+ /* Check if unsafe points inside table_share_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ intptr offset= (ptr - first) % sizeof(PFS_table_share);
+ intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
+ intptr len= sizeof(dummy.m_key.m_hash_key);
+ /* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
+ if (likely((from <= offset) && (offset < from + len)))
+ {
+ PFS_table_share *base= (PFS_table_share*) (ptr - offset);
+ /* Check if unsafe really is the table name */
+ if (likely(base->m_table_name == unsafe))
+ return unsafe;
+ }
+ }
+ return NULL;
}
static void reset_mutex_class_waits(void)
diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h
index bd6560dbb55..107db628226 100644
--- a/storage/perfschema/pfs_instr_class.h
+++ b/storage/perfschema/pfs_instr_class.h
@@ -222,6 +222,8 @@ PFS_thread_class *find_thread_class(PSI_thread_key key);
PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe);
PFS_file_class *find_file_class(PSI_file_key key);
PFS_file_class *sanitize_file_class(PFS_file_class *unsafe);
+const char *sanitize_table_schema_name(const char *unsafe);
+const char *sanitize_table_object_name(const char *unsafe);
PFS_table_share *find_or_create_table_share(PFS_thread *thread,
const char *schema_name,
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index 5c74d3944ba..d253cfa4366 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -135,7 +135,25 @@ struct pfs_lock
*/
void allocated_to_free(void)
{
- DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
+#ifndef DBUG_OFF
+ extern volatile bool ready_to_exit;
+#endif
+
+ /*
+ If this record is not in the ALLOCATED state and the caller is trying
+ to free it, this is a bug: the caller is confused,
+ and potentially damaging data owned by another thread or object.
+ The correct assert to use here to guarantee data integrity is simply:
+ DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
+ Now, because of Bug#56666 (Race condition between the server main thread
+ and the kill server thread), this assert actually fails during shutdown,
+ and the failure is legitimate, on concurrent calls to mysql_*_destroy(),
+ when destroying the instrumentation of an object ... twice.
+ During shutdown this has no consequences for the performance schema,
+ so the assert is relaxed with the "|| ready_to_exit" condition as a work
+ around until Bug#56666 is fixed.
+ */
+ DBUG_ASSERT((m_state == PFS_LOCK_ALLOCATED) || ready_to_exit);
PFS_atomic::store_32(&m_state, PFS_LOCK_FREE);
}
diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in
deleted file mode 100644
index 36a1c1e8bda..00000000000
--- a/storage/perfschema/plug.in
+++ /dev/null
@@ -1,26 +0,0 @@
-dnl -*- ksh -*-
-
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-dnl This file is part of the configure scripts used by autoconf.
-
-MYSQL_STORAGE_ENGINE(perfschema,
- perfschema,
- [Performance Schema],
- [Performance Schema],
- [default,max,max-no-ndb])
-MYSQL_PLUGIN_DIRECTORY(perfschema, [storage/perfschema])
-MYSQL_PLUGIN_STATIC(perfschema, [libperfschema.a])
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index d34f6fbe722..8408cc55975 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -118,7 +118,7 @@ table_events_waits_current::m_field_def=
PFS_engine_table_share
table_events_waits_current::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_CURRENT") },
+ { C_STRING_WITH_LEN("events_waits_current") },
&pfs_truncatable_acl,
&table_events_waits_current::create,
NULL, /* write_row */
@@ -135,7 +135,7 @@ THR_LOCK table_events_waits_history::m_table_lock;
PFS_engine_table_share
table_events_waits_history::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY") },
+ { C_STRING_WITH_LEN("events_waits_history") },
&pfs_truncatable_acl,
&table_events_waits_history::create,
NULL, /* write_row */
@@ -152,7 +152,7 @@ THR_LOCK table_events_waits_history_long::m_table_lock;
PFS_engine_table_share
table_events_waits_history_long::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY_LONG") },
+ { C_STRING_WITH_LEN("events_waits_history_long") },
&pfs_truncatable_acl,
&table_events_waits_history_long::create,
NULL, /* write_row */
@@ -194,6 +194,9 @@ void table_events_waits_common::make_row(bool thread_own_wait,
PFS_instr_class *safe_class;
const char *base;
const char *safe_source_file;
+ const char *safe_table_schema_name;
+ const char *safe_table_object_name;
+ const char *safe_file_name;
m_row_exists= false;
safe_thread= sanitize_thread(pfs_thread);
@@ -252,15 +255,19 @@ void table_events_waits_common::make_row(bool thread_own_wait,
m_row.m_object_type= "TABLE";
m_row.m_object_type_length= 5;
m_row.m_object_schema_length= wait->m_schema_name_length;
+ safe_table_schema_name= sanitize_table_schema_name(wait->m_schema_name);
if (unlikely((m_row.m_object_schema_length == 0) ||
- (m_row.m_object_schema_length > sizeof(m_row.m_object_schema))))
+ (m_row.m_object_schema_length > sizeof(m_row.m_object_schema)) ||
+ (safe_table_schema_name == NULL)))
return;
- memcpy(m_row.m_object_schema, wait->m_schema_name, m_row.m_object_schema_length);
+ memcpy(m_row.m_object_schema, safe_table_schema_name, m_row.m_object_schema_length);
m_row.m_object_name_length= wait->m_object_name_length;
+ safe_table_object_name= sanitize_table_object_name(wait->m_object_name);
if (unlikely((m_row.m_object_name_length == 0) ||
- (m_row.m_object_name_length > sizeof(m_row.m_object_name))))
+ (m_row.m_object_name_length > sizeof(m_row.m_object_name)) ||
+ (safe_table_object_name == NULL)))
return;
- memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length);
+ memcpy(m_row.m_object_name, safe_table_object_name, m_row.m_object_name_length);
safe_class= &global_table_class;
break;
case WAIT_CLASS_FILE:
@@ -268,10 +275,12 @@ void table_events_waits_common::make_row(bool thread_own_wait,
m_row.m_object_type_length= 4;
m_row.m_object_schema_length= 0;
m_row.m_object_name_length= wait->m_object_name_length;
+ safe_file_name= sanitize_file_name(wait->m_object_name);
if (unlikely((m_row.m_object_name_length == 0) ||
- (m_row.m_object_name_length > sizeof(m_row.m_object_name))))
+ (m_row.m_object_name_length > sizeof(m_row.m_object_name)) ||
+ (safe_file_name == NULL)))
return;
- memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length);
+ memcpy(m_row.m_object_name, safe_file_name, m_row.m_object_name_length);
safe_class= sanitize_file_class((PFS_file_class*) wait->m_class);
break;
case NO_WAIT_CLASS:
diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc
index 435a3500f06..05f280f8521 100644
--- a/storage/perfschema/table_events_waits_summary.cc
+++ b/storage/perfschema/table_events_waits_summary.cc
@@ -74,7 +74,7 @@ table_events_waits_summary_by_thread_by_event_name::m_field_def=
PFS_engine_table_share
table_events_waits_summary_by_thread_by_event_name::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME") },
+ { C_STRING_WITH_LEN("events_waits_summary_by_thread_by_event_name") },
&pfs_truncatable_acl,
&table_events_waits_summary_by_thread_by_event_name::create,
NULL, /* write_row */
@@ -386,7 +386,7 @@ table_events_waits_summary_by_instance::m_field_def=
PFS_engine_table_share
table_events_waits_summary_by_instance::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_INSTANCE") },
+ { C_STRING_WITH_LEN("events_waits_summary_by_instance") },
&pfs_truncatable_acl,
&table_events_waits_summary_by_instance::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc
index 35e744ed96b..c983a967c4e 100644
--- a/storage/perfschema/table_ews_global_by_event_name.cc
+++ b/storage/perfschema/table_ews_global_by_event_name.cc
@@ -69,7 +69,7 @@ table_ews_global_by_event_name::m_field_def=
PFS_engine_table_share
table_ews_global_by_event_name::m_share=
{
- { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME") },
+ { C_STRING_WITH_LEN("events_waits_summary_global_by_event_name") },
&pfs_truncatable_acl,
&table_ews_global_by_event_name::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc
index f1676421616..9ae732a0e1c 100644
--- a/storage/perfschema/table_file_instances.cc
+++ b/storage/perfschema/table_file_instances.cc
@@ -54,7 +54,7 @@ table_file_instances::m_field_def=
PFS_engine_table_share
table_file_instances::m_share=
{
- { C_STRING_WITH_LEN("FILE_INSTANCES") },
+ { C_STRING_WITH_LEN("file_instances") },
&pfs_readonly_acl,
&table_file_instances::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc
index f8b9e66118b..a954db7ef4e 100644
--- a/storage/perfschema/table_file_summary.cc
+++ b/storage/perfschema/table_file_summary.cc
@@ -64,7 +64,7 @@ table_file_summary_by_event_name::m_field_def=
PFS_engine_table_share
table_file_summary_by_event_name::m_share=
{
- { C_STRING_WITH_LEN("FILE_SUMMARY_BY_EVENT_NAME") },
+ { C_STRING_WITH_LEN("file_summary_by_event_name") },
&pfs_truncatable_acl,
&table_file_summary_by_event_name::create,
NULL, /* write_row */
@@ -227,7 +227,7 @@ table_file_summary_by_instance::m_field_def=
PFS_engine_table_share
table_file_summary_by_instance::m_share=
{
- { C_STRING_WITH_LEN("FILE_SUMMARY_BY_INSTANCE") },
+ { C_STRING_WITH_LEN("file_summary_by_instance") },
&pfs_truncatable_acl,
&table_file_summary_by_instance::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc
index f400e37366c..acd379bc57b 100644
--- a/storage/perfschema/table_performance_timers.cc
+++ b/storage/perfschema/table_performance_timers.cc
@@ -58,7 +58,7 @@ table_performance_timers::m_field_def=
PFS_engine_table_share
table_performance_timers::m_share=
{
- { C_STRING_WITH_LEN("PERFORMANCE_TIMERS") },
+ { C_STRING_WITH_LEN("performance_timers") },
&pfs_readonly_acl,
&table_performance_timers::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc
index 3cc6a1441c1..5b39fd89a03 100644
--- a/storage/perfschema/table_setup_consumers.cc
+++ b/storage/perfschema/table_setup_consumers.cc
@@ -84,7 +84,7 @@ table_setup_consumers::m_field_def=
PFS_engine_table_share
table_setup_consumers::m_share=
{
- { C_STRING_WITH_LEN("SETUP_CONSUMERS") },
+ { C_STRING_WITH_LEN("setup_consumers") },
&pfs_updatable_acl,
&table_setup_consumers::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc
index 259ccee3c84..310f859248b 100644
--- a/storage/perfschema/table_setup_instruments.cc
+++ b/storage/perfschema/table_setup_instruments.cc
@@ -54,7 +54,7 @@ table_setup_instruments::m_field_def=
PFS_engine_table_share
table_setup_instruments::m_share=
{
- { C_STRING_WITH_LEN("SETUP_INSTRUMENTS") },
+ { C_STRING_WITH_LEN("setup_instruments") },
&pfs_updatable_acl,
&table_setup_instruments::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index 8ca218913bb..24ec18dafb1 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -57,7 +57,7 @@ table_setup_timers::m_field_def=
PFS_engine_table_share
table_setup_timers::m_share=
{
- { C_STRING_WITH_LEN("SETUP_TIMERS") },
+ { C_STRING_WITH_LEN("setup_timers") },
&pfs_updatable_acl,
&table_setup_timers::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc
index 82587ce493d..f2bd9fa1a28 100644
--- a/storage/perfschema/table_sync_instances.cc
+++ b/storage/perfschema/table_sync_instances.cc
@@ -55,7 +55,7 @@ table_mutex_instances::m_field_def=
PFS_engine_table_share
table_mutex_instances::m_share=
{
- { C_STRING_WITH_LEN("MUTEX_INSTANCES") },
+ { C_STRING_WITH_LEN("mutex_instances") },
&pfs_readonly_acl,
&table_mutex_instances::create,
NULL, /* write_row */
@@ -223,7 +223,7 @@ table_rwlock_instances::m_field_def=
PFS_engine_table_share
table_rwlock_instances::m_share=
{
- { C_STRING_WITH_LEN("RWLOCK_INSTANCES") },
+ { C_STRING_WITH_LEN("rwlock_instances") },
&pfs_readonly_acl,
&table_rwlock_instances::create,
NULL, /* write_row */
@@ -388,7 +388,7 @@ table_cond_instances::m_field_def=
PFS_engine_table_share
table_cond_instances::m_share=
{
- { C_STRING_WITH_LEN("COND_INSTANCES") },
+ { C_STRING_WITH_LEN("cond_instances") },
&pfs_readonly_acl,
&table_cond_instances::create,
NULL, /* write_row */
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index bba7806cab9..541ba860386 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -34,13 +34,13 @@ static const TABLE_FIELD_TYPE field_types[]=
{ NULL, 0}
},
{
- { C_STRING_WITH_LEN("ID") },
+ { C_STRING_WITH_LEN("PROCESSLIST_ID") },
{ C_STRING_WITH_LEN("int(11)") },
{ NULL, 0}
},
{
{ C_STRING_WITH_LEN("NAME") },
- { C_STRING_WITH_LEN("varchar(64)") },
+ { C_STRING_WITH_LEN("varchar(128)") },
{ NULL, 0}
}
};
@@ -52,7 +52,7 @@ table_threads::m_field_def=
PFS_engine_table_share
table_threads::m_share=
{
- { C_STRING_WITH_LEN("THREADS") },
+ { C_STRING_WITH_LEN("threads") },
&pfs_readonly_acl,
&table_threads::create,
NULL, /* write_row */
@@ -140,7 +140,7 @@ void table_threads::make_row(PFS_thread *pfs)
}
int table_threads::read_row_values(TABLE *table,
- unsigned char *,
+ unsigned char *buf,
Field **fields,
bool read_all)
{
@@ -150,7 +150,8 @@ int table_threads::read_row_values(TABLE *table,
return HA_ERR_RECORD_DELETED;
/* Set the null bits */
- DBUG_ASSERT(table->s->null_bytes == 0);
+ DBUG_ASSERT(table->s->null_bytes == 1);
+ buf[0]= 0;
for (; (f= *fields) ; fields++)
{
@@ -161,7 +162,7 @@ int table_threads::read_row_values(TABLE *table,
case 0: /* THREAD_ID */
set_field_ulong(f, m_row.m_thread_internal_id);
break;
- case 1: /* ID */
+ case 1: /* PROCESSLIST_ID */
set_field_ulong(f, m_row.m_thread_id);
break;
case 2: /* NAME */
diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h
index 9df323f6d82..fb239007069 100644
--- a/storage/perfschema/table_threads.h
+++ b/storage/perfschema/table_threads.h
@@ -36,7 +36,7 @@ struct row_threads
{
/** Column THREAD_ID. */
ulong m_thread_internal_id;
- /** Column ID. */
+ /** Column PROCESSLIST_ID. */
ulong m_thread_id;
/** Column NAME. */
const char *m_name;
@@ -79,7 +79,7 @@ private:
/** Current row. */
row_threads m_row;
- /** True is the current row exists. */
+ /** True if the current row exists. */
bool m_row_exists;
/** Current position. */
PFS_simple_index m_pos;
diff --git a/storage/perfschema/unittest/Makefile.am b/storage/perfschema/unittest/Makefile.am
deleted file mode 100644
index 7d82753c9e5..00000000000
--- a/storage/perfschema/unittest/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-INCLUDES = -I$(top_builddir)/include \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/include/mysql \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/unittest/mytap \
- -I$(top_srcdir)/sql \
- -I$(top_srcdir)/storage/perfschema
-
-DEFS = -DMYSQL_SERVER @DEFS@
-
-TEST_CODE = $(top_builddir)/unittest/mytap/libmytap.a
-
-$(TEST_CODE) :
- (cd $(top_builddir)/unittest/mytap; $(MAKE))
-
-PROD_CODE = $(top_builddir)/storage/perfschema/libperfschema.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
-
-noinst_PROGRAMS = pfs_instr_class-t pfs_instr_class-oom-t \
- pfs_instr-t pfs_instr-oom-t pfs_timer-t pfs-t
-
-pfs_t_SOURCES = pfs-t.cc stub_print_error.h
-pfs_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-pfs_instr_class_t_SOURCES = pfs_instr_class-t.cc
-pfs_instr_class_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-pfs_instr_class_oom_t_SOURCES = pfs_instr_class-oom-t.cc stub_pfs_global.h
-pfs_instr_class_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-pfs_instr_t_SOURCES = pfs_instr-t.cc
-pfs_instr_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-pfs_instr_oom_t_SOURCES = pfs_instr-oom-t.cc stub_pfs_global.h
-pfs_instr_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-pfs_timer_t_SOURCES = pfs_timer-t.cc
-pfs_timer_t_LDADD = $(TEST_CODE) $(PROD_CODE)
-
-EXTRA_DIST = conf.txt CMakeLists.txt
-
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index c51f358c4d8..20e736a546f 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -25,6 +25,7 @@
#include <memory.h>
#include "stub_print_error.h"
+#include "stub_server_misc.h"
/* test helpers, to simulate the setup */
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index 9a3b179aa56..13335326932 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -21,6 +21,7 @@
#include <tap.h>
#include "stub_pfs_global.h"
+#include "stub_server_misc.h"
void test_oom()
{
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index 7dcc8cec7f8..2ef9a5769ca 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -22,6 +22,8 @@
#include <memory.h>
+#include "stub_server_misc.h"
+
void test_no_instruments()
{
int rc;
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index 20fa0f3e6ff..9ccaf432ba2 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -20,6 +20,7 @@
#include <tap.h>
#include "stub_pfs_global.h"
+#include "stub_server_misc.h"
void test_oom()
{
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index c5a199727d5..f9a1ee510b1 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -21,6 +21,8 @@
#include <pfs_global.h>
#include <tap.h>
+#include "stub_server_misc.h"
+
void test_no_registration()
{
int rc;
diff --git a/storage/perfschema/unittest/stub_server_misc.h b/storage/perfschema/unittest/stub_server_misc.h
new file mode 100644
index 00000000000..17beadbb104
--- /dev/null
+++ b/storage/perfschema/unittest/stub_server_misc.h
@@ -0,0 +1,21 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ Minimal code to be able to link a unit test.
+*/
+
+volatile bool ready_to_exit= false;
+
diff --git a/strings/Makefile.am b/strings/Makefile.am
deleted file mode 100644
index 3a051e38899..00000000000
--- a/strings/Makefile.am
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB, 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
-
-# This file is public domain and comes with NO WARRANTY of any kind
-
-#
-# Note that the string library is built with #define THREAD,
-# which by default cause all the thread related code (my_pthread.h)
-# and therefore the associated instrumentation (mysql/psi/mysql_thread.h)
-# to be used.
-# Since the string code itself is not instrumented, we use
-# #define DISABLE_MYSQL_THREAD_H here to avoid unneeded dependencies.
-#
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -DDISABLE_MYSQL_THREAD_H
-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 bchange.c strxnmov.c int2str.c str2int.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
-#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 strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.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
-
-libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
-noinst_PROGRAMS = conf_to_src
-CLEANFILES = str_test uctypedump test_decimal
-# Default charset definitions
-EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-win1250ch.c \
- ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
- ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \
- xml.c decimal.c strto.c strings-x86.s \
- longlong2str.c longlong2str-x86.s longlong2str_asm.c \
- my_strtoll10.c my_strtoll10-x86.s \
- strxmov.c bmove_upp.c strappend.c strcont.c strend.c \
- strfill.c strcend.c is_prefix.c strstr.c \
- strmake.c strnmov.c strmov.c strnlen.c \
- t_ctype.h my_strchr.c CMakeLists.txt \
- CHARSET_INFO.txt
-
-libmystrings_a_LIBADD=
-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
-conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
-
-# This is because the dependency tracking misses @FOO@ vars in sources.
-#strtoull.o: @CHARSET_OBJS@
-
-
-FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
-
-str_test: str_test.c $(pkglib_LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(pkglib_LIBRARIES)
-
-uctypedump: uctypedump.c
- $(LINK) $(INCLUDES) $(srcdir)/uctypedump.c
-
-test_decimal$(EXEEXT): decimal.c $(pkglib_LIBRARIES)
- $(CP) $(srcdir)/decimal.c ./test_decimal.c
- $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES)
- $(RM) -f ./test_decimal.c
diff --git a/strings/bfill.c b/strings/bfill.c
deleted file mode 100644
index ccc063f59e3..00000000000
--- a/strings/bfill.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2002 MySQL AB
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; version 2
- of the License.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
-
-/* File : bfill.c
- Author : Richard A. O'Keefe.
- Michael Widenius; ifdef MC68000
- Updated: 23 April 1984
- Defines: bfill()
-
- bfill(dst, len, fill) moves "len" fill characters to "dst".
- Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' ').
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-#if !defined(bfill) && !defined(HAVE_BFILL)
-
-void bfill(dst, len, fill)
-register byte *dst;
-register uint len;
-register pchar fill;
-{
- while (len-- != 0) *dst++ = fill;
-}
-
-#endif
diff --git a/strings/bmove.c b/strings/bmove.c
deleted file mode 100644
index 0aa825558ca..00000000000
--- a/strings/bmove.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2002 MySQL AB
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; version 2
- of the License.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
-
-/* File : bmove.c
- Author : Richard A. O'Keefe.
- Michael Widenius; ifdef MC68000
- Updated: 23 April 1984
- Defines: bmove()
-
- bmove(dst, src, len) moves exactly "len" bytes from the source "src"
- to the destination "dst". It does not check for NUL characters as
- strncpy() and strnmov() do. Thus if your C compiler doesn't support
- structure assignment, you can simulate it with
- bmove(&to, &from, sizeof from);
- The standard 4.2bsd routine for this purpose is bcopy. But as bcopy
- has its first two arguments the other way around you may find this a
- bit easier to get right.
- No value is returned.
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-
-void bmove(dst, src, len)
-register char *dst;
-register const char *src;
-register uint len;
-{
- while (len-- != 0) *dst++ = *src++;
-}
-
-#endif
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index beacf4f02c4..3cf61b213eb 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -9461,7 +9461,7 @@ CHARSET_INFO my_charset_utf8_sinhala_uca_ci=
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
- 3, /* mbminlen */
+ 1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index ecfac3170d1..85d391d0c70 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1205,12 +1205,10 @@ my_strnncoll_utf16(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res, t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se= s + slen;
const uchar *te= t + tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
- LINT_INIT(t_wc);
while (s < se && t < te)
{
@@ -1271,11 +1269,9 @@ my_strnncollsp_utf16(CHARSET_INFO *cs,
my_bool diff_if_only_endspace_difference)
{
int res;
- my_wc_t s_wc, t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se= s + slen, *te= t + tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
- LINT_INIT(t_wc);
DBUG_ASSERT((slen % 2) == 0);
DBUG_ASSERT((tlen % 2) == 0);
@@ -1451,17 +1447,15 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
- LINT_INIT(s_wc);
- LINT_INIT(t_wc);
while ( s < se && t < te )
{
s_res= my_utf16_uni(cs,&s_wc, s, se);
t_res= my_utf16_uni(cs,&t_wc, t, te);
-
+
if (s_res <= 0 || t_res <= 0)
{
/* Incorrect string, compare by char value */
@@ -1469,9 +1463,9 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs,
}
if (s_wc != t_wc)
{
- return my_bincmp(s, s + s_res, t, t + t_res);
+ return s_wc > t_wc ? 1 : -1;
}
-
+
s+= s_res;
t+= t_res;
}
@@ -1486,10 +1480,8 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs,
my_bool diff_if_only_endspace_difference)
{
int res;
- my_wc_t s_wc, t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se= s + slen, *te= t + tlen;
- LINT_INIT(s_wc);
- LINT_INIT(t_wc);
DBUG_ASSERT((slen % 2) == 0);
DBUG_ASSERT((tlen % 2) == 0);
@@ -1511,7 +1503,7 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs,
if (s_wc != t_wc)
{
- return my_bincmp(s, s + s_res, t, t + t_res);
+ return s_wc > t_wc ? 1 : -1;
}
s+= s_res;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 76fff72290b..324f6b9aafb 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1967,17 +1967,6 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs,
if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0)
break;
src+= res;
- if (cs->mbminlen == 2) /* utf16_bin */
- {
- /*
- Reorder code points to weights as follows:
- U+0000..U+D7FF -> [00][00][00]..[00][D7][FF] BMP part #1
- U+10000..U+10FFFF -> [01][00][00]..[10][FF][FF] Supplementary
- U+E000..U+FFFF -> [20][E0][00]..[20][FF][FF] BMP part #2
- */
- if (wc >= 0xE000 && wc <= 0xFFFF)
- wc+= 0x200000;
- }
*dst++= (uchar) (wc >> 16);
*dst++= (uchar) ((wc >> 8) & 0xFF);
*dst++= (uchar) (wc & 0xFF);
diff --git a/strings/longlong2str-x86.s b/strings/longlong2str-x86.s
deleted file mode 100644
index 3de43a96e78..00000000000
--- a/strings/longlong2str-x86.s
+++ /dev/null
@@ -1,216 +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
-
-# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
-# Some set sequences are optimized for pentuimpro II
-
- .file "longlong2str-x86.s"
- .version "1.02"
-
-.text
- .align 4
-
-.globl longlong2str_with_dig_vector
- .type longlong2str_with_dig_vector,@function
-
-longlong2str_with_dig_vector:
- subl $80,%esp # Temporary buffer for up to 64 radix-2 digits
- pushl %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
- movl 100(%esp),%esi # esi = Lower part of val
- movl 112(%esp),%ebx # ebx = Radix
- movl 104(%esp),%ebp # ebp = Higher part of val
- movl 108(%esp),%edi # edi = dst
-
- testl %ebx,%ebx
- jge .L144 # Radix was positive
- negl %ebx # Change radix to positive
- testl %ebp,%ebp # Test if given value is negative
- jge .L144
- movb $45,(%edi) # Add sign
- incl %edi # Change sign of val
- negl %esi
- adcl $0,%ebp
- negl %ebp
-
-.L144: # Test that radix is between 2 and 36
- movl %ebx, %eax
- addl $-2,%eax # Test that radix is between 2 and 36
- cmpl $34,%eax
- ja .Lerror # Radix was not in range
-
- leal 92(%esp),%ecx # End of buffer
- movl %edi, 108(%esp) # Store possible modified dest
- movl 116(%esp), %edi # dig_vec_upper
- testl %ebp,%ebp # Test if value > 0xFFFFFFFF
- jne .Llongdiv
- cmpl %ebx, %esi # Test if <= radix, for easy loop
- movl %esi, %eax # Value in eax (for Llow)
- jae .Llow
-
- # Value is one digit (negative or positive)
- movb (%eax,%edi),%bl
- movl 108(%esp),%edi # get dst
- movb %bl,(%edi)
- incl %edi # End null here
- jmp .L10_end
-
-.Llongdiv:
- # Value in ebp:esi. div the high part by the radix,
- # then div remainder + low part by the radix.
- movl %ebp,%eax # edx=0,eax=high(from ebp)
- xorl %edx,%edx
- decl %ecx
- divl %ebx
- movl %eax,%ebp # edx=result of last, eax=low(from esi)
- movl %esi,%eax
- divl %ebx
- movl %eax,%esi # ebp:esi = quotient
- movb (%edx,%edi),%dl # Store result number in temporary buffer
- testl %ebp,%ebp
- movb %dl,(%ecx) # store value in buff
- ja .Llongdiv # (Higher part of val still > 0)
-
- .align 4
-.Llow: # Do rest with integer precision
- # Value in 0:eax. div 0 + low part by the radix.
- xorl %edx,%edx
- decl %ecx
- divl %ebx
- movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36
- testl %eax,%eax
- movb %dl,(%ecx)
- jne .Llow
-
-.L160:
- movl 108(%esp),%edi # get dst
-
-.Lcopy_end:
- leal 92(%esp),%esi # End of buffer
-.Lmov: # mov temporary buffer to result (%ecx -> %edi)
- movb (%ecx), %al
- movb %al, (%edi)
- incl %ecx
- incl %edi
- cmpl %ecx,%esi
- jne .Lmov
-
-.L10_end:
- movl %edi,%eax # Pointer to end null
- movb $0,(%edi) # Store the end null
-
-.L165:
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- addl $80,%esp
- ret
-
-.Lerror:
- xorl %eax,%eax # Wrong radix
- jmp .L165
-
-.Lfe3:
- .size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector
-
-#
-# This is almost equal to the above, except that we can do the final
-# loop much more efficient
-#
-
- .align 4
-
-.globl longlong10_to_str
- .type longlong10_to_str,@function
-longlong10_to_str:
- subl $80,%esp
- pushl %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
- movl 100(%esp),%esi # Lower part of val
- movl 104(%esp),%ebp # Higher part of val
- movl 108(%esp),%edi # get dst
- movl 112(%esp),%ebx # Radix (10 or -10)
- testl %ebx,%ebx
- jge .L10_10 # Positive radix
-
- negl %ebx # Change radix to positive (= 10)
-
- testl %ebp,%ebp # Test if negative value
- jge .L10_10
- movb $45,(%edi) # Add sign
- incl %edi
- negl %esi # Change sign of val (ebp:esi)
- adcl $0,%ebp
- negl %ebp
-
-.L10_10:
- leal 92(%esp),%ecx # End of buffer
- testl %ebp,%ebp # Test if value > 0xFFFFFFFF
- jne .L10_longdiv
- cmpl $10, %esi # Test if <= radix, for easy loop
- movl %esi, %ebx # Value in eax (for L10_low)
- jae .L10_low
-
- # Value is one digit (negative or positive)
- addb $48, %bl
- movb %bl,(%edi)
- incl %edi
- jmp .L10_end
- .align 4
-
-.L10_longdiv:
- # val is stored in in ebp:esi
- movl %ebp,%eax # High part of value
- xorl %edx,%edx
- divl %ebx # Divide by 10
- movl %eax,%ebp
- movl %esi,%eax
- divl %ebx # Divide by 10
- decl %ecx
- movl %eax,%esi # quotent in ebp:esi
- addl $48,%edx # Convert to ascii
- movb %dl,(%ecx) # store value in buff
-
-.L10_30:
- testl %ebp,%ebp
- ja .L10_longdiv
- movl %esi,%ebx # Move val to %ebx
-
-.L10_low:
- # The following code uses some tricks to change division by 10 to
- # multiplication and shifts
- movl $0xcccccccd,%esi
-
-.L10_40: # Divide %ebx with 10
- movl %ebx,%eax
- mull %esi
- decl %ecx
- shrl $3,%edx
- leal (%edx,%edx,4),%eax
- addl %eax,%eax
- subb %al,%bl # %bl now contains val % 10
- addb $48,%bl
- movb %bl,(%ecx)
- movl %edx,%ebx
- testl %ebx,%ebx
- jne .L10_40
- jmp .Lcopy_end # Shared end with longlong2str
-
-.L10end:
- .size longlong10_to_str,.L10end-longlong10_to_str
diff --git a/strings/longlong2str_asm.c b/strings/longlong2str_asm.c
deleted file mode 100644
index e5628043da6..00000000000
--- a/strings/longlong2str_asm.c
+++ /dev/null
@@ -1,33 +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 */
-
-/*
- Wrapper for longlong2str.s
-
- We need this because the assembler code can't access the local variable
- _dig_vector in a portable manner.
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix,
- const char *dig_vector);
-
-char *ll2str(longlong val,char *dst,int radix, int upcase)
-{
- return longlong2str_with_dig_vector(val, dst, radix,
- upcase ? _dig_vec_upper : _dig_vec_lower);
-}
diff --git a/strings/my_strtoll10-x86.s b/strings/my_strtoll10-x86.s
deleted file mode 100644
index f73428de7de..00000000000
--- a/strings/my_strtoll10-x86.s
+++ /dev/null
@@ -1,418 +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
-
-# Implemention of my_strtoll(): Converting a string to a 64 bit integer.
-# For documentation, check my_strtoll.c
-
- .file "my_strtoll10-x86.s"
- .version "01.02"
-
-.text
- .align 4
-
-.globl my_strtoll10
- .type my_strtoll10,@function
-
-
- # Used stack variables
- # ebp-4 dummy for storing endptr if endptr = 0
- # ebp-8 First 9 digits of return values
- # ebp-12 Pointer to first digit of second part
- # ebp-16 Store lowest 2 digits
- # ebp-20 != 0 if value was negative
- # ebp-24 High max value
- # ebp-28 Middle max value
- # ebp-32 Low max value
- # ebp-36 Temp value
-
- # esi Pointer to input string
- # ebx End of string
-
-my_strtoll10:
- pushl %ebp
- movl %esp,%ebp
- subl $48,%esp
- pushl %esi
- pushl %edi
- pushl %ebx
- movl 8(%ebp),%esi # esi= nptr
- movl 16(%ebp),%ecx # ecx= error (Will be overwritten later)
- movl 12(%ebp),%eax # eax= endptr
- cmpl $0,%eax # if (endptr)
- je .L110
-
-# Fixed length string
- movl (%eax),%ebx # bx= end-of-string
- .p2align 4,,7
-.L100:
- cmpl %ebx,%esi
- je .Lno_conv
- movb (%esi), %al # al= next byte
- incl %esi
- cmpb $32,%al # Skip space
- je .L100
- cmpb $9,%al # Skip tab
- je .L100
- jmp .L130
-
-# String that ends with \0
-
-.L110:
- leal -4(%ebp),%edi
- movl %edi,12(%ebp) # endptr= &dummy, for easier end check
- .p2align 4,,7
-.L120:
- movb (%esi), %al # al= next byte
- incl %esi
- cmpb $32,%al
- je .L120
- cmpb $9,%al
- je .L120
- testb %al,%al # Test if we found end \0
- je .Lno_conv
- leal 65535(%esi),%ebx # ebx = end-of-string
-
-.L130:
- cmpb $45,%al # Test if '-'
- jne .Lpositive
-
- # negative number
- movl $-1,(%ecx) # error = -1 (mark that number is negative)
- movl $1,-20(%ebp) # negative= 1
- movl $92233720,-24(%ebp)
- movl $368547758,-28(%ebp)
- movl $8,-32(%ebp)
- jmp .L460
-
- .p2align 4,,7
-.Lpositive:
- movl $0,(%ecx) # error=0
- movl $0,-20(%ebp) # negative= 0
- movl $184467440,-24(%ebp)
- movl $737095516,-28(%ebp)
- movl $15,-32(%ebp)
- cmpb $43,%al # Check if '+'
- jne .L462
-
-.L460:
- cmpl %ebx,%esi # Check if overflow
- je .Lno_conv
- movb (%esi), %al # al= next byte after sign
- incl %esi
-
- # Remove pre zero to be able to handle a lot of pre-zero
-.L462:
- cmpb $48,%al
- jne .L475 # Number doesn't start with 0
- decl %esi
- .p2align 4,,7
-
- # Skip pre zeros
-.L481:
- incl %esi # Skip processed byte
- cmpl %ebx,%esi
- je .Lms_return_zero
- cmpb (%esi),%al # Test if next byte is also zero
- je .L481
- leal 9(%esi),%ecx # ecx = end-of-current-part
- xorl %edi,%edi # Store first 9 digits in edi
- jmp .L482
- .p2align 4,,7
-
- # Check if first char is a valid number
-.L475:
- addb $-48,%al
- cmpb $9,%al
- ja .Lno_conv
-.L477:
- movzbl %al,%edi # edi = first digit
- leal 8(%esi),%ecx # ecx = end-of-current-part
-
- # Handle first 8/9 digits and store them in edi
-.L482:
- cmpl %ebx,%ecx
- jbe .L522
- movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
- jmp .L522
-
- .p2align 4,,7
-.L488:
- movb (%esi), %al # al= next byte
- incl %esi
- addb $-48,%al
- cmpb $9,%al
- ja .Lend_i_dec_esi
-
- # Calculate edi= edi*10 + al
- leal (%edi,%edi,4),%edx
- movzbl %al,%eax
- leal (%eax,%edx,2),%edi
-.L522:
- cmpl %ecx,%esi # If more digits at this level
- jne .L488
- cmpl %ebx,%esi # If end of string
- je .Lend_i
-
- movl %edi,-8(%ebp) # Store first 9 digits
- movl %esi,-12(%ebp) # store pos to first digit of second part
-
- # Calculate next 9 digits and store them in edi
-
- xorl %edi,%edi
- leal 9(%esi),%ecx # ecx= end-of-current-part
- movl %ecx,-36(%ebp) # Store max length
- cmpl %ebx,%ecx
- jbe .L498
- movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
-
- .p2align 4,,7
-.L498:
- movb (%esi), %al # al= next byte
- incl %esi
- addb $-48,%al
- cmpb $9,%al
- ja .Lend_i_and_j_decl_esi
-
- # Calculate edi= edi*10 + al
- leal (%edi,%edi,4),%edx
- movzbl %al,%eax
- leal (%eax,%edx,2),%edi
-
- cmpl %ecx,%esi # If end of current part
- jne .L498
- cmpl %ebx,%esi # If end of string
- jne .L500
- cmpl -36(%ebp),%esi # Test if string is less than 18 digits
- jne .Lend_i_and_j
-.L499:
- movl $1000000000,%eax
- jmp .Lgot_factor # 18 digit string
-
- # Handle the possible next to last digit and store in ecx
-.L500:
- movb (%esi),%al
- addb $-48,%al
- cmpb $9,%al
- ja .L499 # 18 digit string
-
- incl %esi
- movzbl %al,%ecx
- cmpl %ebx,%esi # If end of string
- je .Lend4
-
- movb (%esi),%al # Read last digit
- addb $-48,%al
- cmpb $9,%al
- ja .Lend4
-
- # ecx= ecx*10 + al
- leal (%ecx,%ecx,4),%edx
- movzbl %al,%eax
- leal (%eax,%edx,2),%ecx
-
- movl 12(%ebp),%eax # eax = endptr
- incl %esi
- movl %esi,(%eax) # *endptr = end-of-string
- cmpl %ebx,%esi
- je .L505 # At end of string
-
- movb (%esi),%al # check if extra digits
- addb $-48,%al
- cmpb $9,%al
- jbe .Loverflow
-
- # At this point we have:
- # -8(%ebp) First 9 digits
- # edi Next 9 digits
- # ecx Last 2 digits
- # *endpos end-of-string
-
-.L505: # Check that we are not going to get overflow for unsigned long long
- movl -8(%ebp),%eax # First 9 digits
- cmpl -24(%ebp),%eax
- ja .Loverflow
- jne .L507
- cmpl -28(%ebp),%edi
- ja .Loverflow
- jne .L507
- cmpl -32(%ebp),%ecx
- ja .Loverflow
-
-.L507:
- movl %edi,-4(%ebp) # Save middle bytes
- movl %ecx,%esi # esi = 2 last digits
- movl $1215752192,%ecx # %ecx= lower_32_bits(100000000000)
- mull %ecx
- imull $23,-8(%ebp),%ecx
- movl $0,-36(%ebp)
- movl %eax,%ebx
- imull $1215752192,-36(%ebp),%eax
- movl %edx,%edi
- addl %ecx,%edi
- addl %eax,%edi # Temp in edi:ebx
-
- movl $100,%eax # j= j*100
- mull -4(%ebp)
- addl %ebx,%eax # edx:eax+= edi:ebx
- adcl %edi,%edx
- addl %esi,%eax
- adcl $0,%edx
- jmp .Lms_return
-
-.Loverflow:
- # When we come here, *endptr is already updated
-
- movl 16(%ebp),%edx # edx= error
- movl $34,(%edx) # *error = 34
- movl $-1,%eax
- movl %eax,%edx
- cmpl $0,-20(%ebp) # If negative
- je .Lms_return
- xor %eax,%eax # edx:eax = LONGLONG_LMIN
- movl $-2147483648,%edx
- jmp .Lms_return
-
- # Return value that is in %edi as long long
- .p2align 4,,7
-.Lend_i_dec_esi:
- decl %esi # Fix so that it points at last digit
-.Lend_i:
- xorl %edx,%edx
- movl %edi,%eax
- cmpl $0,-20(%ebp)
- je .Lreturn_save_endptr # Positive number
- negl %eax
- cltd # Neg result in edx:eax
- jmp .Lreturn_save_endptr
-
- # Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi
- .p2align 4,,7
-.Lend_i_and_j_decl_esi:
- decl %esi # Fix so that it points at last digit
-.Lend_i_and_j:
- movl %esi,%ecx
- subl -12(%ebp),%ecx # ecx= number of digits in second part
-
- # Calculate %eax= 10 ** %cl, where %cl <= 8
- # With an array one could do this with:
- # movl 10_factor_table(,%ecx,4),%eax
- # We calculate the table here to avoid problems in
- # position independent code (gcc -pic)
-
- cmpb $3,%cl
- ja .L4_to_8
- movl $1000, %eax
- je .Lgot_factor # %cl=3, eax= 1000
- movl $10, %eax
- cmpb $1,%cl # %cl is here 0 - 2
- je .Lgot_factor # %cl=1, eax= 10
- movl $100, %eax
- ja .Lgot_factor # %cl=2, eax=100
- movl $1, %eax
- jmp .Lgot_factor # %cl=0, eax=1
-
-.L4_to_8: # %cl is here 4-8
- cmpb $5,%cl
- movl $100000, %eax
- je .Lgot_factor # %cl=5, eax=100000
- movl $10000, %eax
- jbe .Lgot_factor # %cl=4, eax=10000
- movl $10000000, %eax
- cmpb $7,%cl
- je .Lgot_factor # %cl=7, eax=10000000
- movl $100000000, %eax
- ja .Lgot_factor # %cl=8, eax=100000000
- movl $1000000, %eax # %cl=6, eax=1000000
-
- # Return -8(%ebp) * %eax + edi
- .p2align 4,,7
-.Lgot_factor:
- mull -8(%ebp)
- addl %edi,%eax
- adcl $0,%edx
- cmpl $0,-20(%ebp) # if negative
- je .Lreturn_save_endptr
- negl %eax # Neg edx:%eax
- adcl $0,%edx
- negl %edx
- jmp .Lreturn_save_endptr
-
- # Return -8(%ebp) * $10000000000 + edi*10 + ecx
- .p2align 4,,7
-.Lend4:
- movl %ecx,-16(%ebp) # store lowest digits
- movl 12(%ebp),%ebx
- movl %esi,(%ebx) # *endpos = end-of-string
- movl -8(%ebp),%eax # First 9 digits
- movl $1410065408,%ecx # ecx= lower_32_bits(10000000000)
- mull %ecx
- movl $0,-36(%ebp)
- movl %eax,%ebx # Store lowest 32 byte from multiplication
- imull $1410065408,-36(%ebp),%eax
- movl -8(%ebp),%ecx # First 9 digits
- movl %edx,%esi
- addl %ecx,%ecx
- addl %ecx,%esi
- addl %eax,%esi # %esi:%ebx now has -8(%ebp) * $10000000000
-
- movl $10,%eax # Calc edi*10
- mull %edi
- addl %ebx,%eax # And add to result
- adcl %esi,%edx
- addl -16(%ebp),%eax # Add lowest digit
- adcl $0,%edx
- cmpl $0,-20(%ebp) # if negative
- je .Lms_return
-
- cmpl $-2147483648,%edx # Test if too big signed integer
- ja .Loverflow
- jne .L516
- testl %eax,%eax
- ja .Loverflow
-
-.L516:
- negl %eax
- adcl $0,%edx
- negl %edx
- jmp .Lms_return
-
- .p2align 4,,7
-.Lno_conv: # Not a legal number
- movl 16(%ebp),%eax
- movl $33,(%eax) # error= edom
-
-.Lms_return_zero:
- xorl %eax,%eax # Return zero
- xorl %edx,%edx
-
- .p2align 4,,7
-.Lreturn_save_endptr:
- movl 12(%ebp),%ecx # endptr= end-of-string
- movl %esi,(%ecx) # *endptr= end-of-string
-
-.Lms_return:
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp,%esp
- popl %ebp
- ret
-
-.my_strtoll10_end:
- .size my_strtoll10,.my_strtoll10_end-my_strtoll10
- .comm res,240,32
- .comm end_ptr,120,32
- .comm error,120,32
- .ident "Monty"
diff --git a/strings/str_test.c b/strings/str_test.c
deleted file mode 100644
index 7e304fbd10a..00000000000
--- a/strings/str_test.c
+++ /dev/null
@@ -1,275 +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 */
-
-/* Test of all stringfunktions that is coded in assembler */
-
-#include <my_global.h>
-#include <stdarg.h>
-#include "m_string.h"
-
-#define F_LEN 8
-#define F_CHAR 'A'
-#define F_FILL 'B'
-#define T_LEN 15
-#define T_CHAR 'D'
-#define T_FILL 'E'
-#define F_PREFILL '0'
-#define T_PREFILL '1'
-
-static char from_buff[100],to_buff[100];
-static char * from, *to;
-static int errors,tests;
-static int test_strarg(const char *name,...);
-static void init_strings (void); /* Init from and to */
-void test_arg (const char *message,long func_value,long value);
-int compare_buff(const char *message,char * b1,char * b2,int length,
- pchar fill, pchar prefill);
-
-static int my_test(int a)
-{
- return a ? 1 : 0;
-}
-
-int main(void)
-{
- static char v1[]="Monty",v2[]="on",v3[]="Montys",v4[]="ty",v5[]="gr",
- v6[]="hohohoo",v7[]="hohoo",v8[]="hohooo",v9[]="t",
- cont[]="qwet";
- errors=tests=0;
- init_strings();
-
- 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("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);
- test_arg("strchr(v1,'x')",(long) strchr(v1,'x'),0L);
- test_arg("strcont(v1,cont)",(long) strcont(v1,cont),(long) v1+3);
- test_arg("strcont(v1,v2)",(long) strcont(v1,v2),(long) v1+1);
- test_arg("strcont(v1,v5)",(long) strcont(v1,v5),0L);
- test_arg("is_prefix(v3,v1)",(long) is_prefix(v3,v1),1L);
- test_arg("is_prefix(v1,v3)",(long) is_prefix(v1,v3),0L);
- test_arg("is_prefix(v3,v4)",(long) is_prefix(v3,v4),0L);
- test_arg("strstr(v1,v1)",(long) strstr(v1,v1),(long) v1);
- test_arg("strstr(v1,v2)",(long) strstr(v1,v2),(long) v1+1);
- test_arg("strstr(v1,v4)",(long) strstr(v1,v4),(long) v1+3);
- test_arg("strstr(v6,v7)",(long) strstr(v6,v7),(long) v6+2);
- test_arg("strstr(v1,v9)",(long) strstr(v1,v9),(long) v1+3);
- test_arg("strstr(v1,v3)",(long) strstr(v1,v3),0L);
- test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L);
- test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L);
-
- test_arg("strlen(from)",(long) strlen(from),(long) F_LEN);
- test_arg("strlen(\"\")",(long) strlen(""),0L);
-#ifdef HAVE_STRNLEN
- test_arg("strnlen(from,3)",(long) strnlen(from,3),3L);
- test_arg("strnlen(from,0)",(long) strnlen(from,0),0L);
- test_arg("strnlen(from,1000)",(long) strnlen(from,1000),(long) F_LEN);
-#endif
-
- test_strarg("bfill(to,4,' ')",(bfill(to,4,' '),0L),INT_MAX32,4,' ',0,0);
- test_strarg("bfill(from,0,' ')",(bfill(from,0,' '),0L),INT_MAX32,0,0);
- test_strarg("bzero(to,3)",(bzero(to,3),0L),INT_MAX32,3,0,0,0);
- test_strarg("bzero(to,0)",(bzero(to,0),0L),INT_MAX32,0,0);
- test_strarg("bmove(to,from,4)",(bmove(to,from,4),0L),INT_MAX32,4,F_CHAR,
- 0,0);
- test_strarg("bmove(to,from,0)",(bmove(to,from,0),0L),INT_MAX32,0,0);
- 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("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);
- test_strarg("strappend(to,T_LEN+5,' ')",(strappend(to,T_LEN+5,' '),0L),INT_MAX32,
- T_LEN,T_CHAR,5,' ',1,0,0,0);
- test_strarg("strcat(to,from)",strcat(to,from),to,T_LEN,T_CHAR,
- F_LEN,F_CHAR,1,0,0,0);
- test_strarg("strcat(to,\"\")",strcat(to,""),INT_MAX32,0,0);
- test_strarg("strfill(to,4,' ')",strfill(to,4,' '),to+4,4,' ',1,0,0,0);
- test_strarg("strfill(from,0,' ')",strfill(from,0,' '),from,0,1,0,0);
- test_strarg("strmake(to,from,4)",strmake(to,from,4),to+4,4,F_CHAR,
- 1,0,0,0);
- test_strarg("strmake(to,from,0)",strmake(to,from,0),to+0,1,0,0,0);
- test_strarg("strmov(to,from)",strmov(to,from),to+F_LEN,F_LEN,F_CHAR,0,0);
- test_strarg("strmov(to,\"\")",strmov(to,""),to,1,0,0,0);
- test_strarg("strnmov(to,from,2)",strnmov(to,from,2),to+2,2,F_CHAR,0,0);
- test_strarg("strnmov(to,from,F_LEN+5)",strnmov(to,from,F_LEN+5),to+F_LEN,
- F_LEN,F_CHAR,1,0,0,0);
- test_strarg("strnmov(to,\"\",2)",strnmov(to,"",2),to,1,0,0,0);
- test_strarg("strxmov(to,from,\"!!\",NullS)",strxmov(to,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
- test_strarg("strxmov(to,NullS)",strxmov(to,NullS),to,1,0,0,0);
- test_strarg("strxmov(to,from,from,from,from,from,'!!',from,NullS)",strxmov(to,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
-
- test_strarg("strxnmov(to,100,from,\"!!\",NullS)",strxnmov(to,100,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
- test_strarg("strxnmov(to,2,NullS)",strxnmov(to,2,NullS),to,1,0,0,0);
- test_strarg("strxnmov(to,100,from,from,from,from,from,'!!',from,NullS)",strxnmov(to,100,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
- test_strarg("strxnmov(to,2,\"!!!\",NullS)",strxnmov(to,2,"!!!",NullS),to+2,2,'!',0,0,0);
- test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0);
- test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0);
-
- test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32,
- 4,F_CHAR,2,T_CHAR,0,0);
-
- printf("tests: %d errors: %d\n",tests,errors);
- if (errors)
- fputs("--- Some functions doesn't work!! Fix them\n",stderr);
- return(errors > 0);
-} /* main */
-
-
- /* Init strings */
-
-void init_strings(void)
-{
- reg1 int i;
- reg2 char *pos;
-
- from=from_buff+3; to=to_buff+3;
-
- pos=from_buff; *pos++= F_FILL; *pos++=F_FILL; *pos++=F_PREFILL;
- for (i=0 ; i < F_LEN ; i++)
- *pos++=F_CHAR;
- *pos++=0;
- for (i=0; i<50 ; i++)
- *pos++= F_FILL;
-
- pos=to_buff; *pos++= T_FILL; *pos++=T_FILL; *pos++=T_PREFILL;
- for (i=0 ; i < T_LEN ; i++)
- *pos++=T_CHAR;
- *pos++=0;
- for (i=0; i<50 ; i++)
- *pos++= T_FILL;
-} /* init_strings */
-
-
- /* Test that function return rigth value */
-
-void test_arg(const char *message, long int func_value, long int value)
-{
- tests++;
- printf("testing '%s'\n",message);
- if (func_value != value)
- {
- printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value);
- errors++;
- }
-} /* test_arg */
-
- /* Test function return value and from and to arrays */
-
-static int test_strarg(const char *message,...)
-{
- long func_value,value;
- int error,length;
- char chr,cmp_buff[100],*pos,*pos2;
- va_list pvar;
-
- tests++;
- va_start(pvar,message);
- func_value=va_arg(pvar,long);
- value=va_arg(pvar,long);
-
- printf("testing '%s'\n",message);
- if (func_value != value && value != INT_MAX32)
- {
- printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value);
- errors++;
- }
- pos= cmp_buff;
- while ((length = va_arg(pvar, int)) != 0)
- {
- chr= (char) (va_arg(pvar, int));
- while (length--)
- *pos++=chr;
- }
- pos2=to+ (int)(pos-cmp_buff);
- while (pos <= cmp_buff+T_LEN)
- *pos++= *pos2++;
- if (compare_buff(message,to,cmp_buff,(int) (pos-cmp_buff),T_FILL,T_PREFILL))
- {
- init_strings();
- va_end(pvar);
- return 1;
- }
-
- pos= cmp_buff;
- while ((length = va_arg(pvar, int)) != 0)
- {
- chr= (char) (va_arg(pvar, int));
- while (length--)
- *pos++=chr;
- }
- pos2=from+ (int)(pos-cmp_buff);
- while (pos <= cmp_buff+F_LEN)
- *pos++= *pos2++;
- error=compare_buff(message,from,cmp_buff,(int) (pos-cmp_buff),F_FILL,F_PREFILL);
- init_strings();
- va_end(pvar);
- return (error != 0);
-} /* test_strarg */
-
-
- /* test if function made right value */
-
-int compare_buff(const char *message, char * b1, char * b2, int length,
- pchar fill, pchar prefill)
-{
- int i,error=0;
-
- if (memcmp(b1,b2,length))
- {
- errors++;
- printf("func: '%s' Buffers differ\nIs: ",message);
- for (i=0 ; i<length ; i++)
- printf("%3d ",b1[i]);
- printf("\nShould be: ");
- for (i=0 ; i<length ; i++)
- printf("%3d ",b2[i]);
- puts("");
- }
- else if (b1[-1] != prefill || b1[-2] != fill || b1[-3] != fill)
- {
- printf("func: '%s' Chars before buffer is changed\n",message);
- errors++;
- error=1;
- }
- else if (b1[length] != fill || b1[length+1] != fill)
- {
- printf("func: '%s' Chars after buffer is changed\n",message);
- errors++;
- error=1;
- }
- return error;
-} /* compare_buff */
-
- /* These are here to be loaded and examined */
-
-extern void dummy_functions(void);
-
-void dummy_functions(void)
-{
- (void) memchr(from,'a',5);
- (void) memcmp(from,to,5);
- (void) memcpy(from,to,5);
- (void) memset(from,' ',5);
- (void) strcmp(from,to);
- (void) strcpy(from,to);
- (void) strstr(from,to);
- (void) strrchr(from,'a');
- return;
-}
diff --git a/strings/strings-x86.s b/strings/strings-x86.s
deleted file mode 100644
index 4872c566685..00000000000
--- a/strings/strings-x86.s
+++ /dev/null
@@ -1,393 +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
-
-# Optimized string functions Intel 80x86 (gcc/gas syntax)
-
- .file "strings.s"
- .version "1.00"
-
-.text
-
-# Move a alligned, not overlapped, by (long) divided memory area
-# Args: to,from,length
-
-.globl bmove_align
- .type bmove_align,@function
-bmove_align:
- movl %edi,%edx
- push %esi
- movl 4(%esp),%edi # to
- movl 8(%esp),%esi # from
- movl 12(%esp),%ecx # length
- addw $3,%cx # fix if not divisible with long
- shrw $2,%cx
- jz .ba_20
- .p2align 4,,7
-.ba_10:
- movl -4(%esi,%ecx),%eax
- movl %eax,-4(%edi,%ecx)
- decl %ecx
- jnz .ba_10
-.ba_20: pop %esi
- movl %edx,%edi
- ret
-
-.bmove_align_end:
- .size bmove_align,.bmove_align_end-bmove_align
-
- # Move a string from higher to lower
- # Arg from_end+1,to_end+1,length
-
-.globl bmove_upp
- .type bmove_upp,@function
-bmove_upp:
- movl %edi,%edx # Remember %edi
- push %esi
- movl 8(%esp),%edi # dst
- movl 16(%esp),%ecx # length
- movl 12(%esp),%esi # source
- test %ecx,%ecx
- jz .bu_20
- subl %ecx,%esi # To start of strings
- subl %ecx,%edi
-
- .p2align 4,,7
-.bu_10: movb -1(%esi,%ecx),%al
- movb %al,-1(%edi,%ecx)
- decl %ecx
- jnz .bu_10
-.bu_20: pop %esi
- movl %edx,%edi
- ret
-
-.bmove_upp_end:
- .size bmove_upp,.bmove_upp_end-bmove_upp
-
- # Append fillchars to string
- # Args: dest,len,fill
-
-.globl strappend
- .type strappend,@function
-strappend:
- pushl %edi
- movl 8(%esp),%edi # Memory pointer
- movl 12(%esp),%ecx # Length
- clrl %eax # Find end of string
- repne
- scasb
- jnz sa_99 # String to long, shorten it
- movzb 16(%esp),%eax # Fillchar
- decl %edi # Point at end null
- incl %ecx # rep made one dec for null-char
-
- movb %al,%ah # (2) Set up a 32 bit pattern.
- movw %ax,%dx # (2)
- shll $16,%eax # (3)
- movw %dx,%ax # (2) %eax has the 32 bit pattern.
-
- movl %ecx,%edx # (2) Save the count of bytes.
- shrl $2,%ecx # (2) Number of dwords.
- rep
- stosl # (5 + 5n)
- movb $3,%cl # (2)
- and %edx,%ecx # (2) Fill in the odd bytes
- rep
- stosb # Move last bytes if any
-
-sa_99: movb $0,(%edi) # End of string
- popl %edi
- ret
-.strappend_end:
- .size strappend,.strappend_end-strappend
-
- # Find if string contains any char in another string
- # Arg: str,set
- # Ret: Pointer to first found char in str
-
-.globl strcont
- .type strcont,@function
-strcont:
- movl %edi,%edx
- pushl %esi
- movl 8(%esp),%esi # str
- movl 12(%esp),%ecx # set
- clrb %ah # For endtest
- jmp sc_60
-
-sc_10: scasb
- jz sc_fo # Found char
-sc_20: cmp (%edi),%ah # Test if null
- jnz sc_10 # Not end of set yet
- incl %esi # Next char in str
-sc_60: movl %ecx,%edi # %edi = Set
- movb (%esi),%al # Test if this char exist
- andb %al,%al
- jnz sc_20 # Not end of string
- clrl %esi # Return Null
-sc_fo: movl %esi,%eax # Char found here
- movl %edx,%edi # Restore
- popl %esi
- ret
-.strcont_end:
- .size strcont,.strcont_end-strcont
-
- # Find end of string
- # Arg: str
- # ret: Pointer to end null
-
-.globl strend
- .type strend,@function
-strend:
- movl %edi,%edx # Save
- movl 4(%esp),%edi # str
- clrl %eax # Find end of string
- movl %eax,%ecx
- decl %ecx # ECX = -1
- repne
- scasb
- movl %edi,%eax
- decl %eax # End of string
- movl %edx,%edi # Restore
- ret
-.strend_end:
- .size strend,.strend_end-strend
-
- # Make a string with len fill-chars and endnull
- # Args: dest,len,fill
- # Ret: dest+len
-
-.globl strfill
- .type strfill,@function
-strfill:
- pushl %edi
- movl 8(%esp),%edi # Memory pointer
- movl 12(%esp),%ecx # Length
- movzb 16(%esp),%eax # Fill
-
- movb %al,%ah # (2) Set up a 32 bit pattern
- movw %ax,%dx # (2)
- shll $16,%eax # (3)
- movw %dx,%ax # (2) %eax has the 32 bit pattern.
-
- movl %ecx,%edx # (2) Save the count of bytes.
- shrl $2,%ecx # (2) Number of dwords.
- rep
- stosl # (5 + 5n)
- movb $3,%cl # (2)
- and %edx,%ecx # (2) Fill in the odd bytes
- rep
- stosb # Move last bytes if any
-
- movb %cl,(%edi) # End NULL
- movl %edi,%eax # End i %eax
- popl %edi
- ret
-.strfill_end:
- .size strfill,.strfill_end-strfill
-
-
- # Find a char in or end of a string
- # Arg: str,char
- # Ret: pointer to found char or NullS
-
-.globl strcend
- .type strcend,@function
-strcend:
- movl %edi,%edx
- movl 4(%esp),%edi # str
- movb 8(%esp),%ah # search
- clrb %al # for scasb to find end
-
-se_10: cmpb (%edi),%ah
- jz se_20 # Found char
- scasb
- jnz se_10 # Not end
- dec %edi # Not found, point at end of string
-se_20: movl %edi,%eax
- movl %edx,%edi # Restore
- ret
-.strcend_end:
- .size strcend,.strcend_end-strcend
-
- # Test if string has a given suffix
-
-.globl is_prefix
- .type is_prefix,@function
-is_prefix:
- movl %edi,%edx # Save %edi
- pushl %esi # and %esi
- movl 12(%esp),%esi # get suffix
- movl 8(%esp),%edi # s1
- movl $1,%eax # Ok and zero-test
-ip_10: cmpb (%esi),%ah
- jz suf_ok # End of string/ found suffix
- cmpsb # Compare strings
- jz ip_10 # Same, possible prefix
- xor %eax,%eax # Not suffix
-suf_ok: popl %esi
- movl %edx,%edi
- ret
-.is_prefix_end:
- .size is_prefix,.is_prefix_end-is_prefix
-
- # Find a substring in string
- # Arg: str,search
-
-.globl strstr
- .type strstr,@function
-
-strstr:
- pushl %edi
- pushl %esi
- movl 12(%esp),%esi # str
- movl 16(%esp),%edi # search
- movl %edi,%ecx
- incl %ecx # %ecx = search+1
- movb (%edi),%ah # %ah = First char in search
- jmp sf_10
-
-sf_00: movl %edx,%esi # si = Current str-pos
-sf_10: movb (%esi),%al # Test if this char exist
- andb %al,%al
- jz sf_90 # End of string, didn't find search
- incl %esi
- cmpb %al,%ah
- jnz sf_10 # Didn't find first char, continue
- movl %esi,%edx # Save str-pos in %edx
- movl %ecx,%edi
-sf_20: cmpb $0,(%edi)
- jz sf_fo # Found substring
- cmpsb
- jz sf_20 # Char ok
- jmp sf_00 # Next str-pos
-
-sf_90: movl $1,%edx # Return Null
-sf_fo: movl %edx,%eax # Char found here
- decl %eax # Pointed one after
- popl %esi
- popl %edi
- ret
-.strstr_end:
- .size strstr,.strstr_end-strstr
-
- # Make a string of len length from another string
- # Arg: dst,src,length
- # ret: end of dst
-
-.globl strmake
- .type strmake,@function
-
-strmake:
- pushl %edi
- pushl %esi
- mov 12(%esp),%edi # dst
- movl $0,%edx
- movl 20(%esp),%ecx # length
- movl 16(%esp),%esi # src
- cmpl %edx,%ecx
- jz sm_90
-sm_00: movb (%esi,%edx),%al
- cmpb $0,%al
- jz sm_90
- movb %al,(%edi,%edx)
- incl %edx
- cmpl %edx,%ecx
- jnz sm_00
-sm_90: movb $0,(%edi,%edx)
-sm_99: lea (%edi,%edx),%eax # Return pointer to end null
- pop %esi
- pop %edi
- ret
-.strmake_end:
- .size strmake,.strmake_end-strmake
-
- # Move a string with max len chars
- # arg: dst,src,len
- # ret: pos to first null or dst+len
-
-.globl strnmov
- .type strnmov,@function
-strnmov:
- pushl %edi
- pushl %esi
- movl 12(%esp),%edi # dst
- movl 16(%esp),%esi # src
- movl 20(%esp),%ecx # Length of memory-area
- jecxz snm_99 # Nothing to do
- clrb %al # For test of end-null
-
-snm_10: cmpb (%esi),%al # Next char to move
- movsb # move arg
- jz snm_20 # last char, fill with null
- loop snm_10 # Continue moving
- incl %edi # Point two after last
-snm_20: decl %edi # Point at first null (or last+1)
-snm_99: movl %edi,%eax # Pointer at last char
- popl %esi
- popl %edi
- ret
-.strnmov_end:
- .size strnmov,.strnmov_end-strnmov
-
-
-.globl strmov
- .type strmov,@function
-strmov:
- movl %esi,%ecx # Save old %esi and %edi
- movl %edi,%edx
- movl 8(%esp),%esi # get source pointer (s2)
- movl 4(%esp),%edi # %edi -> s1
-smo_10: movb (%esi),%al
- movsb # move arg
- andb %al,%al
- jnz smo_10 # Not last
- movl %edi,%eax
- dec %eax
- movl %ecx,%esi # Restore
- movl %edx,%edi
- ret
-.strmov_end:
- .size strmov,.strmov_end-strmov
-
-.globl strxmov
- .type strxmov,@function
-strxmov:
- movl %ebx,%edx # Save %ebx, %esi and %edi
- mov %esi,%ecx
- push %edi
- leal 8(%esp),%ebx # Get destination
- movl (%ebx),%edi
- xorb %al,%al
- jmp next_str # Handle source ebx+4
-
-start_str:
- movsb
- cmpb -1(%edi),%al
- jne start_str
- decl %edi # Don't copy last null
-
-next_str:
- addl $4,%ebx
- movl (%ebx),%esi
- orl %esi,%esi
- jne start_str
- movb %al,0(%edi) # Force last to ASCII 0
-
- movl %edi,%eax # Return ptr to ASCII 0
- pop %edi # Restore registers
- movl %ecx,%esi
- movl %edx,%ebx
- ret
-.strxmov_end:
- .size strxmov,.strxmov_end-strxmov
diff --git a/strings/strstr.c b/strings/strstr.c
deleted file mode 100644
index a5b50d12043..00000000000
--- a/strings/strstr.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2002 MySQL AB
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; version 2
- of the License.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
-
-/* File : strstr.c
- Author : Monty
- Updated: 1986.11.24
- Defines: strstr()
-
- strstr(src, pat) looks for an instance of pat in src. pat is not a
- regex(3) pattern, it is a literal string which must be matched exactly.
- The result is a pointer to the first character of the located instance,
- or NullS if pat does not occur in src.
-
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-#ifndef HAVE_STRSTR
-
-char *strstr(register const char *str,const char *search)
-{
- register char *i,*j;
- register char first= *search;
-
-skip:
- while (*str != '\0') {
- if (*str++ == first) {
- i=(char*) str; j=(char*) search+1;
- while (*j)
- if (*i++ != *j++) goto skip;
- return ((char*) str-1);
- }
- }
- return ((char*) 0);
-} /* strstr */
-
-#endif
diff --git a/strings/strto.c b/strings/strto.c
deleted file mode 100644
index fcb0d800b81..00000000000
--- a/strings/strto.c
+++ /dev/null
@@ -1,209 +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 */
-
-/*
- strtol,strtoul,strtoll,strtoull
- convert string to long, unsigned long, long long or unsigned long long.
- strtoxx(char *src,char **ptr,int base)
- converts the string pointed to by src to an long of appropriate long and
- returnes it. It skips leading spaces and tabs (but not newlines, formfeeds,
- backspaces), then it accepts an optional sign and a sequence of digits
- in the specified radix.
- If the value of ptr is not (char **)NULL, a pointer to the character
- terminating the scan is returned in the location pointed to by ptr.
- Trailing spaces will NOT be skipped.
-
- If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX,
- (or LONGLONG..) and errno will be set to
- EDOM if there are no digits
- ERANGE if the result would overflow.
- the ptr will be set to src.
- This file is based on the strtol from the the GNU C Library.
- it can be compiled with the UNSIGNED and/or LONGLONG flag set
-*/
-
-
-#if !defined(_global_h) || !defined(_m_string_h)
-# error Calling file must include 'my_global.h' and 'm_string.h'
- /* see 'strtoll.c' and 'strtoull.c' for the reasons */
-#endif
-
-#include "m_ctype.h"
-#include "my_sys.h" /* defines errno */
-#include <errno.h>
-
-#undef strtoull
-#undef strtoll
-#undef strtoul
-#undef strtol
-#ifdef USE_LONGLONG
-#define UTYPE_MAX (~(ulonglong) 0)
-#define TYPE_MIN LONGLONG_MIN
-#define TYPE_MAX LONGLONG_MAX
-#define longtype longlong
-#define ulongtype ulonglong
-#ifdef USE_UNSIGNED
-#define function ulongtype strtoull
-#else
-#define function longtype strtoll
-#endif
-#else
-#define UTYPE_MAX (ulong) ~0L
-#define TYPE_MIN LONG_MIN
-#define TYPE_MAX LONG_MAX
-#define longtype long
-#define ulongtype unsigned long
-#ifdef USE_UNSIGNED
-#define function ulongtype strtoul
-#else
-#define function longtype strtol
-#endif
-#endif
-
-
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
- If BASE is 0 the base is determined by the presence of a leading
- zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
- If BASE is < 2 or > 36, it is reset to 10.
- If ENDPTR is not NULL, a pointer to the character after the last
- one converted is stored in *ENDPTR. */
-
-
-function (const char *nptr,char **endptr,int base)
-{
- int negative;
- register ulongtype cutoff;
- register unsigned int cutlim;
- register ulongtype i;
- register const char *s;
- register uchar c;
- const char *save;
- int overflow;
-
- if (base < 0 || base == 1 || base > 36)
- base = 10;
-
- s = nptr;
-
- /* Skip white space. */
- while (my_isspace(&my_charset_latin1, *s))
- ++s;
- if (*s == '\0')
- {
- goto noconv;
- }
-
- /* Check for a sign. */
- negative= 0;
- if (*s == '-')
- {
- negative = 1;
- ++s;
- }
- else if (*s == '+')
- {
- ++s;
- }
-
-
- if (base == 16 && s[0] == '0' && my_toupper (&my_charset_latin1, s[1]) == 'X')
- s += 2;
-
- /* If BASE is zero, figure it out ourselves. */
- if (base == 0)
- {
- if (*s == '0')
- {
- if (my_toupper (&my_charset_latin1, s[1]) == 'X')
- {
- s += 2;
- base = 16;
- }
- else
- base = 8;
- }
- else
- base = 10;
- }
-
- /* Save the pointer so we can check later if anything happened. */
- save = s;
-
- cutoff = UTYPE_MAX / (unsigned long int) base;
- cutlim = (uint) (UTYPE_MAX % (unsigned long int) base);
-
- overflow = 0;
- i = 0;
- for (c = *s; c != '\0'; c = *++s)
- {
- if (my_isdigit (&my_charset_latin1, c))
- c -= '0';
- else if (my_isalpha (&my_charset_latin1, c))
- c = my_toupper (&my_charset_latin1, c) - 'A' + 10;
- else
- break;
- if (c >= base)
- break;
- /* Check for overflow. */
- if (i > cutoff || (i == cutoff && c > cutlim))
- overflow = 1;
- else
- {
- i *= (ulongtype) base;
- i += c;
- }
- }
-
- /* Check if anything actually happened. */
- if (s == save)
- goto noconv;
-
- /* Store in ENDPTR the address of one character
- past the last character we converted. */
- if (endptr != NULL)
- *endptr = (char *) s;
-
-#ifndef USE_UNSIGNED
- /* Check for a value that is within the range of
- `unsigned long int', but outside the range of `long int'. */
- if (negative)
- {
- if (i > (ulongtype) TYPE_MIN)
- overflow = 1;
- }
- else if (i > (ulongtype) TYPE_MAX)
- overflow = 1;
-#endif
-
- if (overflow)
- {
- my_errno=ERANGE;
-#ifdef USE_UNSIGNED
- return UTYPE_MAX;
-#else
- return negative ? TYPE_MIN : TYPE_MAX;
-#endif
- }
-
- /* Return the result of the appropriate sign. */
- return (negative ? -((longtype) i) : (longtype) i);
-
-noconv:
- /* There was no number to convert. */
- my_errno=EDOM;
- if (endptr != NULL)
- *endptr = (char *) nptr;
- return 0L;
-}
diff --git a/strings/strtol.c b/strings/strtol.c
deleted file mode 100644
index 2f0a5286ee9..00000000000
--- a/strings/strtol.c
+++ /dev/null
@@ -1,28 +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 */
-
-/* This implements strtol() if needed */
-
-/*
- These includes are mandatory because they check for type sizes and
- functions, especially they handle tricks for Tru64 where 'long' is
- 64 bit already and our 'longlong' is just a 'long'.
- */
-#include <my_global.h>
-#include <m_string.h>
-
-#if !defined(HAVE_STRTOL) && !defined(__WIN__)
-#include "strto.c"
-#endif
diff --git a/strings/strtoll.c b/strings/strtoll.c
deleted file mode 100644
index cfb6fbd75ee..00000000000
--- a/strings/strtoll.c
+++ /dev/null
@@ -1,33 +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 */
-
-/* This implements strtoll() if needed */
-
-
-/*
- These includes are mandatory because they check for type sizes and
- functions, especially they handle tricks for Tru64 where 'long' is
- 64 bit already and our 'longlong' is just a 'long'.
- This solves a problem on Tru64 where the C99 compiler has a prototype
- for 'strtoll()' but no implementation, see "6.1 New C99 library functions"
- in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
- */
-#include <my_global.h>
-#include <m_string.h>
-
-#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
-#define USE_LONGLONG
-#include "strto.c"
-#endif
diff --git a/strings/strtoul.c b/strings/strtoul.c
deleted file mode 100644
index df5c46c220f..00000000000
--- a/strings/strtoul.c
+++ /dev/null
@@ -1,29 +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 */
-
-/* This implements strtol() if needed */
-
-/*
- These includes are mandatory because they check for type sizes and
- functions, especially they handle tricks for Tru64 where 'long' is
- 64 bit already and our 'longlong' is just a 'long'.
- */
-#include <my_global.h>
-#include <m_string.h>
-
-#if !defined(HAVE_STRTOUL)
-#define USE_UNSIGNED
-#include "strto.c"
-#endif
diff --git a/strings/strtoull.c b/strings/strtoull.c
deleted file mode 100644
index 94bf6904f8d..00000000000
--- a/strings/strtoull.c
+++ /dev/null
@@ -1,34 +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 */
-
-/* This implements strtoull() if needed */
-
-
-/*
- These includes are mandatory because they check for type sizes and
- functions, especially they handle tricks for Tru64 where 'long' is
- 64 bit already and our 'longlong' is just a 'long'.
- This solves a problem on Tru64 where the C99 compiler has a prototype
- for 'strtoull()' but no implementation, see "6.1 New C99 library functions"
- in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
- */
-#include <my_global.h>
-#include <m_string.h>
-
-#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
-#define USE_UNSIGNED
-#define USE_LONGLONG
-#include "strto.c"
-#endif
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index ef676c8ee2a..2d1d1e83b8b 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -14,7 +14,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF(WIN32)
- SET(localstatedir "C:\\mysql\\data")
+ SET(localstatedir "C:\\\\mysql\\\\data\\\\")
SET(ini_file_extension "ini")
ELSE()
SET(localstatedir "${MYSQL_DATADIR}")
@@ -61,12 +61,17 @@ IF(UNIX)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
+ IF(script MATCHES ".ini")
+ SET(comp IniFiles)
+ ELSE()
+ SET(comp Server_Scripts)
+ ENDIF()
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${script}
- DESTINATION ${inst_location}
+ DESTINATION ${inst_location} COMPONENT ${comp}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDFOREACH()
IF(INSTALL_SUPPORTFILESDIR)
- INSTALL(FILES magic DESTINATION ${inst_location})
+ INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles)
ENDIF()
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
@@ -83,7 +88,7 @@ IF(UNIX)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
- DESTINATION ${inst_location}
+ DESTINATION ${inst_location} COMPONENT SupportFiles
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDIF()
diff --git a/support-files/MacOSX/Makefile.am b/support-files/MacOSX/Makefile.am
deleted file mode 100644
index 7d4384a2a56..00000000000
--- a/support-files/MacOSX/Makefile.am
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (C) 2003-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-EXTRA_DIST = Info.plist.sh \
- Description.plist.sh \
- StartupParameters.plist.sh \
- postflight.sh \
- preflight.sh \
- ReadMe.txt \
- MySQLCOM \
- StartupItem.Description.plist \
- StartupItem.Info.plist \
- StartupItem.postinstall
-
-noinst_DATA = Info.plist \
- Description.plist \
- StartupParameters.plist \
- postflight \
- preflight
-
-CLEANFILES = Info.plist \
- Description.plist \
- StartupParameters.plist \
- postflight \
- preflight
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_NUMERIC_VERSION''@!@MYSQL_NUMERIC_VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- $< > $@-t
- @MV@ $@-t $@
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
deleted file mode 100644
index 7ddb39e1c7c..00000000000
--- a/support-files/Makefile.am
+++ /dev/null
@@ -1,131 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB, 2008-2010 Sun Microsystems, Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-EXTRA_DIST = mysql.spec.sh \
- my-small.cnf.sh \
- my-medium.cnf.sh \
- my-large.cnf.sh \
- my-huge.cnf.sh \
- my-innodb-heavy-4G.cnf.sh \
- mysql-log-rotate.sh \
- mysql.server.sh \
- mysqld_multi.server.sh \
- config.huge.ini.sh \
- config.medium.ini.sh \
- config.small.ini.sh \
- binary-configure.sh \
- magic mysql.m4 \
- MySQL-shared-compat.spec.sh \
- ndb-config-2-node.ini.sh \
- compiler_warnings.supp \
- dtrace \
- CMakeLists.txt
-
-SUBDIRS = MacOSX RHEL4-SElinux
-
-# Default same as 'pkgdatadir', but we can override it
-pkgsuppdir = $(datadir)/@PACKAGE@
-
-pkgsupp_DATA = my-small.cnf \
- my-medium.cnf \
- my-large.cnf \
- my-huge.cnf \
- config.huge.ini \
- config.medium.ini \
- config.small.ini \
- my-innodb-heavy-4G.cnf \
- mysql-log-rotate \
- binary-configure \
- ndb-config-2-node.ini
-
-pkgsupp_SCRIPTS = mysql.server \
- mysqld_multi.server
-
-aclocaldir = $(datadir)/aclocal
-aclocal_DATA = mysql.m4
-
-noinst_DATA = mysql-@VERSION@.spec \
- MySQL-shared-compat.spec
-
-CLEANFILES = my-small.cnf \
- my-medium.cnf \
- my-large.cnf \
- my-huge.cnf \
- config.huge.ini \
- config.medium.ini \
- config.small.ini \
- my-innodb-heavy-4G.cnf \
- mysql.spec \
- mysql-@VERSION@.spec \
- mysql-log-rotate \
- mysql.server \
- mysqld_multi.server \
- binary-configure \
- MySQL-shared-compat.spec \
- ndb-config-2-node.ini
-
-mysql-@VERSION@.spec: mysql.spec
- rm -f $@
- cp mysql.spec $@
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''sbindir''@!$(sbindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''CC''@!@CC@!'\
- -e 's!@''CXX''@!@CXX@!'\
- -e 's!@''GXX''@!@GXX@!'\
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
- -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
- -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
- -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
- -e 's!@''HOSTNAME''@!@HOSTNAME@!' \
- -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \
- -e 's!@''CHECK_PID''@!@CHECK_PID@!' \
- -e 's!@''FIND_PROC''@!@FIND_PROC@!' \
- -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
- -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- -e 's!@''sysconfdir''@!@sysconfdir@!' \
- -e 's!@''SHORT_MYSQL_INTRO''@!@SHORT_MYSQL_INTRO@!' \
- -e 's!@''SHARED_LIB_VERSION''@!@SHARED_LIB_VERSION@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
- -e 's!@''MYSQL_U_SCORE_VERSION''@!@MYSQL_U_SCORE_VERSION@!' \
- -e 's!@''MYSQL_COPYRIGHT_YEAR''@!@MYSQL_COPYRIGHT_YEAR@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''PERL_DBI_VERSION''@!@PERL_DBI_VERSION@!' \
- -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \
- -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
- $< > $@-t
- @MV@ $@-t $@
diff --git a/support-files/MySQL-shared-compat.spec.sh b/support-files/MySQL-shared-compat.spec.sh
index 72654a22d87..b8b27863b3d 100644
--- a/support-files/MySQL-shared-compat.spec.sh
+++ b/support-files/MySQL-shared-compat.spec.sh
@@ -27,7 +27,7 @@
#
# Change this to match the version of the shared libs you want to include
#
-%define version_cur @MYSQL_U_SCORE_VERSION@
+%define version_cur @MYSQL_RPM_VERSION@
%define version41 4.1.17
%define version40 4.0.26
%define version3 3.23.58
diff --git a/support-files/RHEL4-SElinux/Makefile.am b/support-files/RHEL4-SElinux/Makefile.am
deleted file mode 100644
index d2143a5285c..00000000000
--- a/support-files/RHEL4-SElinux/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2000-2001, 2003-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-EXTRA_DIST = mysql.fc mysql.te
diff --git a/support-files/SCO/INSTALL.sh b/support-files/SCO/INSTALL.sh
deleted file mode 100755
index 979f33f3f06..00000000000
--- a/support-files/SCO/INSTALL.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# search & check GNU patch
-PATCH="gpatch"
-$PATCH --version || PATCH="patch"
-$PATCH --version || exit
-
-
-if /usr/bin/test ! -e PKG/stamp-pre ; then
- grep VERSION configure | head -1 | sed 's/VERSION=//' > ./PKG/version
- touch PKG/stamp-pre
-fi
-
-if /usr/bin/test ! -e PKG/stamp-patch ; then
- ${PATCH} -p0 < ./PKG/patch
- touch PKG/stamp-patch
-fi
-
-if /usr/bin/test ! -e PKG/stamp-compile ; then
-sh ./PKG/compile.sh ujis
-touch PKG/stamp-compile
-
-sh ./PKG/doc.sh ujis
-
-fi
-
-
-cd PKG
-sh mkpkg.sh ujis
diff --git a/support-files/SCO/compile.sh b/support-files/SCO/compile.sh
deleted file mode 100644
index 5281ccde02d..00000000000
--- a/support-files/SCO/compile.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-# GNU ncurses
-
-# search & check GNU make
-GMAKE="gmake"
-$GMAKE --version || GMAKE="make"
-$GMAKE --version || exit
-
-MAKE=$GMAKE
-export MAKE
-
-CC=gcc
-CFLAGS="-O6 -fomit-frame-pointer"
-CXX=gcc
-CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
-# LDFLAGS="-static"
-LD=gcc
-
-export CC
-export CXX
-export LD
-export CFLAGS
-export CXXFLAGS
-# export LDFLAGS
-# Solaris don't have libpthread.a.
-
-if [ "x$1" = "x" ]; then
- echo " please set character set"
- exit
-fi
-
-CHAR="$1"
-case "$1" in
- [uU]*)
- CHAR=ujis
- ;;
- [sS]*)
- CHAR=sjis
- ;;
-esac
-
-#---------------
-P=`pwd`
-
-if [ -f Makefile ] ; then
- ${GMAKE} distclean
-fi
-
-for i in bin sbin include man share/doc/mysql mysql-data
-do
- /usr/bin/mkdir -p PKG/tmp-${CHAR}/usr/local/${i}
-done
-/usr/bin/mkdir -p PKG/tmp-${CHAR}/etc/init.d
-
-#----------------------------
-./configure \
- --prefix=/usr/local \
- --libexecdir=/usr/local/sbin \
- --sbindir=/usr/local/sbin \
- --localstatedir=/usr/local/mysql-data \
- --with-charset=${CHAR} \
- --with-extra-charsets=all \
- --with-raid \
- --without-docs \
- --without-bench \
- --without-perl \
- --with-gcc \
- --with-mysqld-ldflags="-static" \
- --with-client-ldflags="-static" \
- --with-named-curses-libs=/usr/local/lib/libncurses.a \
- --with-mysqld-user=mysql
-
-# --with-berkeley-db-includes=/usr/local/include/db3 \
-# --with-berkeley-db-libs=/usr/local/lib/libdb3.a \
-# --with-low-memory
-
-${GMAKE}
-${GMAKE} install DESTDIR=${P}/PKG/tmp-${CHAR}
-
-v=`grep '^SHARED_LIB_VERSION' configure.in | sed 's@SHARED_LIB_VERSION@@' | sed -e 's@=@@' -e 's@:@ @g' | awk '{print $1}'`
-km="libmysqlclient.so.$v"
-export km
-
-(cd ${P}/PKG/tmp-${CHAR}/usr/local/lib/mysql/ ; \
- for i in libmysqlclient* ; do \
- if /usr/bin/test ! -L $i ; then \
- mv $i ../ ; ln -sf ../$i ; \
- fi ; \
- done ; \
- k=`ls libmysqlclient.so.*.*.*` ; \
- cd .. ; \
- if /usr/bin/test ! -z libmysqlclient.so ; then \
- ln -sf $k libmysqlclient.so ;
- fi ; \
- if /usr/bin/test ! -z $km ; then \
- ln -sf $k $km ;
- fi ; \
-)
-
-#
-(cd ${P}/PKG/tmp-${CHAR}/usr/local/bin ; strip * )
-(cd ${P}/PKG/tmp-${CHAR}/usr/local/sbin ; strip * )
diff --git a/support-files/SCO/doc.sh b/support-files/SCO/doc.sh
deleted file mode 100644
index 9ef17166a6f..00000000000
--- a/support-files/SCO/doc.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-CHAR="$1"
-case "$1" in
- [uU]*)
- CHAR=ujis
- ;;
- [sS]*)
- CHAR=sjis
- ;;
-esac
-
-cp -r Docs/* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
-cp INSTALL-SOURCE* COPYING* MIRRORS README* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
-
-cd PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
-gzip *.txt *.texi *.info *.pdf
diff --git a/support-files/SCO/mkpkg.sh b/support-files/SCO/mkpkg.sh
deleted file mode 100644
index 5a38113138d..00000000000
--- a/support-files/SCO/mkpkg.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-if [ "x$1" = "x" ]; then
- echo " please set charset"
- exit
-fi
-
-CHAR="$1"
-case "$1" in
- [uU]*)
- CHAR=ujis ; CH=uj
- ;;
- [sS]*)
- CHAR=sjis ; CH=sj
- ;;
-esac
-
-#-------------------
-DIR=`pwd`
-
-VERSION=`cat version`
-
-T=`uname -p`
-
-sed -e "s/@CHAR1@/${CH}/" \
- -e "s/@CHAR2@/${CHAR}/" \
- -e "s/@VERSION@/${VERSION}/" \
- -e "s/@TYPE@/${T}/" \
- pkginfo.ini > pkginfo.${CHAR}
-
-sed -e "s,@DIR@,${DIR},g" \
- -e "s,@PKGINFO@,${DIR}/pkginfo.${CHAR}," \
- prototype.ini > prototype.${CHAR}
-
-INIT="tmp-${CHAR}/etc/init.d/mysql"
-cp ../support-files/mysql.server $INIT
-chmod 755 $INIT
-
-(cd tmp-${CHAR}; \
-chown root etc usr ; \
-chgrp sys etc usr ;\
-chmod 755 usr etc; \
-chgrp sys etc/init.d ; \
-chmod 755 etc/init.d ; \
-find . -print|pkgproto >> ../prototype.${CHAR})
-
-pkgmk -o -f prototype.${CHAR} -r ${DIR}/tmp-${CHAR}
diff --git a/support-files/SCO/patch b/support-files/SCO/patch
deleted file mode 100644
index 373eb8518c6..00000000000
--- a/support-files/SCO/patch
+++ /dev/null
@@ -1,96 +0,0 @@
---- scripts/safe_mysqld.sh.orig Sat Sep 2 17:28:26 2000
-+++ scripts/safe_mysqld.sh Sat Sep 2 17:31:19 2000
-@@ -89,10 +89,10 @@
-
-
- NOHUP_NICENESS=`nohup nice`
--if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice --1 echo foo > /dev/null 2>&1; then
-+if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice -1 echo foo > /dev/null 2>&1; then
- NOHUP_NICENESS="nohup"
- else
-- NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
-+ NOHUP_NICENESS="nice -$NOHUP_NICENESS nohup"
- fi
-
- export MYSQL_UNIX_PORT
-@@ -163,7 +163,8 @@
- # The only thing is ps x => redhat 5 gives warnings when using ps -x.
- # kill -9 is used or the process won't react on the kill.
- numofproces=`ps xa | grep -v "grep" | grep -c $ledir/mysqld`
-- echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
-+ echo | tee -a $err_log
-+ echo "Number of processes running now: $numofproces" | tee -a $err_log
- I=1
- while test "$I" -le "$numofproces"
- do
-@@ -185,4 +186,6 @@
- echo "`date +'%y%m%d %H:%M:%S mysqld restarted'`" | tee -a $err_log
- done
-
--echo -e "`date +'%y%m%d %H:%M:%S mysqld ended\n'`" | tee -a $err_log
-+echo | tee -a $err_log
-+echo "`date +'%y%m%d %H:%M:%S mysqld ended'`" | tee -a $err_log
-+echo | tee -a $err_log
---- support-files/mysql.server.sh.orig Sat Sep 2 17:35:56 2000
-+++ support-files/mysql.server.sh Sat Sep 2 17:36:35 2000
-@@ -23,6 +23,9 @@
- mysql_daemon_user=@MYSQLD_USER@
- export PATH
-
-+## your options...
-+OPT=""
-+
- mode=$1
-
- if test -w / # determine if we should look at the root config file
-@@ -82,8 +85,9 @@
- then
- # Give extra arguments to mysqld with the my.cnf file. This script may
- # be overwritten at next upgrade.
-- $bindir/safe_mysqld \
-- --user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file --log=$log_file &
-+ $bindir/safe_mysqld $OPT \
-+ --user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file &
-+# --log=$log_file &
- else
- echo "Can't execute $bindir/safe_mysqld"
- fi
---- configure.orig Sat Sep 2 17:54:03 2000
-+++ configure Sat Sep 2 17:54:18 2000
-@@ -202,7 +202,7 @@
- --with-charset=CHARSET use CHARSET by default (one of: big5 cp1251 cp1257
- croat czech danish dec8 dos estonia euc_kr gb2312 gbk
- german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
-- latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
-+ latin1 latin2 swe7 usa7 win1250 win1251ukr
- ujis sjis tis620; default is latin1)"
- ac_help="$ac_help
- --with-extra-charsets=cs1,cs2
-@@ -8843,7 +8843,7 @@
-
- # Choose a character set
-
--CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
-+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
- DEFAULT_CHARSET=latin1
-
- # Check whether --with-charset or --without-charset was given.
---- configure.in.orig Sat Sep 2 17:53:57 2000
-+++ configure.in Sat Sep 2 17:54:36 2000
-@@ -1517,14 +1517,14 @@
- dnl or other special handling, you must also create
- dnl strings/ctype-$charset_name.c
-
--CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
-+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
- DEFAULT_CHARSET=latin1
-
- AC_ARG_WITH(charset,
- [ --with-charset=CHARSET use CHARSET by default (one of: big5 cp1251 cp1257
- croat czech danish dec8 dos estonia euc_kr gb2312 gbk
- german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
-- latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
-+ latin1 latin2 swe7 usa7 win1250 win1251ukr
- ujis sjis tis620; default is latin1)],
- [default_charset="$withval"],
- [default_charset="$DEFAULT_CHARSET"])
diff --git a/support-files/SCO/pkginfo.ini b/support-files/SCO/pkginfo.ini
deleted file mode 100644
index 13b8b6adb09..00000000000
--- a/support-files/SCO/pkginfo.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-PKG=MySQL
-NAME=MySQL
-ARCH=@TYPE@
-VERSION=@VERSION@
-CATEGORY=utility
-VENDOR=TcX DataKonsult AB, Detron HB and MySQL AB
-BASEDIR=/
-CLASSES=none
diff --git a/support-files/SCO/postinstall b/support-files/SCO/postinstall
deleted file mode 100644
index 2e199b9af82..00000000000
--- a/support-files/SCO/postinstall
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
-export PATH
-export LD_LIBRARY_PATH
-
-D0="/usr/local/mysql-data"
-D="${D0}/mysql"
-
-DOFIX=0
-
-if /usr/bin/test ! -f ${D}/tables_priv.frm -a -d ${D} ; then
- DOFIX=1
-fi
-
-if [ ! -d ${D} ]; then
- DOFIX=2
- /usr/local/bin/mysql_install_db
-fi
-
- chown -R mysql $D0
- chgrp -R mysql $D0
-
-if /usr/bin/test $DOFIX -eq 1 ; then
- /etc/init.d/mysql start
- /usr/local/bin/mysql_fix_privilege_tables
-else
- /etc/init.d/mysql start || true
-fi
diff --git a/support-files/SCO/preinstall b/support-files/SCO/preinstall
deleted file mode 100644
index c1175561a99..00000000000
--- a/support-files/SCO/preinstall
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
-export PATH
-export LD_LIBRARY_PATH
-
-if /usr/bin/test -x /etc/init.d/mysql ; then
- /etc/init.d/mysql stop || true
-fi
-
-#----- user check
-P=`grep mysql /etc/passwd`
-G=`grep mysql /etc/group`
-
-if /usr/bin/test "x$G" = "x" ; then
- /usr/sbin/groupadd mysql
-fi
-if /usr/bin/test "x$P" = "x" ; then
- /usr/sbin/useradd -g mysql -d /usr/local/mysql-data -s /bin/false mysql
-fi
diff --git a/support-files/SCO/preremove b/support-files/SCO/preremove
deleted file mode 100644
index a89648431c1..00000000000
--- a/support-files/SCO/preremove
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
-export PATH
-export LD_LIBRARY_PATH
-
-pid=`/usr/bin/ps -e | /usr/bin/grep mysqld | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
-[ "$pid" != "" ] && /usr/local/bin/mysqladmin shutdown
-
-#---
-#/usr/ucb/echo -n "Remove DATA Directory (All data expire) [Y/N]? "
-#read I
-I=No
-
-case "$I" in
-Y*|y*)
- /usr/ucb/echo -n "Removing MySQL DATA ALL..."
- rm -rf /usr/local/mysql-data
- echo "done."
- ;;
-*)
- echo "not purge DATA directory"
- ;;
-esac;
diff --git a/support-files/SCO/prototype.ini b/support-files/SCO/prototype.ini
deleted file mode 100644
index ca88bb67a90..00000000000
--- a/support-files/SCO/prototype.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-i pkginfo=@PKGINFO@
-i postinstall=@DIR@/postinstall
-i preinstall=@DIR@/preinstall
-i preremove=@DIR@/preremove
diff --git a/support-files/SCO/version b/support-files/SCO/version
deleted file mode 100644
index f9dc296b71b..00000000000
--- a/support-files/SCO/version
+++ /dev/null
@@ -1 +0,0 @@
-3.23.23-beta
diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh
index a6bf70b6f83..378a1df67aa 100644
--- a/support-files/my-huge.cnf.sh
+++ b/support-files/my-huge.cnf.sh
@@ -3,11 +3,11 @@
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
-# You can copy this file to
-# /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options (in this
-# installation this directory is @localstatedir@) or
-# ~/.my.cnf to set user-specific options.
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
@@ -113,14 +113,10 @@ server-id = 1
# binary logging format - mixed recommended
#binlog_format=mixed
-# Point the following paths to different dedicated disks
-#tmpdir = /tmp/
-#log-bin = /path-to-dedicated-directory/hostname
-
# Uncomment the following if you are using InnoDB tables
-#innodb_data_home_dir = @localstatedir@/
+#innodb_data_home_dir = @localstatedir@
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
-#innodb_log_group_home_dir = @localstatedir@/
+#innodb_log_group_home_dir = @localstatedir@
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh
index 80f1d6fe50b..3fce97cf1d2 100644
--- a/support-files/my-innodb-heavy-4G.cnf.sh
+++ b/support-files/my-innodb-heavy-4G.cnf.sh
@@ -8,10 +8,11 @@
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
#
-# You can copy this file to /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options
-# (@localstatedir@ for this installation) or to
-# ~/.my.cnf to set user-specific options.
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
@@ -232,15 +233,6 @@ slow_query_log
# currently measures time with second accuracy only).
long_query_time = 2
-# The directory used by MySQL for storing temporary files. For example,
-# it is used to perform disk based large sorts, as well as for internal
-# and explicit temporary tables. It might be good to put it on a
-# swapfs/tmpfs filesystem, if you do not create very large temporary
-# files. Alternatively you can put it on dedicated disk. You can
-# specify multiple paths here by separating them by ";" - they will then
-# be used in a round-robin fashion.
-#tmpdir = /tmp
-
# *** Replication related settings
diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh
index 92839b8fc2c..79d43407cda 100644
--- a/support-files/my-large.cnf.sh
+++ b/support-files/my-large.cnf.sh
@@ -3,11 +3,11 @@
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
-# You can copy this file to
-# /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options (in this
-# installation this directory is @localstatedir@) or
-# ~/.my.cnf to set user-specific options.
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
@@ -113,14 +113,10 @@ server-id = 1
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
-# Point the following paths to different dedicated disks
-#tmpdir = /tmp/
-#log-bin = /path-to-dedicated-directory/hostname
-
# Uncomment the following if you are using InnoDB tables
-#innodb_data_home_dir = @localstatedir@/
+#innodb_data_home_dir = @localstatedir@
#innodb_data_file_path = ibdata1:10M:autoextend
-#innodb_log_group_home_dir = @localstatedir@/
+#innodb_log_group_home_dir = @localstatedir@
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 256M
diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh
index b219d02a7be..4ec245e88b9 100644
--- a/support-files/my-medium.cnf.sh
+++ b/support-files/my-medium.cnf.sh
@@ -4,11 +4,11 @@
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
-# You can copy this file to
-# /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options (in this
-# installation this directory is @localstatedir@) or
-# ~/.my.cnf to set user-specific options.
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
@@ -111,14 +111,10 @@ server-id = 1
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
-# Point the following paths to different dedicated disks
-#tmpdir = /tmp/
-#log-bin = /path-to-dedicated-directory/hostname
-
# Uncomment the following if you are using InnoDB tables
-#innodb_data_home_dir = @localstatedir@/
+#innodb_data_home_dir = @localstatedir@
#innodb_data_file_path = ibdata1:10M:autoextend
-#innodb_log_group_home_dir = @localstatedir@/
+#innodb_log_group_home_dir = @localstatedir@
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh
index d789a175603..7b215988572 100644
--- a/support-files/my-small.cnf.sh
+++ b/support-files/my-small.cnf.sh
@@ -4,11 +4,11 @@
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
-# You can copy this file to
-# /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options (in this
-# installation this directory is @localstatedir@) or
-# ~/.my.cnf to set user-specific options.
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
@@ -59,9 +59,9 @@ server-id = 1
#binlog_direct_non_transactional_updates=TRUE
# Uncomment the following if you are using InnoDB tables
-#innodb_data_home_dir = @localstatedir@/
+#innodb_data_home_dir = @localstatedir@
#innodb_data_file_path = ibdata1:10M:autoextend
-#innodb_log_group_home_dir = @localstatedir@/
+#innodb_log_group_home_dir = @localstatedir@
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 15fe4a38a54..aa861609a5f 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -211,7 +211,6 @@
%define license_files_server %{src_dir}/LICENSE.mysql
%define license_type Commercial
%else
-%define license_files_devel %{src_dir}/EXCEPTIONS-CLIENT
%define license_files_server %{src_dir}/COPYING %{src_dir}/README
%define license_type GPL
%endif
@@ -223,7 +222,7 @@
Name: MySQL%{product_suffix}
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
-Version: @MYSQL_U_SCORE_VERSION@
+Version: @MYSQL_RPM_VERSION@
Release: %{release}%{?distro_releasetag:.%{distro_releasetag}}
Distribution: %{distro_description}
License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Use is subject to license terms. Under %{license_type} license as shown in the Description field.
@@ -335,6 +334,7 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
%package -n MySQL-shared%{product_suffix}
Summary: MySQL - Shared libraries
Group: Applications/Databases
+Provides: mysql-shared
Obsoletes: MySQL-shared-community
%description -n MySQL-shared%{product_suffix}
@@ -398,6 +398,7 @@ export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}}
export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}}
export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}}
export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}}
+export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-}
# Build debug mysqld and libmysqld.a
mkdir debug
@@ -425,7 +426,7 @@ mkdir debug
-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
+ make ${MAKE_JFLAG} VERBOSE=1
)
# Build full release
mkdir release
@@ -440,7 +441,7 @@ mkdir release
-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
+ make ${MAKE_JFLAG} VERBOSE=1
)
# Use the build root for temporary storage of the shared libraries.
@@ -977,6 +978,9 @@ echo "=====" >> $STATUS_HISTORY
%attr(755, root, root) %{_libdir}/mysql/plugin/auth.so
%attr(755, root, root) %{_libdir}/mysql/plugin/auth_socket.so
%attr(755, root, root) %{_libdir}/mysql/plugin/auth_test_plugin.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_client.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_interface.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_server.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
@@ -985,6 +989,9 @@ echo "=====" >> $STATUS_HISTORY
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth.so
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_socket.so
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_test_plugin.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_client.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_interface.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_server.so
%if %{WITH_TCMALLOC}
%attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target}
@@ -1030,9 +1037,6 @@ echo "=====" >> $STATUS_HISTORY
# ----------------------------------------------------------------------------
%files -n MySQL-devel%{product_suffix} -f optional-files-devel
%defattr(-, root, root, 0755)
-%if %{defined license_files_devel}
-%doc %{license_files_devel}
-%endif
%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
%attr(755, root, root) %{_bindir}/mysql_config
@@ -1081,6 +1085,16 @@ echo "=====" >> $STATUS_HISTORY
# merging BK trees)
##############################################################################
%changelog
+* Tue Nov 23 2010 Jonathan Perkin <jonathan.perkin@oracle.com>
+
+- EXCEPTIONS-CLIENT has been deleted, remove it from here too
+- Support MYSQL_BUILD_MAKE_JFLAG environment variable for passing
+ a '-j' argument to make.
+
+* Mon Nov 1 2010 Georgi Kodinov <georgi.godinov@oracle.com>
+
+- Added test authentication (WL#1054) plugin binaries
+
* Wed Oct 6 2010 Georgi Kodinov <georgi.godinov@oracle.com>
- Added example external authentication (WL#1054) plugin binaries
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index ca4a2a4e986..00000000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-## Process this file with automake to create Makefile.in
-
-
-if THREAD_SAFE_CLIENT
-LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql_r/libmysqlclient_r.la
-else
-LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql/libmysqlclient.la
-endif
-
-EXTRA_DIST = auto_increment.res auto_increment.tst \
- function.res function.tst lock_test.pl lock_test.res \
- export.pl big_record.pl \
- fork2_test.pl fork_big.pl \
- insert_and_repair.pl \
- grant.pl grant.res test_delayed_insert.pl \
- pmail.pl mail_to_db.pl table_types.pl \
- myisam-big-rows.tst \
- CMakeLists.txt
-
-bin_PROGRAMS = mysql_client_test
-noinst_PROGRAMS = insert_test select_test thread_test bug25714
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes)
-LIBS = @CLIENT_LIBS@
-LDADD = @CLIENT_EXTRA_LDFLAGS@ \
- $(LIBMYSQLCLIENT_LA)
-
-mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS)
-mysql_client_test_SOURCES= mysql_client_test.c\
- $(top_srcdir)/mysys/my_memmem.c
-
-insert_test_SOURCES= insert_test.c
-select_test_SOURCES= select_test.c
-insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-
-bug25714_SOURCES= bug25714.c
-bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-
-# Fix for mit-threads
-DEFS = -DMYSQL_CLIENT_NO_THREADS
-
-thread_test.o: thread_test.c
- $(COMPILE) -c $(INCLUDES) $<
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index b85a6c587e4..327c3b5cad0 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1199,7 +1199,7 @@ my_bool fetch_n(const char **query_list, unsigned query_count,
/* Separate thread query to test some cases */
-static my_bool thread_query(char *query)
+static my_bool thread_query(const char *query)
{
MYSQL *l_mysql;
my_bool error;
@@ -1221,7 +1221,7 @@ static my_bool thread_query(char *query)
goto end;
}
l_mysql->reconnect= 1;
- if (mysql_query(l_mysql, (char *)query))
+ if (mysql_query(l_mysql, query))
{
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
error= 1;
@@ -2103,6 +2103,255 @@ static void test_wl4435_2()
}
+#define WL4435_TEST(sql_type, sql_value, \
+ c_api_in_type, c_api_out_type, \
+ c_type, c_type_ext, \
+ printf_args, assert_condition) \
+\
+ do { \
+ int rc; \
+ MYSQL_STMT *ps; \
+ MYSQL_BIND psp; \
+ MYSQL_RES *rs_metadata; \
+ MYSQL_FIELD *fields; \
+ c_type pspv c_type_ext; \
+ my_bool psp_null; \
+ \
+ bzero(&pspv, sizeof (pspv)); \
+ \
+ rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1"); \
+ myquery(rc); \
+ \
+ rc= mysql_query(mysql, \
+ "CREATE PROCEDURE p1(OUT v " sql_type ") SET v = " sql_value ";"); \
+ myquery(rc); \
+ \
+ ps = mysql_simple_prepare(mysql, "CALL p1(?)"); \
+ check_stmt(ps); \
+ \
+ bzero(&psp, sizeof (psp)); \
+ psp.buffer_type= c_api_in_type; \
+ psp.is_null= &psp_null; \
+ psp.buffer= (char *) &pspv; \
+ psp.buffer_length= sizeof (psp); \
+ \
+ rc= mysql_stmt_bind_param(ps, &psp); \
+ check_execute(ps, rc); \
+ \
+ rc= mysql_stmt_execute(ps); \
+ check_execute(ps, rc); \
+ \
+ DIE_UNLESS(mysql->server_status & SERVER_PS_OUT_PARAMS); \
+ DIE_UNLESS(mysql_stmt_field_count(ps) == 1); \
+ \
+ rs_metadata= mysql_stmt_result_metadata(ps); \
+ fields= mysql_fetch_fields(rs_metadata); \
+ \
+ rc= mysql_stmt_bind_result(ps, &psp); \
+ check_execute(ps, rc); \
+ \
+ rc= mysql_stmt_fetch(ps); \
+ DIE_UNLESS(rc == 0); \
+ \
+ DIE_UNLESS(fields[0].type == c_api_out_type); \
+ printf printf_args; \
+ printf("; in type: %d; out type: %d\n", \
+ (int) c_api_in_type, (int) c_api_out_type); \
+ \
+ rc= mysql_stmt_fetch(ps); \
+ DIE_UNLESS(rc == MYSQL_NO_DATA); \
+ \
+ rc= mysql_stmt_next_result(ps); \
+ DIE_UNLESS(rc == 0); \
+ \
+ mysql_stmt_free_result(ps); \
+ mysql_stmt_close(ps); \
+ \
+ DIE_UNLESS(assert_condition); \
+ \
+ } while (0)
+
+static void test_wl4435_3()
+{
+ char tmp[255];
+
+ puts("");
+
+ // The following types are not supported:
+ // - ENUM
+ // - SET
+ //
+ // The following types are supported but can not be used for
+ // OUT-parameters:
+ // - MEDIUMINT;
+ // - BIT(..);
+ //
+ // The problem is that those types are not supported for IN-parameters,
+ // and OUT-parameters should be bound as IN-parameters before execution.
+ //
+ // The following types should not be used:
+ // - MYSQL_TYPE_YEAR (use MYSQL_TYPE_SHORT instead);
+ // - MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB
+ // (use MYSQL_TYPE_BLOB instead);
+
+ WL4435_TEST("TINYINT", "127",
+ MYSQL_TYPE_TINY, MYSQL_TYPE_TINY,
+ char, ,
+ (" - TINYINT / char / MYSQL_TYPE_TINY:\t\t\t %d", (int) pspv),
+ pspv == 127);
+
+ WL4435_TEST("SMALLINT", "32767",
+ MYSQL_TYPE_SHORT, MYSQL_TYPE_SHORT,
+ short, ,
+ (" - SMALLINT / short / MYSQL_TYPE_SHORT:\t\t %d", (int) pspv),
+ pspv == 32767);
+
+ WL4435_TEST("INT", "2147483647",
+ MYSQL_TYPE_LONG, MYSQL_TYPE_LONG,
+ int, ,
+ (" - INT / int / MYSQL_TYPE_LONG:\t\t\t %d", pspv),
+ pspv == 2147483647l);
+
+ WL4435_TEST("BIGINT", "9223372036854775807",
+ MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG,
+ long long, ,
+ (" - BIGINT / long long / MYSQL_TYPE_LONGLONG:\t\t %lld", pspv),
+ pspv == 9223372036854775807ll);
+
+ WL4435_TEST("TIMESTAMP", "'2007-11-18 15:01:02'",
+ MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_TIMESTAMP,
+ MYSQL_TIME, ,
+ (" - TIMESTAMP / MYSQL_TIME / MYSQL_TYPE_TIMESTAMP:\t "
+ "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
+ (int) pspv.year, (int) pspv.month, (int) pspv.day,
+ (int) pspv.hour, (int) pspv.minute, (int) pspv.second),
+ pspv.year == 2007 && pspv.month == 11 && pspv.day == 18 &&
+ pspv.hour == 15 && pspv.minute == 1 && pspv.second == 2);
+
+ WL4435_TEST("DATETIME", "'1234-11-12 12:34:59'",
+ MYSQL_TYPE_DATETIME, MYSQL_TYPE_DATETIME,
+ MYSQL_TIME, ,
+ (" - DATETIME / MYSQL_TIME / MYSQL_TYPE_DATETIME:\t "
+ "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
+ (int) pspv.year, (int) pspv.month, (int) pspv.day,
+ (int) pspv.hour, (int) pspv.minute, (int) pspv.second),
+ pspv.year == 1234 && pspv.month == 11 && pspv.day == 12 &&
+ pspv.hour == 12 && pspv.minute == 34 && pspv.second == 59);
+
+ WL4435_TEST("TIME", "'123:45:01'",
+ MYSQL_TYPE_TIME, MYSQL_TYPE_TIME,
+ MYSQL_TIME, ,
+ (" - TIME / MYSQL_TIME / MYSQL_TYPE_TIME:\t\t "
+ "%.3d:%.2d:%.2d",
+ (int) pspv.hour, (int) pspv.minute, (int) pspv.second),
+ pspv.hour == 123 && pspv.minute == 45 && pspv.second == 1);
+
+ WL4435_TEST("DATE", "'1234-11-12'",
+ MYSQL_TYPE_DATE, MYSQL_TYPE_DATE,
+ MYSQL_TIME, ,
+ (" - DATE / MYSQL_TIME / MYSQL_TYPE_DATE:\t\t "
+ "%.4d-%.2d-%.2d",
+ (int) pspv.year, (int) pspv.month, (int) pspv.day),
+ pspv.year == 1234 && pspv.month == 11 && pspv.day == 12);
+
+ WL4435_TEST("YEAR", "'2010'",
+ MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR,
+ short, ,
+ (" - YEAR / short / MYSQL_TYPE_SHORT:\t\t\t %.4d", (int) pspv),
+ pspv == 2010);
+
+ WL4435_TEST("FLOAT(7, 4)", "123.4567",
+ MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT,
+ float, ,
+ (" - FLOAT / float / MYSQL_TYPE_FLOAT:\t\t\t %g", (double) pspv),
+ pspv - 123.4567 < 0.0001);
+
+ WL4435_TEST("DOUBLE(8, 5)", "123.45678",
+ MYSQL_TYPE_DOUBLE, MYSQL_TYPE_DOUBLE,
+ double, ,
+ (" - DOUBLE / double / MYSQL_TYPE_DOUBLE:\t\t %g", (double) pspv),
+ pspv - 123.45678 < 0.00001);
+
+ WL4435_TEST("DECIMAL(9, 6)", "123.456789",
+ MYSQL_TYPE_NEWDECIMAL, MYSQL_TYPE_NEWDECIMAL,
+ char, [255],
+ (" - DECIMAL / char[] / MYSQL_TYPE_NEWDECIMAL:\t\t '%s'", (char *) pspv),
+ !strcmp(pspv, "123.456789"));
+
+ WL4435_TEST("CHAR(32)", "REPEAT('C', 16)",
+ MYSQL_TYPE_STRING, MYSQL_TYPE_STRING,
+ char, [255],
+ (" - CHAR(32) / char[] / MYSQL_TYPE_STRING:\t\t '%s'", (char *) pspv),
+ !strcmp(pspv, "CCCCCCCCCCCCCCCC"));
+
+ WL4435_TEST("VARCHAR(32)", "REPEAT('V', 16)",
+ MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VAR_STRING,
+ char, [255],
+ (" - VARCHAR(32) / char[] / MYSQL_TYPE_VAR_STRING:\t '%s'", (char *) pspv),
+ !strcmp(pspv, "VVVVVVVVVVVVVVVV"));
+
+ WL4435_TEST("TINYTEXT", "REPEAT('t', 16)",
+ MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - TINYTEXT / char[] / MYSQL_TYPE_TINY_BLOB:\t\t '%s'", (char *) pspv),
+ !strcmp(pspv, "tttttttttttttttt"));
+
+ WL4435_TEST("TEXT", "REPEAT('t', 16)",
+ MYSQL_TYPE_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - TEXT / char[] / MYSQL_TYPE_BLOB:\t\t\t '%s'", (char *) pspv),
+ !strcmp(pspv, "tttttttttttttttt"));
+
+ WL4435_TEST("MEDIUMTEXT", "REPEAT('t', 16)",
+ MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - MEDIUMTEXT / char[] / MYSQL_TYPE_MEDIUM_BLOB:\t '%s'", (char *) pspv),
+ !strcmp(pspv, "tttttttttttttttt"));
+
+ WL4435_TEST("LONGTEXT", "REPEAT('t', 16)",
+ MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - LONGTEXT / char[] / MYSQL_TYPE_LONG_BLOB:\t\t '%s'", (char *) pspv),
+ !strcmp(pspv, "tttttttttttttttt"));
+
+ WL4435_TEST("BINARY(32)", "REPEAT('\1', 16)",
+ MYSQL_TYPE_STRING, MYSQL_TYPE_STRING,
+ char, [255],
+ (" - BINARY(32) / char[] / MYSQL_TYPE_STRING:\t\t '%s'", (char *) pspv),
+ memset(tmp, 1, 16) && !memcmp(tmp, pspv, 16));
+
+ WL4435_TEST("VARBINARY(32)", "REPEAT('\1', 16)",
+ MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VAR_STRING,
+ char, [255],
+ (" - VARBINARY(32) / char[] / MYSQL_TYPE_VAR_STRING:\t '%s'", (char *) pspv),
+ memset(tmp, 1, 16) && !memcmp(tmp, pspv, 16));
+
+ WL4435_TEST("TINYBLOB", "REPEAT('\2', 16)",
+ MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - TINYBLOB / char[] / MYSQL_TYPE_TINY_BLOB:\t\t '%s'", (char *) pspv),
+ memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
+
+ WL4435_TEST("BLOB", "REPEAT('\2', 16)",
+ MYSQL_TYPE_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - BLOB / char[] / MYSQL_TYPE_BLOB:\t\t\t '%s'", (char *) pspv),
+ memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
+
+ WL4435_TEST("MEDIUMBLOB", "REPEAT('\2', 16)",
+ MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - MEDIUMBLOB / char[] / MYSQL_TYPE_MEDIUM_BLOB:\t '%s'", (char *) pspv),
+ memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
+
+ WL4435_TEST("LONGBLOB", "REPEAT('\2', 16)",
+ MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB,
+ char, [255],
+ (" - LONGBLOB / char[] / MYSQL_TYPE_LONG_BLOB:\t\t '%s'", (char *) pspv),
+ memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
+}
+
+
/* Test simple prepare field results */
static void test_prepare_field_result()
@@ -6198,7 +6447,7 @@ static void test_prepare_alter()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
+ if (thread_query("ALTER TABLE test_prep_alter change id id_new varchar(20)"))
exit(1);
is_null= 1;
@@ -19061,7 +19310,7 @@ static void test_bug49972()
my_bool is_null;
DBUG_ENTER("test_bug49972");
- myheader("test_49972");
+ myheader("test_bug49972");
rc= mysql_query(mysql, "DROP FUNCTION IF EXISTS f1");
myquery(rc);
@@ -19148,6 +19397,45 @@ static void test_bug49972()
DBUG_VOID_RETURN;
}
+
+/**
+ Bug#57058 SERVER_QUERY_WAS_SLOW not wired up.
+*/
+
+static void test_bug57058()
+{
+ MYSQL_RES *res;
+ int rc;
+
+ DBUG_ENTER("test_bug57058");
+ myheader("test_bug57058");
+
+ rc= mysql_query(mysql, "set @@session.long_query_time=0.1");
+ myquery(rc);
+
+ DIE_UNLESS(!(mysql->server_status & SERVER_QUERY_WAS_SLOW));
+
+ rc= mysql_query(mysql, "select sleep(1)");
+ myquery(rc);
+
+ /*
+ Important: the flag is sent in the last EOF packet of
+ the query, the one which ends the result. Read the
+ result to see the "slow" status.
+ */
+ res= mysql_store_result(mysql);
+
+ DIE_UNLESS(mysql->server_status & SERVER_QUERY_WAS_SLOW);
+
+ mysql_free_result(res);
+
+ rc= mysql_query(mysql, "set @@session.long_query_time=default");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -19468,6 +19756,7 @@ static struct my_tests_st my_tests[]= {
{ "test_wl4284_1", test_wl4284_1 },
{ "test_wl4435", test_wl4435 },
{ "test_wl4435_2", test_wl4435_2 },
+ { "test_wl4435_3", test_wl4435_3 },
{ "test_bug38486", test_bug38486 },
{ "test_bug33831", test_bug33831 },
{ "test_bug40365", test_bug40365 },
@@ -19481,6 +19770,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug42373", test_bug42373 },
{ "test_bug54041", test_bug54041 },
{ "test_bug47485", test_bug47485 },
+ { "test_bug57058", test_bug57058 },
{ 0, 0 }
};
diff --git a/unittest/Makefile.am b/unittest/Makefile.am
deleted file mode 100644
index da655d1844e..00000000000
--- a/unittest/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SUBDIRS = mytap . mysys examples strings
-
-EXTRA_DIST = unit.pl
-CLEANFILES = unit
-
-unittests = mytap mysys strings @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
-
-test:
- perl unit.pl run $(unittests)
-
-test-verbose:
- HARNESS_VERBOSE=1 perl unit.pl run $(unittests)
diff --git a/unittest/examples/Makefile.am b/unittest/examples/Makefile.am
deleted file mode 100644
index 3e64c7ceddc..00000000000
--- a/unittest/examples/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include \
- -I$(top_srcdir)/unittest/mytap -I$(top_srcdir)/include
-
-AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
-
-LDADD = -lmytap
-
-# We omit core-t here, since it will always fail.
-noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t
diff --git a/unittest/examples/skip-t.c b/unittest/examples/skip-t.c
index 092353fcc48..c8c910b31ff 100644
--- a/unittest/examples/skip-t.c
+++ b/unittest/examples/skip-t.c
@@ -18,11 +18,11 @@
int main() {
plan(4);
- ok(1, NULL);
- ok(1, NULL);
+ ok1(1);
+ ok1(1);
SKIP_BLOCK_IF(1, 2, "Example of skipping a few test points in a test") {
- ok(1, NULL);
- ok(1, NULL);
+ ok1(1);
+ ok1(1);
}
return exit_status();
}
diff --git a/unittest/examples/skip_all-t.c b/unittest/examples/skip_all-t.c
index 11c1ef13276..3751642293b 100644
--- a/unittest/examples/skip_all-t.c
+++ b/unittest/examples/skip_all-t.c
@@ -31,9 +31,9 @@ int main() {
if (!has_feature())
skip_all("Example of skipping an entire test");
plan(4);
- ok(1, NULL);
- ok(1, NULL);
- ok(1, NULL);
- ok(1, NULL);
+ ok1(1);
+ ok1(1);
+ ok1(1);
+ ok1(1);
return exit_status();
}
diff --git a/unittest/examples/todo-t.c b/unittest/examples/todo-t.c
index 027d6d6b65e..67bea51965c 100644
--- a/unittest/examples/todo-t.c
+++ b/unittest/examples/todo-t.c
@@ -21,15 +21,15 @@
int main()
{
plan(4);
- ok(1, NULL);
- ok(1, NULL);
+ ok1(1);
+ ok1(1);
/*
Tests in the todo region is expected to fail. If they don't,
something is strange.
*/
todo_start("Need to fix these");
- ok(0, NULL);
- ok(0, NULL);
+ ok1(0);
+ ok1(0);
todo_end();
return exit_status();
}
diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am
deleted file mode 100644
index 64d2749987e..00000000000
--- a/unittest/mysys/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include
-AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
-
-noinst_HEADERS = thr_template.c
-
-LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
- $(top_builddir)/mysys/libmysys.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 my_malloc-t
-
-if NEED_THREAD
-# my_atomic-t is used to check thread functions, so it is safe to
-# ignore the file in non-threaded builds.
-# In fact, it will not compile without thread support.
-noinst_PROGRAMS += my_atomic-t
-endif
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/unittest/mytap/Makefile.am b/unittest/mytap/Makefile.am
deleted file mode 100644
index d36dc25d0b5..00000000000
--- a/unittest/mytap/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-
-noinst_LIBRARIES = libmytap.a
-noinst_HEADERS = tap.h
-
-libmytap_a_SOURCES = tap.c
-
-EXTRA_DIST = CMakeLists.txt
-
-SUBDIRS = . t
diff --git a/unittest/mytap/t/Makefile.am b/unittest/mytap/t/Makefile.am
deleted file mode 100644
index bce72a88c05..00000000000
--- a/unittest/mytap/t/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -I$(srcdir)/.. -I$(top_srcdir)/include
-
-AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
-
-LDADD = -lmytap
-
-noinst_PROGRAMS = basic-t
diff --git a/unittest/mytap/t/basic-t.c b/unittest/mytap/t/basic-t.c
index c0ceb5bf190..b588521d192 100644
--- a/unittest/mytap/t/basic-t.c
+++ b/unittest/mytap/t/basic-t.c
@@ -22,7 +22,7 @@ int main() {
plan(5);
ok(1 == 1, "testing basic functions");
ok(2 == 2, " ");
- ok(3 == 3, NULL);
+ ok1(3 == 3);
if (1 == 1)
skip(2, "Sensa fragoli");
else {
diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c
index 7facb23e7e3..f7a6d881421 100644
--- a/unittest/mytap/tap.c
+++ b/unittest/mytap/tap.c
@@ -244,6 +244,23 @@ ok(int pass, char const *fmt, ...)
emit_endl();
}
+void
+ok1(int const pass)
+{
+ va_list ap;
+
+ memset(&ap, 0, sizeof(ap));
+
+ if (!pass && *g_test.todo == '\0')
+ ++g_test.failed;
+
+ vemit_tap(pass, NULL, ap);
+
+ if (*g_test.todo != '\0')
+ emit_dir("todo", g_test.todo);
+
+ emit_endl();
+}
void
skip(int how_many, char const *fmt, ...)
diff --git a/unittest/mytap/tap.h b/unittest/mytap/tap.h
index 1f6edfbba07..60d39c42441 100644
--- a/unittest/mytap/tap.h
+++ b/unittest/mytap/tap.h
@@ -121,8 +121,8 @@ void plan(int const count);
@endcode
@param pass Zero if the test failed, non-zero if it passed.
- @param fmt Format string in printf() format. NULL is allowed, in
- which case nothing is printed.
+ @param fmt Format string in printf() format. NULL is not allowed,
+ use ok1() in this case.
*/
void ok(int const pass, char const *fmt, ...)
@@ -130,6 +130,17 @@ void ok(int const pass, char const *fmt, ...)
/**
+ Report test result as a TAP line.
+
+ Same as ok() but does not take a message to be printed.
+
+ @param pass Zero if the test failed, non-zero if it passed.
+*/
+
+void ok1(int const pass);
+
+
+/**
Skip a determined number of tests.
Function to print that <em>how_many</em> tests have been skipped.
diff --git a/unittest/strings/Makefile.am b/unittest/strings/Makefile.am
deleted file mode 100644
index 5b18d89f58e..00000000000
--- a/unittest/strings/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include
-AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
-
-LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
-
-noinst_PROGRAMS = strings-t
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/vio/Makefile.am b/vio/Makefile.am
deleted file mode 100644
index c70af1008cd..00000000000
--- a/vio/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2000-2003, 2005, 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- $(openssl_includes)
-LDADD = @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs)
-pkglib_LIBRARIES = libvio.a
-
-noinst_HEADERS = vio_priv.h
-
-libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c
-
-EXTRA_DIST= CMakeLists.txt
diff --git a/win/Makefile.am b/win/Makefile.am
deleted file mode 100644
index 5b71b7342a9..00000000000
--- a/win/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-## Process this file with automake to create Makefile.in
-EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat build-vs9.bat \
- build-vs9_x64.bat configure.js README mysql_manifest.cmake \
- create_manifest.js create_def_file.js
diff --git a/win/README b/win/README
deleted file mode 100644
index 63923a6d7e2..00000000000
--- a/win/README
+++ /dev/null
@@ -1,102 +0,0 @@
-Windows building readme
-======================================
-
-----------------IMPORTANT----------------------------
-This readme outlines the instructions for building
-MySQL for Windows staring from version 5.1.
-This readme does not apply to MySQL versions 5.0
-or ealier.
------------------------------------------------------
-
-The Windows build system uses a tool named CMake to generate build files for
-a variety of project systems. This tool is combined with a set of jscript
-files to enable building of MySQL for Windows directly out of a bk clone.
-The steps required are below.
-
-Step 1:
--------
-
-Install a Windows C++ compiler. If you don't have one, you can use
-the free compiler "Visual C++ 2005 express edition", which from Cmake
-point of view is same as Visual studio 8:
-http://msdn.microsoft.com/vstudio/express/
-
-Step 2
-------
-Download and install CMake. It can be downloaded from http://www.cmake.org.
-Once it is installed, modify your path to make sure you can execute
-the cmake binary.
-
-Step 3
-------
-Download and install bison for Windows. It can be downloaded from
-http://gnuwin32.sourceforge.net/packages/bison.htm. Please download using
-the link named "Complete package, excluding sources". This includes an
-installer that will install bison. After the installer finishes, modify
-your path so that you can execute bison.
-
-(As an alternative you can take the sql_yacc.yy and sql_yacc.h files from a
-matching mysql tar distribution and drop them into the sql directory just
-before you start the build)
-
-Step 4
-------
-Clone your bk tree to any location you like.
-
-Step 5
-------
-From the root of your installation directory, execute the command:
-
-win\configure <options>
-
-The options right now are:
-
- WITH_INNOBASE_STORAGE_ENGINE Enable particular storage engines
- WITH_PARTITION_STORAGE_ENGINE
- WITH_ARCHIVE_STORAGE_ENGINE
- WITH_BLACKHOLE_STORAGE_ENGINE
- WITH_EXAMPLE_STORAGE_ENGINE
- WITH_FEDERATED_STORAGE_ENGINE
- __NT__ Enable named pipe support
- WITHOUT_ATOMICS Do not use atomic instructions
- MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none
- COMPILATION_COMMENT=<comment> Server comment, default "Source distribution"
- MYSQL_TCP_PORT=<port> Server port, default 3306
- CYBOZU Default character set is UTF8
- EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS
- default will be used. (Note - This option should only be
- used by MySQL AB.)
- WITH_EMBEDDED_SERVER Configure solution to produce libmysqld.dll
- and the static mysqlserver.lib
-
-So the command line could look like:
-
-win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
-
-Step 6
-------
-
-From the root of your installation directory/bk clone, execute one of
-the batch files to generate the type of project files you desire.
-
-For Visual Studio 8 (or Visual C++ 2005 express edition), do win\build-vs8.
-For Visual Studio 7.1, do win\build-vs71.
-
-We will support building with nmake in the near future.
-
-Step 7
-------
-From the root of your bk clone, start your build.
-
-For Visual Studio, execute mysql.sln. This will start the IDE
-and you can click the build solution menu option.
-
-Current issues
---------------
-1. After changing configuration (eg. adding or removing a storage engine), it
-may be necessary to clean the build tree to remove any stale objects.
-
-2. To use Visual C++ Express Edition you also need to install the Platform SDK.
-Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
-At step 5 you only need to add the libraries advapi32.lib and user32.lib to
-the file "corewin_express.vsprops" in order to avoid link errors.
diff --git a/win/build-nmake-x64.bat b/win/build-nmake-x64.bat
deleted file mode 100644
index f73574ac8de..00000000000
--- a/win/build-nmake-x64.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-if exist cmakecache.txt del cmakecache.txt
-copy win\nmake_x64_cache.txt cmakecache.txt
-cmake -G "NMake Makefiles"
-copy cmakecache.txt win\nmake_x64_cache.txt
diff --git a/win/build-nmake.bat b/win/build-nmake.bat
deleted file mode 100644
index 89505c08313..00000000000
--- a/win/build-nmake.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-if exist cmakecache.txt del cmakecache.txt
-copy win\nmake_cache.txt cmakecache.txt
-cmake -G "NMake Makefiles"
-copy cmakecache.txt win\nmake_cache.txt
diff --git a/win/build-vs71.bat b/win/build-vs71.bat
deleted file mode 100755
index 159b1ec97d1..00000000000
--- a/win/build-vs71.bat
+++ /dev/null
@@ -1,22 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-if exist cmakecache.txt del cmakecache.txt
-copy win\vs71cache.txt cmakecache.txt
-cmake -G "Visual Studio 7 .NET 2003"
-copy cmakecache.txt win\vs71cache.txt
-
diff --git a/win/build-vs8.bat b/win/build-vs8.bat
deleted file mode 100755
index ff0eeb0a8cb..00000000000
--- a/win/build-vs8.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-if exist cmakecache.txt del cmakecache.txt
-copy win\vs8cache.txt cmakecache.txt
-cmake -G "Visual Studio 8 2005"
-copy cmakecache.txt win\vs8cache.txt
diff --git a/win/build-vs8_x64.bat b/win/build-vs8_x64.bat
deleted file mode 100755
index bc13e01d742..00000000000
--- a/win/build-vs8_x64.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-if exist cmakecache.txt del cmakecache.txt
-copy win\vs8cache.txt cmakecache.txt
-cmake -G "Visual Studio 8 2005 Win64"
-copy cmakecache.txt win\vs8cache.txt
diff --git a/win/build-vs9.bat b/win/build-vs9.bat
deleted file mode 100644
index 09f1e343013..00000000000
--- a/win/build-vs9.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-cmake -G "Visual Studio 9 2008"
-
diff --git a/win/build-vs9_x64.bat b/win/build-vs9_x64.bat
deleted file mode 100644
index 61c7253132d..00000000000
--- a/win/build-vs9_x64.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off
-
-REM Copyright (C) 2006 MySQL AB
-REM
-REM This program is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; version 2 of the License.
-REM
-REM This program is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with this program; if not, write to the Free Software
-REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-cmake -G "Visual Studio 9 2008 Win64"
-
diff --git a/win/configure.js b/win/configure.js
deleted file mode 100644
index 764b33bb976..00000000000
--- a/win/configure.js
+++ /dev/null
@@ -1,321 +0,0 @@
-// Configure.js
-//
-// Copyright (C) 2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-ForReading = 1;
-ForWriting = 2;
-ForAppending = 8;
-
-try
-{
- var fso = new ActiveXObject("Scripting.FileSystemObject");
-
- var args = WScript.Arguments
-
- // read in the Unix configure.in file
- var configureInTS = fso.OpenTextFile("configure.in", ForReading);
- var configureIn = configureInTS.ReadAll();
- configureInTS.Close();
- var default_comment = "Source distribution";
- var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT");
- var actual_port = 0;
-
- var configfile = fso.CreateTextFile("win\\configure.data", true);
- for (i=0; i < args.Count(); i++)
- {
- var parts = args.Item(i).split('=');
- switch (parts[0])
- {
- case "CYBOZU":
- case "EMBED_MANIFESTS":
- case "EXTRA_DEBUG":
- case "WITH_EMBEDDED_SERVER":
- case "WITHOUT_ATOMICS":
- configfile.WriteLine("SET (" + args.Item(i) + " TRUE CACHE BOOL \"\")");
- break;
- case "MYSQL_SERVER_SUFFIX":
- case "MYSQLD_EXE_SUFFIX":
- configfile.WriteLine("SET (" + parts[0] + " \""
- + parts[1] + "\" CACHE STRING \"\")");
- break;
- case "COMPILATION_COMMENT":
- default_comment = parts[1];
- break;
- case "MYSQL_TCP_PORT":
- actual_port = parts[1];
- break;
- }
- }
-
- if (actual_port == 0)
- {
- // if we actually defaulted (as opposed to the pathological case of
- // --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
- // happen if whole batch of servers was built from a script), set
- // the default to zero to indicate that; we don't lose information
- // that way, because 0 obviously indicates that we can get the
- // default value from MYSQL_TCP_PORT. this seems really evil, but
- // testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
- // a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
- // intend it to mean "use the default, in fact, look up a good default
- // from /etc/services if you can", but really, really meant 3306 when
- // they passed in 3306. When they pass in a specific value, let them
- // have it; don't second guess user and think we know better, this will
- // just make people cross. this makes the the logic work like this
- // (which is complicated enough):
- //
- // - if a port was set during build, use that as a default.
- //
- // - otherwise, try to look up a port in /etc/services; if that fails,
- // use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
- //
- // - allow the MYSQL_TCP_PORT environment variable to override that.
- //
- // - allow command-line parameters to override all of the above.
- //
- // the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
- // so don't mess with that.
- actual_port = default_port;
- default_port = 0;
- }
-
- configfile.WriteLine("SET (COMPILATION_COMMENT \"" +
- default_comment + "\" CACHE STRING \"\" )");
-
- configfile.WriteLine("SET (PROTOCOL_VERSION \"" +
- GetValue(configureIn, "PROTOCOL_VERSION") + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (DOT_FRM_VERSION \"" +
- GetValue(configureIn, "DOT_FRM_VERSION") + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (MYSQL_TCP_PORT_DEFAULT \"" + default_port + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (MYSQL_TCP_PORT \"" + actual_port + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (MYSQL_UNIX_ADDR \"" +
- GetValue(configureIn, "MYSQL_UNIX_ADDR_DEFAULT") + "\" CACHE STRING \"\")");
- var version = GetVersion(configureIn);
- configfile.WriteLine("SET (VERSION \"" + version + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (MYSQL_BASE_VERSION \"" +
- GetBaseVersion(version) + "\" CACHE STRING \"\")");
- configfile.WriteLine("SET (MYSQL_VERSION_ID \"" +
- GetVersionId(version) + "\" CACHE STRING \"\")");
- var engineOptions = ParsePlugins();
- for (option in engineOptions)
- {
- configfile.WriteLine("SET(" + engineOptions[option] + " TRUE CACHE BOOL \"\")");
- }
- configfile.Close();
-
- fso = null;
-
- WScript.Echo("done!");
-}
-catch (e)
-{
- WScript.Echo("Error: " + e.description);
-}
-
-function GetValue(str, key)
-{
- var pos = str.indexOf(key+'=');
- if (pos == -1) return null;
- pos += key.length + 1;
- var end = str.indexOf("\n", pos);
- if (str.charAt(pos) == "\"")
- pos++;
- if (str.charAt(end-1) == "\"")
- end--;
- return str.substring(pos, end);
-}
-
-function GetVersion(str)
-{
- var key = "AC_INIT([MySQL Server], [";
- var pos = str.indexOf(key);
- if (pos == -1) return null;
- pos += key.length;
- var end = str.indexOf("]", pos);
- if (end == -1) return null;
- return str.substring(pos, end);
-}
-
-function GetBaseVersion(version)
-{
- var dot = version.indexOf(".");
- if (dot == -1) return null;
- dot = version.indexOf(".", dot+1);
- if (dot == -1) dot = version.length;
- return version.substring(0, dot);
-}
-
-function GetVersionId(version)
-{
- var dot = version.indexOf(".");
- if (dot == -1) return null;
- var major = parseInt(version.substring(0, dot), 10);
-
- dot++;
- var nextdot = version.indexOf(".", dot);
- if (nextdot == -1) return null;
- var minor = parseInt(version.substring(dot, nextdot), 10);
- dot = nextdot+1;
-
- var stop = version.indexOf("-", dot);
- if (stop == -1) stop = version.length;
- var build = parseInt(version.substring(dot, stop), 10);
-
- var id = major;
- if (minor < 10)
- id += '0';
- id += minor;
- if (build < 10)
- id += '0';
- id += build;
- return id;
-}
-
-function PluginConfig(isGroup, include)
-{
- this.isGroup = isGroup;
- this.include = include;
-}
-
-
-// Parse command line arguments specific to plugins (aka storage engines).
-//
-// --with-plugin-PLUGIN, --with-plugins=group, --with-plugins=PLUGIN[,PLUGIN...]
-// --without-plugin-PLUGIN is supported.
-//
-// Legacy option WITH_<PLUGIN>_STORAGE_ENGINE is supported as well.
-// The function returns string array with elements like WITH_SOME_STORAGE_ENGINE
-// or WITHOUT_SOME_STORAGE_ENGINE.
-//
-// This function handles groups, for example effect of specifying --with-plugins=max
-// is the same as --with-plugins==archive,federated,falcon,innobase...
-
-function ParsePlugins()
-{
-
- var config = new Array();
-
- config["DEFAULT"] = new PluginConfig(true,true);
-
- // Parse command line parameters
- for (i=0; i< WScript.Arguments.length;i++)
- {
- var option = WScript.Arguments.Item(i);
- var match = /WITH_(\w+)_STORAGE_ENGINE/.exec(option);
- if (match == null)
- match = /--with-plugin-(\w+)/.exec(option);
- if (match != null)
- {
- config[match[1].toUpperCase()] = new PluginConfig(false,true);
- continue;
- }
-
- match = /WITHOUT_(\w+)_STORAGE_ENGINE/.exec(option);
- if (match == null)
- match = /--without-plugin-(\w+)/.exec(option);
-
- if (match != null)
- {
- config[match[1].toUpperCase()] =
- new PluginConfig(false,false);
- continue;
- }
-
- match = /--with-plugins=([\w,\-_]+)/.exec(option);
- if(match != null)
- {
-
- var plugins = match[1].split(",");
- for(var key in plugins)
- {
- config[plugins[key].toUpperCase()] =
- new PluginConfig(null,true);
- }
- continue;
- }
- match = /--without-plugins=([\w,\-_]+)/.exec(option);
- if(match != null)
- {
- var plugins = match[1].split(",");
- for(var key in plugins)
- config[plugins[key].toUpperCase()] =
- new PluginConfig(null, false);
- continue;
- }
- }
-
- // Read plugin definitions, find out groups plugins belong to.
- var fc = new Enumerator(fso.GetFolder("storage").SubFolders);
- for (;!fc.atEnd(); fc.moveNext())
- {
- var subfolder = fc.item();
- var name = subfolder.name.toUpperCase();
-
- // Handle case where storage engine was already specified by name in
- // --with-plugins or --without-plugins.
- if (config[name] != undefined)
- {
- config[name].isGroup = false;
- continue;
- }
- config[name] = new PluginConfig(false,null);
-
- // Handle groups. For each plugin, find out which group it belongs to
- // If this group was specified on command line for inclusion/exclusion,
- // then include/exclude the plugin.
- filename = subfolder +"\\plug.in";
- if (fso.FileExists(filename))
- {
- var content = fso.OpenTextFile(filename, ForReading).ReadAll();
- var match =
- /MYSQL_STORAGE_ENGINE([ ]*)[\(]([^\)]+)[\)]/.exec(content);
- if (match== null)
- continue;
- match = /\[[\w,\-_]+\][\s]?\)/.exec(match[0]);
- if (match == null)
- continue;
- groups = match[0].split(/[\,\(\)\[\] ]/);
- for (var key in groups)
- {
- var group = groups[key].toUpperCase();
- if (config[group] != undefined)
- {
- config[group].isGroup = true;
- if (config[group].include != null)
- {
- config[name].include = config[group].include;
- break;
- }
- }
- }
- }
- }
-
- var arr = new Array();
- for(key in config)
- {
- var eng = config[key];
- if(eng.isGroup != undefined && !eng.isGroup && eng.include != undefined)
- {
- if (fso.FolderExists("storage\\"+key) || key=="PARTITION")
- {
- arr[arr.length] = eng.include?
- "WITH_"+key+"_STORAGE_ENGINE":"WITHOUT_"+key+"_STORAGE_ENGINE";
- }
- }
- }
- return arr;
-}
diff --git a/win/create_manifest.js b/win/create_manifest.js
deleted file mode 100755
index dbdd83588c5..00000000000
--- a/win/create_manifest.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- manifest.js - Writes a custom XML manifest for each executable/library
- 5 command line options must be supplied:
- name - Name of the executable/library into which the mainfest will be
- embedded.
- version - Version of the executable
- arch - Architecture intended.
- exe_level - Application execution level.
- [asInvoker|highestAvailable|requireAdministrator]
- outfile - Final destination where mainfest will be written.
-
- Example:
- cscript manifest.js name=mysql version=5.0.32 arch=X86 type=win32
- exe_level=asInvoker outfile=out.xml
-*/
-
-try
-{
- var args = WScript.Arguments
- for (i=0; i < args.Count(); i++)
- {
- var parts = args.Item(i).split('=');
- switch (parts[0])
- {
- case "name":
- var app_name= parts[1];
- break;
- case "version":
- var supp_version= parts[1];
- // Clean up the supplied version string.
- var end= supp_version.indexOf("-");
- if (end == -1) end= supp_version.length;
- var app_version= supp_version.substring(0, end);
- var fourth_element= 0;
- if(app_version.match(/[a-z]$/)) {
- fourth_element+= (1 + app_version.charCodeAt(end-1) - "a".charCodeAt(0));
- app_version= app_version.substring(0,--end);
- }
- if(app_version.match(/sp[1-9]$/)) {
- fourth_element+= 100*(app_version.charCodeAt(end-1) - "0".charCodeAt(0));
- app_version= app_version.substring(0, end-3);
- end-= 3;
- }
- app_version+= "." + fourth_element;
- break;
- case "arch":
- var app_arch= parts[1];
- break;
- case "exe_level":
- var app_exe_level= parts[1];
- break;
- case "outfile":
- var manifest_file= parts[1];
- break;
- default:
- WScript.echo("Invalid argument supplied.");
- }
- }
- if (i != 5)
- throw new Error(1, "Incorrect number of arguments.");
-
- var manifest_xml= "<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\'?>\r\n";
- manifest_xml+= "<assembly xmlns=\'urn:schemas-microsoft-com:asm.v1\'";
- manifest_xml+= " manifestVersion=\'1.0\'>\r\n";
- // Application Information
- manifest_xml+= "\t<assemblyIdentity name=\'" + app_name + "\'";
- manifest_xml+= " version=\'" + app_version + "\'";
- manifest_xml+= " processorArchitecture=\'" + app_arch + "\'";
- manifest_xml+= " publicKeyToken=\'02ad33b422233ae3\'";
- manifest_xml+= " type=\'win32\' />\r\n";
- // Identify the application security requirements.
- manifest_xml+= "\t<trustInfo xmlns=\'urn:schemas-microsoft-com:asm.v2\'>\r\n";
- manifest_xml+= "\t\t<security>\r\n\t\t\t<requestedPrivileges>\r\n\t\t\t\t";
- manifest_xml+= "<requestedExecutionLevel level=\'" + app_exe_level + "\'";
- manifest_xml+= " uiAccess=\'false\'/>\r\n";
- manifest_xml+= "\t\t\t</requestedPrivileges>\r\n\t\t</security>\r\n";
- manifest_xml+= "\t</trustInfo>\r\n</assembly>\r\n";
-
- // Write the valid XML to it's final destination.
- var outfileXML = WScript.CreateObject("Msxml2.DOMDocument.3.0");
- outfileXML.async = false;
- if (!outfileXML.loadXML(manifest_xml))
- {
- WScript.Echo(manifest_xml);
- throw new Error(2, "Invalid XML");
- }
- outfileXML.save(manifest_file);
-
- WScript.Echo("Success, created custom manifest!");
- WScript.Quit(0);
-}
-catch (e)
-{
- WScript.Echo("Error: " + e.description);
- WScript.Quit(1);
-}
diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake
deleted file mode 100644
index 611553d68ac..00000000000
--- a/win/mysql_manifest.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-
-# - MYSQL_EMBED_MANIFEST(target_name required_privs)
-# Create a manifest for target_name. Set the execution level to require_privs
-#
-# NOTE. PROCESSOR_ARCH must be defined before this MACRO is called.
-
-MACRO(MYSQL_EMBED_MANIFEST _target_name _required_privs)
- ADD_CUSTOM_COMMAND(
- TARGET ${_target_name}
- PRE_LINK
- COMMAND cscript.exe
- ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(TargetName) version=${VERSION} arch=${PROCESSOR_ARCH} exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest
- COMMENT "Generates the contents of the manifest contents.")
- ADD_CUSTOM_COMMAND(
- TARGET ${_target_name}
- POST_BUILD
- COMMAND mt.exe ARGS -nologo -hashupdate -makecdfs -manifest $(IntDir)\\$(TargetFileName).intermediate.manifest -outputresource:$(TargetPath)
- COMMAND makecat.exe ARGS $(IntDir)\\$(TargetFileName).intermediate.manifest.cdf
- COMMAND signtool.exe ARGS sign /a /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetPath)
- COMMENT "Embeds the manifest contents, creates a cryptographic catalog, signs the target with Authenticode certificate.")
-ENDMACRO(MYSQL_EMBED_MANIFEST)
diff --git a/zlib/Makefile.am b/zlib/Makefile.am
deleted file mode 100644
index 277f6445a85..00000000000
--- a/zlib/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2004-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Process this file with automake to create Makefile.in
-
-INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include
-
-LIBS= $(NON_THREADED_LIBS)
-
-pkglib_LTLIBRARIES = libz.la
-noinst_LTLIBRARIES = libzlt.la
-
-libz_la_LDFLAGS = -static
-
-noinst_HEADERS = crc32.h deflate.h inffast.h inffixed.h inflate.h \
- inftrees.h trees.h zconf.h zlib.h zutil.h
-
-libz_la_SOURCES = adler32.c compress.c crc32.c deflate.c gzio.c \
- infback.c inffast.c inflate.c inftrees.c trees.c \
- uncompr.c zutil.c
-libzlt_la_SOURCES = $(libz_la_SOURCES)
-
-EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3 CMakeLists.txt