summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2010-11-21 14:32:48 +0100
committerMarc Alff <marc.alff@oracle.com>2010-11-21 14:32:48 +0100
commit218ca24cd9f8261b2473de6792067de75d95ca31 (patch)
tree6f388bd43f36d4b3086f63dbcf97467ca95c61ff
parent8afd96e4d4ec6498babb78f5b41215491660ca74 (diff)
parentf6deb00a56b2e87287d606aba3bcd71290d876ae (diff)
downloadmariadb-git-218ca24cd9f8261b2473de6792067de75d95ca31.tar.gz
local merge
-rw-r--r--BUILD/FINISH.sh3
-rw-r--r--BUILD/Makefile.am77
-rwxr-xr-xBUILD/autorun.sh39
-rw-r--r--BUILD/cmake_configure.sh11
-rw-r--r--CMakeLists.txt8
-rw-r--r--Docs/Makefile.am39
-rw-r--r--Makefile.am337
-rw-r--r--VERSION4
-rw-r--r--client/Makefile.am125
-rw-r--r--client/mysqltest.cc161
-rw-r--r--cmake/Makefile.am40
-rw-r--r--cmake/build_configurations/mysql_release.cmake24
-rw-r--r--cmake/make_dist.cmake.in32
-rw-r--r--cmake/mysql_version.cmake72
-rw-r--r--cmake/os/Windows.cmake10
-rw-r--r--cmake/os/WindowsCache.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/readline/Makefile.am34
-rw-r--r--cmd-line-utils/readline/bind.c2
-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.m466
-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.in3013
-rw-r--r--dbug/Makefile.am68
-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.h4
-rw-r--r--include/my_compiler.h5
-rw-r--r--include/mysql_com.h6
-rw-r--r--libmysql/Makefile.am115
-rw-r--r--libmysql/Makefile.shared119
-rw-r--r--libmysql/acinclude.m491
-rw-r--r--libmysql_r/Makefile.am45
-rw-r--r--libmysqld/Makefile.am229
-rw-r--r--libmysqld/examples/Makefile.am53
-rw-r--r--libservices/Makefile.am21
-rw-r--r--man/Makefile.am26
-rw-r--r--mysql-test/Makefile.am150
-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/mix_innodb_myisam_binlog.test2
-rw-r--r--mysql-test/extra/rpl_tests/create_recursive_construct.inc33
-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_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_not_null.test14
-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_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/handler.inc2
-rw-r--r--mysql-test/include/have_example_plugin.inc2
-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/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.inc9
-rw-r--r--mysql-test/include/show_rpl_debug_info.inc4
-rw-r--r--mysql-test/include/truncate_file.inc2
-rw-r--r--mysql-test/include/wait_for_slave_io_to_stop.inc2
-rw-r--r--mysql-test/include/wait_for_slave_sql_error.inc2
-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_show_condition.inc20
-rw-r--r--mysql-test/lib/My/SafeProcess/Makefile.am25
-rwxr-xr-xmysql-test/mysql-test-run.pl12
-rw-r--r--mysql-test/r/ctype_binary.result19
-rw-r--r--mysql-test/r/ctype_cp1251.result19
-rw-r--r--mysql-test/r/ctype_latin1.result19
-rw-r--r--mysql-test/r/ctype_ucs.result19
-rw-r--r--mysql-test/r/ctype_utf8.result19
-rw-r--r--mysql-test/r/delayed.result12
-rw-r--r--mysql-test/r/events_2.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/func_math.result9
-rw-r--r--mysql-test/r/func_misc.result8
-rw-r--r--mysql-test/r/handler_innodb.result4
-rw-r--r--mysql-test/r/handler_myisam.result4
-rw-r--r--mysql-test/r/kill.result274
-rw-r--r--mysql-test/r/mdl_sync.result11
-rw-r--r--mysql-test/r/mysqltest.result38
-rw-r--r--mysql-test/r/partition_debug_sync.result10
-rw-r--r--mysql-test/r/partition_innodb.result28
-rw-r--r--mysql-test/r/plugin_auth.result64
-rw-r--r--mysql-test/r/show_check.result24
-rw-r--r--mysql-test/r/sp-lock.result91
-rw-r--r--mysql-test/r/xml.result20
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test6
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_unsafe.test26
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.test2
-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_bug56632.result294
-rwxr-xr-xmysql-test/suite/innodb/r/innodb_bug57904.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_bug56632.test216
-rwxr-xr-xmysql-test/suite/innodb/t/innodb_bug57904.test27
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result2
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result1
-rw-r--r--mysql-test/suite/perfschema/r/func_mutex.result1
-rw-r--r--mysql-test/suite/perfschema/r/global_read_lock.result5
-rw-r--r--mysql-test/suite/perfschema/r/server_init.result12
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test3
-rw-r--r--mysql-test/suite/perfschema/t/func_mutex.test2
-rw-r--r--mysql-test/suite/perfschema/t/global_read_lock.test8
-rw-r--r--mysql-test/suite/perfschema/t/server_init.test9
-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/rpl_tmp_table_and_DDL.result6
-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_heartbeat.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test4
-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_slow_query_log.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync.test1
-rw-r--r--mysql-test/suite/sys_vars/t/slow_launch_time_func.test2
-rw-r--r--mysql-test/t/change_user.test2
-rw-r--r--mysql-test/t/delayed.test15
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/events_2.test46
-rw-r--r--mysql-test/t/execution_constants.test2
-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/func_math.test8
-rw-r--r--mysql-test/t/func_misc.test13
-rw-r--r--mysql-test/t/kill.test456
-rw-r--r--mysql-test/t/lock_multi.test58
-rw-r--r--mysql-test/t/mdl_sync.test15
-rw-r--r--mysql-test/t/mysqltest.test224
-rw-r--r--mysql-test/t/named_pipe.test2
-rw-r--r--mysql-test/t/partition_debug_sync.test10
-rw-r--r--mysql-test/t/partition_innodb.test21
-rw-r--r--mysql-test/t/plugin_auth.test60
-rw-r--r--mysql-test/t/shm.test2
-rw-r--r--mysql-test/t/show_check.test27
-rw-r--r--mysql-test/t/sp-lock.test165
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test2
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test2
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test2
-rw-r--r--mysql-test/t/trigger_notembedded.test2
-rw-r--r--mysql-test/t/xml.test25
-rw-r--r--mysys/Makefile.am158
-rw-r--r--mysys/default.c24
-rw-r--r--mysys/mf_keycache.c10
-rw-r--r--packaging/Makefile.am14
-rw-r--r--packaging/WiX/create_msi.cmake.in2
-rw-r--r--packaging/WiX/mysql_server.wxs.in8
-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/Makefile.am20
-rw-r--r--plugin/auth/plug.in12
-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/regexec.c5
-rw-r--r--scripts/Makefile.am192
-rw-r--r--scripts/make_sharedlib_distribution.sh136
-rw-r--r--scripts/mysql_system_tables_fix.sql9
-rw-r--r--sql-bench/Makefile.am83
-rw-r--r--sql-common/Makefile.am17
-rw-r--r--sql-common/client_plugin.c4
-rw-r--r--sql/CMakeLists.txt4
-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.cc9
-rw-r--r--sql/field.h22
-rw-r--r--sql/ha_ndbcluster.cc51
-rw-r--r--sql/handler.cc42
-rw-r--r--sql/item.cc43
-rw-r--r--sql/item.h2
-rw-r--r--sql/lock.cc363
-rw-r--r--sql/lock.h6
-rw-r--r--sql/log_event.cc25
-rw-r--r--sql/mdl.cc563
-rw-r--r--sql/mdl.h185
-rw-r--r--sql/mysqld.cc16
-rw-r--r--sql/mysqld.h9
-rw-r--r--sql/opt_range.cc1
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/rpl_rli.cc3
-rw-r--r--sql/share/Makefile.am60
-rw-r--r--sql/slave.cc20
-rw-r--r--sql/sp.cc123
-rw-r--r--sql/sp.h12
-rw-r--r--sql/sp_head.cc21
-rw-r--r--sql/sql_acl.cc73
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_audit.h17
-rw-r--r--sql/sql_base.cc130
-rw-r--r--sql/sql_base.h27
-rw-r--r--sql/sql_class.cc95
-rw-r--r--sql/sql_class.h153
-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_insert.cc88
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h16
-rw-r--r--sql/sql_parse.cc191
-rw-r--r--sql/sql_partition.cc4
-rw-r--r--sql/sql_prepare.cc5
-rw-r--r--sql/sql_rename.cc7
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_show.cc17
-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_update.cc12
-rw-r--r--sql/sql_view.cc10
-rw-r--r--sql/sql_yacc.yy4
-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/innobase/Makefile.am336
-rw-r--r--storage/innobase/btr/btr0cur.c11
-rw-r--r--storage/innobase/dict/dict0crea.c2
-rw-r--r--storage/innobase/dict/dict0dict.c164
-rw-r--r--storage/innobase/dict/dict0load.c3
-rw-r--r--storage/innobase/fil/fil0fil.c88
-rw-r--r--storage/innobase/fsp/fsp0fsp.c50
-rw-r--r--storage/innobase/handler/ha_innodb.cc359
-rw-r--r--storage/innobase/handler/handler0alter.cc11
-rw-r--r--storage/innobase/include/btr0btr.h49
-rw-r--r--storage/innobase/include/btr0btr.ic38
-rw-r--r--storage/innobase/include/btr0cur.h2
-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/row0ins.h5
-rw-r--r--storage/innobase/include/row0upd.h4
-rw-r--r--storage/innobase/include/univ.i5
-rw-r--r--storage/innobase/plug.in234
-rw-r--r--storage/innobase/row/row0ins.c9
-rw-r--r--storage/innobase/row/row0merge.c2
-rw-r--r--storage/innobase/row/row0mysql.c6
-rw-r--r--storage/innobase/row/row0sel.c12
-rw-r--r--storage/innobase/row/row0upd.c8
-rw-r--r--storage/innobase/sync/sync0rw.c2
-rw-r--r--storage/innobase/thr/thr0loc.c30
-rw-r--r--storage/innobase/trx/trx0i_s.c54
-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/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/perfschema/Makefile.am76
-rw-r--r--storage/perfschema/plug.in26
-rw-r--r--storage/perfschema/unittest/Makefile.am58
-rw-r--r--strings/Makefile.am80
-rw-r--r--support-files/CMakeLists.txt2
-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
-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.sh2
-rw-r--r--tests/Makefile.am62
-rw-r--r--tests/mysql_client_test.c48
-rw-r--r--unittest/Makefile.am27
-rw-r--r--unittest/examples/Makefile.am24
-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/strings/Makefile.am27
-rw-r--r--unittest/unit.pl32
-rw-r--r--vio/Makefile.am25
-rw-r--r--win/Makefile.am19
-rw-r--r--win/configure.js3
-rw-r--r--zlib/Makefile.am35
349 files changed, 10348 insertions, 14777 deletions
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/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/CMakeLists.txt b/CMakeLists.txt
index 6c7e89974c1..89ae82f2c35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,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
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/Makefile.am b/Makefile.am
deleted file mode 100644
index c47d8e780cf..00000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,337 +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.
-#
-# Attention: do not forget to also add to cmake/abi_check.cmake
-#
-
-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/VERSION b/VERSION
new file mode 100644
index 00000000000..be3984ec359
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,4 @@
+MYSQL_VERSION_MAJOR=5
+MYSQL_VERSION_MINOR=5
+MYSQL_VERSION_PATCH=8
+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/mysqltest.cc b/client/mysqltest.cc
index d3d20f109a2..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;
}
@@ -5521,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
@@ -5546,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)
@@ -5581,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, ')');
@@ -5599,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 */
{
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/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 48d3765ea67..87b9ba46864 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)
@@ -219,22 +221,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/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_version.cmake b/cmake/mysql_version.cmake
index 9f0f7729c22..e981e58c292 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
+#
+# 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 configure.in
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,60 +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}")
- IF(NOT VERSION_STRING)
- STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
- ENDIF()
- 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")
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/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/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/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 b4d2f08e558..00000000000
--- a/config/ac-macros/maintainer.m4
+++ /dev/null
@@ -1,66 +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],
- [AS_IF([test "$with_debug" != "no"],
- [USE_MYSQL_MAINTAINER_MODE=yes], [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"
- C_WARNINGS="${C_WARNINGS} -Wdeclaration-after-statement"
- ])
-
- # 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.in b/configure.in
deleted file mode 100644
index 2d67f34b4bb..00000000000
--- a/configure.in
+++ /dev/null
@@ -1,3013 +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.8], [], [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)
-
-# Check whether a debug mode should be enabled.
-AC_ARG_WITH([debug],
- AS_HELP_STRING([--with-debug@<:@=full@:>@],
- [Enable various amounts of debugging support (full adds a slow memory checker).]),
- [with_debug=$withval],
- [with_debug=no])
-
-# 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
-
-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_DECLS([fdatasync],,,
-[
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-])
-
-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/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..77ec603464f 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -76,7 +76,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 */
diff --git a/include/my_compiler.h b/include/my_compiler.h
index c7d334999d0..5f898621159 100644
--- a/include/my_compiler.h
+++ b/include/my_compiler.h
@@ -76,6 +76,11 @@
/**
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; };
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/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_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/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/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/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/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/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 12693e752fe..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
@@ -295,7 +302,7 @@ if ($CRC_RET_stmt_sidef) {
--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 ($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 ($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;
@@ -375,7 +382,7 @@ if ($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_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_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/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_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/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_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/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 c5d709601cf..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
diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc
index 9944e6cd25f..dedf689cd19 100644
--- a/mysql-test/include/show_rpl_debug_info.inc
+++ b/mysql-test/include/show_rpl_debug_info.inc
@@ -50,7 +50,7 @@ eval SHOW BINLOG EVENTS IN '$binlog_name';
let $_master_con= $master_connection;
if (!$_master_con)
{
- if (`SELECT '$_con' = 'slave'`)
+ if ($_con == slave)
{
let $_master_con= master;
}
@@ -80,7 +80,7 @@ if ($_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_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_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
index 80836f908c6..3ae34b1fb9e 100644
--- a/mysql-test/include/wait_for_slave_sql_error.inc
+++ b/mysql-test/include/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_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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 28956eb0092..bee48ed1e17 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1811,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");
@@ -2193,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'}=
@@ -2206,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);
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index d79265b29c7..4d526a86ade 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -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 babed8951a2..d5ee7214cde 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -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 6edddecb88f..3585f0934b0 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -3158,6 +3158,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 1008f201366..11d5117bbe1 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -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_utf8.result b/mysql-test/r/ctype_utf8.result
index 02ff80890e0..f207d056b51 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -4848,6 +4848,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;
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/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/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/func_math.result b/mysql-test/r/func_math.result
index bfb3af0afff..835715ac51e 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -607,3 +607,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..3c5dc0faa0c 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -375,4 +375,10 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
3
1
DROP TABLE t1;
-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;
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/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/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/mysqltest.result b/mysql-test/r/mysqltest.result
index cff845a2819..f5dce1e4196 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
@@ -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/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..525cc439cd1 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -489,3 +489,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/plugin_auth.result b/mysql-test/r/plugin_auth.result
index 7119ba11077..8a649f63598 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -255,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/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/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/xml.result b/mysql-test/r/xml.result
index fad2cab0e57..f5cf30e865b 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1093,4 +1093,24 @@ 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#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/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_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 5c649477dd8..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
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/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_bug56632.result b/mysql-test/suite/innodb/r/innodb_bug56632.result
deleted file mode 100644
index 8236b37676b..00000000000
--- a/mysql-test/suite/innodb/r/innodb_bug56632.result
+++ /dev/null
@@ -1,294 +0,0 @@
-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) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
-DROP TABLE IF EXISTS bug56632;
-Warnings:
-Note 1051 Unknown table 'bug56632'
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table 'test.bug56632' (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.bug56632' (errno: 1478)
-# Test 2) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-Warnings:
-Note 1051 Unknown table 'bug56632'
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed row_format=COMPACT KEY_BLOCK_SIZE=1
-# Test 3) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed KEY_BLOCK_SIZE=1
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed KEY_BLOCK_SIZE=1
-# Test 4) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT );
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact
-# Test 5) CREATE with KEY_BLOCK_SIZE=3 (invalid).
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-ERROR HY000: Can't create table 'test.bug56632' (errno: 1478)
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 3. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.bug56632' (errno: 1478)
-SET SESSION innodb_strict_mode = OFF;
-# Test 6) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
-DROP TABLE IF EXISTS bug56632;
-Warnings:
-Note 1051 Unknown table 'bug56632'
-CREATE TABLE bug56632 ( 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.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT KEY_BLOCK_SIZE=1
-ALTER TABLE bug56632 ADD COLUMN f1 INT;
-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.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL,
- `f1` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT KEY_BLOCK_SIZE=1
-# Test 7) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed row_format=COMPACT KEY_BLOCK_SIZE=1
-# Test 8) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed KEY_BLOCK_SIZE=1
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
-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.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT KEY_BLOCK_SIZE=1
-# Test 9) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT );
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact
-ALTER TABLE bug56632 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.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT KEY_BLOCK_SIZE=1
-# Test 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact KEY_BLOCK_SIZE=3
-ALTER TABLE bug56632 ADD COLUMN f1 INT;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL,
- `f1` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact KEY_BLOCK_SIZE=3
-# Test 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact KEY_BLOCK_SIZE=3
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=3
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact row_format=COMPACT KEY_BLOCK_SIZE=3
-# Test 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=3.
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=3
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compact KEY_BLOCK_SIZE=3
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE bug56632;
-Table Create Table
-bug56632 CREATE TABLE `bug56632` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-bug56632 Compressed KEY_BLOCK_SIZE=1
-# Cleanup
-DROP TABLE IF EXISTS bug56632;
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/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_bug56632.test b/mysql-test/suite/innodb/t/innodb_bug56632.test
deleted file mode 100644
index 60703814da2..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug56632.test
+++ /dev/null
@@ -1,216 +0,0 @@
-#
-# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED
-# http://bugs.mysql.com/56632
-#
-# Innodb automatically uses compressed mode when the KEY_BLOCK_SIZE
-# parameter is used, except if the ROW_FORMAT is also specified, in
-# which case the KEY_BLOCK_SIZE is ignored and a warning is shown.
-# But Innodb was getting confused when neither of those parameters
-# was used on the ALTER statement after they were both used on the
-# CREATE.
-#
-# This will test the results of all 4 combinations of these two
-# parameters of the CREATE and ALTER.
-#
-# Tests 1-5 use INNODB_STRICT_MODE=1 which returns an error
-# if there is anything wrong with the statement.
-#
-# 1) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither.
-# Result; CREATE; fails with error ER_CANT_CREATE_TABLE
-# 2) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1
-# Result; CREATE succeeds,
-# ALTER quietly converts ROW_FORMAT to compressed.
-# 3) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT
-# Result; CREATE quietly converts ROW_FORMAT to compressed,
-# ALTER fails with error ER_CANT_CREATE_TABLE.
-# 4) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1
-# Result; CREATE succeeds,
-# ALTER; fails with error ER_CANT_CREATE_TABLE
-# 5) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
-# Result; CREATE; fails with error ER_CANT_CREATE_TABLE
-#
-# Tests 6-11 use INNODB_STRICT_MODE=0 which automatically makes
-# adjustments if the prameters are incompatible.
-#
-# 6) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither.
-# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE is ignored.
-# ALTER succeeds, no warnings.
-# 7) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1
-# Result; CREATE succeeds,
-# ALTER quietly converts ROW_FORMAT to compressed.
-# 8) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT
-# Result; CREATE quietly converts ROW_FORMAT to compressed,
-# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored.
-# 9) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1
-# Result; CREATE succeeds,
-# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored.
-# 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
-# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
-# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
-# 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT.
-# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
-# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
-# 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1.
-# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
-# ALTER succeeds, quietly converts ROW_FORMAT to compressed.
-
--- 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;
-
-# Innodb strict mode will cause an error on the CREATE or ALTER when;
-# 1. both ROW_FORMAT=COMPACT and KEY_BLOCK_SIZE=1,
-# 2. KEY_BLOCK_SIZE is not a valid number (0,1,2,4,8,16).
-# With innodb_strict_mode = OFF, These errors are corrected
-# and just a warning is returned.
-SET SESSION innodb_strict_mode = ON;
-
---echo # Test 1) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
-DROP TABLE IF EXISTS bug56632;
---error ER_CANT_CREATE_TABLE
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-
---echo # Test 2) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 3) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
---disable_result_log
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
---enable_result_log
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 4) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT );
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
---disable_result_log
---error ER_CANT_CREATE_TABLE
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
---enable_result_log
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 5) CREATE with KEY_BLOCK_SIZE=3 (invalid).
-DROP TABLE IF EXISTS bug56632;
---error ER_CANT_CREATE_TABLE
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-SHOW WARNINGS;
-
-SET SESSION innodb_strict_mode = OFF;
-
---echo # Test 6) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 7) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 8) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 9) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT );
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Test 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1.
-DROP TABLE IF EXISTS bug56632;
-CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE bug56632;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
-
---echo # Cleanup
-DROP TABLE IF EXISTS bug56632;
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
-EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
---enable_query_log
-
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/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index 7dbb7274c1d..fefc4f46061 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -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,6 +45,7 @@ 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
+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
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index 781851bd11c..d99e77dcd8c 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -100,3 +100,4 @@ INNER JOIN performance_schema.threads p USING (THREAD_ID)
WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
+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 d767455609d..93a8ae5d218 100644
--- a/mysql-test/suite/perfschema/r/func_mutex.result
+++ b/mysql-test/suite/perfschema/r/func_mutex.result
@@ -110,4 +110,5 @@ 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 8a58c072b7a..d71bcf81ea7 100644
--- a/mysql-test/suite/perfschema/r/global_read_lock.result
+++ b/mysql-test/suite/perfschema/r/global_read_lock.result
@@ -1,4 +1,5 @@
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);
@@ -21,9 +22,9 @@ 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";
+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';
diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result
index 950b63fd94c..b6f1d4828c3 100644
--- a/mysql-test/suite/perfschema/r/server_init.result
+++ b/mysql-test/suite/perfschema/r/server_init.result
@@ -88,10 +88,6 @@ 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
where name like "wait/synch/mutex/sql/LOCK_global_system_variables";
count(name)
1
@@ -120,10 +116,6 @@ 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
where name like "wait/synch/mutex/sql/LOCK_event_queue";
count(name)
1
@@ -184,10 +176,6 @@ 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
where name like "wait/synch/cond/sql/COND_thread_cache";
count(name)
1
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index 911f97b5d6c..64f71a99ee6 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -190,3 +190,6 @@ HAVING TOTAL_WAIT > 0;
## 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 31d81e4b004..51cbc77790e 100644
--- a/mysql-test/suite/perfschema/t/func_mutex.test
+++ b/mysql-test/suite/perfschema/t/func_mutex.test
@@ -128,4 +128,6 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
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 711e72ede76..d00c6583e31 100644
--- a/mysql-test/suite/perfschema/t/global_read_lock.test
+++ b/mysql-test/suite/perfschema/t/global_read_lock.test
@@ -22,6 +22,10 @@
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;
@@ -60,7 +64,7 @@ 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
@@ -69,7 +73,7 @@ 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";
+ where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";
unlock tables;
diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test
index 93663118772..33eeeb7edb2 100644
--- a/mysql-test/suite/perfschema/t/server_init.test
+++ b/mysql-test/suite/perfschema/t/server_init.test
@@ -101,9 +101,6 @@ 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
where name like "wait/synch/mutex/sql/LOCK_global_system_variables";
select count(name) from mutex_instances
@@ -133,9 +130,6 @@ 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
where name like "wait/synch/mutex/sql/LOCK_event_queue";
select count(name) from mutex_instances
@@ -189,9 +183,6 @@ 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
where name like "wait/synch/cond/sql/COND_thread_cache";
select count(name) from cond_instances
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/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/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_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_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.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_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_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test
index 4ec02325572..3b0cbbabe25 100644
--- a/mysql-test/suite/rpl/t/rpl_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_sync.test
@@ -151,3 +151,4 @@ source include/diff_tables.inc;
connection master;
drop table t1;
--remove_file $MYSQLD_SLAVE_DATADIR/master.backup
+--sync_slave_with_master
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/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/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 e1d4e4f80b5..d312254da19 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -9,7 +9,6 @@
# 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
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06
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/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/func_math.test b/mysql-test/t/func_math.test
index efdf7201a40..5d5dea74e28 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -464,3 +464,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..8cea850b184 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -504,4 +504,15 @@ SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
DROP TABLE t1;
---echo End of 5.1 tests
+--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;
+
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/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/mysqltest.test b/mysql-test/t/mysqltest.test
index 8fb05e52cdc..cde517be03a 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -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;
}
@@ -2529,26 +2719,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/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..ddc2812f617 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -569,3 +569,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/plugin_auth.test b/mysql-test/t/plugin_auth.test
index 439cabaef18..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';
@@ -335,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/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-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/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
index 8c2060d76ba..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;
}
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
index 7d55a091b6d..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;
}
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
index 260400b9c8a..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;
}
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/xml.test b/mysql-test/t/xml.test
index 6e7d38cdfca..4d5c5e1a91e 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -617,4 +617,29 @@ FROM t1 ORDER BY t1.id;
DROP TABLE t1;
+--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 a57f1150816..75eb4709e1e 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -68,6 +68,9 @@ const char *my_defaults_file=0;
const char *my_defaults_group_suffix=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) */
@@ -152,22 +155,19 @@ static char *remove_end_comment(char *ptr);
*/
static int
-fn_expand(const char *filename, const char **filename_var)
+fn_expand(const char *filename, char *result_buf)
{
- char dir[FN_REFLEN], buf[FN_REFLEN];
+ char dir[FN_REFLEN];
const int flags= MY_UNPACK_FILENAME | MY_SAFE_PATH | MY_RELATIVE_PATH;
- const char *result_path= NULL;
DBUG_ENTER("fn_expand");
- DBUG_PRINT("enter", ("filename: %s, buf: 0x%lx", filename, (unsigned long) buf));
+ 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(buf, filename, dir, NULL, flags) == NULL ||
- (result_path= my_strdup(buf, MYF(0))) == NULL)
+ if (fn_format(result_buf, filename, dir, NULL, flags) == NULL)
DBUG_RETURN(2);
- DBUG_PRINT("return", ("result: %s", result_path));
- DBUG_ASSERT(result_path != NULL);
- *filename_var= result_path;
+ DBUG_PRINT("return", ("result: %s", result_buf));
DBUG_RETURN(0);
}
@@ -224,16 +224,18 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
if (forced_extra_defaults && !defaults_already_read)
{
- int error= fn_expand(forced_extra_defaults, &my_defaults_extra_file);
+ 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);
+ 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;
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/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/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in
index 404095fb567..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@")
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
index 59cc817a302..ea2ee1d9aaf 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>
@@ -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/Makefile.am b/plugin/auth/Makefile.am
deleted file mode 100644
index 30e185f36f7..00000000000
--- a/plugin/auth/Makefile.am
+++ /dev/null
@@ -1,20 +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 qa_auth_interface.la qa_auth_server.la qa_auth_client.la
-auth_la_SOURCES= dialog.c
-auth_test_plugin_la_SOURCES= test_plugin.c
-
-qa_auth_interface_la_SOURCES= qa_auth_interface.c
-qa_auth_server_la_SOURCES= qa_auth_server.c
-qa_auth_client_la_SOURCES= qa_auth_client.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/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/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/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/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_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/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index b51e4c6f549..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 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';
+-- 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/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_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/CMakeLists.txt b/sql/CMakeLists.txt
index 2c782380baf..1bec2d7b082 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -287,3 +287,7 @@ ELSE()
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 a9b5fedda2d..e5cae9ea8e3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -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)
diff --git a/sql/field.h b/sql/field.h
index d854b78f9a3..e3db95260c3 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -746,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;
@@ -1227,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; }
@@ -1256,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; }
@@ -1360,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; }
@@ -1409,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; }
@@ -1448,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; }
@@ -1487,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
@@ -1555,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; }
@@ -1635,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; }
@@ -1730,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);
@@ -1879,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);
@@ -1910,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;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 6b07cf76d79..20745db9ce9 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -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. */
diff --git a/sql/handler.cc b/sql/handler.cc
index eb060002f48..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,6 +1154,7 @@ 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_SUICIDE(););
@@ -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 &&
@@ -1225,8 +1241,16 @@ int ha_commit_trans(THD *thd, bool all)
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/item.cc b/sql/item.cc
index 71e495fd259..e14c3c95934 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5527,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)
@@ -5548,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);
diff --git a/sql/item.h b/sql/item.h
index 8e8199ecac8..e65bacf4cb7 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);
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_event.cc b/sql/log_event.cc
index b4641af07c5..537865197da 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3241,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()));
@@ -3293,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)
@@ -3353,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);
}
@@ -3513,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
@@ -4750,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));
@@ -4944,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;
@@ -4961,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;);
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..ff30746e739 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 };
@@ -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/mysqld.cc b/sql/mysqld.cc
index 871d9a795af..7fec30520d0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -605,8 +605,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,
@@ -626,7 +625,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;
@@ -1543,7 +1541,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
@@ -1561,12 +1558,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);
@@ -3525,8 +3520,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,
@@ -3554,7 +3547,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);
@@ -7670,7 +7662,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,
@@ -7708,7 +7700,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},
@@ -7757,7 +7748,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,
@@ -7780,7 +7771,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},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 113bc3aa983..376d8440619 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -100,7 +100,7 @@ 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;
@@ -227,7 +227,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 +248,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,
@@ -321,7 +321,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;
@@ -334,7 +334,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;
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/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/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/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 ab8952069fb..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)
@@ -2513,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;
@@ -3011,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)
{
@@ -3401,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);
diff --git a/sql/sp.cc b/sql/sp.cc
index 7385a6ffcae..5d424564317 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);
@@ -925,6 +925,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);
@@ -944,8 +946,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. */
@@ -1193,6 +1194,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));
@@ -1201,8 +1204,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)))
@@ -1273,6 +1275,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));
@@ -1281,8 +1285,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)))
@@ -1358,6 +1361,106 @@ 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_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
@@ -1370,7 +1473,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));
@@ -1697,7 +1800,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 5d0490586a1..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);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 01c11d35a62..2f165310c28 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2140,6 +2140,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();
@@ -2978,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)
@@ -3065,8 +3069,6 @@ 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()));
@@ -3074,8 +3076,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res))
DBUG_RETURN(TRUE);
- 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);
@@ -3096,7 +3097,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);
@@ -3105,7 +3111,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())
@@ -4176,7 +4182,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 */
@@ -4220,7 +4227,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/sql_acl.cc b/sql/sql_acl.cc
index 8ef17cec6a8..5ac31d1f578 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -339,7 +339,7 @@ public:
(hostname_requires_resolving(host.hostname) ||
hostname_requires_resolving(proxied_host.hostname)))
{
- sql_print_warning("'proxes_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 : "",
@@ -1029,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();
@@ -1127,6 +1138,7 @@ my_bool acl_reload(THD *thd)
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))
{
@@ -5703,6 +5715,8 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
(tables+5)->init_one_table(C_STRING_WITH_LEN("mysql"),
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;
@@ -6295,17 +6309,20 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
}
/* Handle proxies_priv table. */
- if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0)
+ if (tables[5].table)
{
- /* 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. */
+ 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);
@@ -9234,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;
@@ -9249,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 8caae3ee406..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)
@@ -3379,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=
@@ -3856,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)
{}
@@ -4013,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;
@@ -4551,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);
}
@@ -5362,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));
@@ -5419,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) ||
@@ -5676,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 fc4ab1bd27b..2df7a2c8572 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -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)
{
@@ -2586,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;
}
@@ -2626,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. */
@@ -3167,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);
}
/**
@@ -3178,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)
@@ -3423,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);
}
@@ -3466,11 +3495,15 @@ 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)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 24fd765d653..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,7 +2786,7 @@ 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();
@@ -3497,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_insert.cc b/sql/sql_insert.cc
index a81c9ae15a0..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;
}
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 c20c2f0bca2..191562bd3e8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2394,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 daf8971fb68..40cecb75b69 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
{
@@ -3127,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;
@@ -3785,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.
@@ -4051,13 +4024,22 @@ create_sp_error:
#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.
+ 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.
*/
- close_mysql_tables(thd);
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
if (sp_result != SP_KEY_NOT_FOUND &&
sp_automatic_privileges && !opt_noacl &&
@@ -4346,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());
@@ -4389,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. */
@@ -4414,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());
}
@@ -5494,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)
{
@@ -5883,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 70b200bf3cd..cec047d11fc 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -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");
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 851782c623f..4a1d1ae7fe3 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3179,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.
@@ -3251,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
@@ -3742,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 8f990eae001..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))
{
@@ -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 d521abd51a3..e9373bc455f 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 :
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 19a73c85a9b..ec147a99553 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -671,7 +671,7 @@ 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;
@@ -1727,7 +1727,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
@@ -1824,12 +1824,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;
@@ -1857,7 +1859,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 */
}
@@ -3186,7 +3189,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)
{
@@ -7745,7 +7748,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.
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_update.cc b/sql/sql_update.cc
index 8cc8d511fd6..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);
/*
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 66d74a398fb..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
{
@@ -13182,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/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/innobase/Makefile.am b/storage/innobase/Makefile.am
deleted file mode 100644
index 8e8e3300d35..00000000000
--- a/storage/innobase/Makefile.am
+++ /dev/null
@@ -1,336 +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/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 \
- 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 73d27a787f4..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
@@ -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/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 9c6fa086d58..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);
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 c955f807a63..b0d620c060d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -960,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:
@@ -6494,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
@@ -6508,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);
@@ -6519,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:
@@ -6536,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;
}
}
@@ -6550,109 +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 > 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.",
- 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);
@@ -6778,8 +6779,7 @@ 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. */
@@ -6800,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) {
- /* if KEY_BLOCK_SIZE was specified on this statement and
- ROW_FORMAT was not, automatically change ROW_FORMAT to COMPRESSED.*/
- if ( (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)
- && !(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) {
+ /* 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
@@ -6841,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.",
@@ -6867,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
@@ -6905,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;
@@ -6988,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) {
@@ -7534,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");
@@ -7553,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
@@ -7752,7 +7769,9 @@ ha_innobase::info_low(
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";
}
@@ -7771,6 +7790,9 @@ ha_innobase::info_low(
}
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
@@ -7820,6 +7842,8 @@ ha_innobase::info_low(
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
@@ -7836,19 +7860,12 @@ ha_innobase::info_low(
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);
+ ullint avail_space;
- /* ib_table->space must be an existent tablespace */
- if (!ib_table->ibd_file_missing
- && !ib_table->tablespace_discarded) {
-
- 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();
@@ -7865,9 +7882,9 @@ ha_innobase::info_low(
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;
@@ -7896,6 +7913,8 @@ ha_innobase::info_low(
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
@@ -7933,8 +7952,6 @@ ha_innobase::info_low(
break;
}
- dict_index_stat_mutex_enter(index);
-
if (index->stat_n_diff_key_vals[j + 1] == 0) {
rec_per_key = stats.records;
@@ -7943,8 +7960,6 @@ ha_innobase::info_low(
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
@@ -7961,6 +7976,8 @@ ha_innobase::info_low(
(ulong) rec_per_key;
}
}
+
+ dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -8376,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 */
@@ -8482,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);
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/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 5e29d4a1453..9865ebfbfc2 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -508,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/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/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/row0upd.h b/storage/innobase/include/row0upd.h
index e7b3f6559e3..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 */
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/plug.in b/storage/innobase/plug.in
deleted file mode 100644
index 5fa82e585a4..00000000000
--- a/storage/innobase/plug.in
+++ /dev/null
@@ -1,234 +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_cas_ulong \
- atomic_cas_32 \
- atomic_cas_64 \
- atomic_add_long_nv \
- atomic_swap_uchar,
-
- 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/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 bd9143125f8..709750fc4e7 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -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 */);
}
}
@@ -3020,7 +3021,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 491db8849e3..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);
diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
index a564a2367c5..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 */
@@ -1615,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/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/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 ab10135c6c4..8b11e706180 100644
--- a/storage/innobase/trx/trx0i_s.c
+++ b/storage/innobase/trx/trx0i_s.c
@@ -415,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.
@@ -445,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;
}
@@ -812,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);
}
@@ -832,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;
@@ -903,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
@@ -960,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));
@@ -1000,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
@@ -1037,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/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/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/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/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/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/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/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 26aa7ad81ad..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}")
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/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 595586962ba..75021c318e6 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -223,7 +223,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.
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 5ddf428602b..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;
@@ -6447,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;
@@ -19310,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);
@@ -19397,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
*/
@@ -19731,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/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/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/unittest/unit.pl b/unittest/unit.pl
index a1aab376fdf..f5f5d21f988 100644
--- a/unittest/unit.pl
+++ b/unittest/unit.pl
@@ -14,7 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-use Test::Harness;
use File::Find;
use Getopt::Long;
@@ -38,9 +37,10 @@ unit - Run unit tests in directory
my $big= $ENV{'MYTAP_CONFIG'} eq 'big';
+my $opt_verbose;
my $result = GetOptions (
"big!" => \$big,
- "verbose!" => \$Test::Harness::verbose,
+ "verbose!" => \$opt_verbose,
);
$ENV{'MYTAP_CONFIG'} = $big ? 'big' : '';
@@ -60,6 +60,19 @@ Run all unit tests in the current directory and all subdirectories.
=cut
+BEGIN {
+ # Test::Harness have been extensively rewritten in newer perl
+ # versions and is now just a backward compatibility wrapper
+ # (with a bug causing the HARNESS_PERL_SWITCHES to be mangled)
+ # Prefer to use TAP::Harness directly if available
+ if (eval "use TAP::Harness; 1") {
+ eval 'sub NEW_HARNESS { 1 }';
+ warn "using TAP::Harness";
+ } else {
+ eval "use Test::Harness; 1" or die "couldn't find Test::Harness!";
+ eval 'sub NEW_HARNESS { 0 }';
+ }
+}
sub _find_test_files (@) {
my @dirs = @_;
@@ -102,8 +115,19 @@ sub run_cmd (@) {
if (@files > 0) {
# Removing the first './' from the file names
foreach (@files) { s!^\./!! }
- $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"';
- runtests @files;
+
+ if (NEW_HARNESS())
+ {
+ my %args = ( exec => [ ], verbosity => $opt_verbose );
+ my $harness = TAP::Harness->new( \%args );
+ $harness->runtests(@files);
+ }
+ else
+ {
+ $ENV{'HARNESS_VERBOSE'} = $opt_verbose;
+ $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"';
+ runtests(@files);
+ }
}
}
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/configure.js b/win/configure.js
index 764b33bb976..812ff54a09c 100644
--- a/win/configure.js
+++ b/win/configure.js
@@ -101,8 +101,7 @@ try
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 \"\")");
+ configfile.WriteLine("SET (MYSQL_UNIX_ADDR \"MySQL\" CACHE STRING \"\")");
var version = GetVersion(configureIn);
configfile.WriteLine("SET (VERSION \"" + version + "\" CACHE STRING \"\")");
configfile.WriteLine("SET (MYSQL_BASE_VERSION \"" +
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