#At file:///home/cpowers/work/dev/mysql-trunk-wl4896/ based on revid:chris.powers@stripped
3307 Christopher Powers 2011-06-18 [merge]
Merge w/ mysql-trunk
removed:
mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc
storage/innobase/scripts/
storage/innobase/scripts/persistent_storage.sql
added:
mysql-test/r/archive_debug.result
mysql-test/r/mysql_embedded.result
mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
mysql-test/suite/perfschema/r/table_schema.result
mysql-test/suite/perfschema/t/table_schema.test
mysql-test/t/archive_debug.test
mysql-test/t/mysql_embedded.test
modified:
.bzrignore
client/mysql.cc
client/mysql_upgrade.c
client/mysqladmin.cc
client/mysqlbinlog.cc
client/mysqlcheck.c
client/mysqldump.c
client/mysqlimport.c
client/mysqlshow.c
client/mysqlslap.c
client/mysqltest.cc
cmake/make_dist.cmake.in
cmake/plugin.cmake
configure.cmake
extra/yassl/src/yassl_error.cpp
include/mysql/plugin_audit.h
include/mysql/plugin_audit.h.pp
libmysql/authentication_win/plugin_client.cc
libmysqld/emb_qcache.cc
libmysqld/lib_sql.cc
mysql-test/collections/default.experimental
mysql-test/extra/rpl_tests/rpl_auto_increment.test
mysql-test/include/icp_tests.inc
mysql-test/mysql-test-run.pl
mysql-test/r/1st.result
mysql-test/r/alter_table.result
mysql-test/r/connect.result
mysql-test/r/events_bugs.result
mysql-test/r/flush.result
mysql-test/r/gis-precise.result
mysql-test/r/gis-rtree.result
mysql-test/r/group_by.result
mysql-test/r/innodb_icp.result
mysql-test/r/innodb_icp_all.result
mysql-test/r/innodb_icp_none.result
mysql-test/r/log_tables_upgrade.result
mysql-test/r/lowercase_table4.result
mysql-test/r/multi_update.result
mysql-test/r/multi_update_innodb.result
mysql-test/r/myisam_icp.result
mysql-test/r/myisam_icp_all.result
mysql-test/r/myisam_icp_none.result
mysql-test/r/mysql_upgrade.result
mysql-test/r/mysql_upgrade_ssl.result
mysql-test/r/mysqlcheck.result
mysql-test/r/partition.result
mysql-test/r/partition_datatype.result
mysql-test/r/plugin_auth.result
mysql-test/r/query_cache_28249.result
mysql-test/r/sp_notembedded.result
mysql-test/r/symlink.result
mysql-test/r/system_mysql_db.result
mysql-test/r/trigger-compat.result
mysql-test/r/trigger.result
mysql-test/r/type_datetime.result
mysql-test/suite/funcs_1/r/is_columns_mysql.result
mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_key_column_usage.result
mysql-test/suite/funcs_1/r/is_statistics.result
mysql-test/suite/funcs_1/r/is_statistics_mysql.result
mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_table_constraints.result
mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_tables_mysql.result
mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
mysql-test/suite/innodb/r/innodb-system-table-view.result
mysql-test/suite/innodb/r/innodb-zip.result
mysql-test/suite/innodb/r/innodb_bug57904.result
mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
mysql-test/suite/innodb/t/innodb-system-table-view.test
mysql-test/suite/innodb/t/innodb-zip.test
mysql-test/suite/innodb/t/innodb_bug11933790.test
mysql-test/suite/innodb/t/innodb_bug57904.test
mysql-test/suite/innodb/t/innodb_bug60049.test
mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
mysql-test/suite/innodb/t/innodb_stats.test
mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
mysql-test/suite/perfschema/include/cleanup_helper.inc
mysql-test/suite/perfschema/include/upgrade_check.inc
mysql-test/suite/perfschema/r/pfs_upgrade.result
mysql-test/suite/perfschema/r/schema.result
mysql-test/suite/perfschema/r/selects.result
mysql-test/suite/perfschema/t/selects.test
mysql-test/suite/rpl/r/rpl_auto_increment.result
mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result
mysql-test/t/alter_table.test
mysql-test/t/disabled.def
mysql-test/t/events_bugs.test
mysql-test/t/flush.test
mysql-test/t/gis-precise.test
mysql-test/t/gis-rtree.test
mysql-test/t/group_by.test
mysql-test/t/multi_update.test
mysql-test/t/multi_update_innodb.test
mysql-test/t/partition.test
mysql-test/t/partition_datatype.test
mysql-test/t/query_cache_28249.test
mysql-test/t/sp_notembedded.test
mysql-test/t/symlink.test
mysql-test/t/system_mysql_db_fix40123.test
mysql-test/t/system_mysql_db_fix50030.test
mysql-test/t/system_mysql_db_fix50117.test
mysql-test/t/trigger-compat.test
mysql-test/t/type_datetime.test
mysys/mf_pack.c
plugin/audit_null/audit_null.c
scripts/mysql_install_db.pl.in
scripts/mysql_install_db.sh
scripts/mysql_system_tables.sql
sql/binlog.cc
sql/event_db_repository.cc
sql/event_parse_data.cc
sql/event_parse_data.h
sql/event_scheduler.cc
sql/field.cc
sql/filesort.cc
sql/gcalc_tools.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/handler.cc
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_cmpfunc.h
sql/item_func.cc
sql/item_inetfunc.cc
sql/item_row.cc
sql/item_strfunc.cc
sql/item_sum.cc
sql/item_timefunc.cc
sql/item_timefunc.h
sql/log_event.cc
sql/log_event_old.cc
sql/mdl.h
sql/mysqld.cc
sql/opt_sum.cc
sql/partition_info.cc
sql/protocol.cc
sql/rpl_master.cc
sql/rpl_reporting.cc
sql/rpl_rli.cc
sql/rpl_slave.cc
sql/share/errmsg-utf8.txt
sql/sp.cc
sql/sp_head.cc
sql/spatial.cc
sql/sql_acl.cc
sql/sql_admin.cc
sql/sql_alloc_error_handler.cc
sql/sql_audit.cc
sql/sql_audit.h
sql/sql_base.cc
sql/sql_cache.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_connect.cc
sql/sql_derived.cc
sql/sql_error.cc
sql/sql_error.h
sql/sql_insert.cc
sql/sql_lex.cc
sql/sql_lex.h
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_plist.h
sql/sql_prepare.cc
sql/sql_prepare.h
sql/sql_select.cc
sql/sql_servers.cc
sql/sql_show.cc
sql/sql_signal.cc
sql/sql_table.cc
sql/sql_test.cc
sql/sql_time.cc
sql/sql_trigger.cc
sql/sql_trigger.h
sql/sql_update.cc
sql/sql_yacc.yy
sql/structs.h
sql/sys_vars.cc
sql/table.cc
sql/table.h
sql/transaction.cc
sql/tztime.cc
storage/archive/azio.c
storage/archive/ha_archive.cc
storage/innobase/btr/btr0btr.c
storage/innobase/btr/btr0cur.c
storage/innobase/buf/buf0buddy.c
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0flu.c
storage/innobase/buf/buf0lru.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/include/btr0btr.h
storage/innobase/include/btr0cur.h
storage/innobase/include/btr0cur.ic
storage/innobase/include/buf0buddy.h
storage/innobase/include/buf0buddy.ic
storage/innobase/include/buf0buf.h
storage/innobase/include/buf0buf.ic
storage/innobase/include/buf0lru.h
storage/innobase/include/buf0types.h
storage/innobase/include/page0cur.ic
storage/innobase/include/page0page.h
storage/innobase/include/page0page.ic
storage/innobase/include/rem0rec.h
storage/innobase/include/rem0rec.ic
storage/innobase/include/sync0rw.ic
storage/innobase/include/sync0sync.h
storage/innobase/include/sync0sync.ic
storage/innobase/include/trx0purge.h
storage/innobase/include/trx0trx.h
storage/innobase/include/univ.i
storage/innobase/lock/lock0lock.c
storage/innobase/page/page0cur.c
storage/innobase/page/page0page.c
storage/innobase/page/page0zip.c
storage/innobase/rem/rem0rec.c
storage/innobase/row/row0ins.c
storage/innobase/row/row0row.c
storage/innobase/row/row0upd.c
storage/innobase/row/row0vers.c
storage/innobase/srv/srv0srv.c
storage/innobase/sync/sync0rw.c
storage/innobase/sync/sync0sync.c
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0rec.c
storage/myisam/mi_update.c
storage/myisam/mi_write.c
tests/mysql_client_test.c
=== modified file '.bzrignore'
--- a/.bzrignore 2011-05-16 08:52:10 +0000
+++ b/.bzrignore 2011-06-07 13:07:28 +0000
@@ -3160,3 +3160,4 @@ info_macros.cmake
Docs/INFO_BIN
Docs/INFO_SRC
Testing
+source_downloads
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2011-05-26 15:20:09 +0000
+++ b/client/mysql.cc 2011-06-09 17:44:21 +0000
@@ -1640,11 +1640,11 @@ static struct my_option my_long_options[
&show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2011-05-26 15:20:09 +0000
+++ b/client/mysql_upgrade.c 2011-06-06 10:29:45 +0000
@@ -92,7 +92,7 @@ static struct my_option my_long_options[
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.",
@@ -109,7 +109,7 @@ static struct my_option my_long_options[
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc 2011-02-11 14:38:34 +0000
+++ b/client/mysqladmin.cc 2011-06-06 10:29:45 +0000
@@ -210,11 +210,11 @@ static struct my_option my_long_options[
&opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2011-05-26 15:20:09 +0000
+++ b/client/mysqlbinlog.cc 2011-06-06 10:29:45 +0000
@@ -1037,7 +1037,7 @@ static struct my_option my_long_options[
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
@@ -1065,7 +1065,7 @@ static struct my_option my_long_options[
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2011-03-08 09:21:39 +0000
+++ b/client/mysqlcheck.c 2011-06-06 10:29:45 +0000
@@ -106,7 +106,7 @@ static struct my_option my_long_options[
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.",
&opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
@@ -146,7 +146,7 @@ static struct my_option my_long_options[
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c 2011-05-26 15:20:09 +0000
+++ b/client/mysqldump.c 2011-06-06 10:29:45 +0000
@@ -508,11 +508,11 @@ static struct my_option my_long_options[
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c 2011-01-16 04:02:29 +0000
+++ b/client/mysqlimport.c 2011-06-06 10:29:45 +0000
@@ -97,7 +97,7 @@ static struct my_option my_long_options[
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", &opt_delete,
&opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -149,7 +149,7 @@ static struct my_option my_long_options[
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c 2011-01-16 04:02:29 +0000
+++ b/client/mysqlshow.c 2011-06-06 10:29:45 +0000
@@ -197,7 +197,7 @@ static struct my_option my_long_options[
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
@@ -213,7 +213,7 @@ static struct my_option my_long_options[
"solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2011-05-26 15:20:09 +0000
+++ b/client/mysqlslap.c 2011-06-06 10:29:45 +0000
@@ -592,7 +592,7 @@ static struct my_option my_long_options[
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
@@ -636,7 +636,7 @@ static struct my_option my_long_options[
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2011-05-26 15:20:09 +0000
+++ b/client/mysqltest.cc 2011-06-06 10:29:45 +0000
@@ -6399,7 +6399,7 @@ static struct my_option my_long_options[
&opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
120, 0, 3600 * 12, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
=== modified file 'cmake/make_dist.cmake.in'
--- a/cmake/make_dist.cmake.in 2011-03-04 15:12:05 +0000
+++ b/cmake/make_dist.cmake.in 2011-06-10 07:13:51 +0000
@@ -28,6 +28,7 @@ SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@")
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@")
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
+SET(PLUGIN_REPOS "@PLUGIN_REPOS@")
SET(VERSION "@VERSION@")
@@ -53,6 +54,22 @@ IF(BZR_EXECUTABLE)
ENDIF()
ENDIF()
+IF(BZR_EXECUTABLE)
+ FOREACH(REPO ${PLUGIN_REPOS})
+ GET_FILENAME_COMPONENT(PLUGIN_NAME ${REPO} NAME)
+ SET(DEST ${PACKAGE_DIR}/plugin/${PLUGIN_NAME})
+ MESSAGE(STATUS "Running bzr export for plugin/${PLUGIN_NAME}")
+ EXECUTE_PROCESS(
+ COMMAND "${BZR_EXECUTABLE}" export ${DEST}
+ WORKING_DIRECTORY ${REPO}
+ RESULT_VARIABLE RESULT
+ )
+ IF(NOT RESULT EQUAL 0)
+ MESSAGE(STATUS "bzr export failed")
+ ENDIF()
+ ENDFOREACH()
+ENDIF()
+
IF(NOT BZR_EXECUTABLE)
MESSAGE(STATUS "bzr not found or source dir is not a repo, use CPack")
=== modified file 'cmake/plugin.cmake'
--- a/cmake/plugin.cmake 2011-05-27 12:45:38 +0000
+++ b/cmake/plugin.cmake 2011-06-10 14:12:38 +0000
@@ -32,16 +32,15 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_
MACRO(PLUGIN_APPEND_COLLECTIONS plugin)
SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied")
- IF(EXISTS ${fcopied})
- RETURN()
+ IF(NOT EXISTS ${fcopied})
+ FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*)
+ FOREACH(cfile ${collections})
+ FILE(READ ${cfile} contents)
+ GET_FILENAME_COMPONENT(fname ${cfile} NAME)
+ FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}")
+ FILE(APPEND ${fcopied} "${fname}\n")
+ ENDFOREACH()
ENDIF()
- FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*)
- FOREACH(cfile ${collections})
- FILE(READ ${cfile} contents)
- GET_FILENAME_COMPONENT(fname ${cfile} NAME)
- FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}")
- FILE(APPEND ${fcopied} "${fname}\n")
- ENDFOREACH()
ENDMACRO()
MACRO(MYSQL_ADD_PLUGIN)
@@ -228,4 +227,11 @@ MACRO(CONFIGURE_PLUGINS)
ADD_SUBDIRECTORY(${dir})
ENDIF()
ENDFOREACH()
+ FOREACH(dir ${dirs_plugin})
+ IF (EXISTS ${dir}/.bzr)
+ MESSAGE(STATUS "Found repo ${dir}/.bzr")
+ LIST(APPEND PLUGIN_BZR_REPOS "${dir}")
+ ENDIF()
+ ENDFOREACH()
+ SET(PLUGIN_REPOS "${PLUGIN_BZR_REPOS}" CACHE INTERNAL "")
ENDMACRO()
=== modified file 'configure.cmake'
--- a/configure.cmake 2011-05-31 13:52:09 +0000
+++ b/configure.cmake 2011-06-06 10:29:45 +0000
@@ -338,6 +338,7 @@ CHECK_FUNCTION_EXISTS (fconvert HAVE_FCO
CHECK_FUNCTION_EXISTS (fdatasync HAVE_FDATASYNC)
CHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_DECL_FDATASYNC)
CHECK_FUNCTION_EXISTS (fesetround HAVE_FESETROUND)
+CHECK_FUNCTION_EXISTS (fedisableexcept HAVE_FEDISABLEEXCEPT)
CHECK_FUNCTION_EXISTS (fpsetmask HAVE_FPSETMASK)
CHECK_FUNCTION_EXISTS (fseeko HAVE_FSEEKO)
CHECK_FUNCTION_EXISTS (fsync HAVE_FSYNC)
=== modified file 'extra/yassl/src/yassl_error.cpp'
--- a/extra/yassl/src/yassl_error.cpp 2010-02-22 13:23:47 +0000
+++ b/extra/yassl/src/yassl_error.cpp 2011-06-17 07:51:34 +0000
@@ -128,7 +128,7 @@ void SetErrorString(unsigned long error,
break;
case badVersion_error :
- strncpy(buffer, "protocl version mismatch", max);
+ strncpy(buffer, "protocol version mismatch", max);
break;
case compress_error :
=== modified file 'include/mysql/plugin_audit.h'
--- a/include/mysql/plugin_audit.h 2010-12-14 14:34:23 +0000
+++ b/include/mysql/plugin_audit.h 2011-06-03 07:27:11 +0000
@@ -24,16 +24,7 @@
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
-#define MYSQL_AUDIT_INTERFACE_VERSION 0x0200
-
-/*
- The first word in every event class struct indicates the specific
- class of the event.
-*/
-struct mysql_event
-{
- unsigned int event_class;
-};
+#define MYSQL_AUDIT_INTERFACE_VERSION 0x0300
/*************************************************************************
@@ -55,7 +46,6 @@ struct mysql_event
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -87,7 +77,6 @@ struct mysql_event_general
struct mysql_event_connection
{
- unsigned int event_class;
unsigned int event_subclass;
int status;
unsigned long thread_id;
@@ -118,9 +107,9 @@ struct mysql_event_connection
waiting for the next query from the client.
event_notify() is invoked whenever an event occurs which is of any
- class for which the plugin has interest. The first word of the
- mysql_event argument indicates the specific event class and the
- remainder of the structure is as required for that class.
+ class for which the plugin has interest. The second argument
+ indicates the specific event class and the third argument is data
+ as required for that class.
class_mask is an array of bits used to indicate what event classes
that this plugin wants to receive.
@@ -130,7 +119,7 @@ struct st_mysql_audit
{
int interface_version;
void (*release_thd)(MYSQL_THD);
- void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+ void (*event_notify)(MYSQL_THD, unsigned int, const void *);
unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
};
=== modified file 'include/mysql/plugin_audit.h.pp'
--- a/include/mysql/plugin_audit.h.pp 2011-05-04 09:54:04 +0000
+++ b/include/mysql/plugin_audit.h.pp 2011-06-03 08:00:42 +0000
@@ -44,7 +44,7 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG= 8,
THD_WAIT_GROUP_COMMIT= 9,
THD_WAIT_SYNC= 10,
- THD_WAIT_LAST= 11
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
void (*thd_wait_begin_func)(void*, int);
@@ -209,13 +209,8 @@ void mysql_query_cache_invalidate4(void*
void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
void thd_set_ha_data(void* thd, const struct handlerton *hton,
const void *ha_data);
-struct mysql_event
-{
- unsigned int event_class;
-};
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -231,7 +226,6 @@ struct mysql_event_general
};
struct mysql_event_connection
{
- unsigned int event_class;
unsigned int event_subclass;
int status;
unsigned long thread_id;
@@ -254,6 +248,6 @@ struct st_mysql_audit
{
int interface_version;
void (*release_thd)(void*);
- void (*event_notify)(void*, const struct mysql_event *);
+ void (*event_notify)(void*, unsigned int, const void *);
unsigned long class_mask[1];
};
=== modified file 'libmysql/authentication_win/plugin_client.cc'
--- a/libmysql/authentication_win/plugin_client.cc 2011-04-29 21:53:46 +0000
+++ b/libmysql/authentication_win/plugin_client.cc 2011-06-03 13:17:35 +0000
@@ -20,6 +20,16 @@
#include "common.h"
+/*
+ The following MS C++ specific pragma embeds a comment in the resulting
+ object file. A "lib" comment tells the linker to use the specified
+ library, thus the dependency is handled automagically.
+*/
+
+#ifdef _MSC_VER
+#pragma comment(lib, "Secur32")
+#endif
+
static int win_auth_client_plugin_init(char*, size_t, int, va_list)
{
return 0;
=== modified file 'libmysqld/emb_qcache.cc'
--- a/libmysqld/emb_qcache.cc 2010-03-31 14:05:33 +0000
+++ b/libmysqld/emb_qcache.cc 2011-06-10 16:57:01 +0000
@@ -487,7 +487,7 @@ int emb_load_querycache_result(THD *thd,
data->embedded_info->prev_ptr= prev_row;
return_ok:
net_send_eof(thd, thd->server_status,
- thd->warning_info->statement_warn_count());
+ thd->get_stmt_wi()->statement_warn_count());
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2011-05-26 15:20:09 +0000
+++ b/libmysqld/lib_sql.cc 2011-06-13 18:46:41 +0000
@@ -130,7 +130,7 @@ emb_advanced_command(MYSQL *mysql, enum
/* Clear result variables */
thd->clear_error();
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net_clear_error(net);
@@ -241,7 +241,7 @@ static my_bool emb_read_prepare_result(M
stmt->stmt_id= thd->client_stmt_id;
stmt->param_count= thd->client_param_count;
stmt->field_count= 0;
- mysql->warning_count= thd->warning_info->statement_warn_count();
+ mysql->warning_count= thd->get_stmt_wi()->statement_warn_count();
if (thd->first_data)
{
@@ -426,7 +426,7 @@ static void emb_free_embedded_thd(MYSQL
static const char * emb_read_statistics(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
- return thd->is_error() ? thd->stmt_da->message() : "";
+ return thd->is_error() ? thd->get_stmt_da()->message() : "";
}
@@ -532,8 +532,8 @@ int init_embedded_server(int argc, char
return 1;
defaults_argc= *argcp;
defaults_argv= *argvp;
- remaining_argc= argc;
- remaining_argv= argv;
+ remaining_argc= *argcp;
+ remaining_argv= *argvp;
/* Must be initialized early for comparison of options name */
system_charset_info= &my_charset_utf8_general_ci;
@@ -1047,7 +1047,7 @@ bool Protocol::send_result_set_metadata(
if (flags & SEND_EOF)
write_eof_packet(thd, thd->server_status,
- thd->warning_info->statement_warn_count());
+ thd->get_stmt_wi()->statement_warn_count());
DBUG_RETURN(prepare_for_send(list->elements));
err:
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2011-05-27 04:52:39 +0000
+++ b/mysql-test/collections/default.experimental 2011-06-13 04:17:23 +0000
@@ -6,14 +6,11 @@ binlog.binlog_multi_engine
funcs_1.charset_collation_1 # depends on compile-time decisions
main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
-main.gis-rtree @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
main.mysqlslap @windows # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
main.signal_demo3 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.subquery_sj_none @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.log_tables-big # Bug#11756699 2010-11-15 mattiasj report already exists
-main.type_float @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_delayed_slave # BUG#11764654 rpl_delayed_slave fails sporadically in pb
@@ -22,6 +19,7 @@ rpl.rpl_heartbeat_basic
rpl.rpl_row_sp011 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
rpl.rpl_seconds_behind_master # BUG#11765124 2010-11-24 luis fails sporadically on pb2
rpl.rpl_show_slave_running # BUG#12346048 2011-04-11 sven fails sporadically on pb2
+rpl.rpl_change_master_dbug # BUG#11933491 2011-06-13 Anitha Test fails on redhat
sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails
@@ -34,6 +32,3 @@ sys_vars.ndb_log_updated_only_basic
sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
rpl_bhs.* # skozlov : WL#5139 - rpl_bhs suite generated "on-the-fly" at testing moment from rpl suite
-main.gis-rtree # svoj: due to BUG#11749418
-main.type_float # svoj: due to BUG#11749418
-main.type_newdecimal # svoj: due to BUG#11749418
=== modified file 'mysql-test/extra/rpl_tests/rpl_auto_increment.test'
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test 2010-12-21 10:39:20 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test 2011-05-02 13:52:51 +0000
@@ -256,4 +256,19 @@ connection master;
DROP TABLE t1;
sync_slave_with_master;
+#
+# WL#5872 "avoid using global heap memory to remember autoincrement
+# values for statement-based binlog".
+#
+connection master;
+eval create table t1(a int auto_increment primary key) engine=$engine_type;
+insert into t1 values (null),(null),(1025),(null);
+sync_slave_with_master;
+select * from t1;
+let $diff_tables= master:t1, slave:t1;
+--source include/diff_tables.inc
+connection master;
+drop table t1;
+sync_slave_with_master;
+
--source include/rpl_end.inc
=== modified file 'mysql-test/include/icp_tests.inc'
--- a/mysql-test/include/icp_tests.inc 2011-03-24 13:16:36 +0000
+++ b/mysql-test/include/icp_tests.inc 2011-06-09 06:22:39 +0000
@@ -924,3 +924,43 @@ eval EXPLAIN $query;
eval $query;
DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+--echo #
+
+CREATE TABLE t1 (
+ pk INTEGER PRIMARY KEY,
+ a INTEGER NOT NULL,
+ b CHAR(1),
+ KEY(b)
+);
+
+INSERT INTO t1 VALUES (23,5,'d');
+
+let query=
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+ AND (a1.a != a2.a OR a1.b IS NULL);
+
+eval EXPLAIN $query;
+eval $query;
+
+# Re-run the same query using a view. This will test the code with
+# an Item_ref object in the condition tree (note: in order for this
+# to trigger the bug the patch for Bug#59696 needs to be applied first).
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+let query=
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+ AND (a1.a != a2.a OR a1.b IS NULL);
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP VIEW v1;
+DROP TABLE t1;
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2011-05-30 14:00:14 +0000
+++ b/mysql-test/mysql-test-run.pl 2011-06-16 13:56:45 +0000
@@ -171,6 +171,7 @@ our $exe_mysql;
our $exe_mysqladmin;
our $exe_mysqltest;
our $exe_libtool;
+our $exe_mysql_embedded;
our $opt_big_test= 0;
@@ -1952,6 +1953,8 @@ sub executable_setup () {
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
+ $exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded");
+
if ( ! $opt_skip_ndbcluster )
{
# Look for single threaded NDB
@@ -2356,6 +2359,7 @@ sub environment_setup {
$ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin);
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
$ENV{'EXE_MYSQL'}= $exe_mysql;
+ $ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded;
# ----------------------------------------------------
# bug25714 executable may _not_ exist in
=== modified file 'mysql-test/r/1st.result'
--- a/mysql-test/r/1st.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/1st.result 2011-06-15 08:02:11 +0000
@@ -17,6 +17,8 @@ help_keyword
help_relation
help_topic
host
+innodb_index_stats
+innodb_table_stats
ndb_binlog_index
plugin
proc
=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result 2011-05-04 07:51:15 +0000
+++ b/mysql-test/r/alter_table.result 2011-06-16 23:45:58 +0000
@@ -1345,6 +1345,35 @@ DROP TABLE t1;
CREATE TABLE t1 (a TEXT, id INT, b INT);
ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST;
DROP TABLE t1;
+#
+# Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
+# FIRST CAN CAUSE DATA TO BE CORRUPTED".
+#
+drop table if exists t1;
+# Use MyISAM engine as the fact that InnoDB doesn't support
+# in-place ALTER TABLE in cases when columns are being renamed
+# hides some bugs.
+create table t1 (i int, j int) engine=myisam;
+insert into t1 value (1, 2);
+# First, test for original problem described in the bug report.
+select * from t1;
+i j
+1 2
+# Change of column order by the below ALTER TABLE statement should
+# affect both column names and column contents.
+alter table t1 modify column j int first;
+select * from t1;
+j i
+2 1
+# Now test for similar problem with the same root.
+# The below ALTER TABLE should change not only the name but
+# also the value for the last column of the table.
+alter table t1 drop column i, add column k int default 0;
+select * from t1;
+j k
+2 0
+# Clean-up.
+drop table t1;
End of 5.1 tests
CREATE TABLE t1(c CHAR(10),
i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
=== added file 'mysql-test/r/archive_debug.result'
--- a/mysql-test/r/archive_debug.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/archive_debug.result 2011-05-18 10:01:43 +0000
@@ -0,0 +1,12 @@
+#
+# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
+# WITH PARTITIONED ARCHIVE TABLES
+#
+CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES(1);
+SET SESSION debug='d,simulate_archive_open_failure';
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Corrupt
+SET SESSION debug=DEFAULT;
+DROP TABLE t1;
=== modified file 'mysql-test/r/connect.result'
--- a/mysql-test/r/connect.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/connect.result 2011-06-15 08:02:11 +0000
@@ -11,6 +11,8 @@ help_keyword
help_relation
help_topic
host
+innodb_index_stats
+innodb_table_stats
ndb_binlog_index
plugin
proc
@@ -47,6 +49,8 @@ help_keyword
help_relation
help_topic
host
+innodb_index_stats
+innodb_table_stats
ndb_binlog_index
plugin
proc
@@ -91,6 +95,8 @@ help_keyword
help_relation
help_topic
host
+innodb_index_stats
+innodb_table_stats
ndb_binlog_index
plugin
proc
=== modified file 'mysql-test/r/events_bugs.result'
--- a/mysql-test/r/events_bugs.result 2011-05-27 11:42:28 +0000
+++ b/mysql-test/r/events_bugs.result 2011-06-09 18:08:38 +0000
@@ -419,7 +419,7 @@ SET TIME_ZONE= '+04:00';
ALTER EVENT e1 DO SELECT 2;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
-events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT e1;
SET TIME_ZONE='+05:00';
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
@@ -796,6 +796,20 @@ COUNT(*)
DROP EVENT IF EXISTS event_Bug12546938;
DROP TABLE table_bug12546938;
SET GLOBAL EVENT_SCHEDULER = OFF;
+DROP DATABASE IF EXISTS event_test11764334;
+CREATE DATABASE event_test11764334;
+USE event_test11764334;
+CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 4 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP EVENT ev1;
+DROP DATABASE event_test11764334;
+USE test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;
=== modified file 'mysql-test/r/flush.result'
--- a/mysql-test/r/flush.result 2011-03-07 09:08:10 +0000
+++ b/mysql-test/r/flush.result 2011-06-16 15:18:16 +0000
@@ -466,3 +466,26 @@ ALTER TABLE t1 COMMENT 'test';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES;
DROP TABLE t1;
+#
+# Test for bug #12641342 - "61401: UPDATE PERFORMANCE DEGRADES
+# GRADUALLY IF A TRIGGER EXISTS".
+#
+# One of side-effects of this bug was that a transaction which
+# involved DML statements requiring prelocking blocked concurrent
+# FLUSH TABLES WITH READ LOCK for the whole its duration, while
+# correct behavior in this case is to block FTWRL only for duration
+# of individual DML statements.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT);
+INSERT INTO t1 VALUES (1, 1);
+CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW SET @var = "a";
+BEGIN;
+UPDATE t1 SET value= value + 1 WHERE id = 1;
+# Switching to connection 'con1'.
+# The below FLUSH TABLES WITH READ LOCK should succeed and
+# should not be blocked by the transaction in default connection.
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+# Switching to connection 'default'.
+COMMIT;
+DROP TABLE t1;
=== modified file 'mysql-test/r/gis-precise.result'
--- a/mysql-test/r/gis-precise.result 2011-01-14 21:08:28 +0000
+++ b/mysql-test/r/gis-precise.result 2011-06-08 17:24:16 +0000
@@ -201,3 +201,28 @@ result
SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
result
1
+#
+# BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD
+# BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
+#
+SELECT ASTEXT(ST_UNION(GEOMFROMTEXT('POLYGON((525000 183300,525400
+183300,525400 18370, 525000 183700,525000 183300))'),
+geomfromtext('POLYGON((525298.67 183511.53,525296.57
+183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
+183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
+183500.84,525276.79 183500,525260.7 183491.55,525263.95
+183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
+183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
+183499.1,525282.2 183499.3,525283.55 183500,525301.75
+183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
+183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
+183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
+183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
+183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
+183491.55))'))) st_u;
+st_u
+MULTIPOLYGON(((525400 18370,525000.9677614468 183300,525400 183300,525400 18370)),((525000.9677614468 183300,525000 183300,525000 183700,525000.9677614468 183300)),((525265.58 183481.95,525263.95 183484.75,525260.7 183491.55,525276.79 183500,525278.39 183500.84,525278.63 183500.97,525280.98 183502.26,525283.17 183503.47,525289.11 183506.62,525296.42 183510.31,525296.57 183510.39,525298.67 183511.53,525302.81 183513.8,525304.5 183510.83,525307.85 183504.95,525304.45 183504.25,525301.75 183509.35,525283.55 183500,525282.2 183499.3,525282.3 183499.1,525280.35 183498.2,525275.5 183495.7,525276.5 183493.45,525278.97 183488.73,525265.58 183481.95),(525266.99 183484.33,525263.26 183491.55,525266.15 183493.04,525269.88 183485.82,525266.99 183484.33),(525272.06 183488.37,525268.94 183494.51,525271.94 183496.03,525275.06 183489.89,525272.06 183488.37)))
+SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
+SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t;
+t
+NULL
=== modified file 'mysql-test/r/gis-rtree.result'
--- a/mysql-test/r/gis-rtree.result 2010-10-28 09:54:31 +0000
+++ b/mysql-test/r/gis-rtree.result 2011-06-07 16:00:42 +0000
@@ -1535,3 +1535,30 @@ HANDLER t1 READ a NEXT;
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.0 tests.
+#
+# Bug #57323/11764487: myisam corruption with insert ignore
+# and invalid spatial data
+#
+CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
+SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT ASTEXT(a), ASTEXT(b) FROM t1;
+ASTEXT(a) ASTEXT(b)
+POINT(0 0) POINT(1 1)
+DROP TABLE t1;
+CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
+KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
+INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+INSERT IGNORE INTO t1 SET a=1, b=NULL;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT a, ASTEXT(b) FROM t1;
+a ASTEXT(b)
+0 POINT(1 1)
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result 2011-05-26 05:50:01 +0000
+++ b/mysql-test/r/group_by.result 2011-06-10 09:52:57 +0000
@@ -1967,3 +1967,23 @@ field1 field2
DROP TABLE t1;
DROP TABLE where_subselect;
# End of Bug #58782
+#
+# Bug #11766429
+# RE-EXECUTE OF PREPARED STATEMENT CRASHES IN ITEM_REF::FIX_FIELDS WITH
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (0);
+CREATE TABLE t2(b INT, KEY(b));
+INSERT INTO t2 VALUES (0),(0);
+PREPARE stmt FROM '
+SELECT 1 FROM t2
+LEFT JOIN t1 ON NULL
+GROUP BY t2.b, t1.a
+HAVING a <> 2';
+EXECUTE stmt;
+1
+EXECUTE stmt;
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+# End of Bug #11766429
=== modified file 'mysql-test/r/innodb_icp.result'
--- a/mysql-test/r/innodb_icp.result 2011-03-24 13:16:36 +0000
+++ b/mysql-test/r/innodb_icp.result 2011-06-09 06:22:39 +0000
@@ -871,5 +871,46 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY a1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY t1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set default_storage_engine= @save_storage_engine;
set optimizer_switch=default;
=== modified file 'mysql-test/r/innodb_icp_all.result'
--- a/mysql-test/r/innodb_icp_all.result 2011-03-29 08:10:26 +0000
+++ b/mysql-test/r/innodb_icp_all.result 2011-06-09 06:22:39 +0000
@@ -871,5 +871,46 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY a1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY t1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set default_storage_engine= @save_storage_engine;
set optimizer_switch=default;
=== modified file 'mysql-test/r/innodb_icp_none.result'
--- a/mysql-test/r/innodb_icp_none.result 2011-03-24 13:16:36 +0000
+++ b/mysql-test/r/innodb_icp_none.result 2011-06-09 06:22:39 +0000
@@ -870,5 +870,46 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY a1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY t1 ref b b 2 const 1 Using where
+3 SUBQUERY t1 index NULL b 2 NULL 1 Using index
+2 DERIVED t1 ALL NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set default_storage_engine= @save_storage_engine;
set optimizer_switch=default;
=== modified file 'mysql-test/r/log_tables_upgrade.result'
--- a/mysql-test/r/log_tables_upgrade.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/log_tables_upgrade.result 2011-06-15 08:02:11 +0000
@@ -23,6 +23,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
=== modified file 'mysql-test/r/lowercase_table4.result'
--- a/mysql-test/r/lowercase_table4.result 2010-11-30 18:25:52 +0000
+++ b/mysql-test/r/lowercase_table4.result 2011-06-15 08:02:11 +0000
@@ -30,6 +30,17 @@ Create Table CREATE TABLE `Table2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME innodb_index_stats_ibfk_1
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA mysql
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE RESTRICT
+DELETE_RULE RESTRICT
+TABLE_NAME innodb_index_stats
+REFERENCED_TABLE_NAME innodb_table_stats
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME fk1
UNIQUE_CONSTRAINT_CATALOG def
@@ -89,6 +100,17 @@ Create Table CREATE TABLE `Customer` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME innodb_index_stats_ibfk_1
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA mysql
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE RESTRICT
+DELETE_RULE RESTRICT
+TABLE_NAME innodb_index_stats
+REFERENCED_TABLE_NAME innodb_table_stats
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME product_order_ibfk_1
UNIQUE_CONSTRAINT_CATALOG def
=== modified file 'mysql-test/r/multi_update.result'
--- a/mysql-test/r/multi_update.result 2011-03-08 19:14:42 +0000
+++ b/mysql-test/r/multi_update.result 2011-06-16 06:30:16 +0000
@@ -697,4 +697,40 @@ SELECT * FROM t1;
pk a
1 2
DROP TABLE t1;
-end of tests
+#
+# BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+# UPDATED TWICE
+#
+CREATE TABLE t1 (
+col_int_key int,
+pk int,
+col_int int,
+key(col_int_key),
+primary key (pk)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,2,3);
+
+CREATE TABLE t2 (
+col_int_key int,
+pk_1 int,
+pk_2 int,
+col_int int,
+key(col_int_key),
+primary key (pk_1,pk_2)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+
+SELECT * FROM t1;
+col_int_key pk col_int
+1 7 3
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+
+SELECT * FROM t2;
+col_int_key pk_1 pk_2 col_int
+1 7 11 4
+DROP TABLE t1,t2;
=== modified file 'mysql-test/r/multi_update_innodb.result'
--- a/mysql-test/r/multi_update_innodb.result 2011-02-21 15:31:41 +0000
+++ b/mysql-test/r/multi_update_innodb.result 2011-06-16 06:30:16 +0000
@@ -27,3 +27,43 @@ pk a b
0 1 2
DROP VIEW v1;
DROP TABLE t1;
+#
+# BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+# UPDATED TWICE
+#
+CREATE TABLE t1 (
+col_int_key int,
+pk int,
+col_int int,
+key(col_int_key),
+primary key (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2,3);
+
+CREATE TABLE t2 (
+col_int_key int,
+pk_1 int,
+pk_2 int,
+col_int int,
+key(col_int_key),
+primary key (pk_1,pk_2)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+SELECT * FROM t1;
+col_int_key pk col_int
+1 2 3
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+SELECT * FROM t2;
+col_int_key pk_1 pk_2 col_int
+1 2 3 4
+DROP TABLE t1,t2;
=== modified file 'mysql-test/r/myisam_icp.result'
--- a/mysql-test/r/myisam_icp.result 2011-03-24 13:16:36 +0000
+++ b/mysql-test/r/myisam_icp.result 2011-06-09 06:22:39 +0000
@@ -868,4 +868,43 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set optimizer_switch=default;
=== modified file 'mysql-test/r/myisam_icp_all.result'
--- a/mysql-test/r/myisam_icp_all.result 2011-03-29 08:10:26 +0000
+++ b/mysql-test/r/myisam_icp_all.result 2011-06-09 06:22:39 +0000
@@ -868,4 +868,43 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set optimizer_switch=default;
=== modified file 'mysql-test/r/myisam_icp_none.result'
--- a/mysql-test/r/myisam_icp_none.result 2011-03-24 13:16:36 +0000
+++ b/mysql-test/r/myisam_icp_none.result 2011-06-09 06:22:39 +0000
@@ -867,4 +867,43 @@ i1
1
2
DROP TABLE t1, t2, t3;
+#
+# Bug#12355958 "FAILING ASSERTION: TRX->LOCK.N_ACTIVE_THRS == 1"
+#
+CREATE TABLE t1 (
+pk INTEGER PRIMARY KEY,
+a INTEGER NOT NULL,
+b CHAR(1),
+KEY(b)
+);
+INSERT INTO t1 VALUES (23,5,'d');
+EXPLAIN SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM t1 AS a1 JOIN (SELECT * FROM t1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM t1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY t1 system NULL NULL NULL NULL 1
+2 DERIVED t1 system NULL NULL NULL NULL 1
+SELECT a1.pk
+FROM v1 AS a1 JOIN (SELECT * FROM v1 LIMIT 1) AS a2 ON a2.b = a1.b
+WHERE a1.a = (SELECT pk FROM v1 LIMIT 1)
+AND (a1.a != a2.a OR a1.b IS NULL);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
set optimizer_switch=default;
=== added file 'mysql-test/r/mysql_embedded.result'
--- a/mysql-test/r/mysql_embedded.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysql_embedded.result 2011-06-13 18:41:24 +0000
@@ -0,0 +1,5 @@
+#
+# Bug#12561297 : LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
+#
+1
+1
=== modified file 'mysql-test/r/mysql_upgrade.result'
--- a/mysql-test/r/mysql_upgrade.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/mysql_upgrade.result 2011-06-15 08:02:11 +0000
@@ -11,6 +11,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -42,6 +44,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -73,6 +77,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -106,6 +112,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -143,6 +151,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -183,6 +193,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
=== modified file 'mysql-test/r/mysql_upgrade_ssl.result'
--- a/mysql-test/r/mysql_upgrade_ssl.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/mysql_upgrade_ssl.result 2011-06-15 08:02:11 +0000
@@ -13,6 +13,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
=== modified file 'mysql-test/r/mysqlcheck.result'
--- a/mysql-test/r/mysqlcheck.result 2011-03-08 09:21:39 +0000
+++ b/mysql-test/r/mysqlcheck.result 2011-06-15 08:02:11 +0000
@@ -14,6 +14,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -44,6 +46,12 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats
+note : Table does not support optimize, doing recreate + analyze instead
+status : OK
+mysql.innodb_table_stats
+note : Table does not support optimize, doing recreate + analyze instead
+status : OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -72,6 +80,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -100,6 +110,12 @@ mysql.help_keyword
mysql.help_relation Table is already up to date
mysql.help_topic Table is already up to date
mysql.host Table is already up to date
+mysql.innodb_index_stats
+note : Table does not support optimize, doing recreate + analyze instead
+status : OK
+mysql.innodb_table_stats
+note : Table does not support optimize, doing recreate + analyze instead
+status : OK
mysql.ndb_binlog_index Table is already up to date
mysql.plugin Table is already up to date
mysql.proc Table is already up to date
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2011-03-23 09:52:24 +0000
+++ b/mysql-test/r/partition.result 2011-06-13 10:55:58 +0000
@@ -1,5 +1,34 @@
drop table if exists t1, t2;
#
+# Bug#11765667: bug#58655: ASSERTION FAILED,
+# SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
+#
+CREATE TABLE t1 (
+id MEDIUMINT NOT NULL AUTO_INCREMENT,
+dt DATE, st VARCHAR(255), uid INT,
+id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
+('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
+('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
+('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
+('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
+('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
+('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
+('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
+('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
+('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
+ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
+PARTITION d1 VALUES IN (1991, 1994),
+PARTITION d2 VALUES IN (1993),
+PARTITION d3 VALUES IN (1992, 1995, 1996)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
+UPDATE t1 SET filler='Updating the row' WHERE uid=298;
+DROP TABLE t1;
+#
# Bug#59297: Can't find record in 'tablename' on update inner join
#
CREATE TABLE t1 (
@@ -202,6 +231,15 @@ a b
2007-07-30 17:35:48 p1
2009-07-14 17:35:55 pmax
2009-09-21 17:31:42 pmax
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+a b
+2007-07-30 17:35:48 p1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
PARTITION p3 VALUES LESS THAN (1247688000),
PARTITION pmax VALUES LESS THAN MAXVALUE);
@@ -210,6 +248,15 @@ a b
2007-07-30 17:35:48 p1
2009-07-14 17:35:55 pmax
2009-09-21 17:31:42 pmax
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+a b
+2007-07-30 17:35:48 p1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
=== modified file 'mysql-test/r/partition_datatype.result'
--- a/mysql-test/r/partition_datatype.result 2009-10-28 00:11:17 +0000
+++ b/mysql-test/r/partition_datatype.result 2011-06-13 09:57:47 +0000
@@ -338,3 +338,1003 @@ select hex(a) from t1 where a = 7;
hex(a)
7
drop table t1;
+#
+# Bug#28928: UNIX_TIMESTAMP() should be considered unary monotonic
+# by partition pruning
+SET @old_time_zone= @@session.time_zone;
+SET @@session.time_zone = 'UTC';
+# Using MyISAM to get stable values on TABLE_ROWS in I_S.PARTITIONS
+CREATE TABLE t1
+(a TIMESTAMP NULL,
+tz varchar(16))
+ENGINE = MyISAM;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION `p0` VALUES LESS THAN (0),
+PARTITION `p-2000` VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01')),
+PARTITION `p-2011-MSK` VALUES LESS THAN (UNIX_TIMESTAMP('2011-03-26 23:00:00')),
+PARTITION `p-2011-MSD-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 22:00:00')),
+PARTITION `p-2011-MSD-2` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 23:00:00')),
+PARTITION `p-2012-MSK-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-30 00:00:00')),
+PARTITION `p-2012-MSK-2` VALUES LESS THAN (UNIX_TIMESTAMP('2012-03-24 23:00:00')),
+PARTITION `pEnd` VALUES LESS THAN (UNIX_TIMESTAMP('2038-01-19 03:14:07')),
+PARTITION `pMax` VALUES LESS THAN MAXVALUE);
+# Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'UTC');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'UTC');
+# Test invalid values
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+# Test start range
+INSERT INTO t1 VALUES ('1970-01-01 00:00:01', 'UTC');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'UTC');
+# Test end range
+INSERT INTO t1 VALUES ('2038-01-19 03:14:06', 'UTC');
+INSERT INTO t1 VALUES ('2038-01-19 03:14:07', 'UTC');
+# Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-26 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 21:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:01', 'UTC');
+SET @@session.time_zone = 'Europe/Moscow';
+# Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'Moscow');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'Moscow');
+# Test invalid values
+INSERT INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+# values truncated to 03:00:00 due to daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+INSERT INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+INSERT INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+# Test start range
+INSERT INTO t1 VALUES ('1970-01-01 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'Moscow');
+# Test end range
+INSERT INTO t1 VALUES ('2038-01-19 06:14:06', 'Moscow');
+INSERT INTO t1 VALUES ('2038-01-19 06:14:07', 'Moscow');
+# Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 01:59:59', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 01:59:59', 'Moscow');
+# All values between 02:00 and 02:59:59 will be interpretated as DST
+INSERT INTO t1 VALUES ('2011-10-30 02:00:00', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:00:01', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:59:59', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:01', 'Moscow');
+SET @@session.time_zone = 'UTC';
+INSERT INTO t2 SELECT * FROM t1;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 2
+p-2000 16
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 2
+SELECT * FROM t1 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1 ALL NULL NULL NULL NULL 18 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+a tz
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2 ALL NULL NULL NULL NULL 15 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 13 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 7 Using where; Using filesort
+# Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+1
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+2038-01-19 03:14:06 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 34
+Warning 1264 Out of range value for column 'a' at row 35
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+0000-00-00 00:00:00 2038-01-19 03:14:07
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+2
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 3
+p-2000 6
+p-2011-MSK 0
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 4
+p-2012-MSK-2 5
+pEnd 0
+pMax 2
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 UTC
+1970-01-01 00:00:02 Moscow
+1970-01-01 00:00:02 UTC
+1974-02-05 18:28:17 Moscow
+1974-02-05 21:28:17 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 UTC
+2011-03-26 23:00:02 Moscow
+2011-03-26 23:00:02 UTC
+2011-10-29 22:00:00 Moscow
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:00:02 MoscowD
+2011-10-29 22:00:02 UTC
+2011-10-29 23:00:00 MoscowD
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:00:02 UTC
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2011-10-30 00:00:02 Moscow
+2011-10-30 00:00:02 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+# Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+3
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+NULL UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+2011-10-30 00:00:02 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+1970-01-01 00:00:01 2038-01-19 03:14:06
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+0
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 6
+p-2000 4
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 0
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+NULL UTC
+NULL UTC
+NULL UTC
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` timestamp NULL DEFAULT NULL,
+ `tz` varchar(16) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
+ PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
+ PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+TRUNCATE TABLE t2;
+SET @@session.time_zone = 'Europe/Moscow';
+INSERT INTO t2 SELECT * FROM t1;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 2
+p-2000 16
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 2
+SELECT * FROM t1 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+# Testing the leap from 01:59:59 to 03:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+# Testing the leap from 02:59:59 to 02:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+# Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+1
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+2038-01-19 06:14:06 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 8
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 9
+Warning 1264 Out of range value for column 'a' at row 34
+Warning 1264 Out of range value for column 'a' at row 35
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+0000-00-00 00:00:00 2038-01-19 06:14:07
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+2
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 3
+p-2000 6
+p-2011-MSK 0
+p-2011-MSD-1 9
+p-2011-MSD-2 8
+p-2012-MSK-1 0
+p-2012-MSK-2 7
+pEnd 0
+pMax 2
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 UTC
+1970-01-01 03:00:02 Moscow
+1970-01-01 03:00:02 UTC
+1974-02-05 21:28:17 Moscow
+1974-02-06 00:28:17 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 UTC
+2011-03-27 03:00:02 Moscow
+2011-03-27 03:00:02 UTC
+2011-10-30 02:00:00 Moscow
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:02 MoscowD
+2011-10-30 02:00:02 UTC
+2011-10-30 02:00:02 UTC
+2011-10-30 03:00:00 MoscowD
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2011-10-30 03:00:02 Moscow
+2011-10-30 03:00:02 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+# Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+3
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+2011-10-30 03:00:02 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 18
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 19
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+1970-01-01 03:00:01 2038-01-19 06:14:06
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+0
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 6
+p-2000 4
+p-2011-MSK 0
+p-2011-MSD-1 11
+p-2011-MSD-2 9
+p-2012-MSK-1 0
+p-2012-MSK-2 4
+pEnd 2
+pMax 0
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL Moscow
+NULL Moscow
+NULL UTC
+NULL UTC
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` timestamp NULL DEFAULT NULL,
+ `tz` varchar(16) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
+ PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
+ PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+TRUNCATE TABLE t2;
+DROP TABLE t1, t2;
+SET @@session.time_zone= @old_time_zone;
=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result 2011-04-07 09:55:09 +0000
+++ b/mysql-test/r/plugin_auth.result 2011-06-15 08:02:11 +0000
@@ -299,6 +299,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
@@ -429,6 +431,8 @@ mysql.help_keyword
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
=== modified file 'mysql-test/r/query_cache_28249.result'
--- a/mysql-test/r/query_cache_28249.result 2008-11-28 15:45:34 +0000
+++ b/mysql-test/r/query_cache_28249.result 2011-06-10 09:40:57 +0000
@@ -8,7 +8,7 @@ SET @query_cache_size= @@global.
SET GLOBAL query_cache_type=1;
SET GLOBAL query_cache_limit=10000;
SET GLOBAL query_cache_min_res_unit=0;
-SET GLOBAL query_cache_size= 100000;
+SET GLOBAL query_cache_size= 102400;
FLUSH TABLES;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT);
@@ -23,10 +23,10 @@ SELECT *, (SELECT COUNT(*) FROM t2) FROM
# Switch to connection user3
# Poll till the select of connection user1 is blocked by the write lock on t1.
SELECT user,command,state,info FROM information_schema.processlist
-WHERE state = 'Locked'
+WHERE state = 'Waiting for table metadata lock'
AND info = 'SELECT *, (SELECT COUNT(*) FROM t2) FROM t1';
user command state info
-root Query Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
+root Query Waiting for table metadata lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
INSERT INTO t1 VALUES (4);
# Switch to connection user2
UNLOCK TABLES;
=== modified file 'mysql-test/r/sp_notembedded.result'
--- a/mysql-test/r/sp_notembedded.result 2011-03-18 14:16:17 +0000
+++ b/mysql-test/r/sp_notembedded.result 2011-06-08 13:44:50 +0000
@@ -254,7 +254,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END;
DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
-set @@global.concurrent_insert= @old_concurrent_insert;
#
# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
#
@@ -288,3 +287,25 @@ DROP FUNCTION f1;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
+#
+# Test for bug#11763757 "56510: ERROR 42000: FUNCTION DOES NOT EXIST
+# IF NOT-PRIV USER RECONNECTS ".
+#
+# The real problem was that server was unable handle properly stored
+# functions in databases which names contained dot.
+#
+DROP DATABASE IF EXISTS `my.db`;
+create database `my.db`;
+use `my.db`;
+CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
+# Create new connection.
+USE `my.db`;
+SELECT f1(1);
+f1(1)
+1
+SELECT `my.db`.f1(2);
+`my.db`.f1(2)
+2
+# Switching to default connection.
+DROP DATABASE `my.db`;
+set @@global.concurrent_insert= @old_concurrent_insert;
=== modified file 'mysql-test/r/symlink.result'
--- a/mysql-test/r/symlink.result 2011-01-31 09:34:39 +0000
+++ b/mysql-test/r/symlink.result 2011-06-09 12:54:12 +0000
@@ -188,3 +188,28 @@ DROP TABLE user;
FLUSH TABLE mysql.user;
SELECT * FROM mysql.user;
End of 5.1 tests
+#
+# Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
+# STATEMENTS FAIL".
+#
+drop table if exists t1, t2;
+create table t1 (a int primary key) engine=myisam
+data directory="MYSQLTEST_VARDIR/tmp"
+ index directory="MYSQLTEST_VARDIR/run";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
+# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
+# options should not fail. Per documentation newly created table
+# should not inherit value of these options from the original table.
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1, t2;
=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result 2011-03-18 14:58:27 +0000
+++ b/mysql-test/r/system_mysql_db.result 2011-06-15 08:02:11 +0000
@@ -10,6 +10,8 @@ help_keyword
help_relation
help_topic
host
+innodb_index_stats
+innodb_table_stats
ndb_binlog_index
plugin
proc
=== modified file 'mysql-test/r/trigger-compat.result'
--- a/mysql-test/r/trigger-compat.result 2010-02-03 21:48:40 +0000
+++ b/mysql-test/r/trigger-compat.result 2011-06-10 07:20:15 +0000
@@ -41,3 +41,98 @@ DROP TABLE t2;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
+USE test;
+#
+# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
+#
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+INSERT INTO t3 VALUES (1), (2), (3);
+# We simulate importing a trigger from 5.0 by writing a .TRN file for
+# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
+# with syntax allowed in 5.0 only.
+#
+# Note that in 5.0 the following lines are missing from t1.TRG:
+#
+# client_cs_names='latin1'
+# connection_cl_names='latin1_swedish_ci'
+# db_cl_names='latin1_swedish_ci'
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+# We will get parse errors for most DDL and DML statements when the table
+# has broken triggers. The parse error refers to the first broken
+# trigger.
+CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
+ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+INSERT INTO t1 VALUES (1);
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+INSERT INTO t2 VALUES (1);
+ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
+DELETE FROM t1;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+UPDATE t1 SET a = 1 WHERE a = 1;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+SELECT * FROM t1;
+a
+1
+2
+3
+RENAME TABLE t1 TO t1_2;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TRIGGER tr11;
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+DROP TRIGGER tr12;
+DROP TRIGGER tr13;
+DROP TRIGGER tr14;
+DROP TRIGGER tr15;
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+# Make sure there is no trigger file left.
+# We write the same trigger files one more time to test DROP TABLE.
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+DROP TABLE t1;
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+DROP TABLE t2;
+Warnings:
+Warning 1603 Triggers for table `test`.`t2` have no creation context
+DROP TABLE t3;
+# Make sure there is no trigger file left.
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
+# and last trigger is broken.
+# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
+FLUSH TABLE t1;
+SHOW CREATE TRIGGER tr12;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+SHOW CREATE TRIGGER tr11;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TRIGGER tr12;
+DROP TRIGGER tr11;
+DROP TABLE t1;
+DROP TABLE t2;
=== modified file 'mysql-test/r/trigger.result'
--- a/mysql-test/r/trigger.result 2011-05-09 08:48:22 +0000
+++ b/mysql-test/r/trigger.result 2011-06-10 13:31:09 +0000
@@ -2106,7 +2106,7 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2
SHOW TRIGGERS IN db1;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
INSERT INTO t2 VALUES (1);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1 VALUES (1)' at line 1
+ERROR 42000: Trigger 'trg1' has an error in its body: '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 't1 VALUES (1)' at line 1'
SELECT * FROM t1;
b
# Work around Bug#45235
=== modified file 'mysql-test/r/type_datetime.result'
--- a/mysql-test/r/type_datetime.result 2011-01-19 14:39:13 +0000
+++ b/mysql-test/r/type_datetime.result 2011-06-10 08:34:13 +0000
@@ -704,5 +704,51 @@ b
DROP TABLE t1;
#
#
+# BUG#12561818: RERUN OF STORED FUNCTION GIVES ERROR 1172:
+# RESULT CONSISTED OF MORE THAN ONE ROW
+#
+CREATE TABLE t1 (a DATE NOT NULL, b INT);
+INSERT INTO t1 VALUES ('0000-00-00',1), ('1999-05-10',2);
+CREATE TABLE t2 (a DATETIME NOT NULL, b INT);
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00',1), ('1999-05-10 00:00:00',2);
+
+SELECT * FROM t1 WHERE a IS NULL;
+a b
+0000-00-00 1
+SELECT * FROM t2 WHERE a IS NULL;
+a b
+0000-00-00 00:00:00 1
+SELECT * FROM t1 LEFT JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+SELECT * FROM t2 LEFT JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+a b a b
+0000-00-00 00:00:00 1 0000-00-00 00:00:00 1
+1999-05-10 00:00:00 2 0000-00-00 00:00:00 1
+SELECT * FROM t1 JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+SELECT * FROM t2 JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+a b a b
+0000-00-00 00:00:00 1 0000-00-00 00:00:00 1
+1999-05-10 00:00:00 2 0000-00-00 00:00:00 1
+
+PREPARE stmt1 FROM
+'SELECT *
+ FROM t1 LEFT JOIN t1 AS t1_2 ON 1
+ WHERE t1_2.a IS NULL AND t1_2.b < 2';
+EXECUTE stmt1;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+EXECUTE stmt1;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1,t2;
+#
# End of 5.5 tests
#
=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2011-05-05 22:46:07 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2011-06-15 08:02:11 +0000
@@ -97,6 +97,20 @@ def mysql host Select_priv 3 N NO enum 1
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
+def mysql innodb_index_stats database_name 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
+def mysql innodb_index_stats index_name 3 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
+def mysql innodb_index_stats sample_size 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql innodb_index_stats stat_description 8 NULL NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select,insert,update,references
+def mysql innodb_index_stats stat_name 5 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
+def mysql innodb_index_stats stat_timestamp 4 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
+def mysql innodb_index_stats stat_value 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql innodb_index_stats table_name 2 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
+def mysql innodb_table_stats clustered_index_size 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql innodb_table_stats database_name 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
+def mysql innodb_table_stats n_rows 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql innodb_table_stats stats_timestamp 3 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
+def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references
@@ -420,6 +434,20 @@ NULL mysql help_topic help_category_id s
3.0000 mysql host Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
+3.0000 mysql innodb_index_stats database_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_index_stats table_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_index_stats index_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_index_stats stat_timestamp timestamp NULL NULL NULL NULL timestamp
+3.0000 mysql innodb_index_stats stat_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_index_stats stat_value bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_index_stats sample_size bigint NULL NULL NULL NULL bigint(20) unsigned
+3.0000 mysql innodb_index_stats stat_description varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 mysql innodb_table_stats database_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_table_stats table_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_table_stats stats_timestamp timestamp NULL NULL NULL NULL timestamp
+NULL mysql innodb_table_stats n_rows bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats clustered_index_size bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql ndb_binlog_index Position bigint NULL NULL NULL NULL bigint(20) unsigned
1.0000 mysql ndb_binlog_index File varchar 255 255 latin1 latin1_swedish_ci varchar(255)
NULL mysql ndb_binlog_index epoch bigint NULL NULL NULL NULL bigint(20) unsigned
=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result 2011-05-06 10:38:10 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result 2011-06-15 08:02:11 +0000
@@ -97,6 +97,20 @@ def mysql host Select_priv 3 N NO enum 1
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y')
+def mysql innodb_index_stats database_name 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
+def mysql innodb_index_stats index_name 3 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
+def mysql innodb_index_stats sample_size 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql innodb_index_stats stat_description 8 NULL NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024)
+def mysql innodb_index_stats stat_name 5 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
+def mysql innodb_index_stats stat_timestamp 4 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP
+def mysql innodb_index_stats stat_value 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql innodb_index_stats table_name 2 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
+def mysql innodb_table_stats clustered_index_size 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql innodb_table_stats database_name 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
+def mysql innodb_table_stats n_rows 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql innodb_table_stats stats_timestamp 3 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP
+def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI
def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255)
@@ -420,6 +434,20 @@ NULL mysql help_topic help_category_id s
3.0000 mysql host Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
+3.0000 mysql innodb_index_stats database_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_index_stats table_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_index_stats index_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_index_stats stat_timestamp timestamp NULL NULL NULL NULL timestamp
+3.0000 mysql innodb_index_stats stat_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_index_stats stat_value bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_index_stats sample_size bigint NULL NULL NULL NULL bigint(20) unsigned
+3.0000 mysql innodb_index_stats stat_description varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
+3.0000 mysql innodb_table_stats database_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 mysql innodb_table_stats table_name varchar 64 192 utf8 utf8_general_ci varchar(64)
+NULL mysql innodb_table_stats stats_timestamp timestamp NULL NULL NULL NULL timestamp
+NULL mysql innodb_table_stats n_rows bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats clustered_index_size bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql ndb_binlog_index Position bigint NULL NULL NULL NULL bigint(20) unsigned
1.0000 mysql ndb_binlog_index File varchar 255 255 latin1 latin1_swedish_ci varchar(255)
NULL mysql ndb_binlog_index epoch bigint NULL NULL NULL NULL bigint(20) unsigned
=== modified file 'mysql-test/suite/funcs_1/r/is_key_column_usage.result'
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result 2011-06-15 08:02:11 +0000
@@ -96,6 +96,14 @@ def mysql PRIMARY def mysql help_topic h
def mysql name def mysql help_topic name
def mysql PRIMARY def mysql host Host
def mysql PRIMARY def mysql host Db
+def mysql PRIMARY def mysql innodb_index_stats database_name
+def mysql PRIMARY def mysql innodb_index_stats table_name
+def mysql PRIMARY def mysql innodb_index_stats index_name
+def mysql PRIMARY def mysql innodb_index_stats stat_name
+def mysql innodb_index_stats_ibfk_1 def mysql innodb_index_stats database_name
+def mysql innodb_index_stats_ibfk_1 def mysql innodb_index_stats table_name
+def mysql PRIMARY def mysql innodb_table_stats database_name
+def mysql PRIMARY def mysql innodb_table_stats table_name
def mysql PRIMARY def mysql ndb_binlog_index epoch
def mysql PRIMARY def mysql plugin name
def mysql PRIMARY def mysql proc db
=== modified file 'mysql-test/suite/funcs_1/r/is_statistics.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result 2011-06-15 08:02:11 +0000
@@ -107,6 +107,12 @@ def mysql help_topic mysql PRIMARY
def mysql help_topic mysql name
def mysql host mysql PRIMARY
def mysql host mysql PRIMARY
+def mysql innodb_index_stats mysql PRIMARY
+def mysql innodb_index_stats mysql PRIMARY
+def mysql innodb_index_stats mysql PRIMARY
+def mysql innodb_index_stats mysql PRIMARY
+def mysql innodb_table_stats mysql PRIMARY
+def mysql innodb_table_stats mysql PRIMARY
def mysql ndb_binlog_index mysql PRIMARY
def mysql plugin mysql PRIMARY
def mysql proc mysql PRIMARY
=== modified file 'mysql-test/suite/funcs_1/r/is_statistics_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result 2011-06-15 08:02:11 +0000
@@ -29,6 +29,12 @@ def mysql help_topic 0 mysql name 1 name
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 4 stat_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
=== modified file 'mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result 2011-06-15 08:02:11 +0000
@@ -29,6 +29,12 @@ def mysql help_topic 0 mysql name 1 name
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 4 stat_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
@@ -89,6 +95,12 @@ def mysql help_topic 0 mysql name 1 name
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
+def mysql innodb_index_stats 0 mysql PRIMARY 4 stat_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 1 database_name A #CARD# NULL NULL BTREE
+def mysql innodb_table_stats 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result 2011-06-15 08:02:11 +0000
@@ -69,6 +69,9 @@ def mysql PRIMARY mysql help_relation
def mysql PRIMARY mysql help_topic
def mysql name mysql help_topic
def mysql PRIMARY mysql host
+def mysql PRIMARY mysql innodb_index_stats
+def mysql innodb_index_stats_ibfk_1 mysql innodb_index_stats
+def mysql PRIMARY mysql innodb_table_stats
def mysql PRIMARY mysql ndb_binlog_index
def mysql PRIMARY mysql plugin
def mysql PRIMARY mysql proc
=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result 2011-06-15 08:02:11 +0000
@@ -19,6 +19,9 @@ def mysql PRIMARY mysql help_relation PR
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
+def mysql innodb_index_stats_ibfk_1 mysql innodb_index_stats FOREIGN KEY
+def mysql PRIMARY mysql innodb_index_stats PRIMARY KEY
+def mysql PRIMARY mysql innodb_table_stats PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result 2011-06-15 08:02:11 +0000
@@ -19,6 +19,9 @@ def mysql PRIMARY mysql help_relation PR
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
+def mysql innodb_index_stats_ibfk_1 mysql innodb_index_stats FOREIGN KEY
+def mysql PRIMARY mysql innodb_index_stats PRIMARY KEY
+def mysql PRIMARY mysql innodb_table_stats PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
@@ -51,6 +54,9 @@ def mysql PRIMARY mysql help_relation PR
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
+def mysql innodb_index_stats_ibfk_1 mysql innodb_index_stats FOREIGN KEY
+def mysql PRIMARY mysql innodb_index_stats PRIMARY KEY
+def mysql PRIMARY mysql innodb_table_stats PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result 2010-12-17 11:28:59 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result 2011-06-15 08:02:11 +0000
@@ -244,6 +244,52 @@ user_comment Host privileges; Merged wi
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME innodb_index_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
+TABLE_NAME innodb_table_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MyISAM
=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result 2011-06-15 08:02:11 +0000
@@ -244,6 +244,52 @@ user_comment Host privileges; Merged wi
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME innodb_index_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
+TABLE_NAME innodb_table_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MyISAM
@@ -858,6 +904,52 @@ user_comment Host privileges; Merged wi
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME innodb_index_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
+TABLE_NAME innodb_table_stats
+TABLE_TYPE BASE TABLE
+ENGINE InnoDB
+VERSION 10
+ROW_FORMAT Compact
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MyISAM
=== removed file 'mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc'
--- a/mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc 2011-05-30 13:56:01 +0000
+++ b/mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
--- disable_warnings
--- disable_query_log
-
-DROP TABLE IF EXISTS mysql.innodb_table_stats;
-CREATE TABLE mysql.innodb_table_stats (
- database_name VARCHAR(64) NOT NULL,
- table_name VARCHAR(64) NOT NULL,
- stats_timestamp TIMESTAMP NOT NULL,
- n_rows BIGINT UNSIGNED NOT NULL,
- clustered_index_size BIGINT UNSIGNED NOT NULL,
- sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL,
- PRIMARY KEY (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS mysql.innodb_index_stats;
-CREATE TABLE mysql.innodb_index_stats (
- database_name VARCHAR(64) NOT NULL,
- table_name VARCHAR(64) NOT NULL,
- index_name VARCHAR(64) NOT NULL,
- stat_timestamp TIMESTAMP NOT NULL,
- /* there are at least:
- stat_name='size'
- stat_name='n_leaf_pages'
- stat_name='n_diff_pfx%' */
- stat_name VARCHAR(64) NOT NULL,
- stat_value BIGINT UNSIGNED NOT NULL,
- sample_size BIGINT UNSIGNED,
- stat_description VARCHAR(1024) NOT NULL,
- PRIMARY KEY (database_name, table_name, index_name, stat_name),
- FOREIGN KEY (database_name, table_name)
- REFERENCES mysql.innodb_table_stats (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
--- enable_warnings
--- enable_query_log
=== modified file 'mysql-test/suite/innodb/r/innodb-system-table-view.result'
--- a/mysql-test/suite/innodb/r/innodb-system-table-view.result 2010-12-07 10:25:25 +0000
+++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result 2011-06-15 08:02:11 +0000
@@ -1,14 +1,11 @@
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
TABLE_ID NAME FLAG N_COLS SPACE
11 SYS_FOREIGN 0 7 0
12 SYS_FOREIGN_COLS 0 7 0
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE
11 ID_IND 11 3 1 302 0
12 FOR_IND 11 0 1 303 0
13 REF_IND 11 0 1 304 0
14 ID_IND 12 3 2 305 0
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
TABLE_ID NAME POS MTYPE PRTYPE LEN
11 ID 0 1 524292 0
11 FOR_NAME 1 1 524292 0
@@ -18,7 +15,7 @@ TABLE_ID NAME POS MTYPE PRTYPE LEN
12 POS 1 6 0 4
12 FOR_COL_NAME 2 1 524292 0
12 REF_COL_NAME 3 1 524292 0
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name');
INDEX_ID NAME POS
11 ID 0
12 FOR_NAME 0
@@ -27,11 +24,14 @@ INDEX_ID NAME POS
14 POS 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
+mysql/innodb_index_stats_ibfk_1 mysql/innodb_index_stats mysql/innodb_table_stats 2 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
+mysql/innodb_index_stats_ibfk_1 database_name database_name 0
+mysql/innodb_index_stats_ibfk_1 table_name table_name 1
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
count(*)
-2
+4
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
@@ -41,9 +41,12 @@ FOREIGN KEY (parent_id) REFERENCES paren
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
+mysql/innodb_index_stats_ibfk_1 mysql/innodb_index_stats mysql/innodb_table_stats 2 0
test/constraint_test test/child test/parent 1 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
+mysql/innodb_index_stats_ibfk_1 database_name database_name 0
+mysql/innodb_index_stats_ibfk_1 table_name table_name 1
test/constraint_test parent_id id 0
INSERT INTO parent VALUES(1);
SELECT name, num_rows, ref_count
@@ -55,6 +58,8 @@ SELECT NAME, FLAG, N_COLS, SPACE FROM IN
NAME FLAG N_COLS SPACE
SYS_FOREIGN 0 7 0
SYS_FOREIGN_COLS 0 7 0
+mysql/innodb_index_stats 1 11 0
+mysql/innodb_table_stats 1 9 0
test/child 1 5 0
test/parent 1 4 0
SELECT name, n_fields
@@ -91,9 +96,12 @@ FOREIGN KEY (id, parent_id) REFERENCES p
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
+mysql/innodb_index_stats_ibfk_1 mysql/innodb_index_stats mysql/innodb_table_stats 2 0
test/constraint_test test/child test/parent 2 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
+mysql/innodb_index_stats_ibfk_1 database_name database_name 0
+mysql/innodb_index_stats_ibfk_1 table_name table_name 1
test/constraint_test id id 0
test/constraint_test parent_id newid 1
INSERT INTO parent VALUES(1, 9);
=== modified file 'mysql-test/suite/innodb/r/innodb-zip.result'
--- a/mysql-test/suite/innodb/r/innodb-zip.result 2010-11-02 23:28:32 +0000
+++ b/mysql-test/suite/innodb/r/innodb-zip.result 2011-06-15 08:02:11 +0000
@@ -63,8 +63,7 @@ row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t0 Compact
test t00 Compact
@@ -85,18 +84,15 @@ 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;
alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Dynamic
alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Compact
alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Redundant
drop table t1;
@@ -115,8 +111,7 @@ rollback;
select a,left(b,40) from t1 natural join t2;
a left(b,40)
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Compressed
test t2 Compact
@@ -207,8 +202,7 @@ create table t8 (id int primary key) eng
create table t9 (id int primary key) engine = innodb row_format = dynamic;
create table t10(id int primary key) engine = innodb row_format = compact;
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';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Compact
test t10 Compact
@@ -246,8 +240,7 @@ Warning 1478 InnoDB: cannot specify ROW_
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;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t1 Compressed
test t5 Compressed
@@ -276,8 +269,7 @@ Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
@@ -324,8 +316,7 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t8 Compact
test t9 Redundant
@@ -376,8 +367,7 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format
test t8 Compact
test t9 Redundant
=== modified file 'mysql-test/suite/innodb/r/innodb_bug57904.result'
--- a/mysql-test/suite/innodb/r/innodb_bug57904.result 2010-11-30 18:25:52 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug57904.result 2011-06-15 08:02:11 +0000
@@ -13,7 +13,8 @@ INDEX (customer_id),
FOREIGN KEY (customer_id)
REFERENCES customer(id)
) ENGINE=INNODB;
-SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
+WHERE table_name = 'product_order';
CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME product_order_ibfk_1
=== modified file 'mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result'
--- a/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result 2011-06-01 09:55:08 +0000
+++ b/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result 2011-06-02 09:42:55 +0000
@@ -1,6 +1,7 @@
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
+DROP TABLE IF EXISTS worklog5743;
CREATE TABLE worklog5743 (
col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) ,
PRIMARY KEY (col_1_varchar(3072))
@@ -874,92 +875,6 @@ COUNT(*)
COMMIT;
DROP TABLE worklog5743;
CREATE TABLE worklog5743 (
-col_1_text TEXT(4000) , col_2_text TEXT(4000) ,
-PRIMARY KEY (col_1_text(3072))
-) ROW_FORMAT=DYNAMIC, engine = innodb;
-INSERT INTO worklog5743 VALUES(REPEAT("a", 3500) , REPEAT("o", 3500));
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-"In connection 1"
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-"In connection 2"
-START TRANSACTION;
-INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
-"In connection 1"
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-START TRANSACTION;
-"In connection default ....restarting the server"
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-"In connection 1"
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-START TRANSACTION;
-INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
-DELETE FROM worklog5743 WHERE col_1_text = REPEAT("b", 3500);
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-"In connection default ....restarting the server"
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-"In connection 1"
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-START TRANSACTION;
-UPDATE worklog5743 SET col_1_text = REPEAT("b", 3500) WHERE col_1_text = REPEAT("a", 3500);
-SELECT col_1_text = REPEAT("b", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("b", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-"In connection default ....restarting the server"
-SELECT COUNT(*) FROM worklog5743;
-COUNT(*)
-1
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
-1 1
-DROP TABLE worklog5743;
-set global innodb_file_format="Barracuda";
-set global innodb_file_per_table=1;
-set global innodb_large_prefix=1;
-CREATE TABLE worklog5743 (
col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) ,
PRIMARY KEY (col_1_varchar(3072))
) ROW_FORMAT=DYNAMIC, engine = innodb;
=== added file 'mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result'
--- a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result 2011-06-02 09:42:55 +0000
@@ -0,0 +1,91 @@
+set global innodb_file_format="Barracuda";
+set global innodb_file_per_table=1;
+set global innodb_large_prefix=1;
+DROP TABLE IF EXISTS worklog5743;
+CREATE TABLE worklog5743 (
+col_1_text TEXT(4000) , col_2_text TEXT(4000) ,
+PRIMARY KEY (col_1_text(3072))
+) ROW_FORMAT=DYNAMIC, engine = innodb;
+INSERT INTO worklog5743 VALUES(REPEAT("a", 3500) , REPEAT("o", 3500));
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+"In connection 1"
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+"In connection 2"
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
+"In connection 1"
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+START TRANSACTION;
+"In connection default ....restarting the server"
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+"In connection 1"
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
+DELETE FROM worklog5743 WHERE col_1_text = REPEAT("b", 3500);
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+"In connection default ....restarting the server"
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+"In connection 1"
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+START TRANSACTION;
+UPDATE worklog5743 SET col_1_text = REPEAT("b", 3500) WHERE col_1_text = REPEAT("a", 3500);
+SELECT col_1_text = REPEAT("b", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("b", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+"In connection default ....restarting the server"
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
+1 1
+DROP TABLE worklog5743;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_per_table=0;
+SET GLOBAL innodb_file_format_max=Antelope;
+SET GLOBAL innodb_large_prefix=0;
=== modified file 'mysql-test/suite/innodb/t/innodb-system-table-view.test'
--- a/mysql-test/suite/innodb/t/innodb-system-table-view.test 2010-12-07 10:25:25 +0000
+++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test 2011-06-15 08:02:11 +0000
@@ -4,13 +4,25 @@
--source include/have_innodb.inc
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
+# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats are
+# unpredictable, probably they on whether mtr has created the database for
+# this test from scratch or is using a previously created database where
+# those tables have been dropped and recreated. If we can force mtr to
+# use a freshly created database for this test then the following
+# complications can be removed and the test be reverted to the version
+# it was before the patch that adds this comment.
+--let table_stats_id = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_table_stats'`
+--let index_stats_id = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_index_stats'`
+
+--disable_query_log
+--eval SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE table_id NOT IN ($table_stats_id, $index_stats_id)
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
+--eval SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE table_id NOT IN ($table_stats_id, $index_stats_id)
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
+--eval SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE table_id NOT IN ($table_stats_id, $index_stats_id)
+--enable_query_log
-SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name');
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
=== modified file 'mysql-test/suite/innodb/t/innodb-zip.test'
--- a/mysql-test/suite/innodb/t/innodb-zip.test 2010-11-02 23:28:32 +0000
+++ b/mysql-test/suite/innodb/t/innodb-zip.test 2011-06-15 08:02:11 +0000
@@ -5,6 +5,8 @@ let $format=`select @@innodb_file_format
let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
+-- let $query_i_s = SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'
+
set session innodb_strict_mode=0;
set global innodb_file_per_table=off;
set global innodb_file_format=`0`;
@@ -39,20 +41,16 @@ create table t13(a int primary key) engi
row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t1;
create table t1(a int not null, b text, index(b(10))) engine=innodb
@@ -84,8 +82,7 @@ connection default;
disconnect a;
disconnect b;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t1,t2;
# The following should fail in non-strict mode too.
@@ -195,8 +192,7 @@ create table t9 (id int primary key) eng
create table t10(id int primary key) engine = innodb row_format = compact;
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';
+-- eval $query_i_s
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
@@ -221,8 +217,7 @@ show warnings;
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t1, t5;
#test multiple errors
@@ -241,8 +236,7 @@ create table t2 (id int primary key) eng
key_block_size = 9 row_format = dynamic;
show warnings;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
#test valid values with innodb_file_per_table unset
set global innodb_file_per_table = off;
@@ -271,8 +265,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t8, t9;
#test valid values with innodb_file_format unset
@@ -303,8 +296,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
+-- eval $query_i_s
drop table t8, t9;
eval set global innodb_file_per_table=$per_table;
=== modified file 'mysql-test/suite/innodb/t/innodb_bug11933790.test'
--- a/mysql-test/suite/innodb/t/innodb_bug11933790.test 2011-05-30 13:56:01 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug11933790.test 2011-06-15 08:02:11 +0000
@@ -4,7 +4,6 @@
#
-- source include/have_innodb.inc
--- source suite/innodb/include/innodb_stats_bootstrap.inc
call mtr.add_suppression("InnoDB: Error while trying to save table statistics for table .+bug11933790: Lock wait timeout");
@@ -16,12 +15,12 @@ SET SESSION innodb_analyze_is_persistent
CREATE TABLE bug11933790 (c INT) ENGINE=INNODB;
-# add some records to innodb.table_stats
+# add some records to mysql.innodb_table_stats
ANALYZE TABLE bug11933790;
SET autocommit=0;
-# lock the records in innodb.table_stats
+# lock the records in mysql.innodb_table_stats
SELECT * FROM mysql.innodb_table_stats FOR UPDATE;
-- connect (con1,localhost,root,,)
@@ -45,5 +44,3 @@ ANALYZE TABLE bug11933790;
COMMIT;
DROP TABLE bug11933790;
-DROP TABLE mysql.innodb_index_stats;
-DROP TABLE mysql.innodb_table_stats;
=== modified file 'mysql-test/suite/innodb/t/innodb_bug57904.test'
--- a/mysql-test/suite/innodb/t/innodb_bug57904.test 2010-11-30 18:25:52 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug57904.test 2011-06-15 08:02:11 +0000
@@ -19,7 +19,8 @@ CREATE TABLE product_order (no INT NOT N
REFERENCES customer(id)
) ENGINE=INNODB;
-query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
+WHERE table_name = 'product_order';
DROP TABLE product_order;
DROP TABLE product;
=== modified file 'mysql-test/suite/innodb/t/innodb_bug60049.test'
--- a/mysql-test/suite/innodb/t/innodb_bug60049.test 2011-02-17 20:25:33 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug60049.test 2011-06-15 08:02:11 +0000
@@ -5,6 +5,13 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
+-- disable_query_log
+let $create1 = query_get_value(SHOW CREATE TABLE mysql.innodb_table_stats, Create Table, 1);
+let $create2 = query_get_value(SHOW CREATE TABLE mysql.innodb_index_stats, Create Table, 1);
+DROP TABLE mysql.innodb_index_stats;
+DROP TABLE mysql.innodb_table_stats;
+-- enable_query_log
+
CREATE TABLE t(a INT)ENGINE=InnoDB;
RENAME TABLE t TO u;
DROP TABLE u;
@@ -37,3 +44,8 @@ EOF
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
+
+-- disable_query_log
+USE mysql;
+eval $create1;
+eval $create2;
=== modified file 'mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test'
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test 2011-06-01 09:55:08 +0000
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test 2011-06-02 09:42:55 +0000
@@ -26,7 +26,9 @@ set global innodb_file_format="Barracuda
set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
-
+-- disable_warnings
+DROP TABLE IF EXISTS worklog5743;
+-- enable_warnings
#------------------------------------------------------------------------------
# Prefix index with VARCHAR data type , primary/secondary index and DML ops
CREATE TABLE worklog5743 (
@@ -849,97 +851,6 @@ DROP TABLE worklog5743;
#------------------------------------------------------------------------------
-# Stop the server in between when prefix index are created and see if state is
-# correct when server is restarted.
-# Server is restarted at differnt points.
-
-CREATE TABLE worklog5743 (
-col_1_text TEXT(4000) , col_2_text TEXT(4000) ,
-PRIMARY KEY (col_1_text(3072))
-) ROW_FORMAT=DYNAMIC, engine = innodb;
-INSERT INTO worklog5743 VALUES(REPEAT("a", 3500) , REPEAT("o", 3500));
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
---echo "In connection 1"
---connect (con1,localhost,root,,)
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-SELECT COUNT(*) FROM worklog5743;
-
-
---echo "In connection 2"
---connect (con2,localhost,root,,)
-START TRANSACTION;
-INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
-
-
---echo "In connection 1"
---connection con1
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-SELECT COUNT(*) FROM worklog5743;
-START TRANSACTION;
-
-
---echo "In connection default ....restarting the server"
---connection default
-# Restart the server
--- source include/restart_mysqld.inc
-SELECT COUNT(*) FROM worklog5743;
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
---disconnect con1
---disconnect con2
-
---echo "In connection 1"
---connect (con1,localhost,root,,)
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-SELECT COUNT(*) FROM worklog5743;
-START TRANSACTION;
-INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
-DELETE FROM worklog5743 WHERE col_1_text = REPEAT("b", 3500);
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
---echo "In connection default ....restarting the server"
---connection default
-# Restart the server
--- source include/restart_mysqld.inc
-SELECT COUNT(*) FROM worklog5743;
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
---disconnect con1
-
---echo "In connection 1"
---connect (con2,localhost,root,,)
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-SELECT COUNT(*) FROM worklog5743;
-START TRANSACTION;
-UPDATE worklog5743 SET col_1_text = REPEAT("b", 3500) WHERE col_1_text = REPEAT("a", 3500);
-SELECT col_1_text = REPEAT("b", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
---echo "In connection default ....restarting the server"
---connection default
-# Restart the server
--- source include/restart_mysqld.inc
-SELECT COUNT(*) FROM worklog5743;
-SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
-worklog5743;
-
-DROP TABLE worklog5743;
-
-#------------------------------------------------------------------------------
-# Reset variables at server was restarted in previous case
-set global innodb_file_format="Barracuda";
-set global innodb_file_per_table=1;
-set global innodb_large_prefix=1;
-#------------------------------------------------------------------------------
# Select queries on prefix index column as index will be used in queries.
# Use few select functions , join condition , subqueries.
=== added file 'mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test'
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test 2011-06-16 04:30:51 +0000
@@ -0,0 +1,127 @@
+######## suite/innodb/t/innodb_prefix_iindex_restart_server.test #####
+# #
+# Testcase for worklog WL#5743: Lift the limit of index key prefixes #
+# Test scenario : Stop the server in between when prefix index are #
+# created and see if state is preserved after restart #
+# #
+# Creation: #
+# 2011-06-02 Implemented this test as part of WL#5743 #
+# #
+######################################################################
+
+# Don't test this under valgrind, memory leaks will occur due restart
+--source include/not_valgrind.inc
+# Test restart the server and "shutdown_server" looks for pid file
+# which is not there with embedded mode
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+# Save innodb variables
+let $innodb_file_format_orig=`select @@innodb_file_format`;
+let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
+let $innodb_large_prefix_orig=`select @@innodb_large_prefix`;
+
+# Set Innodb file format as feature works for Barracuda file format
+set global innodb_file_format="Barracuda";
+set global innodb_file_per_table=1;
+set global innodb_large_prefix=1;
+
+-- disable_warnings
+DROP TABLE IF EXISTS worklog5743;
+-- enable_warnings
+
+
+#------------------------------------------------------------------------------
+# Stop the server in between when prefix index are created and see if state is
+# correct when server is restarted.
+# Server is restarted at differnt points.
+
+CREATE TABLE worklog5743 (
+col_1_text TEXT(4000) , col_2_text TEXT(4000) ,
+PRIMARY KEY (col_1_text(3072))
+) ROW_FORMAT=DYNAMIC, engine = innodb;
+INSERT INTO worklog5743 VALUES(REPEAT("a", 3500) , REPEAT("o", 3500));
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
+
+
+--echo "In connection 1"
+--connection con1
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+START TRANSACTION;
+
+
+--echo "In connection default ....restarting the server"
+--connection default
+# Restart the server
+-- source include/restart_mysqld.inc
+SELECT COUNT(*) FROM worklog5743;
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+--disconnect con1
+--disconnect con2
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500));
+DELETE FROM worklog5743 WHERE col_1_text = REPEAT("b", 3500);
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+--echo "In connection default ....restarting the server"
+--connection default
+# Restart the server
+-- source include/restart_mysqld.inc
+SELECT COUNT(*) FROM worklog5743;
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+--disconnect con1
+
+--echo "In connection 1"
+--connect (con2,localhost,root,,)
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+START TRANSACTION;
+UPDATE worklog5743 SET col_1_text = REPEAT("b", 3500) WHERE col_1_text = REPEAT("a", 3500);
+SELECT col_1_text = REPEAT("b", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+--echo "In connection default ....restarting the server"
+--connection default
+# Restart the server
+-- source include/restart_mysqld.inc
+SELECT COUNT(*) FROM worklog5743;
+SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
+worklog5743;
+
+DROP TABLE worklog5743;
+
+
+#------------------------------------------------------------------------------
+
+eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
+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_large_prefix=$innodb_large_prefix_orig;
+
=== modified file 'mysql-test/suite/innodb/t/innodb_stats.test'
--- a/mysql-test/suite/innodb/t/innodb_stats.test 2011-05-30 13:56:01 +0000
+++ b/mysql-test/suite/innodb/t/innodb_stats.test 2011-06-15 08:02:11 +0000
@@ -3,7 +3,6 @@
#
-- source include/have_innodb.inc
--- source suite/innodb/include/innodb_stats_bootstrap.inc
-- disable_warnings
-- disable_query_log
@@ -62,6 +61,3 @@ CREATE TABLE test_innodb_stats (
-- disable_query_log
DROP TABLE test_innodb_stats;
-
-DROP TABLE mysql.innodb_index_stats;
-DROP TABLE mysql.innodb_table_stats;
=== modified file 'mysql-test/suite/innodb/t/innodb_stats_drop_locked.test'
--- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test 2011-05-30 13:56:01 +0000
+++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test 2011-06-15 08:02:11 +0000
@@ -4,7 +4,6 @@
#
-- source include/have_innodb.inc
--- source suite/innodb/include/innodb_stats_bootstrap.inc
-- disable_warnings
-- disable_query_log
@@ -57,7 +56,3 @@ WHERE table_name='innodb_stats_drop_lock
SELECT table_name FROM mysql.innodb_index_stats
WHERE table_name='innodb_stats_drop_locked';
-
--- disable_query_log
-DROP TABLE mysql.innodb_index_stats;
-DROP TABLE mysql.innodb_table_stats;
=== modified file 'mysql-test/suite/perfschema/include/cleanup_helper.inc'
--- a/mysql-test/suite/perfschema/include/cleanup_helper.inc 2010-11-08 19:35:17 +0000
+++ b/mysql-test/suite/perfschema/include/cleanup_helper.inc 2011-06-16 20:45:54 +0000
@@ -1,25 +1,33 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, 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 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
+# 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
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
# Tests for PERFORMANCE_SCHEMA
update performance_schema.setup_instruments set enabled='YES';
+connection con1;
disconnect con1;
+--source include/wait_until_disconnected.inc
+connection con2;
disconnect con2;
+--source include/wait_until_disconnected.inc
+connection con3;
disconnect con3;
+--source include/wait_until_disconnected.inc
connection default;
=== modified file 'mysql-test/suite/perfschema/include/upgrade_check.inc'
--- a/mysql-test/suite/perfschema/include/upgrade_check.inc 2010-09-13 23:19:39 +0000
+++ b/mysql-test/suite/perfschema/include/upgrade_check.inc 2011-06-16 20:35:01 +0000
@@ -17,8 +17,10 @@
# $out_file and $err_file must be set within pfs_upgrade.test.
#
+--source include/count_sessions.inc
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --force > $out_file 2> $err_file
+--source include/wait_until_count_sessions.inc
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $err_file
=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result 2011-05-25 14:04:29 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result 2011-06-18 20:34:45 +0000
@@ -8,43 +8,43 @@ use performance_schema;
show tables like "user_table";
Tables_in_performance_schema (user_table)
user_table
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 225: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 255: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 284: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 293: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 307: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 317: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 327: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 336: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 344: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 353: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 363: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 371: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 416: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 460: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 539: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 559: Table 'threads' already exists
-ERROR 1050 (42S01) at line 574: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 589: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 604: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 617: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 629: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 715: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 758: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 790: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 821: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1241: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 96: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 120: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 144: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 181: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 194: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 206: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 251: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 281: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 310: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 319: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 333: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 343: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 353: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 362: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 370: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 379: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 389: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 397: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 442: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 486: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 585: Table 'threads' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 615: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 630: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 655: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 698: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 741: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 784: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 816: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1267: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
@@ -57,43 +57,43 @@ use performance_schema;
show tables like "user_view";
Tables_in_performance_schema (user_view)
user_view
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 225: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 255: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 284: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 293: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 307: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 317: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 327: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 336: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 344: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 353: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 363: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 371: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 416: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 460: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 539: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 559: Table 'threads' already exists
-ERROR 1050 (42S01) at line 574: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 589: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 604: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 617: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 629: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 715: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 758: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 790: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 821: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1241: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 96: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 120: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 144: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 181: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 194: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 206: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 251: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 281: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 310: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 319: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 333: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 343: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 353: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 362: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 370: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 379: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 389: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 397: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 442: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 486: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 585: Table 'threads' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 615: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 630: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 655: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 698: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 741: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 784: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 816: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1267: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
@@ -104,43 +104,43 @@ drop view test.user_view;
create procedure test.user_proc()
select "Not supposed to be here";
update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 225: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 255: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 284: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 293: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 307: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 317: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 327: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 336: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 344: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 353: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 363: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 371: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 416: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 460: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 539: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 559: Table 'threads' already exists
-ERROR 1050 (42S01) at line 574: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 589: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 604: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 617: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 629: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 715: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 758: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 790: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 821: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1241: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 96: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 120: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 144: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 181: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 194: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 206: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 251: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 281: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 310: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 319: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 333: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 343: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 353: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 362: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 370: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 379: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 389: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 397: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 442: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 486: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 585: Table 'threads' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 615: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 630: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 655: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 698: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 741: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 784: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 816: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1267: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -151,43 +151,43 @@ drop procedure test.user_proc;
create function test.user_func() returns integer
return 0;
update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 225: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 255: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 284: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 293: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 307: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 317: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 327: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 336: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 344: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 353: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 363: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 371: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 416: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 460: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 539: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 559: Table 'threads' already exists
-ERROR 1050 (42S01) at line 574: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 589: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 604: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 617: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 629: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 715: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 758: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 790: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 821: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1241: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 96: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 120: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 144: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 181: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 194: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 206: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 251: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 281: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 310: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 319: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 333: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 343: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 353: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 362: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 370: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 379: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 389: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 397: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 442: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 486: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 585: Table 'threads' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 615: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 630: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 655: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 698: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 741: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 784: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 816: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1267: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -198,43 +198,43 @@ drop function test.user_func;
create event test.user_event on schedule every 1 day do
select "not supposed to be here";
update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 225: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 255: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 284: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 293: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 307: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 317: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 327: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 336: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 344: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 353: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 363: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 371: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 416: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 460: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 539: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 559: Table 'threads' already exists
-ERROR 1050 (42S01) at line 574: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 589: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 604: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 617: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 629: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 715: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 758: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 790: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 821: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1241: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 96: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 120: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 144: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 181: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 194: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 206: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 251: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 281: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 310: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 319: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 333: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 343: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 353: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 362: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 370: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 379: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 389: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 397: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 442: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 486: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 585: Table 'threads' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 615: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 630: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 655: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 698: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 741: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 784: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 816: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1267: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result 2011-05-25 14:04:29 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result 2011-06-18 20:34:45 +0000
@@ -47,7 +47,7 @@ show create table cond_instances;
Table Create Table
cond_instances CREATE TABLE `cond_instances` (
`NAME` varchar(128) NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table events_stages_current;
Table Create Table
@@ -125,7 +125,7 @@ events_statements_current CREATE TABLE `
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
`OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
`OBJECT_NAME` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned DEFAULT NULL,
`MYSQL_ERRNO` int(11) DEFAULT NULL,
`RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
`MESSAGE_TEXT` varchar(128) DEFAULT NULL,
@@ -166,7 +166,7 @@ events_statements_history CREATE TABLE `
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
`OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
`OBJECT_NAME` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned DEFAULT NULL,
`MYSQL_ERRNO` int(11) DEFAULT NULL,
`RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
`MESSAGE_TEXT` varchar(128) DEFAULT NULL,
@@ -207,7 +207,7 @@ events_statements_history_long CREATE TA
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
`OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
`OBJECT_NAME` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned DEFAULT NULL,
`MYSQL_ERRNO` int(11) DEFAULT NULL,
`RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
`MESSAGE_TEXT` varchar(128) DEFAULT NULL,
@@ -306,11 +306,11 @@ events_waits_current CREATE TABLE `event
`OBJECT_NAME` varchar(512) DEFAULT NULL,
`INDEX_NAME` varchar(64) DEFAULT NULL,
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
`NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
`OPERATION` varchar(32) NOT NULL,
- `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+ `NUMBER_OF_BYTES` bigint(20) DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table events_waits_history;
@@ -328,11 +328,11 @@ events_waits_history CREATE TABLE `event
`OBJECT_NAME` varchar(512) DEFAULT NULL,
`INDEX_NAME` varchar(64) DEFAULT NULL,
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
`NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
`OPERATION` varchar(32) NOT NULL,
- `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+ `NUMBER_OF_BYTES` bigint(20) DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table events_waits_history_long;
@@ -350,18 +350,18 @@ events_waits_history_long CREATE TABLE `
`OBJECT_NAME` varchar(512) DEFAULT NULL,
`INDEX_NAME` varchar(64) DEFAULT NULL,
`OBJECT_TYPE` varchar(64) DEFAULT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
`NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
`OPERATION` varchar(32) NOT NULL,
- `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+ `NUMBER_OF_BYTES` bigint(20) DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table events_waits_summary_by_instance;
Table Create Table
events_waits_summary_by_instance CREATE TABLE `events_waits_summary_by_instance` (
`EVENT_NAME` varchar(128) NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -402,8 +402,8 @@ file_summary_by_event_name CREATE TABLE
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_READ` bigint(20) unsigned NOT NULL,
`COUNT_WRITE` bigint(20) unsigned NOT NULL,
- `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
- `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+ `SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL,
+ `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table file_summary_by_instance;
Table Create Table
@@ -412,14 +412,14 @@ file_summary_by_instance CREATE TABLE `f
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_READ` bigint(20) unsigned NOT NULL,
`COUNT_WRITE` bigint(20) unsigned NOT NULL,
- `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
- `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+ `SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL,
+ `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table mutex_instances;
Table Create Table
mutex_instances CREATE TABLE `mutex_instances` (
`NAME` varchar(128) NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table objects_summary_global_by_type;
@@ -446,7 +446,7 @@ show create table rwlock_instances;
Table Create Table
rwlock_instances CREATE TABLE `rwlock_instances` (
`NAME` varchar(128) NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
`WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
`READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
=== modified file 'mysql-test/suite/perfschema/r/selects.result'
--- a/mysql-test/suite/perfschema/r/selects.result 2010-11-09 08:16:50 +0000
+++ b/mysql-test/suite/perfschema/r/selects.result 2011-06-16 20:45:54 +0000
@@ -64,6 +64,7 @@ SELECT EVENT_ID FROM performance_schema.
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
+ON COMPLETION PRESERVE
DO INSERT INTO t_event
SELECT DISTINCT EVENT_ID
FROM performance_schema.events_waits_current
@@ -108,6 +109,7 @@ EVENT_ID
[EVENT_ID]
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
+DROP EVENT t_ps_event;
DROP TABLE t1;
DROP TABLE t_event;
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
=== added file 'mysql-test/suite/perfschema/r/table_schema.result'
--- a/mysql-test/suite/perfschema/r/table_schema.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/table_schema.result 2011-06-13 16:28:34 +0000
@@ -0,0 +1,518 @@
+select * from information_schema.columns where table_schema="performance_schema"
+ order by table_name, ordinal_position;
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+def performance_schema cond_instances NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema cond_instances OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_stages_current EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_stages_current SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_stages_current TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current NESTING_EVENT_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_current NESTING_EVENT_TYPE 9 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_stages_history THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_stages_history EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_stages_history SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_stages_history TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history NESTING_EVENT_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history NESTING_EVENT_TYPE 9 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_stages_history_long THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_stages_history_long EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history_long EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_stages_history_long SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_stages_history_long TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history_long TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history_long TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history_long NESTING_EVENT_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_history_long NESTING_EVENT_TYPE 9 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name EVENT_NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name COUNT_STAR 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name SUM_TIMER_WAIT 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name MIN_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name AVG_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_stages_summary_global_by_event_name MAX_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_current EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_current SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_current TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current LOCK_TIME 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SQL_TEXT 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select,insert,update,references
+def performance_schema events_statements_current CURRENT_SCHEMA 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_current OBJECT_TYPE 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_current OBJECT_SCHEMA 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_current OBJECT_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_current OBJECT_INSTANCE_BEGIN 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current MYSQL_ERRNO 15 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_current RETURNED_SQLSTATE 16 NULL YES varchar 5 15 NULL NULL utf8 utf8_general_ci varchar(5) select,insert,update,references
+def performance_schema events_statements_current MESSAGE_TEXT 17 NULL YES varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_current ERRORS 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current WARNINGS 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current ROWS_AFFECTED 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current ROWS_SENT 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current ROWS_EXAMINED 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current CREATED_TMP_DISK_TABLES 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current CREATED_TMP_TABLES 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SELECT_FULL_JOIN 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SELECT_FULL_RANGE_JOIN 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SELECT_RANGE 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SELECT_RANGE_CHECK 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SELECT_SCAN 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SORT_MERGE_PASSES 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SORT_RANGE 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SORT_ROWS 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current SORT_SCAN 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current NO_INDEX_USED 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current NO_GOOD_INDEX_USED 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current NESTING_EVENT_ID 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_current NESTING_EVENT_TYPE 37 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_statements_history THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_history EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_history SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history LOCK_TIME 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SQL_TEXT 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select,insert,update,references
+def performance_schema events_statements_history CURRENT_SCHEMA 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history OBJECT_TYPE 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history OBJECT_SCHEMA 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history OBJECT_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history OBJECT_INSTANCE_BEGIN 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history MYSQL_ERRNO 15 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_history RETURNED_SQLSTATE 16 NULL YES varchar 5 15 NULL NULL utf8 utf8_general_ci varchar(5) select,insert,update,references
+def performance_schema events_statements_history MESSAGE_TEXT 17 NULL YES varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_history ERRORS 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history WARNINGS 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history ROWS_AFFECTED 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history ROWS_SENT 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history ROWS_EXAMINED 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history CREATED_TMP_DISK_TABLES 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history CREATED_TMP_TABLES 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SELECT_FULL_JOIN 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SELECT_FULL_RANGE_JOIN 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SELECT_RANGE 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SELECT_RANGE_CHECK 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SELECT_SCAN 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SORT_MERGE_PASSES 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SORT_RANGE 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SORT_ROWS 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history SORT_SCAN 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history NO_INDEX_USED 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history NO_GOOD_INDEX_USED 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history NESTING_EVENT_ID 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history NESTING_EVENT_TYPE 37 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_statements_history_long THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_history_long EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_history_long SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history_long TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long LOCK_TIME 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SQL_TEXT 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select,insert,update,references
+def performance_schema events_statements_history_long CURRENT_SCHEMA 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history_long OBJECT_TYPE 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history_long OBJECT_SCHEMA 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history_long OBJECT_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_statements_history_long OBJECT_INSTANCE_BEGIN 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long MYSQL_ERRNO 15 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_history_long RETURNED_SQLSTATE 16 NULL YES varchar 5 15 NULL NULL utf8 utf8_general_ci varchar(5) select,insert,update,references
+def performance_schema events_statements_history_long MESSAGE_TEXT 17 NULL YES varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_history_long ERRORS 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long WARNINGS 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long ROWS_AFFECTED 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long ROWS_SENT 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long ROWS_EXAMINED 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long CREATED_TMP_DISK_TABLES 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long CREATED_TMP_TABLES 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SELECT_FULL_JOIN 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SELECT_FULL_RANGE_JOIN 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SELECT_RANGE 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SELECT_RANGE_CHECK 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SELECT_SCAN 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SORT_MERGE_PASSES 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SORT_RANGE 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SORT_ROWS 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long SORT_SCAN 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long NO_INDEX_USED 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long NO_GOOD_INDEX_USED 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long NESTING_EVENT_ID 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_history_long NESTING_EVENT_TYPE 37 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_LOCK_TIME 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_ERRORS 9 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_WARNINGS 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_ROWS_AFFECTED 11 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_ROWS_SENT 12 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_ROWS_EXAMINED 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_CREATED_TMP_DISK_TABLES 14 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_CREATED_TMP_TABLES 15 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SELECT_FULL_JOIN 16 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SELECT_FULL_RANGE_JOIN 17 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SELECT_RANGE 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SELECT_RANGE_CHECK 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SELECT_SCAN 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_MERGE_PASSES 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_RANGE 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_ROWS 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_SCAN 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_INDEX_USED 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_GOOD_INDEX_USED 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name EVENT_NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name COUNT_STAR 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_TIMER_WAIT 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name MIN_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name AVG_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name MAX_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_LOCK_TIME 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_ERRORS 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_WARNINGS 9 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_ROWS_AFFECTED 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_ROWS_SENT 11 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_ROWS_EXAMINED 12 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_CREATED_TMP_DISK_TABLES 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_CREATED_TMP_TABLES 14 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SELECT_FULL_JOIN 15 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SELECT_FULL_RANGE_JOIN 16 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SELECT_RANGE 17 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SELECT_RANGE_CHECK 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SELECT_SCAN 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SORT_MERGE_PASSES 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SORT_RANGE 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SORT_ROWS 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_SORT_SCAN 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_NO_INDEX_USED 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_statements_summary_global_by_event_name SUM_NO_GOOD_INDEX_USED 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_waits_current EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_current SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_current TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current SPINS 8 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_current OBJECT_SCHEMA 9 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_current OBJECT_NAME 10 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references
+def performance_schema events_waits_current INDEX_NAME 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_current OBJECT_TYPE 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_current OBJECT_INSTANCE_BEGIN 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current NESTING_EVENT_ID 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_current NESTING_EVENT_TYPE 15 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_waits_current OPERATION 16 NULL NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select,insert,update,references
+def performance_schema events_waits_current NUMBER_OF_BYTES 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema events_waits_current FLAGS 18 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_history THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_waits_history EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_history SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history SPINS 8 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_history OBJECT_SCHEMA 9 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history OBJECT_NAME 10 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references
+def performance_schema events_waits_history INDEX_NAME 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history OBJECT_TYPE 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history OBJECT_INSTANCE_BEGIN 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history NESTING_EVENT_ID 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history NESTING_EVENT_TYPE 15 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_waits_history OPERATION 16 NULL NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select,insert,update,references
+def performance_schema events_waits_history NUMBER_OF_BYTES 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema events_waits_history FLAGS 18 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_history_long THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_waits_history_long EVENT_ID 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_history_long SOURCE 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history_long TIMER_START 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long TIMER_END 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long TIMER_WAIT 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long SPINS 8 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_history_long OBJECT_SCHEMA 9 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history_long OBJECT_NAME 10 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references
+def performance_schema events_waits_history_long INDEX_NAME 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history_long OBJECT_TYPE 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema events_waits_history_long OBJECT_INSTANCE_BEGIN 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long NESTING_EVENT_ID 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_history_long NESTING_EVENT_TYPE 15 NULL YES enum 9 27 NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references
+def performance_schema events_waits_history_long OPERATION 16 NULL NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select,insert,update,references
+def performance_schema events_waits_history_long NUMBER_OF_BYTES 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema events_waits_history_long FLAGS 18 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance EVENT_NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_summary_by_instance OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_instance MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name EVENT_NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name COUNT_STAR 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name SUM_TIMER_WAIT 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name MIN_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name AVG_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema events_waits_summary_global_by_event_name MAX_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema file_instances FILE_NAME 1 NULL NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references
+def performance_schema file_instances EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema file_instances OPEN_COUNT 3 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema file_summary_by_event_name EVENT_NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema file_summary_by_event_name COUNT_READ 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema file_summary_by_event_name COUNT_WRITE 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema file_summary_by_event_name SUM_NUMBER_OF_BYTES_READ 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema file_summary_by_event_name SUM_NUMBER_OF_BYTES_WRITE 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema file_summary_by_instance FILE_NAME 1 NULL NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references
+def performance_schema file_summary_by_instance EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema file_summary_by_instance COUNT_READ 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema file_summary_by_instance COUNT_WRITE 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema file_summary_by_instance SUM_NUMBER_OF_BYTES_READ 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema file_summary_by_instance SUM_NUMBER_OF_BYTES_WRITE 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema mutex_instances NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema mutex_instances OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema mutex_instances LOCKED_BY_THREAD_ID 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema objects_summary_global_by_type OBJECT_TYPE 1 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema objects_summary_global_by_type OBJECT_SCHEMA 2 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema objects_summary_global_by_type OBJECT_NAME 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema objects_summary_global_by_type COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema objects_summary_global_by_type SUM_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema objects_summary_global_by_type MIN_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema objects_summary_global_by_type AVG_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema objects_summary_global_by_type MAX_TIMER_WAIT 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema performance_timers TIMER_NAME 1 NULL NO enum 11 33 NULL NULL utf8 utf8_general_ci enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') select,insert,update,references
+def performance_schema performance_timers TIMER_FREQUENCY 2 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema performance_timers TIMER_RESOLUTION 3 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema performance_timers TIMER_OVERHEAD 4 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema rwlock_instances NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema rwlock_instances OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema rwlock_instances WRITE_LOCKED_BY_THREAD_ID 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema rwlock_instances READ_LOCKED_BY_COUNT 4 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references
+def performance_schema setup_actors HOST 1 % NO char 60 180 NULL NULL utf8 utf8_bin char(60) select,insert,update,references
+def performance_schema setup_actors USER 2 % NO char 16 48 NULL NULL utf8 utf8_bin char(16) select,insert,update,references
+def performance_schema setup_actors ROLE 3 % NO char 16 48 NULL NULL utf8 utf8_bin char(16) select,insert,update,references
+def performance_schema setup_consumers NAME 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema setup_consumers ENABLED 2 NULL NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references
+def performance_schema setup_instruments NAME 1 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema setup_instruments ENABLED 2 NULL NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references
+def performance_schema setup_instruments TIMED 3 NULL NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references
+def performance_schema setup_objects OBJECT_TYPE 1 TABLE NO enum 5 15 NULL NULL utf8 utf8_general_ci enum('TABLE') select,insert,update,references
+def performance_schema setup_objects OBJECT_SCHEMA 2 % YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema setup_objects OBJECT_NAME 3 % NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema setup_objects TIMED 4 YES NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references
+def performance_schema setup_timers NAME 1 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema setup_timers TIMER_NAME 2 NULL NO enum 11 33 NULL NULL utf8 utf8_general_ci enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage OBJECT_TYPE 1 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage OBJECT_SCHEMA 2 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage OBJECT_NAME 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage INDEX_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_STAR 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_WAIT 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_WAIT 9 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_READ 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_READ 11 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_READ 12 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_READ 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_READ 14 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_WRITE 15 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_WRITE 16 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_WRITE 17 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_WRITE 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_WRITE 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_FETCH 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_FETCH 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_FETCH 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_FETCH 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_FETCH 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_INSERT 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_INSERT 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_INSERT 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_INSERT 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_INSERT 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_UPDATE 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_UPDATE 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_UPDATE 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_UPDATE 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_UPDATE 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage COUNT_DELETE 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage SUM_TIMER_DELETE 36 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MIN_TIMER_DELETE 37 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage AVG_TIMER_DELETE 38 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_index_usage MAX_TIMER_DELETE 39 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table OBJECT_TYPE 1 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_table OBJECT_SCHEMA 2 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_table OBJECT_NAME 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_WAIT 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_READ 9 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_READ 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_READ 11 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_READ 12 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_READ 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_WRITE 14 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_WRITE 15 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_WRITE 16 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_WRITE 17 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_WRITE 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_FETCH 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_FETCH 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_FETCH 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_FETCH 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_FETCH 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_INSERT 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_INSERT 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_INSERT 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_INSERT 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_INSERT 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_UPDATE 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_UPDATE 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_UPDATE 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_UPDATE 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_UPDATE 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table COUNT_DELETE 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table SUM_TIMER_DELETE 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MIN_TIMER_DELETE 36 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table AVG_TIMER_DELETE 37 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_io_waits_summary_by_table MAX_TIMER_DELETE 38 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table OBJECT_TYPE 1 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table OBJECT_SCHEMA 2 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table OBJECT_NAME 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WAIT 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ 9 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ 11 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ 12 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ 13 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE 14 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE 15 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE 16 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE 17 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE 18 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ_NORMAL 19 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ_NORMAL 20 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ_NORMAL 21 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ_NORMAL 22 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ_NORMAL 23 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ_WITH_SHARED_LOCKS 24 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ_WITH_SHARED_LOCKS 25 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ_WITH_SHARED_LOCKS 26 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ_WITH_SHARED_LOCKS 27 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ_WITH_SHARED_LOCKS 28 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ_HIGH_PRIORITY 29 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ_HIGH_PRIORITY 30 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ_HIGH_PRIORITY 31 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ_HIGH_PRIORITY 32 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ_HIGH_PRIORITY 33 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ_NO_INSERT 34 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ_NO_INSERT 35 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ_NO_INSERT 36 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ_NO_INSERT 37 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ_NO_INSERT 38 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_READ_EXTERNAL 39 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_READ_EXTERNAL 40 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_READ_EXTERNAL 41 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_READ_EXTERNAL 42 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_READ_EXTERNAL 43 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_ALLOW_WRITE 44 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_ALLOW_WRITE 45 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_ALLOW_WRITE 46 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_ALLOW_WRITE 47 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_ALLOW_WRITE 48 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_CONCURRENT_INSERT 49 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_CONCURRENT_INSERT 50 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_CONCURRENT_INSERT 51 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_CONCURRENT_INSERT 52 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_CONCURRENT_INSERT 53 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_DELAYED 54 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_DELAYED 55 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_DELAYED 56 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_DELAYED 57 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_DELAYED 58 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_LOW_PRIORITY 59 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_LOW_PRIORITY 60 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_LOW_PRIORITY 61 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_LOW_PRIORITY 62 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_LOW_PRIORITY 63 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_NORMAL 64 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_NORMAL 65 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_NORMAL 66 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_NORMAL 67 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_NORMAL 68 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table COUNT_WRITE_EXTERNAL 69 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table SUM_TIMER_WRITE_EXTERNAL 70 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MIN_TIMER_WRITE_EXTERNAL 71 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table AVG_TIMER_WRITE_EXTERNAL 72 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema table_lock_waits_summary_by_table MAX_TIMER_WRITE_EXTERNAL 73 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def performance_schema threads THREAD_ID 1 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema threads NAME 2 NULL NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
+def performance_schema threads TYPE 3 NULL NO varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select,insert,update,references
+def performance_schema threads PROCESSLIST_ID 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema threads PROCESSLIST_USER 5 NULL YES varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references
+def performance_schema threads PROCESSLIST_HOST 6 NULL YES varchar 60 180 NULL NULL utf8 utf8_general_ci varchar(60) select,insert,update,references
+def performance_schema threads PROCESSLIST_DB 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema threads PROCESSLIST_COMMAND 8 NULL YES varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references
+def performance_schema threads PROCESSLIST_TIME 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
+def performance_schema threads PROCESSLIST_STATE 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema threads PROCESSLIST_INFO 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select,insert,update,references
+def performance_schema threads PARENT_THREAD_ID 12 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
+def performance_schema threads ROLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references
+def performance_schema threads INSTRUMENTED 14 NULL NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references
+select count(*) from information_schema.columns
+where table_schema="performance_schema" and data_type = "bigint"
+ and column_name like "%number_of_bytes" into @count_byte_columns;
+select @count_byte_columns > 0;
+@count_byte_columns > 0
+1
+select count(*) from information_schema.columns
+where table_schema="performance_schema" and data_type="bigint"
+ and column_name like "%number_of_bytes"
+ and column_type not like "%unsigned" into @count_byte_signed;
+select (@count_byte_columns - @count_byte_signed) = 0;
+(@count_byte_columns - @count_byte_signed) = 0
+1
+select count(*) from information_schema.columns
+where table_schema="performance_schema" and data_type = "bigint"
+ and column_name like "%object_instance_begin" into @count_object_columns;
+select @count_object_columns > 0;
+@count_object_columns > 0
+1
+select count(*) from information_schema.columns
+where table_schema="performance_schema" and data_type="bigint"
+ and column_name like "%object_instance_begin"
+ and column_type like "%unsigned" into @count_object_unsigned;
+select (@count_object_columns - @count_object_unsigned) = 0;
+(@count_object_columns - @count_object_unsigned) = 0
+1
=== modified file 'mysql-test/suite/perfschema/t/selects.test'
--- a/mysql-test/suite/perfschema/t/selects.test 2010-11-09 08:16:50 +0000
+++ b/mysql-test/suite/perfschema/t/selects.test 2011-06-16 20:45:54 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2011, 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
@@ -103,6 +103,7 @@ SELECT EVENT_ID FROM performance_schema.
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
+ON COMPLETION PRESERVE
DO INSERT INTO t_event
SELECT DISTINCT EVENT_ID
FROM performance_schema.events_waits_current
@@ -174,7 +175,7 @@ delimiter ;|
SELECT t_ps_func(connection_id()) = @p_id;
# We might reach this point too early which means the event scheduler has not
-# execute our "t_ps_event". Therefore we poll till the record was inserted
+# executed our "t_ps_event". Therefore we poll till the record was inserted
# and run our test statement afterwards.
let $wait_timeout= 20;
let $wait_condition= SELECT COUNT(*) = 1 FROM t_event;
@@ -185,6 +186,7 @@ SELECT * FROM t_event;
# Clean up
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
+DROP EVENT t_ps_event;
DROP TABLE t1;
DROP TABLE t_event;
=== added file 'mysql-test/suite/perfschema/t/table_schema.test'
--- a/mysql-test/suite/perfschema/t/table_schema.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/table_schema.test 2011-06-13 16:28:34 +0000
@@ -0,0 +1,72 @@
+# Copyright (c) 2011, 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
+
+# Test to detect changest to the PERFORMANCE_SCHEMA table schemas
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Use the INFORMATION_SCHEMA to examine the tables in the PERFORMANCE_SCHEMA
+# and detect any tables that have changed.
+
+select * from information_schema.columns where table_schema="performance_schema"
+ order by table_name, ordinal_position;
+
+# Bug#11766504 "59631: BIGINT UNSIGNED BYTE RELATED COLUMNS IN PERFORMANCE_SCHEMA"
+
+# Goal: Confirm that all byte related columns are BIGINT signed. This test will
+# not have to be changed to accommodate new or deleted columns.
+
+# Count the number of NUMBER_OF_BYTES columns.
+
+select count(*) from information_schema.columns
+ where table_schema="performance_schema" and data_type = "bigint"
+ and column_name like "%number_of_bytes" into @count_byte_columns;
+
+# Confirm that at least one column was found.
+
+select @count_byte_columns > 0;
+
+# Confirm that all NUMBER_OF_BYTES columns are BIGINT signed.
+
+select count(*) from information_schema.columns
+ where table_schema="performance_schema" and data_type="bigint"
+ and column_name like "%number_of_bytes"
+ and column_type not like "%unsigned" into @count_byte_signed;
+
+select (@count_byte_columns - @count_byte_signed) = 0;
+
+# Similar test for OBJECT_INSTANCE_BEGIN values, which are typically derived
+# from a memory address and must therefore be unsigned.
+#
+# Count the number of OBJECT_INSTANCE_BEGIN columns.
+
+select count(*) from information_schema.columns
+ where table_schema="performance_schema" and data_type = "bigint"
+ and column_name like "%object_instance_begin" into @count_object_columns;
+
+# Confirm that at least one column was found.
+
+select @count_object_columns > 0;
+
+# Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned.
+
+select count(*) from information_schema.columns
+ where table_schema="performance_schema" and data_type="bigint"
+ and column_name like "%object_instance_begin"
+ and column_type like "%unsigned" into @count_object_unsigned;
+
+select (@count_object_columns - @count_object_unsigned) = 0;
+
=== modified file 'mysql-test/suite/rpl/r/rpl_auto_increment.result'
--- a/mysql-test/suite/rpl/r/rpl_auto_increment.result 2010-12-21 04:47:22 +0000
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result 2011-05-02 13:52:51 +0000
@@ -320,4 +320,14 @@ SELECT * FROM t1;
id data
0 2
DROP TABLE t1;
+create table t1(a int auto_increment primary key) engine=innodb;
+insert into t1 values (null),(null),(1025),(null);
+select * from t1;
+a
+1
+2
+1025
+1026
+include/diff_tables.inc [master:t1, slave:t1]
+drop table t1;
include/rpl_end.inc
=== modified file 'mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result 2010-04-29 17:43:10 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result 2011-06-02 07:05:42 +0000
@@ -1,19 +1,19 @@
SET @global_start_value = @@global.innodb_purge_batch_size;
SELECT @global_start_value;
@global_start_value
-20
+300
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_purge_batch_size = 1;
SET @@global.innodb_purge_batch_size = DEFAULT;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
-20
+300
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_purge_batch_size = 1;
ERROR HY000: Variable 'innodb_purge_batch_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_purge_batch_size;
@@innodb_purge_batch_size
-20
+300
SELECT local.innodb_purge_batch_size;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_purge_batch_size = 1;
@@ -95,4 +95,4 @@ SELECT @@global.innodb_purge_batch_size;
SET @@global.innodb_purge_batch_size = @global_start_value;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
-20
+300
=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test 2011-05-04 07:51:15 +0000
+++ b/mysql-test/t/alter_table.test 2011-06-16 23:45:58 +0000
@@ -1073,6 +1073,33 @@ ALTER TABLE t1 DROP COLUMN a, ADD COLUMN
DROP TABLE t1;
+--echo #
+--echo # Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
+--echo # FIRST CAN CAUSE DATA TO BE CORRUPTED".
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+--echo # Use MyISAM engine as the fact that InnoDB doesn't support
+--echo # in-place ALTER TABLE in cases when columns are being renamed
+--echo # hides some bugs.
+create table t1 (i int, j int) engine=myisam;
+insert into t1 value (1, 2);
+--echo # First, test for original problem described in the bug report.
+select * from t1;
+--echo # Change of column order by the below ALTER TABLE statement should
+--echo # affect both column names and column contents.
+alter table t1 modify column j int first;
+select * from t1;
+--echo # Now test for similar problem with the same root.
+--echo # The below ALTER TABLE should change not only the name but
+--echo # also the value for the last column of the table.
+alter table t1 drop column i, add column k int default 0;
+select * from t1;
+--echo # Clean-up.
+drop table t1;
+
+
--echo End of 5.1 tests
#
=== added file 'mysql-test/t/archive_debug.test'
--- a/mysql-test/t/archive_debug.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/archive_debug.test 2011-05-18 10:01:43 +0000
@@ -0,0 +1,13 @@
+--source include/have_archive.inc
+--source include/have_debug.inc
+
+--echo #
+--echo # BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
+--echo # WITH PARTITIONED ARCHIVE TABLES
+--echo #
+CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES(1);
+SET SESSION debug='d,simulate_archive_open_failure';
+CHECK TABLE t1;
+SET SESSION debug=DEFAULT;
+DROP TABLE t1;
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2011-05-25 14:10:40 +0000
+++ b/mysql-test/t/disabled.def 2011-06-16 13:56:45 +0000
@@ -15,4 +15,4 @@ sum_distinct-big : Bug#11764126
alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested
create-big : Bug#11748731 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
-main.query_cache_28249 : Bug#12584161 2009-03-25 main.query_cache_28249 fails sporadically
+log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
=== modified file 'mysql-test/t/events_bugs.test'
--- a/mysql-test/t/events_bugs.test 2011-05-27 11:42:28 +0000
+++ b/mysql-test/t/events_bugs.test 2011-06-09 18:08:38 +0000
@@ -1286,6 +1286,23 @@ DROP EVENT IF EXISTS event_Bug12546938;
DROP TABLE table_bug12546938;
SET GLOBAL EVENT_SCHEDULER = OFF;
+#
+# Bug#11764334 - 57156: ALTER EVENT CHANGES THE EVENT STATUS
+#
+--disable_warnings
+DROP DATABASE IF EXISTS event_test11764334;
+--enable_warnings
+CREATE DATABASE event_test11764334;
+USE event_test11764334;
+CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
+--replace_column 9 # 10 #
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
+--replace_column 9 # 10 #
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+DROP EVENT ev1;
+DROP DATABASE event_test11764334;
+USE test;
###########################################################################
#
# End of tests
=== modified file 'mysql-test/t/flush.test'
--- a/mysql-test/t/flush.test 2011-03-07 09:08:10 +0000
+++ b/mysql-test/t/flush.test 2011-06-16 15:18:16 +0000
@@ -668,3 +668,36 @@ ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
+
+
+--echo #
+--echo # Test for bug #12641342 - "61401: UPDATE PERFORMANCE DEGRADES
+--echo # GRADUALLY IF A TRIGGER EXISTS".
+--echo #
+--echo # One of side-effects of this bug was that a transaction which
+--echo # involved DML statements requiring prelocking blocked concurrent
+--echo # FLUSH TABLES WITH READ LOCK for the whole its duration, while
+--echo # correct behavior in this case is to block FTWRL only for duration
+--echo # of individual DML statements.
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT);
+INSERT INTO t1 VALUES (1, 1);
+CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW SET @var = "a";
+BEGIN;
+UPDATE t1 SET value= value + 1 WHERE id = 1;
+
+--echo # Switching to connection 'con1'.
+connect(con1, localhost, root);
+--echo # The below FLUSH TABLES WITH READ LOCK should succeed and
+--echo # should not be blocked by the transaction in default connection.
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Switching to connection 'default'.
+connection default;
+COMMIT;
+DROP TABLE t1;
=== modified file 'mysql-test/t/gis-precise.test'
--- a/mysql-test/t/gis-precise.test 2011-01-14 21:08:28 +0000
+++ b/mysql-test/t/gis-precise.test 2011-06-08 17:24:16 +0000
@@ -108,3 +108,28 @@ select st_touches(geomfromtext('polygon(
SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result;
SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result;
SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
+
+
+--echo #
+--echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD
+--echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
+--echo #
+
+SELECT ASTEXT(ST_UNION(GEOMFROMTEXT('POLYGON((525000 183300,525400
+183300,525400 18370, 525000 183700,525000 183300))'),
+geomfromtext('POLYGON((525298.67 183511.53,525296.57
+183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
+183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
+183500.84,525276.79 183500,525260.7 183491.55,525263.95
+183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
+183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
+183499.1,525282.2 183499.3,525283.55 183500,525301.75
+183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
+183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
+183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
+183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
+183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
+183491.55))'))) st_u;
+
+SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
+SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t;
=== modified file 'mysql-test/t/gis-rtree.test'
--- a/mysql-test/t/gis-rtree.test 2010-03-25 11:49:01 +0000
+++ b/mysql-test/t/gis-rtree.test 2011-06-07 15:30:43 +0000
@@ -928,3 +928,31 @@ DROP TABLE t1;
--echo End of 5.0 tests.
+
+
+--echo #
+--echo # Bug #57323/11764487: myisam corruption with insert ignore
+--echo # and invalid spatial data
+--echo #
+
+CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
+ SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
+SELECT ASTEXT(a), ASTEXT(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
+ KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+INSERT IGNORE INTO t1 SET a=1, b=NULL;
+SELECT a, ASTEXT(b) FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test 2011-02-18 10:59:18 +0000
+++ b/mysql-test/t/group_by.test 2011-06-10 09:52:57 +0000
@@ -1359,3 +1359,26 @@ DROP TABLE t1;
DROP TABLE where_subselect;
--echo # End of Bug #58782
+
+--echo #
+--echo # Bug #11766429
+--echo # RE-EXECUTE OF PREPARED STATEMENT CRASHES IN ITEM_REF::FIX_FIELDS WITH
+--echo #
+
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (0);
+CREATE TABLE t2(b INT, KEY(b));
+INSERT INTO t2 VALUES (0),(0);
+
+PREPARE stmt FROM '
+SELECT 1 FROM t2
+LEFT JOIN t1 ON NULL
+GROUP BY t2.b, t1.a
+HAVING a <> 2';
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+
+--echo # End of Bug #11766429
=== modified file 'mysql-test/t/multi_update.test'
--- a/mysql-test/t/multi_update.test 2011-03-08 19:14:42 +0000
+++ b/mysql-test/t/multi_update.test 2011-06-16 06:30:16 +0000
@@ -703,4 +703,50 @@ UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.
SELECT * FROM t1;
DROP TABLE t1;
---echo end of tests
+--echo #
+--echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+--echo # UPDATED TWICE
+--echo #
+
+# Results differ between storage engines. This test is to verify that
+# the bugfix did NOT change behavior for MyISAM.
+# See multi_update_innodb.test for the InnoDB variant of this test
+CREATE TABLE t1 (
+ col_int_key int,
+ pk int,
+ col_int int,
+ key(col_int_key),
+ primary key (pk)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,2,3);
+
+--echo
+CREATE TABLE t2 (
+ col_int_key int,
+ pk_1 int,
+ pk_2 int,
+ col_int int,
+ key(col_int_key),
+ primary key (pk_1,pk_2)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+--echo
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+
+--echo
+SELECT * FROM t1;
+
+--echo
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+--echo
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+
+--echo
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+
+
+
+
=== modified file 'mysql-test/t/multi_update_innodb.test'
--- a/mysql-test/t/multi_update_innodb.test 2011-02-21 15:31:41 +0000
+++ b/mysql-test/t/multi_update_innodb.test 2011-06-16 06:30:16 +0000
@@ -31,3 +31,47 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+--echo # UPDATED TWICE
+--echo #
+
+# Results differ between storage engines.
+# See multi_update.test for the MyISAM variant of this test
+CREATE TABLE t1 (
+ col_int_key int,
+ pk int,
+ col_int int,
+ key(col_int_key),
+ primary key (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2,3);
+
+--echo
+CREATE TABLE t2 (
+ col_int_key int,
+ pk_1 int,
+ pk_2 int,
+ col_int int,
+ key(col_int_key),
+ primary key (pk_1,pk_2)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+--echo
+--error ER_MULTI_UPDATE_KEY_CONFLICT
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+--echo
+SELECT * FROM t1;
+
+--echo
+--error ER_MULTI_UPDATE_KEY_CONFLICT
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+--echo
+--error ER_MULTI_UPDATE_KEY_CONFLICT
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+
+--echo
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
=== added file 'mysql-test/t/mysql_embedded.test'
--- a/mysql-test/t/mysql_embedded.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_embedded.test 2011-06-16 13:55:11 +0000
@@ -0,0 +1,12 @@
+--echo #
+--echo # Bug#12561297 : LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
+--echo #
+
+--source include/is_embedded.inc
+
+# Test case require mysql_embedded to be present
+if(!$MYSQL_EMBEDDED)
+{
+ --skip Test requires mysql_embedded executable
+}
+--exec $MYSQL_EMBEDDED -e 'select 1'
=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test 2011-03-11 09:58:45 +0000
+++ b/mysql-test/t/partition.test 2011-06-13 10:55:58 +0000
@@ -15,6 +15,37 @@ drop table if exists t1, t2;
--enable_warnings
--echo #
+--echo # Bug#11765667: bug#58655: ASSERTION FAILED,
+--echo # SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
+--echo #
+CREATE TABLE t1 (
+ id MEDIUMINT NOT NULL AUTO_INCREMENT,
+ dt DATE, st VARCHAR(255), uid INT,
+ id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+ ('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
+ ('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
+ ('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
+ ('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
+ ('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
+ ('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
+ ('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
+ ('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
+ ('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
+ ('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
+ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
+ PARTITION d1 VALUES IN (1991, 1994),
+ PARTITION d2 VALUES IN (1993),
+ PARTITION d3 VALUES IN (1992, 1995, 1996)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+ ('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
+UPDATE t1 SET filler='Updating the row' WHERE uid=298;
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug#59297: Can't find record in 'tablename' on update inner join
--echo #
CREATE TABLE t1 (
@@ -205,10 +236,16 @@ INSERT INTO t1 VALUES ('2009-07-14 17:35
INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
SELECT * FROM t1;
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
PARTITION p3 VALUES LESS THAN (1247688000),
PARTITION pmax VALUES LESS THAN MAXVALUE);
SELECT * FROM t1;
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
SHOW CREATE TABLE t1;
DROP TABLE t1;
=== modified file 'mysql-test/t/partition_datatype.test'
--- a/mysql-test/t/partition_datatype.test 2009-10-28 00:11:17 +0000
+++ b/mysql-test/t/partition_datatype.test 2011-06-13 09:57:47 +0000
@@ -7,6 +7,7 @@
# BUG#48164 limited size to 3072 bytes
#
-- source include/have_partition.inc
+-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
@@ -233,3 +234,312 @@ show create table t1;
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
drop table t1;
+
+--echo #
+--echo # Bug#28928: UNIX_TIMESTAMP() should be considered unary monotonic
+--echo # by partition pruning
+SET @old_time_zone= @@session.time_zone;
+SET @@session.time_zone = 'UTC';
+--echo # Using MyISAM to get stable values on TABLE_ROWS in I_S.PARTITIONS
+CREATE TABLE t1
+(a TIMESTAMP NULL,
+ tz varchar(16))
+ENGINE = MyISAM;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION `p0` VALUES LESS THAN (0),
+ PARTITION `p-2000` VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01')),
+ PARTITION `p-2011-MSK` VALUES LESS THAN (UNIX_TIMESTAMP('2011-03-26 23:00:00')),
+ PARTITION `p-2011-MSD-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 22:00:00')),
+ PARTITION `p-2011-MSD-2` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 23:00:00')),
+ PARTITION `p-2012-MSK-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-30 00:00:00')),
+ PARTITION `p-2012-MSK-2` VALUES LESS THAN (UNIX_TIMESTAMP('2012-03-24 23:00:00')),
+ PARTITION `pEnd` VALUES LESS THAN (UNIX_TIMESTAMP('2038-01-19 03:14:07')),
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE);
+
+
+--echo # Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'UTC');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'UTC');
+--echo # Test invalid values
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
+INSERT INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
+INSERT INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
+--echo # Test start range
+INSERT INTO t1 VALUES ('1970-01-01 00:00:01', 'UTC');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'UTC');
+--echo # Test end range
+INSERT INTO t1 VALUES ('2038-01-19 03:14:06', 'UTC');
+INSERT INTO t1 VALUES ('2038-01-19 03:14:07', 'UTC');
+--echo # Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-26 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 21:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:01', 'UTC');
+
+SET @@session.time_zone = 'Europe/Moscow';
+
+--echo # Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'Moscow');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'Moscow');
+--echo # Test invalid values
+INSERT INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
+INSERT INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
+INSERT INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
+INSERT INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
+--echo # values truncated to 03:00:00 due to daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
+INSERT INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
+INSERT INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
+--echo # Test start range
+INSERT INTO t1 VALUES ('1970-01-01 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'Moscow');
+--echo # Test end range
+INSERT INTO t1 VALUES ('2038-01-19 06:14:06', 'Moscow');
+INSERT INTO t1 VALUES ('2038-01-19 06:14:07', 'Moscow');
+--echo # Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 01:59:59', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 01:59:59', 'Moscow');
+--echo # All values between 02:00 and 02:59:59 will be interpretated as DST
+INSERT INTO t1 VALUES ('2011-10-30 02:00:00', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:00:01', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:59:59', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:01', 'Moscow');
+
+
+SET @@session.time_zone = 'UTC';
+
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+
+SELECT * FROM t1 ORDER BY a, tz;
+SELECT * FROM t2 ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+
+--echo # Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+SELECT * FROM t2 ORDER BY a, tz;
+
+--echo # Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+SELECT * FROM t2 ORDER BY a, tz;
+
+SHOW CREATE TABLE t2;
+TRUNCATE TABLE t2;
+
+SET @@session.time_zone = 'Europe/Moscow';
+
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+
+SELECT * FROM t1 ORDER BY a, tz;
+SELECT * FROM t2 ORDER BY a, tz;
+
+--echo # Testing the leap from 01:59:59 to 03:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+
+
+
+--echo # Testing the leap from 02:59:59 to 02:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+
+
+
+--echo # Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+SELECT * FROM t2 ORDER BY a, tz;
+
+--echo # Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+SELECT * FROM t2 ORDER BY a, tz;
+
+SHOW CREATE TABLE t2;
+TRUNCATE TABLE t2;
+
+DROP TABLE t1, t2;
+SET @@session.time_zone= @old_time_zone;
=== modified file 'mysql-test/t/query_cache_28249.test'
--- a/mysql-test/t/query_cache_28249.test 2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/query_cache_28249.test 2011-06-10 09:40:57 +0000
@@ -30,7 +30,7 @@ connection user1;
SET GLOBAL query_cache_type=1;
SET GLOBAL query_cache_limit=10000;
SET GLOBAL query_cache_min_res_unit=0;
-SET GLOBAL query_cache_size= 100000;
+SET GLOBAL query_cache_size= 102400;
FLUSH TABLES;
--disable_warnings
@@ -58,18 +58,18 @@ connection user3;
# Typical information_schema.processlist content after sufficient sleep time
# ID USER COMMAND TIME STATE INFO
# ....
-# 2 root Query 5 Waiting for table level lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
+# 2 root Query 5 Waiting for table metadata lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
# ....
# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# The values marked with 'X' must be reached.
--echo # Poll till the select of connection user1 is blocked by the write lock on t1.
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
-WHERE state = 'Waiting for table level lock'
+WHERE state = 'Waiting for table metadata lock'
AND info = '$select_for_qc';
--source include/wait_condition.inc
eval
SELECT user,command,state,info FROM information_schema.processlist
-WHERE state = 'Waiting for table level lock'
+WHERE state = 'Waiting for table metadata lock'
AND info = '$select_for_qc';
INSERT INTO t1 VALUES (4);
=== modified file 'mysql-test/t/sp_notembedded.test'
--- a/mysql-test/t/sp_notembedded.test 2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/sp_notembedded.test 2011-06-08 13:44:50 +0000
@@ -371,16 +371,6 @@ DELETE FROM mysql.user WHERE User='mysql
FLUSH PRIVILEGES;
-#
-# Restore global concurrent_insert value. Keep in the end of the test file.
-#
-
-set @@global.concurrent_insert= @old_concurrent_insert;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-
--echo #
--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
--echo #
@@ -449,7 +439,47 @@ DROP FUNCTION f1;
--disconnect con1
--disconnect con2
-
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
+
+--echo #
+--echo # Test for bug#11763757 "56510: ERROR 42000: FUNCTION DOES NOT EXIST
+--echo # IF NOT-PRIV USER RECONNECTS ".
+--echo #
+--echo # The real problem was that server was unable handle properly stored
+--echo # functions in databases which names contained dot.
+--echo #
+
+connection default;
+
+--disable_warnings
+DROP DATABASE IF EXISTS `my.db`;
+--enable_warnings
+
+create database `my.db`;
+use `my.db`;
+
+CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
+
+--echo # Create new connection.
+connect (addcon, localhost, root,,);
+connection addcon;
+USE `my.db`;
+SELECT f1(1);
+SELECT `my.db`.f1(2);
+
+--echo # Switching to default connection.
+connection default;
+disconnect addcon;
+DROP DATABASE `my.db`;
+
+#
+# Restore global concurrent_insert value. Keep in the end of the test file.
+#
+
+set @@global.concurrent_insert= @old_concurrent_insert;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
=== modified file 'mysql-test/t/symlink.test'
--- a/mysql-test/t/symlink.test 2011-01-31 09:34:39 +0000
+++ b/mysql-test/t/symlink.test 2011-06-09 12:54:12 +0000
@@ -277,3 +277,24 @@ SELECT * FROM mysql.user;
--remove_file $MYSQL_TMP_DIR/mysql
--echo End of 5.1 tests
+
+
+--echo #
+--echo # Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
+--echo # STATEMENTS FAIL".
+--echo #
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval create table t1 (a int primary key) engine=myisam
+ data directory="$MYSQLTEST_VARDIR/tmp"
+ index directory="$MYSQLTEST_VARDIR/run";
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show create table t1;
+--echo # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
+--echo # options should not fail. Per documentation newly created table
+--echo # should not inherit value of these options from the original table.
+create table t2 like t1;
+show create table t2;
+drop tables t1, t2;
=== modified file 'mysql-test/t/system_mysql_db_fix40123.test'
--- a/mysql-test/t/system_mysql_db_fix40123.test 2010-12-17 11:28:59 +0000
+++ b/mysql-test/t/system_mysql_db_fix40123.test 2011-06-15 08:02:11 +0000
@@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( T
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info, innodb_index_stats, innodb_table_stats;
-- enable_query_log
=== modified file 'mysql-test/t/system_mysql_db_fix50030.test'
--- a/mysql-test/t/system_mysql_db_fix50030.test 2010-12-17 11:28:59 +0000
+++ b/mysql-test/t/system_mysql_db_fix50030.test 2011-06-15 08:02:11 +0000
@@ -78,7 +78,7 @@ INSERT INTO servers VALUES ('test','loca
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info, innodb_index_stats, innodb_table_stats;
-- enable_query_log
=== modified file 'mysql-test/t/system_mysql_db_fix50117.test'
--- a/mysql-test/t/system_mysql_db_fix50117.test 2010-12-17 11:28:59 +0000
+++ b/mysql-test/t/system_mysql_db_fix50117.test 2011-06-15 08:02:11 +0000
@@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS ndb_binlog_in
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, slave_master_info, slave_relay_log_info, innodb_index_stats, innodb_table_stats;
-- enable_query_log
=== modified file 'mysql-test/t/trigger-compat.test'
--- a/mysql-test/t/trigger-compat.test 2009-02-19 23:24:25 +0000
+++ b/mysql-test/t/trigger-compat.test 2011-06-10 07:20:15 +0000
@@ -106,4 +106,184 @@ DROP TABLE t2;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
+USE test;
+
+--echo #
+--echo # Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
+--echo #
+let $MYSQLD_DATADIR=`SELECT @@datadir`;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+INSERT INTO t3 VALUES (1), (2), (3);
+
+--echo # We simulate importing a trigger from 5.0 by writing a .TRN file for
+--echo # each trigger plus a .TRG file the way MySQL 5.0 would have done it,
+--echo # with syntax allowed in 5.0 only.
+--echo #
+--echo # Note that in 5.0 the following lines are missing from t1.TRG:
+--echo #
+--echo # client_cs_names='latin1'
+--echo # connection_cl_names='latin1_swedish_ci'
+--echo # db_cl_names='latin1_swedish_ci'
+
+--write_file $MYSQLD_DATADIR/test/tr11.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr12.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr13.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr14.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr15.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/t1.TRG
+TYPE=TRIGGERS
+triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
+sql_modes=0 0 0 0 0
+definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
+EOF
+
+--write_file $MYSQLD_DATADIR/test/t2.TRG
+TYPE=TRIGGERS
+triggers='Not allowed syntax here, and trigger name cant be extracted either.'
+sql_modes=0
+definers='root@localhost'
+EOF
+
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+
+--echo # We will get parse errors for most DDL and DML statements when the table
+--echo # has broken triggers. The parse error refers to the first broken
+--echo # trigger.
+--error ER_PARSE_ERROR
+CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
+--error ER_PARSE_ERROR
+CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
+SHOW TRIGGERS;
+--error ER_PARSE_ERROR
+INSERT INTO t1 VALUES (1);
+--error ER_PARSE_ERROR
+INSERT INTO t2 VALUES (1);
+--error ER_PARSE_ERROR
+DELETE FROM t1;
+--error ER_PARSE_ERROR
+UPDATE t1 SET a = 1 WHERE a = 1;
+SELECT * FROM t1;
+--error ER_PARSE_ERROR
+RENAME TABLE t1 TO t1_2;
+SHOW TRIGGERS;
+
+DROP TRIGGER tr11;
+DROP TRIGGER tr12;
+DROP TRIGGER tr13;
+DROP TRIGGER tr14;
+DROP TRIGGER tr15;
+
+SHOW TRIGGERS;
+
+--echo # Make sure there is no trigger file left.
+--list_files $MYSQLD_DATADIR/test/ tr*
+
+--echo # We write the same trigger files one more time to test DROP TABLE.
+--write_file $MYSQLD_DATADIR/test/tr11.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr12.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr13.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr14.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr15.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/t1.TRG
+TYPE=TRIGGERS
+triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
+sql_modes=0 0 0 0 0
+definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
+EOF
+
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+--echo # Make sure there is no trigger file left.
+
+--list_files $MYSQLD_DATADIR/test/ tr*
+
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+
+--echo # We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
+--echo # and last trigger is broken.
+--echo # Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
+--write_file $MYSQLD_DATADIR/test/tr11.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/tr12.TRN
+TYPE=TRIGGERNAME
+trigger_table=t1
+EOF
+
+--write_file $MYSQLD_DATADIR/test/t1.TRG
+TYPE=TRIGGERS
+triggers='CREATE the wrongest trigger_in_the_world' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2'
+sql_modes=0 0 0
+definers='root@localhost' 'root@localhost' 'root@localhost'
+EOF
+
+FLUSH TABLE t1;
+
+SHOW CREATE TRIGGER tr12;
+SHOW CREATE TRIGGER tr11;
+DROP TRIGGER tr12;
+DROP TRIGGER tr11;
+
+DROP TABLE t1;
+DROP TABLE t2;
=== modified file 'mysql-test/t/type_datetime.test'
--- a/mysql-test/t/type_datetime.test 2011-01-19 14:39:13 +0000
+++ b/mysql-test/t/type_datetime.test 2011-06-10 08:34:13 +0000
@@ -512,5 +512,35 @@ DROP TABLE t1;
--echo #
--echo #
+--echo # BUG#12561818: RERUN OF STORED FUNCTION GIVES ERROR 1172:
+--echo # RESULT CONSISTED OF MORE THAN ONE ROW
+--echo #
+
+CREATE TABLE t1 (a DATE NOT NULL, b INT);
+INSERT INTO t1 VALUES ('0000-00-00',1), ('1999-05-10',2);
+
+CREATE TABLE t2 (a DATETIME NOT NULL, b INT);
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00',1), ('1999-05-10 00:00:00',2);
+
+--echo
+SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t2 WHERE a IS NULL;
+SELECT * FROM t1 LEFT JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+SELECT * FROM t2 LEFT JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+SELECT * FROM t1 JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+SELECT * FROM t2 JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+
+--echo
+PREPARE stmt1 FROM
+ 'SELECT *
+ FROM t1 LEFT JOIN t1 AS t1_2 ON 1
+ WHERE t1_2.a IS NULL AND t1_2.b < 2';
+EXECUTE stmt1;
+EXECUTE stmt1;
+
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 5.5 tests
--echo #
=== modified file 'mysys/mf_pack.c'
--- a/mysys/mf_pack.c 2010-12-29 00:26:31 +0000
+++ b/mysys/mf_pack.c 2011-06-15 09:18:08 +0000
@@ -193,7 +193,7 @@ size_t cleanup_dirname(register char *to
while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
pos--;
if (pos[1] == FN_HOMELIB ||
- (pos > start && memcmp(pos, parent, length) == 0))
+ (pos >= start && memcmp(pos, parent, length) == 0))
{ /* Don't remove ~user/ */
pos=strmov(end_parentdir+1,parent);
*pos=FN_LIBCHAR;
=== modified file 'plugin/audit_null/audit_null.c'
--- a/plugin/audit_null/audit_null.c 2010-08-12 15:19:57 +0000
+++ b/plugin/audit_null/audit_null.c 2011-06-03 07:27:11 +0000
@@ -81,11 +81,12 @@ static int audit_null_plugin_deinit(void
*/
static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
- const struct mysql_event *event)
+ unsigned int event_class,
+ const void *event)
{
/* prone to races, oh well */
number_of_calls++;
- if (event->event_class == MYSQL_AUDIT_GENERAL_CLASS)
+ if (event_class == MYSQL_AUDIT_GENERAL_CLASS)
{
const struct mysql_event_general *event_general=
(const struct mysql_event_general *) event;
=== modified file 'scripts/mysql_install_db.pl.in'
--- a/scripts/mysql_install_db.pl.in 2011-03-23 23:28:49 +0000
+++ b/scripts/mysql_install_db.pl.in 2011-06-15 08:02:11 +0000
@@ -418,7 +418,6 @@ my $mysqld_install_cmd_line = quote_opti
"--bootstrap",
"--basedir=$opt->{basedir}",
"--datadir=$opt->{ldata}",
- "--skip-innodb",
"--skip-bdb",
"--skip-ndbcluster",
"--max_allowed_packet=8M",
=== modified file 'scripts/mysql_install_db.sh'
--- a/scripts/mysql_install_db.sh 2011-03-23 23:28:49 +0000
+++ b/scripts/mysql_install_db.sh 2011-06-15 08:02:11 +0000
@@ -388,7 +388,7 @@ fi
# Configure mysqld command line
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
- --basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \
+ --basedir=$basedir --datadir=$ldata --log-warnings=0 \
--loose-skip-ndbcluster $args --max_allowed_packet=8M \
--default-storage-engine=myisam \
--net_buffer_length=16K"
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql 2011-05-17 17:34:45 +0000
+++ b/scripts/mysql_system_tables.sql 2011-06-18 20:34:45 +0000
@@ -104,6 +104,34 @@ CREATE TABLE IF NOT EXISTS slave_relay_l
CREATE TABLE IF NOT EXISTS slave_master_info (Master_id INTEGER UNSIGNED NOT NULL, Number_of_lines INTEGER UNSIGNED NOT NULL COMMENT 'Number of lines in the file.', Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.', Master_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The master log position of the last read event.', Host TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The host name of the master.', User_name TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.', User_password TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.', Port INTEGER UNSIGNED NOT NULL COMMENT 'The network port used to connect to the master.', Connect_retry INTEGER UNSIGNED NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.', Enabled_ssl BOOLEAN NOT NULL COMMENT 'Ind
icates whether the server supports SSL connections.', Ssl_ca TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.', Ssl_capath TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.', Ssl_cert TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.', Ssl_cipher TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.', Ssl_key TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.', Ssl_verify_server_cert BOOLEAN NOT NULL COMMENT 'Whether to verify the server certificate.', Heartbeat FLOAT NOT NULL COMMENT '', Bind TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server', Ignored_server_ids TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the act
ual server IDs', Uuid TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.', Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.', PRIMARY KEY(Master_id)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COMMENT 'Master Information';
+CREATE TABLE IF NOT EXISTS innodb_table_stats (
+ database_name VARCHAR(64) NOT NULL,
+ table_name VARCHAR(64) NOT NULL,
+ stats_timestamp TIMESTAMP NOT NULL,
+ n_rows BIGINT UNSIGNED NOT NULL,
+ clustered_index_size BIGINT UNSIGNED NOT NULL,
+ sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL,
+ PRIMARY KEY (database_name, table_name)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS innodb_index_stats (
+ database_name VARCHAR(64) NOT NULL,
+ table_name VARCHAR(64) NOT NULL,
+ index_name VARCHAR(64) NOT NULL,
+ stat_timestamp TIMESTAMP NOT NULL,
+ /* there are at least:
+ stat_name='size'
+ stat_name='n_leaf_pages'
+ stat_name='n_diff_pfx%' */
+ stat_name VARCHAR(64) NOT NULL,
+ stat_value BIGINT UNSIGNED NOT NULL,
+ sample_size BIGINT UNSIGNED,
+ stat_description VARCHAR(1024) NOT NULL,
+ PRIMARY KEY (database_name, table_name, index_name, stat_name),
+ FOREIGN KEY (database_name, table_name)
+ REFERENCES innodb_table_stats (database_name, table_name)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
--
-- PERFORMANCE SCHEMA INSTALLATION
-- Note that this script is also reused by mysql_upgrade,
@@ -175,7 +203,7 @@ set @have_pfs= (select count(engine) fro
SET @cmd="CREATE TABLE performance_schema.cond_instances("
"NAME VARCHAR(128) not null,"
- "OBJECT_INSTANCE_BEGIN BIGINT not null"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null"
")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
@@ -200,11 +228,11 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_NAME VARCHAR(512),"
"INDEX_NAME VARCHAR(64),"
"OBJECT_TYPE VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT'),"
"OPERATION VARCHAR(32) not null,"
- "NUMBER_OF_BYTES BIGINT unsigned,"
+ "NUMBER_OF_BYTES BIGINT,"
"FLAGS INTEGER unsigned"
")ENGINE=PERFORMANCE_SCHEMA;";
@@ -230,11 +258,11 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_NAME VARCHAR(512),"
"INDEX_NAME VARCHAR(64),"
"OBJECT_TYPE VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT'),"
"OPERATION VARCHAR(32) not null,"
- "NUMBER_OF_BYTES BIGINT unsigned,"
+ "NUMBER_OF_BYTES BIGINT,"
"FLAGS INTEGER unsigned"
")ENGINE=PERFORMANCE_SCHEMA;";
@@ -260,11 +288,11 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_NAME VARCHAR(512),"
"INDEX_NAME VARCHAR(64),"
"OBJECT_TYPE VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('STATEMENT', 'STAGE', 'WAIT'),"
"OPERATION VARCHAR(32) not null,"
- "NUMBER_OF_BYTES BIGINT unsigned,"
+ "NUMBER_OF_BYTES BIGINT,"
"FLAGS INTEGER unsigned"
")ENGINE=PERFORMANCE_SCHEMA;";
@@ -279,7 +307,7 @@ DROP PREPARE stmt;
SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_instance("
"EVENT_NAME VARCHAR(128) not null,"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
"MIN_TIMER_WAIT BIGINT unsigned not null,"
@@ -352,8 +380,8 @@ SET @cmd="CREATE TABLE performance_schem
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_READ BIGINT unsigned not null,"
"COUNT_WRITE BIGINT unsigned not null,"
- "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
- "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"
+ "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
+ "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null"
")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
@@ -370,8 +398,8 @@ SET @cmd="CREATE TABLE performance_schem
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_READ BIGINT unsigned not null,"
"COUNT_WRITE BIGINT unsigned not null,"
- "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
- "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"
+ "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
+ "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null"
")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
@@ -475,7 +503,7 @@ DROP PREPARE stmt;
SET @cmd="CREATE TABLE performance_schema.mutex_instances("
"NAME VARCHAR(128) not null,"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"LOCKED_BY_THREAD_ID INTEGER"
")ENGINE=PERFORMANCE_SCHEMA;";
@@ -526,7 +554,7 @@ DROP PREPARE stmt;
SET @cmd="CREATE TABLE performance_schema.rwlock_instances("
"NAME VARCHAR(128) not null,"
- "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
"WRITE_LOCKED_BY_THREAD_ID INTEGER,"
"READ_LOCKED_BY_COUNT INTEGER unsigned not null"
")ENGINE=PERFORMANCE_SCHEMA;";
@@ -940,7 +968,7 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_TYPE VARCHAR(64),"
"OBJECT_SCHEMA VARCHAR(64),"
"OBJECT_NAME VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
"MYSQL_ERRNO INTEGER,"
"RETURNED_SQLSTATE VARCHAR(5),"
"MESSAGE_TEXT VARCHAR(128),"
@@ -989,7 +1017,7 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_TYPE VARCHAR(64),"
"OBJECT_SCHEMA VARCHAR(64),"
"OBJECT_NAME VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
"MYSQL_ERRNO INTEGER,"
"RETURNED_SQLSTATE VARCHAR(5),"
"MESSAGE_TEXT VARCHAR(128),"
@@ -1038,7 +1066,7 @@ SET @cmd="CREATE TABLE performance_schem
"OBJECT_TYPE VARCHAR(64),"
"OBJECT_SCHEMA VARCHAR(64),"
"OBJECT_NAME VARCHAR(64),"
- "OBJECT_INSTANCE_BEGIN BIGINT,"
+ "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
"MYSQL_ERRNO INTEGER,"
"RETURNED_SQLSTATE VARCHAR(5),"
"MESSAGE_TEXT VARCHAR(128),"
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2011-05-30 06:25:47 +0000
+++ b/sql/binlog.cc 2011-06-09 08:58:41 +0000
@@ -1261,9 +1261,9 @@ int query_error_code(THD *thd, bool not_
if (not_killed || (thd->killed == THD::KILL_BAD_DATA))
{
- error= thd->is_error() ? thd->stmt_da->sql_errno() : 0;
+ error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
- /* thd->stmt_da->sql_errno() might be ER_SERVER_SHUTDOWN or
+ /* thd->get_stmt_da()->sql_errno() might be ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED, So here we need to make sure that error
is not set to these errors when specified not_killed by the
caller.
@@ -2087,7 +2087,7 @@ bool MYSQL_BIN_LOG::check_write_error(TH
if (!thd->is_error())
DBUG_RETURN(checked);
- switch (thd->stmt_da->sql_errno())
+ switch (thd->get_stmt_da()->sql_errno())
{
case ER_TRANS_CACHE_FULL:
case ER_STMT_CACHE_FULL:
=== modified file 'sql/event_db_repository.cc'
--- a/sql/event_db_repository.cc 2011-05-27 11:50:52 +0000
+++ b/sql/event_db_repository.cc 2011-06-09 18:18:22 +0000
@@ -236,9 +236,16 @@ mysql_event_fill_row(THD *thd,
if (fields[f_num= ET_FIELD_NAME]->store(et->name.str, et->name.length, scs))
goto err_truncate;
- /* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
+ /* ON_COMPLETION field is NOT NULL thus not calling set_notnull()*/
rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
- rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
+
+ /*
+ Set STATUS value unconditionally in case of CREATE EVENT.
+ For ALTER EVENT set it only if value of this field was changed.
+ Since STATUS field is NOT NULL call to set_notnull() is not needed.
+ */
+ if (!is_update || et->status_changed)
+ rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
/*
@@ -717,8 +724,6 @@ Event_db_repository::create_event(THD *t
if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE))
goto end;
- table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
-
if ((ret= table->file->ha_write_row(table->record[0])))
{
table->file->print_error(ret, MYF(0));
=== modified file 'sql/event_parse_data.cc'
--- a/sql/event_parse_data.cc 2010-07-02 02:58:51 +0000
+++ b/sql/event_parse_data.cc 2011-06-09 18:18:22 +0000
@@ -48,9 +48,8 @@ Event_parse_data::new_instance(THD *thd)
Event_parse_data::Event_parse_data()
:on_completion(Event_parse_data::ON_COMPLETION_DEFAULT),
- status(Event_parse_data::ENABLED),
- do_not_create(FALSE),
- body_changed(FALSE),
+ status(Event_parse_data::ENABLED), status_changed(false),
+ do_not_create(FALSE), body_changed(FALSE),
item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE),
item_expression(NULL), expression(0)
@@ -142,6 +141,7 @@ Event_parse_data::check_if_in_the_past(T
else if (status == Event_parse_data::ENABLED)
{
status= Event_parse_data::DISABLED;
+ status_changed= true;
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_EVENT_EXEC_TIME_IN_THE_PAST,
ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
@@ -571,7 +571,10 @@ void Event_parse_data::check_originator_
DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
if ((status == Event_parse_data::ENABLED) ||
(status == Event_parse_data::DISABLED))
- status = Event_parse_data::SLAVESIDE_DISABLED;
+ {
+ status= Event_parse_data::SLAVESIDE_DISABLED;
+ status_changed= true;
+ }
originator = thd->server_id;
}
else
=== modified file 'sql/event_parse_data.h'
--- a/sql/event_parse_data.h 2010-07-02 02:58:51 +0000
+++ b/sql/event_parse_data.h 2011-06-09 18:18:22 +0000
@@ -55,6 +55,7 @@ public:
int on_completion;
int status;
+ bool status_changed;
longlong originator;
/*
do_not_create will be set if STARTS time is in the past and
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc 2010-07-23 19:03:52 +0000
+++ b/sql/event_scheduler.cc 2011-06-15 22:31:43 +0000
@@ -75,9 +75,9 @@ struct scheduler_param {
void
Event_worker_thread::print_warnings(THD *thd, Event_job_data *et)
{
- MYSQL_ERROR *err;
+ const MYSQL_ERROR *err;
DBUG_ENTER("evex_print_warnings");
- if (thd->warning_info->is_empty())
+ if (thd->get_stmt_wi()->is_empty())
DBUG_VOID_RETURN;
char msg_buf[10 * STRING_BUFFER_USUAL_SIZE];
@@ -93,7 +93,7 @@ Event_worker_thread::print_warnings(THD
prefix.append(et->name.str, et->name.length, system_charset_info);
prefix.append("] ", 2);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
while ((err= it++))
{
String err_msg(msg_buf, sizeof(msg_buf), system_charset_info);
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-05-26 15:20:09 +0000
+++ b/sql/field.cc 2011-06-10 16:57:01 +0000
@@ -1163,7 +1163,8 @@ int Field_num::check_int(const CHARSET_I
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", err.ptr(), field_name,
- (ulong) table->in_use->warning_info->current_row_for_warning());
+ (ulong) table->in_use->get_stmt_wi()->
+ current_row_for_warning());
return 1;
}
/* Test if we have garbage at the end of the given string. */
@@ -2648,7 +2649,8 @@ int Field_new_decimal::store(const char
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", errmsg.ptr(), field_name,
- (ulong) table->in_use->warning_info->current_row_for_warning());
+ (ulong) table->in_use->get_stmt_wi()->
+ current_row_for_warning());
DBUG_RETURN(err);
}
@@ -2668,7 +2670,7 @@ int Field_new_decimal::store(const char
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", errmsg.ptr(), field_name,
- (ulong) table->in_use->warning_info->
+ (ulong) table->in_use->get_stmt_wi()->
current_row_for_warning());
my_decimal_set_zero(&decimal_value);
break;
@@ -5231,7 +5233,7 @@ bool Field_time::get_date(MYSQL_TIME *lt
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
ER(ER_WARN_DATA_OUT_OF_RANGE), field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
return 1;
}
return Field_time::get_time(ltime);
@@ -6230,7 +6232,7 @@ check_string_copy_error(Field_str *field
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", tmp, field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
return TRUE;
}
@@ -10078,7 +10080,7 @@ Field::set_warning(MYSQL_ERROR::enum_war
{
thd->cuted_fields+= cuted_increment;
push_warning_printf(thd, level, code, ER(code), field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
return 0;
}
return level >= MYSQL_ERROR::WARN_LEVEL_WARN;
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2011-05-26 15:20:09 +0000
+++ b/sql/filesort.cc 2011-06-09 08:58:41 +0000
@@ -361,8 +361,10 @@ ha_rows filesort(THD *thd, TABLE *table,
"%s: %s",
MYF(ME_ERROR + ME_WAITTANG),
ER_THD(thd, ER_FILSORT_ABORT),
- kill_errno ? ER(kill_errno) : thd->stmt_da->message());
-
+ kill_errno ?
+ ER(kill_errno) :
+ thd->get_stmt_da()->message());
+
if (global_system_variables.log_warnings > 1)
{
sql_print_warning("%s, host: %s, user: %s, thread: %lu, query: %-.4096s",
=== modified file 'sql/gcalc_tools.cc'
--- a/sql/gcalc_tools.cc 2010-10-14 05:26:25 +0000
+++ b/sql/gcalc_tools.cc 2011-06-08 17:24:16 +0000
@@ -584,8 +584,7 @@ int Gcalc_operation_reducer::start_coupl
t1->rp= rp1;
if (prev_range)
{
- rp0->outer_poly= prev_range->thread_start;
- t1->thread_start= rp1;
+ rp0->outer_poly= t1->thread_start= prev_range->thread_start;
}
else
{
@@ -617,8 +616,7 @@ int Gcalc_operation_reducer::start_i_cou
t1->rp= rp1;
if (prev_range)
{
- rp0->outer_poly= prev_range->thread_start;
- t1->thread_start= rp1;
+ rp0->outer_poly= t1->thread_start= prev_range->thread_start;
}
else
{
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-05-26 15:20:09 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-06-10 16:57:01 +0000
@@ -288,13 +288,13 @@ static void run_query(THD *thd, char *bu
Thd_ndb *thd_ndb= get_thd_ndb(thd);
for (i= 0; no_print_error[i]; i++)
if ((thd_ndb->m_error_code == no_print_error[i]) ||
- (thd->stmt_da->sql_errno() == (unsigned) no_print_error[i]))
+ (thd->get_stmt_da()->sql_errno() == (unsigned) no_print_error[i]))
break;
if (!no_print_error[i])
sql_print_error("NDB: %s: error %s %d(ndb: %d) %d %d",
buf,
- thd->stmt_da->message(),
- thd->stmt_da->sql_errno(),
+ thd->get_stmt_da()->message(),
+ thd->get_stmt_da()->sql_errno(),
thd_ndb->m_error_code,
(int) thd->is_error(), thd->is_slave_error);
}
@@ -308,7 +308,7 @@ static void run_query(THD *thd, char *bu
is called from ndbcluster_reset_logs(), which is called from
mysql_flush().
*/
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
thd->variables.option_bits= save_thd_options;
thd->set_query(save_thd_query, save_thd_query_length);
@@ -982,7 +982,7 @@ static void print_could_not_discover_err
"my_errno: %d",
schema->db, schema->name, schema->query,
schema->node_id, my_errno);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_wi()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
sql_print_warning("NDB Binlog: (%d)%s", err->get_sql_errno(),
@@ -2338,8 +2338,8 @@ static int open_ndb_binlog_index(THD *th
sql_print_error("NDB Binlog: Opening ndb_binlog_index: killed");
else
sql_print_error("NDB Binlog: Opening ndb_binlog_index: %d, '%s'",
- thd->stmt_da->sql_errno(),
- thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message());
thd->proc_info= save_proc_info;
return -1;
}
@@ -2395,9 +2395,9 @@ int ndb_add_ndb_binlog_index(THD *thd, v
}
add_ndb_binlog_index_err:
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
ndb_binlog_index= 0;
@@ -4266,9 +4266,9 @@ err:
sql_print_information("Stopping Cluster Binlog");
DBUG_PRINT("info",("Shutting down cluster binlog thread"));
thd->proc_info= "Shutting down";
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
mysql_mutex_lock(&injector_mutex);
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2011-06-01 09:11:28 +0000
+++ b/sql/ha_partition.cc 2011-06-13 09:33:42 +0000
@@ -3611,9 +3611,13 @@ exit:
index)
mysql_update does not set table->next_number_field, so we use
table->found_next_number_field instead.
+ Also checking that the field is marked in the write set.
*/
- if (table->found_next_number_field && new_data == table->record[0] &&
- !table->s->next_number_keypart)
+ if (table->found_next_number_field &&
+ new_data == table->record[0] &&
+ !table->s->next_number_keypart &&
+ bitmap_is_set(table->write_set,
+ table->found_next_number_field->field_index))
{
if (!table_share->ha_part_data->auto_inc_initialized)
info(HA_STATUS_AUTO);
@@ -4276,6 +4280,7 @@ void ha_partition::position(const uchar
void ha_partition::column_bitmaps_signal()
{
handler::column_bitmaps_signal();
+ /* Must read all partition fields to make position() call possible */
bitmap_union(table->read_set, &m_part_info->full_part_field_set);
}
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-05-31 09:30:59 +0000
+++ b/sql/handler.cc 2011-06-09 08:58:41 +0000
@@ -1402,7 +1402,7 @@ int ha_rollback_trans(THD *thd, bool all
trans->no_2pc=0;
if (is_real_trans && thd->transaction_rollback_request &&
thd->transaction.xid_state.xa_state != XA_NOTR)
- thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno();
+ thd->transaction.xid_state.rm_error= thd->get_stmt_da()->sql_errno();
}
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2011-05-26 15:20:09 +0000
+++ b/sql/item.cc 2011-06-06 12:49:55 +0000
@@ -419,12 +419,11 @@ int Item::save_str_value_in_field(Field
Item::Item():
is_expensive_cache(-1), rsize(0), name(0), orig_name(0), name_length(0),
fixed(0), is_autogenerated_name(TRUE),
- collation(&my_charset_bin, DERIVATION_COERCIBLE)
+ collation(&my_charset_bin, DERIVATION_COERCIBLE), with_subselect(false)
{
marker= 0;
maybe_null=null_value=with_sum_func=unsigned_flag=0;
decimals= 0; max_length= 0;
- with_subselect= 0;
cmp_context= (Item_result)-1;
/* Put item in free list so that we can free all items at end */
@@ -470,8 +469,8 @@ Item::Item(THD *thd, Item *item):
fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
collation(item->collation),
- with_subselect(item->with_subselect),
- cmp_context(item->cmp_context)
+ cmp_context(item->cmp_context),
+ with_subselect(item->with_subselect)
{
next= thd->free_list; // Put in free list
thd->free_list= this;
=== modified file 'sql/item.h'
--- a/sql/item.h 2011-05-26 15:20:09 +0000
+++ b/sql/item.h 2011-06-10 15:29:04 +0000
@@ -567,10 +567,14 @@ public:
my_bool is_autogenerated_name; /* indicate was name of this Item
autogenerated or set by user */
DTCollation collation;
+ Item_result cmp_context; /* Comparison context */
+ protected:
my_bool with_subselect; /* If this item is a subselect or some
of its arguments is or contains a
- subselect. Computed by fix_fields. */
- Item_result cmp_context; /* Comparison context */
+ subselect. Computed by fix_fields
+ and updated by update_used_tables. */
+
+ public:
// alloc & destruct is done as start of select using sql_alloc
Item();
/*
@@ -1301,6 +1305,11 @@ public:
@retval FALSE Otherwise.
*/
bool is_blob_field() const;
+
+ /**
+ Checks if this item or any of its decendents contains a subquery.
+ */
+ virtual bool has_subquery() const { return with_subselect; }
};
@@ -1730,6 +1739,8 @@ public:
String *val_str(String *str) { return field->val_str(str); }
my_decimal *val_decimal(my_decimal *dec) { return field->val_decimal(dec); }
void make_field(Send_field *tmp_field);
+ CHARSET_INFO *charset_for_protocol(void) const
+ { return (CHARSET_INFO *)field->charset_for_protocol(); }
};
@@ -2693,6 +2704,14 @@ public:
return (*ref)->is_outer_field();
}
+ /**
+ Checks if the item tree that ref points to contains a subquery.
+ */
+ virtual bool has_subquery() const
+ {
+ DBUG_ASSERT(ref);
+ return (*ref)->has_subquery();
+ }
};
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-05-26 05:50:01 +0000
+++ b/sql/item_cmpfunc.cc 2011-06-09 06:22:39 +0000
@@ -4404,7 +4404,7 @@ Item_cond::fix_fields(THD *thd, Item **r
const_item_cache= FALSE;
}
with_sum_func= with_sum_func || item->with_sum_func;
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
if (item->maybe_null)
maybe_null=1;
}
@@ -4615,11 +4615,13 @@ void Item_cond::update_used_tables()
used_tables_cache=0;
const_item_cache=1;
+ with_subselect= false;
while ((item=li++))
{
item->update_used_tables();
used_tables_cache|= item->used_tables();
const_item_cache&= item->const_item();
+ with_subselect|= item->has_subquery();
}
}
@@ -4803,6 +4805,8 @@ void Item_is_not_null_test::update_used_
else
{
args[0]->update_used_tables();
+ with_subselect= args[0]->has_subquery();
+
if (!(used_tables_cache=args[0]->used_tables()) && !with_subselect)
{
/* Remember if the value is always NULL or never NULL */
@@ -5827,12 +5831,14 @@ void Item_equal::update_used_tables()
not_null_tables_cache= used_tables_cache= 0;
if ((const_item_cache= cond_false))
return;
+ with_subselect= false;
while ((item=li++))
{
item->update_used_tables();
used_tables_cache|= item->used_tables();
/* see commentary at Item_equal::update_const() */
const_item_cache&= item->const_item() && !item->is_outer_field();
+ with_subselect|= item->has_subquery();
}
}
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2011-05-26 15:20:09 +0000
+++ b/sql/item_cmpfunc.h 2011-06-09 06:22:39 +0000
@@ -1363,6 +1363,8 @@ public:
else
{
args[0]->update_used_tables();
+ with_subselect= args[0]->has_subquery();
+
if ((const_item_cache= !(used_tables_cache= args[0]->used_tables()) &&
!with_subselect))
{
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-05-26 10:13:07 +0000
+++ b/sql/item_func.cc 2011-06-09 06:22:39 +0000
@@ -218,7 +218,7 @@ Item_func::fix_fields(THD *thd, Item **r
used_tables_cache|= item->used_tables();
not_null_tables_cache|= item->not_null_tables();
const_item_cache&= item->const_item();
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
}
}
fix_length_and_dec();
@@ -405,11 +405,13 @@ void Item_func::update_used_tables()
{
used_tables_cache=0;
const_item_cache=1;
+ with_subselect= false;
for (uint i=0 ; i < arg_count ; i++)
{
args[i]->update_used_tables();
used_tables_cache|=args[i]->used_tables();
const_item_cache&=args[i]->const_item();
+ with_subselect|= args[i]->has_subquery();
}
}
=== modified file 'sql/item_inetfunc.cc'
--- a/sql/item_inetfunc.cc 2011-05-30 07:26:59 +0000
+++ b/sql/item_inetfunc.cc 2011-06-02 14:01:33 +0000
@@ -70,8 +70,8 @@ longlong Item_func_inet_aton::val_int()
if (c != '.') // IP number can't end on '.'
{
/*
- Attempt to support short-form addresses (i.e. classful addresses).
- The current code does not support full range of classful addresses.
+ Attempt to support short forms of IP-addresses. It's however pretty
+ basic one comparing to the BSD support.
Examples:
127 -> 0.0.0.127
127.255 -> 127.0.0.255
@@ -310,7 +310,7 @@ static bool str_to_ipv4(const char *str,
if (dot_count != 3)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
- "classful address (too few groups).",
+ "too few groups.",
str_length, str));
return false;
}
=== modified file 'sql/item_row.cc'
--- a/sql/item_row.cc 2011-05-06 13:32:53 +0000
+++ b/sql/item_row.cc 2011-06-09 06:22:39 +0000
@@ -126,11 +126,13 @@ void Item_row::update_used_tables()
{
used_tables_cache= 0;
const_item_cache= 1;
+ with_subselect= false;
for (uint i= 0; i < arg_count; i++)
{
items[i]->update_used_tables();
used_tables_cache|= items[i]->used_tables();
const_item_cache&= items[i]->const_item();
+ with_subselect|= items[i]->has_subquery();
}
}
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2011-05-26 15:20:09 +0000
+++ b/sql/item_strfunc.cc 2011-06-09 06:22:39 +0000
@@ -2571,6 +2571,7 @@ void Item_func_make_set::update_used_tab
item->update_used_tables();
used_tables_cache|=item->used_tables();
const_item_cache&=item->const_item();
+ with_subselect= item->has_subquery();
}
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2011-05-26 15:20:09 +0000
+++ b/sql/item_sum.cc 2011-06-09 06:22:39 +0000
@@ -529,10 +529,12 @@ void Item_sum::update_used_tables ()
if (!forced_const)
{
used_tables_cache= 0;
+ with_subselect= false;
for (uint i=0 ; i < arg_count ; i++)
{
args[i]->update_used_tables();
used_tables_cache|= args[i]->used_tables();
+ with_subselect|= args[i]->has_subquery();
}
used_tables_cache&= PSEUDO_TABLE_BITS;
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2011-05-26 15:20:09 +0000
+++ b/sql/item_timefunc.cc 2011-06-13 10:55:58 +0000
@@ -1385,6 +1385,26 @@ longlong Item_func_unix_timestamp::val_i
return (longlong) TIME_to_timestamp(current_thd, <ime, ¬_used);
}
+enum_monotonicity_info Item_func_unix_timestamp::get_monotonicity_info() const
+{
+ if (args[0]->type() == Item::FIELD_ITEM &&
+ (args[0]->field_type() == MYSQL_TYPE_TIMESTAMP))
+ return MONOTONIC_INCREASING;
+ return NON_MONOTONIC;
+}
+
+
+longlong Item_func_unix_timestamp::val_int_endpoint(bool left_endp, bool *incl_endp)
+{
+ DBUG_ASSERT(fixed == 1);
+ DBUG_ASSERT(arg_count == 1 &&
+ args[0]->type() == Item::FIELD_ITEM &&
+ args[0]->field_type() == MYSQL_TYPE_TIMESTAMP);
+ Field *field=((Item_field*) args[0])->field;
+ /* Leave the incl_endp intact */
+ return ((Field_timestamp*) field)->get_timestamp(&null_value);
+}
+
longlong Item_func_time_to_sec::val_int()
{
=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h 2011-03-30 07:42:03 +0000
+++ b/sql/item_timefunc.h 2011-06-13 10:55:58 +0000
@@ -387,6 +387,8 @@ public:
Item_func_unix_timestamp(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "unix_timestamp"; }
+ enum_monotonicity_info get_monotonicity_info() const;
+ longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
/*
UNIX_TIMESTAMP() depends on the current timezone
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-05-30 06:25:47 +0000
+++ b/sql/log_event.cc 2011-06-15 22:31:43 +0000
@@ -208,8 +208,8 @@ static void inline slave_rows_error_repo
char buff[MAX_SLAVE_ERRMSG], *slider;
const char *buff_end= buff + sizeof(buff);
uint len;
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
+ const MYSQL_ERROR *err;
buff[0]= 0;
for (err= it++, slider= buff; err && slider < buff_end - 1;
@@ -221,7 +221,7 @@ static void inline slave_rows_error_repo
}
if (ha_error != 0)
- rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
+ rli->report(level, thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0,
"Could not execute %s event on table %s.%s;"
"%s handler error %s; "
"the event's master log %s, end_log_pos %lu",
@@ -229,7 +229,7 @@ static void inline slave_rows_error_repo
buff, handler_error == NULL ? "<unknown>" : handler_error,
log_name, pos);
else
- rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
+ rli->report(level, thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0,
"Could not execute %s event on table %s.%s;"
"%s the event's master log %s, end_log_pos %lu",
type, table->s->db.str, table->s->table_name.str,
@@ -372,13 +372,13 @@ inline int ignored_error_code(int err_co
*/
int convert_handler_error(int error, THD* thd, TABLE *table)
{
- uint actual_error= (thd->is_error() ? thd->stmt_da->sql_errno() :
+ uint actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
0);
if (actual_error == 0)
{
table->file->print_error(error, MYF(0));
- actual_error= (thd->is_error() ? thd->stmt_da->sql_errno() :
+ actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
ER_UNKNOWN_ERROR);
if (actual_error == ER_UNKNOWN_ERROR)
if (global_system_variables.log_warnings)
@@ -3760,7 +3760,7 @@ START SLAVE; . Query: '%s'", expected_er
}
/* If the query was not ignored, it is printed to the general log */
- if (!thd->is_error() || thd->stmt_da->sql_errno() != ER_SLAVE_IGNORED_TABLE)
+ if (!thd->is_error() || thd->get_stmt_da()->sql_errno() != ER_SLAVE_IGNORED_TABLE)
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
compare_errors:
@@ -3772,14 +3772,14 @@ compare_errors:
not exist errors", we silently clear the error if TEMPORARY was used.
*/
if (thd->lex->sql_command == SQLCOM_DROP_TABLE && thd->lex->drop_temporary &&
- thd->is_error() && thd->stmt_da->sql_errno() == ER_BAD_TABLE_ERROR &&
+ thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_BAD_TABLE_ERROR &&
!expected_error)
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
/*
If we expected a non-zero error code, and we don't get the same error
code, and it should be ignored or is related to a concurrency issue.
*/
- actual_error= thd->is_error() ? thd->stmt_da->sql_errno() : 0;
+ actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
DBUG_PRINT("info",("expected_error: %d sql_errno: %d",
expected_error, actual_error));
@@ -3796,7 +3796,7 @@ Error on slave: actual message='%s', err
Default database: '%s'. Query: '%s'",
ER_SAFE(expected_error),
expected_error,
- actual_error ? thd->stmt_da->message() : "no error",
+ actual_error ? thd->get_stmt_da()->message() : "no error",
actual_error,
print_slave_db_safe(db), query_arg);
thd->is_slave_error= 1;
@@ -3820,7 +3820,7 @@ Default database: '%s'. Query: '%s'",
{
rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on query. Default database: '%s'. Query: '%s'",
- (actual_error ? thd->stmt_da->message() :
+ (actual_error ? thd->get_stmt_da()->message() :
"unexpected success or fatal error"),
print_slave_db_safe(thd->db), query_arg);
thd->is_slave_error= 1;
@@ -5300,7 +5300,7 @@ int Load_log_event::do_apply_event(NET*
{
thd->set_time((time_t)when);
thd->set_query_id(next_query_id());
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->opt_clear_warning_info(thd->query_id);
TABLE_LIST tables;
char table_buf[NAME_LEN + 1];
@@ -5450,9 +5450,9 @@ error:
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
thd->reset_query();
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
/*
- If inside a multi-statement transaction,
@@ -5479,8 +5479,8 @@ error:
int sql_errno;
if (thd->is_error())
{
- err= thd->stmt_da->message();
- sql_errno= thd->stmt_da->sql_errno();
+ err= thd->get_stmt_da()->message();
+ sql_errno= thd->get_stmt_da()->sql_errno();
}
else
{
@@ -8046,7 +8046,7 @@ int Rows_log_event::do_apply_event(Relay
if (open_and_lock_tables(thd, rli->tables_to_lock, FALSE, 0))
{
- uint actual_error= thd->stmt_da->sql_errno();
+ uint actual_error= thd->get_stmt_da()->sql_errno();
if (thd->is_slave_error || thd->is_fatal_error)
{
/*
@@ -8057,7 +8057,7 @@ int Rows_log_event::do_apply_event(Relay
*/
rli->report(ERROR_LEVEL, actual_error,
"Error executing row event: '%s'",
- (actual_error ? thd->stmt_da->message() :
+ (actual_error ? thd->get_stmt_da()->message() :
"unexpected success or fatal error"));
thd->is_slave_error= 1;
}
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2011-05-12 21:51:20 +0000
+++ b/sql/log_event_old.cc 2011-06-09 08:58:41 +0000
@@ -99,7 +99,7 @@ Old_rows_log_event::do_apply_event(Old_r
if (open_and_lock_tables(ev_thd, rli->tables_to_lock, FALSE, 0))
{
- uint actual_error= ev_thd->stmt_da->sql_errno();
+ uint actual_error= ev_thd->get_stmt_da()->sql_errno();
if (ev_thd->is_slave_error || ev_thd->is_fatal_error)
{
/*
@@ -108,7 +108,7 @@ Old_rows_log_event::do_apply_event(Old_r
*/
rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on opening tables",
- (actual_error ? ev_thd->stmt_da->message() :
+ (actual_error ? ev_thd->get_stmt_da()->message() :
"unexpected success or fatal error"));
ev_thd->is_slave_error= 1;
}
@@ -242,10 +242,10 @@ Old_rows_log_event::do_apply_event(Old_r
break;
default:
- rli->report(ERROR_LEVEL, ev_thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(),
"Error in %s event: row application failed. %s",
ev->get_type_str(),
- ev_thd->is_error() ? ev_thd->stmt_da->message() : "");
+ ev_thd->is_error() ? ev_thd->get_stmt_da()->message() : "");
thd->is_slave_error= 1;
break;
}
@@ -259,12 +259,12 @@ Old_rows_log_event::do_apply_event(Old_r
if (error)
{ /* error has occured during the transaction */
- rli->report(ERROR_LEVEL, ev_thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(),
"Error in %s event: error during transaction execution "
"on table %s.%s. %s",
ev->get_type_str(), table->s->db.str,
table->s->table_name.str,
- ev_thd->is_error() ? ev_thd->stmt_da->message() : "");
+ ev_thd->is_error() ? ev_thd->get_stmt_da()->message() : "");
/*
If one day we honour --skip-slave-errors in row-based replication, and
=== modified file 'sql/mdl.h'
--- a/sql/mdl.h 2011-04-11 11:52:24 +0000
+++ b/sql/mdl.h 2011-06-16 16:06:32 +0000
@@ -187,11 +187,24 @@ enum enum_mdl_type {
/** Duration of metadata lock. */
-enum enum_mdl_duration { MDL_STATEMENT= 0,
- MDL_TRANSACTION,
- MDL_EXPLICIT,
- /* This should be the last ! */
- MDL_DURATION_END };
+enum enum_mdl_duration {
+ /**
+ Locks with statement duration are automatically released at the end
+ of statement or transaction.
+ */
+ MDL_STATEMENT= 0,
+ /**
+ Locks with transaction duration are automatically released at the end
+ of transaction.
+ */
+ MDL_TRANSACTION,
+ /**
+ Locks with explicit duration survive the end of statement and transaction.
+ They have to be released explicitly by calling MDL_context::release_lock().
+ */
+ MDL_EXPLICIT,
+ /* This should be the last ! */
+ MDL_DURATION_END };
/** Maximal length of key for metadata locking subsystem. */
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-05-27 15:46:36 +0000
+++ b/sql/mysqld.cc 2011-06-18 20:34:45 +0000
@@ -160,12 +160,12 @@ extern int memcntl(caddr_t, size_t, int,
int initgroups(const char *,unsigned int);
#endif
-#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
+#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
#include <ieeefp.h>
#ifdef HAVE_FP_EXCEPT // Fix type conflict
typedef fp_except fp_except_t;
#endif
-#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
#ifdef HAVE_SYS_FPU_H
/* for IRIX to use set_fpc_csr() */
#include <sys/fpu.h>
@@ -191,19 +191,24 @@ extern "C" my_bool reopen_fstreams(const
inline void setup_fpu()
{
-#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
+#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
/* We can't handle floating point exceptions with threads, so disable
this on freebsd
- Don't fall for overflow, underflow,divide-by-zero or loss of precision
+ Don't fall for overflow, underflow,divide-by-zero or loss of precision.
+ fpsetmask() is deprecated in favor of fedisableexcept() in C99.
*/
-#if defined(__i386__)
+#if defined(FP_X_DNML)
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#else
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
-#endif /* __i386__ */
-#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
+#endif /* FP_X_DNML */
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
+
+#ifdef HAVE_FEDISABLEEXCEPT
+ fedisableexcept(FE_ALL_EXCEPT);
+#endif
#ifdef HAVE_FESETROUND
/* Set FPU rounding mode to "round-to-nearest" */
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2011-04-15 08:11:49 +0000
+++ b/sql/opt_sum.cc 2011-06-09 08:58:41 +0000
@@ -450,7 +450,7 @@ int opt_sum_query(THD *thd,
}
if (thd->is_error())
- DBUG_RETURN(thd->stmt_da->sql_errno());
+ DBUG_RETURN(thd->get_stmt_da()->sql_errno());
/*
If we have a where clause, we can only ignore searching in the
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2011-05-26 15:20:09 +0000
+++ b/sql/partition_info.cc 2011-06-14 09:50:33 +0000
@@ -115,11 +115,11 @@ bool partition_info::prune_partition_bit
do
{
String *part_name_str= partition_names_it++;
- const char *part_name= part_name_str->c_ptr_safe();
+ const char *part_name= part_name_str->c_ptr();
PART_NAME_DEF *part_def;
part_def= (PART_NAME_DEF*) my_hash_search(part_name_hash,
(const uchar*) part_name,
- strlen(part_name));
+ part_name_str->length());
if (!part_def)
{
my_error(ER_NO_SUCH_PARTITION, MYF(0), part_name);
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc 2011-05-26 15:20:09 +0000
+++ b/sql/protocol.cc 2011-06-10 16:57:01 +0000
@@ -158,14 +158,14 @@ bool net_send_error(THD *thd, uint sql_e
It's one case when we can push an error even though there
is an OK or EOF already.
*/
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
/* Abort multi-result sets */
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
error= net_send_error_packet(thd, sql_errno, err, sqlstate);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_RETURN(error);
}
@@ -239,7 +239,7 @@ net_send_ok(THD *thd,
int2store(pos, server_status);
pos+=2;
}
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
if (message && message[0])
pos= net_store_data(pos, (uchar*) message, strlen(message));
@@ -248,7 +248,7 @@ net_send_ok(THD *thd,
error= net_flush(net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
DBUG_RETURN(error);
@@ -288,11 +288,11 @@ net_send_eof(THD *thd, uint server_statu
/* Set to TRUE if no active vio, to work well in case of --init-file */
if (net->vio != 0)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
error= write_eof_packet(thd, net, server_status, statement_warn_count);
if (!error)
error= net_flush(net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_PRINT("info", ("EOF sent, so no more error sending allowed"));
}
DBUG_RETURN(error);
@@ -487,30 +487,30 @@ static uchar *net_store_length_fast(ucha
void Protocol::end_statement()
{
DBUG_ENTER("Protocol::end_statement");
- DBUG_ASSERT(! thd->stmt_da->is_sent);
+ DBUG_ASSERT(! thd->get_stmt_da()->is_sent);
bool error= FALSE;
/* Can not be true, but do not take chances in production. */
- if (thd->stmt_da->is_sent)
+ if (thd->get_stmt_da()->is_sent)
DBUG_VOID_RETURN;
- switch (thd->stmt_da->status()) {
+ switch (thd->get_stmt_da()->status()) {
case Diagnostics_area::DA_ERROR:
/* The query failed, send error to log and abort bootstrap. */
- error= send_error(thd->stmt_da->sql_errno(),
- thd->stmt_da->message(),
- thd->stmt_da->get_sqlstate());
+ error= send_error(thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message(),
+ thd->get_stmt_da()->get_sqlstate());
break;
case Diagnostics_area::DA_EOF:
error= send_eof(thd->server_status,
- thd->stmt_da->statement_warn_count());
+ thd->get_stmt_da()->statement_warn_count());
break;
case Diagnostics_area::DA_OK:
error= send_ok(thd->server_status,
- thd->stmt_da->statement_warn_count(),
- thd->stmt_da->affected_rows(),
- thd->stmt_da->last_insert_id(),
- thd->stmt_da->message());
+ thd->get_stmt_da()->statement_warn_count(),
+ thd->get_stmt_da()->affected_rows(),
+ thd->get_stmt_da()->last_insert_id(),
+ thd->get_stmt_da()->message());
break;
case Diagnostics_area::DA_DISABLED:
break;
@@ -521,7 +521,7 @@ void Protocol::end_statement()
break;
}
if (!error)
- thd->stmt_da->is_sent= TRUE;
+ thd->get_stmt_da()->is_sent= TRUE;
DBUG_VOID_RETURN;
}
@@ -639,9 +639,9 @@ bool Protocol::flush()
{
#ifndef EMBEDDED_LIBRARY
bool error;
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
error= net_flush(&thd->net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
return error;
#else
return 0;
@@ -802,7 +802,7 @@ bool Protocol::send_result_set_metadata(
Send no warning information, as it will be sent at statement end.
*/
if (write_eof_packet(thd, &thd->net, thd->server_status,
- thd->warning_info->statement_warn_count()))
+ thd->get_stmt_wi()->statement_warn_count()))
DBUG_RETURN(1);
}
DBUG_RETURN(prepare_for_send(list->elements));
=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc 2011-05-26 15:20:09 +0000
+++ b/sql/rpl_master.cc 2011-06-09 08:58:41 +0000
@@ -649,8 +649,8 @@ void mysql_binlog_send(THD* thd, char* l
Diagnostics_area.
*/
Diagnostics_area temp_da;
- Diagnostics_area *saved_da= thd->stmt_da;
- thd->stmt_da= &temp_da;
+ Diagnostics_area *saved_da= thd->get_stmt_da();
+ thd->set_stmt_da(&temp_da);
DBUG_ENTER("mysql_binlog_send");
DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos));
@@ -1248,7 +1248,7 @@ impossible position";
}
end:
- thd->stmt_da= saved_da;
+ thd->set_stmt_da(saved_da);
end_io_cache(&log);
mysql_file_close(file, MYF(MY_WME));
@@ -1279,7 +1279,7 @@ err:
mysql_file_close(file, MYF(MY_WME));
thd->variables.max_allowed_packet= old_max_allowed_packet;
- thd->stmt_da= saved_da;
+ thd->set_stmt_da(saved_da);
my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN;
}
=== modified file 'sql/rpl_reporting.cc'
--- a/sql/rpl_reporting.cc 2011-05-12 17:29:19 +0000
+++ b/sql/rpl_reporting.cc 2011-06-09 08:58:41 +0000
@@ -47,7 +47,7 @@ int Slave_reporting_capability::has_temp
DBUG_ENTER("has_temporary_error");
DBUG_EXECUTE_IF("all_errors_are_temporary_errors",
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
{
thd->clear_error();
my_error(ER_LOCK_DEADLOCK, MYF(0));
@@ -63,7 +63,7 @@ int Slave_reporting_capability::has_temp
if (thd->is_fatal_error || !thd->is_error())
DBUG_RETURN(0);
- error= (error_arg == 0)? thd->stmt_da->sql_errno() : error_arg;
+ error= (error_arg == 0)? thd->get_stmt_da()->sql_errno() : error_arg;
/*
Temporary error codes:
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2011-05-26 15:20:09 +0000
+++ b/sql/rpl_rli.cc 2011-06-09 08:58:41 +0000
@@ -417,7 +417,7 @@ int Relay_log_info::wait_for_pos(THD* th
DBUG_RETURN(-2);
DBUG_PRINT("enter",("log_name: '%s' log_pos: %lu timeout: %lu",
- log_name->c_ptr(), (ulong) log_pos, (ulong) timeout));
+ log_name->c_ptr_safe(), (ulong) log_pos, (ulong) timeout));
set_timespec(abstime,timeout);
mysql_mutex_lock(&data_lock);
@@ -1004,9 +1004,9 @@ void Relay_log_info::clear_tables_to_loc
void Relay_log_info::slave_close_thread_tables(THD *thd)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
/*
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-05-21 08:25:33 +0000
+++ b/sql/rpl_slave.cc 2011-06-15 22:31:43 +0000
@@ -2927,7 +2927,7 @@ static int exec_relay_log_event(THD* thd
else
{
thd->is_fatal_error= 1;
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
"Slave SQL thread retried transaction %lu time(s) "
"in vain, giving up. Consider raising the value of "
"the slave_transaction_retries variable.", rli->trans_retries);
@@ -3639,9 +3639,9 @@ log '%s' at position %s, relay log '%s'
if (check_temp_dir(rli->slave_patternload_file))
{
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
"Unable to use slave's temporary directory %s - %s",
- slave_load_tmpdir, thd->stmt_da->message());
+ slave_load_tmpdir, thd->get_stmt_da()->message());
goto err;
}
@@ -3651,7 +3651,7 @@ log '%s' at position %s, relay log '%s'
execute_init_command(thd, &opt_init_slave, &LOCK_sys_init_slave);
if (thd->is_slave_error)
{
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
"Slave SQL thread aborted. Can't execute init_slave query");
goto err;
}
@@ -3718,20 +3718,22 @@ log '%s' at position %s, relay log '%s'
if (thd->is_error())
{
- char const *const errmsg= thd->stmt_da->message();
+ char const *const errmsg= thd->get_stmt_da()->message();
DBUG_PRINT("info",
- ("thd->stmt_da->sql_errno()=%d; rli->last_error.number=%d",
- thd->stmt_da->sql_errno(), last_errno));
+ ("thd->get_stmt_da()->sql_errno()=%d; "
+ "rli->last_error.number=%d",
+ thd->get_stmt_da()->sql_errno(), last_errno));
if (last_errno == 0)
{
/*
This function is reporting an error which was not reported
while executing exec_relay_log_event().
*/
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(), "%s", errmsg);
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
+ "%s", errmsg);
}
- else if (last_errno != thd->stmt_da->sql_errno())
+ else if (last_errno != thd->get_stmt_da()->sql_errno())
{
/*
* An error was reported while executing exec_relay_log_event()
@@ -3740,13 +3742,13 @@ log '%s' at position %s, relay log '%s'
* what caused the problem.
*/
sql_print_error("Slave (additional info): %s Error_code: %d",
- errmsg, thd->stmt_da->sql_errno());
+ errmsg, thd->get_stmt_da()->sql_errno());
}
}
/* Print any warnings issued */
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
+ const MYSQL_ERROR *err;
/*
Added controlled slave thread cancel for replication
of user-defined variables.
@@ -5485,7 +5487,7 @@ uint sql_slave_skip_counter;
@param mi Pointer to Master_info object for the slave's IO thread.
- @param net_report If true, saves the exit status into thd->stmt_da.
+ @param net_report If true, saves the exit status into Diagnostics_area.
@retval 0 success
@retval 1 error
@@ -5621,7 +5623,7 @@ int start_slave(THD* thd , Master_info*
@param mi Pointer to Master_info object for the slave's IO thread.
- @param net_report If true, saves the exit status into thd->stmt_da.
+ @param net_report If true, saves the exit status into Diagnostics_area.
@retval 0 success
@retval 1 error
=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt 2011-05-31 09:30:59 +0000
+++ b/sql/share/errmsg-utf8.txt 2011-06-10 07:38:06 +0000
@@ -6505,3 +6505,10 @@ ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DR
ER_INDEX_COLUMN_TOO_LONG
eng "Index column size too large. The maximum column size is %lu bytes."
+
+ER_ERROR_IN_TRIGGER_BODY
+ eng "Trigger '%-.64s' has an error in its body: '%-.256s'"
+
+ER_ERROR_IN_UNKNOWN_TRIGGER_BODY
+ eng "Unknown trigger has an error in its body: '%-.256s'"
+
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sp.cc 2011-06-10 16:57:01 +0000
@@ -1727,7 +1727,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *
sp_find_routine(thd, TYPE_ENUM_FUNCTION,
name, &thd->sp_func_cache,
FALSE) != NULL;
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->clear_warning_info(thd->query_id);
if (! sp_object_found)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sp_head.cc 2011-06-15 22:31:43 +0000
@@ -1141,15 +1141,15 @@ find_handler_after_execution(THD *thd, s
if (thd->is_error())
{
ctx->find_handler(thd,
- thd->stmt_da->sql_errno(),
- thd->stmt_da->get_sqlstate(),
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->get_sqlstate(),
MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
}
- else if (thd->warning_info->statement_warn_count())
+ else if (thd->get_stmt_wi()->statement_warn_count())
{
- List_iterator<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
+ const MYSQL_ERROR *err;
while ((err= it++))
{
if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
@@ -1214,8 +1214,9 @@ sp_head::execute(THD *thd, bool merge_da
String old_packet;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
+ Diagnostics_area *da= thd->get_stmt_da();
Warning_info *saved_warning_info;
- Warning_info warning_info(thd->warning_info->warn_id(), false);
+ Warning_info warning_info(thd->get_stmt_wi()->warn_id(), false);
/*
Just reporting a stack overrun error
@@ -1286,9 +1287,9 @@ sp_head::execute(THD *thd, bool merge_da
old_arena= thd->stmt_arena;
/* Push a new warning information area. */
- warning_info.append_warning_info(thd, thd->warning_info);
- saved_warning_info= thd->warning_info;
- thd->warning_info= &warning_info;
+ warning_info.append_warning_info(thd, thd->get_stmt_wi());
+ saved_warning_info= thd->get_stmt_wi();
+ da->set_warning_info(&warning_info);
/*
Switch query context. This has to be done early as this is sometimes
@@ -1388,7 +1389,7 @@ sp_head::execute(THD *thd, bool merge_da
}
/* Reset number of warnings for this query. */
- thd->warning_info->reset_for_next_command();
+ thd->get_stmt_wi()->reset_for_next_command();
DBUG_PRINT("execute", ("Instruction %u", ip));
@@ -1496,8 +1497,8 @@ sp_head::execute(THD *thd, bool merge_da
propagated to the caller in any case.
*/
if (err_status || merge_da_on_success)
- saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
- thd->warning_info= saved_warning_info;
+ saved_warning_info->merge_with_routine_info(thd, thd->get_stmt_wi());
+ da->set_warning_info(saved_warning_info);
done:
DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d",
@@ -2129,9 +2130,9 @@ sp_head::execute_procedure(THD *thd, Lis
if (!thd->in_sub_stmt)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
thd_proc_info(thd, "closing tables");
@@ -2540,7 +2541,22 @@ void
sp_head::restore_thd_mem_root(THD *thd)
{
DBUG_ENTER("sp_head::restore_thd_mem_root");
- Item *flist= free_list; // The old list
+
+ /*
+ In some cases our parser detects a syntax error and calls
+ LEX::cleanup_lex_after_parse_error() method only after
+ finishing parsing the whole routine. In such a situation
+ sp_head::restore_thd_mem_root() will be called twice - the
+ first time as part of normal parsing process and the second
+ time by cleanup_lex_after_parse_error().
+ To avoid ruining active arena/mem_root state in this case we
+ skip restoration of old arena/mem_root if this method has been
+ already called for this routine.
+ */
+ if (!m_thd)
+ DBUG_VOID_RETURN;
+
+ Item *flist= free_list; // The old list
set_query_arena(thd); // Get new free_list and mem_root
state= STMT_INITIALIZED_FOR_SP;
@@ -2968,9 +2984,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
/* Here we also commit or rollback the current statement. */
if (! thd->in_sub_stmt)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
thd_proc_info(thd, "closing tables");
close_thread_tables(thd);
@@ -3004,9 +3020,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
open_tables stage.
*/
if (!res || !thd->is_error() ||
- (thd->stmt_da->sql_errno() != ER_CANT_REOPEN_TABLE &&
- thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
- thd->stmt_da->sql_errno() != ER_UPDATE_TABLE_USED))
+ (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*
@@ -3092,7 +3108,7 @@ sp_instr_stmt::execute(THD *thd, uint *n
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
- if (thd->stmt_da->is_eof())
+ if (thd->get_stmt_da()->is_eof())
{
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
@@ -3111,7 +3127,7 @@ sp_instr_stmt::execute(THD *thd, uint *n
thd->query_name_consts= 0;
if (!thd->is_error())
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
}
DBUG_RETURN(res || thd->is_error());
}
=== modified file 'sql/spatial.cc'
--- a/sql/spatial.cc 2011-05-10 13:37:37 +0000
+++ b/sql/spatial.cc 2011-06-08 17:24:16 +0000
@@ -1141,7 +1141,7 @@ int Gis_polygon::store_shapes(Gcalc_shap
return 1;
n_points= uint4korr(data);
data+= 4;
- if (no_data(data, POINT_DATA_SIZE * n_points))
+ if (!n_points || no_data(data, POINT_DATA_SIZE * n_points))
return 1;
trn->start_ring();
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2011-05-31 13:52:09 +0000
+++ b/sql/sql_acl.cc 2011-06-09 08:58:41 +0000
@@ -1146,9 +1146,9 @@ my_bool acl_reload(THD *thd)
Execution might have been interrupted; only print the error message
if an error condition has been raised.
*/
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
sql_print_error("Fatal error: Can't open and lock privilege tables: %s",
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
goto end;
}
@@ -9538,7 +9538,7 @@ acl_authenticate(THD *thd, uint connect_
sctx->external_user= my_strdup(mpvio.auth_info.external_user, MYF(0));
if (res == CR_OK_HANDSHAKE_COMPLETE)
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
else
my_ok(thd);
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc 2011-05-04 07:51:15 +0000
+++ b/sql/sql_admin.cc 2011-06-15 22:31:43 +0000
@@ -351,17 +351,18 @@ static bool mysql_admin_table(THD* thd,
because it's already known that the table is badly damaged.
*/
+ Diagnostics_area *da= thd->get_stmt_da();
Warning_info wi(thd->query_id, false);
- Warning_info *wi_saved= thd->warning_info;
+ Warning_info *wi_saved= thd->get_stmt_wi();
- thd->warning_info= &wi;
+ da->set_warning_info(&wi);
open_error= open_temporary_tables(thd, table);
if (!open_error)
open_error= open_and_lock_tables(thd, table, TRUE, 0);
- thd->warning_info= wi_saved;
+ da->set_warning_info(wi_saved);
}
else
{
@@ -479,7 +480,7 @@ static bool mysql_admin_table(THD* thd,
if (!table->table)
{
DBUG_PRINT("admin", ("open table failed"));
- if (thd->warning_info->is_empty())
+ if (thd->get_stmt_wi()->is_empty())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
/* if it was a view will check md5 sum */
@@ -487,8 +488,8 @@ static bool mysql_admin_table(THD* thd,
view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
- if (thd->stmt_da->is_error() &&
- table_not_corrupt_error(thd->stmt_da->sql_errno()))
+ if (thd->get_stmt_da()->is_error() &&
+ table_not_corrupt_error(thd->get_stmt_da()->sql_errno()))
result_code= HA_ADMIN_FAILED;
else
/* Default failure code is corrupt table */
@@ -536,7 +537,7 @@ static bool mysql_admin_table(THD* thd,
table->table=0; // For query cache
if (protocol->write())
goto err;
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
continue;
/* purecov: end */
}
@@ -621,8 +622,8 @@ static bool mysql_admin_table(THD* thd,
we will store the error message in a result set row
and then clear.
*/
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
+ if (thd->get_stmt_da()->is_ok())
+ thd->get_stmt_da()->reset_diagnostics_area();
table->table= NULL;
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
goto send_result;
@@ -638,8 +639,8 @@ send_result:
lex->cleanup_after_one_table_open();
thd->clear_error(); // these errors shouldn't get client
{
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
+ const MYSQL_ERROR *err;
while ((err= it++))
{
protocol->prepare_for_resend();
@@ -652,7 +653,7 @@ send_result:
if (protocol->write())
goto err;
}
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->clear_warning_info(thd->query_id);
}
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
@@ -767,8 +768,8 @@ send_result_message:
we will store the error message in a result set row
and then clear.
*/
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
+ if (thd->get_stmt_da()->is_ok())
+ thd->get_stmt_da()->reset_diagnostics_area();
trans_commit_stmt(thd);
trans_commit(thd);
close_thread_tables(thd);
@@ -801,7 +802,7 @@ send_result_message:
DBUG_ASSERT(thd->is_error() || thd->killed);
if (thd->is_error())
{
- const char *err_msg= thd->stmt_da->message();
+ const char *err_msg= thd->get_stmt_da()->message();
if (!thd->vio_ok())
{
sql_print_error("%s", err_msg);
=== modified file 'sql/sql_alloc_error_handler.cc'
--- a/sql/sql_alloc_error_handler.cc 2010-07-02 02:58:51 +0000
+++ b/sql/sql_alloc_error_handler.cc 2011-06-09 08:58:41 +0000
@@ -38,10 +38,10 @@ extern "C" void sql_alloc_error_handler(
returned in the error packet.
- SHOW ERROR/SHOW WARNINGS may be empty.
*/
- thd->stmt_da->set_error_status(thd,
- ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES),
- NULL);
+ thd->get_stmt_da()->set_error_status(thd,
+ ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES),
+ NULL);
}
/* Skip writing to the error log to avoid mtr complaints */
=== modified file 'sql/sql_audit.cc'
--- a/sql/sql_audit.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_audit.cc 2011-06-03 08:00:42 +0000
@@ -21,11 +21,18 @@ extern int finalize_audit_plugin(st_plug
#ifndef EMBEDDED_LIBRARY
+struct st_mysql_event_generic
+{
+ unsigned int event_class;
+ const void *event;
+};
+
unsigned long mysql_global_audit_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
static mysql_mutex_t LOCK_audit_mask;
-static void event_class_dispatch(THD *thd, const struct mysql_event *event);
+static void event_class_dispatch(THD *thd, unsigned int event_class,
+ const void *event);
static inline
@@ -64,7 +71,6 @@ typedef void (*audit_handler_t)(THD *thd
static void general_class_handler(THD *thd, uint event_subtype, va_list ap)
{
mysql_event_general event;
- event.event_class= MYSQL_AUDIT_GENERAL_CLASS;
event.event_subclass= event_subtype;
event.general_error_code= va_arg(ap, int);
event.general_thread_id= thd ? thd->thread_id : 0;
@@ -77,14 +83,13 @@ static void general_class_handler(THD *t
event.general_query_length= va_arg(ap, unsigned int);
event.general_charset= va_arg(ap, struct charset_info_st *);
event.general_rows= (unsigned long long) va_arg(ap, ha_rows);
- event_class_dispatch(thd, (const mysql_event*) &event);
+ event_class_dispatch(thd, MYSQL_AUDIT_GENERAL_CLASS, &event);
}
static void connection_class_handler(THD *thd, uint event_subclass, va_list ap)
{
mysql_event_connection event;
- event.event_class= MYSQL_AUDIT_CONNECTION_CLASS;
event.event_subclass= event_subclass;
event.status= va_arg(ap, int);
event.thread_id= va_arg(ap, unsigned long);
@@ -102,7 +107,7 @@ static void connection_class_handler(THD
event.ip_length= va_arg(ap, unsigned int);
event.database= va_arg(ap, const char *);
event.database_length= va_arg(ap, unsigned int);
- event_class_dispatch(thd, (const mysql_event *) &event);
+ event_class_dispatch(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event);
}
@@ -430,18 +435,19 @@ int finalize_audit_plugin(st_plugin_int
static my_bool plugins_dispatch(THD *thd, plugin_ref plugin, void *arg)
{
- const struct mysql_event *event= (const struct mysql_event *) arg;
+ const struct st_mysql_event_generic *event_generic=
+ (const struct st_mysql_event_generic *) arg;
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
st_mysql_audit *data= plugin_data(plugin, struct st_mysql_audit *);
- set_audit_mask(event_class_mask, event->event_class);
+ set_audit_mask(event_class_mask, event_generic->event_class);
/* Check to see if the plugin is interested in this event */
if (check_audit_mask(data->class_mask, event_class_mask))
return 0;
/* Actually notify the plugin */
- data->event_notify(thd, event);
+ data->event_notify(thd, event_generic->event_class, event_generic->event);
return 0;
}
@@ -454,15 +460,19 @@ static my_bool plugins_dispatch(THD *thd
@param[in] event
*/
-static void event_class_dispatch(THD *thd, const struct mysql_event *event)
+static void event_class_dispatch(THD *thd, unsigned int event_class,
+ const void *event)
{
+ struct st_mysql_event_generic event_generic;
+ event_generic.event_class= event_class;
+ event_generic.event= event;
/*
Check if we are doing a slow global dispatch. This event occurs when
thd == NULL as it is not associated with any particular thread.
*/
if (unlikely(!thd))
{
- plugin_foreach(thd, plugins_dispatch, MYSQL_AUDIT_PLUGIN, (void*) event);
+ plugin_foreach(thd, plugins_dispatch, MYSQL_AUDIT_PLUGIN, &event_generic);
}
else
{
@@ -473,7 +483,7 @@ static void event_class_dispatch(THD *th
plugins_last= plugins + thd->audit_class_plugins.elements;
for (; plugins < plugins_last; plugins++)
- plugins_dispatch(thd, *plugins, (void*) event);
+ plugins_dispatch(thd, *plugins, &event_generic);
}
}
=== modified file 'sql/sql_audit.h'
--- a/sql/sql_audit.h 2011-03-09 20:54:55 +0000
+++ b/sql/sql_audit.h 2011-06-10 16:57:01 +0000
@@ -117,7 +117,7 @@ void mysql_audit_general(THD *thd, uint
query= thd->query_string;
user= user_buff;
userlen= make_user_name(thd, user_buff);
- rows= thd->warning_info->current_row_for_warning();
+ rows= thd->get_stmt_wi()->current_row_for_warning();
}
else
{
@@ -135,7 +135,7 @@ void mysql_audit_general(THD *thd, uint
#define MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd) mysql_audit_notify(\
(thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CONNECT,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
+ (thd)->get_stmt_da()->is_error() ? (thd)->get_stmt_da()->sql_errno() : 0,\
(thd)->thread_id, (thd)->security_ctx->user,\
(thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
(thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
@@ -156,7 +156,7 @@ void mysql_audit_general(THD *thd, uint
#define MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd) mysql_audit_notify(\
(thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CHANGE_USER,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
+ (thd)->get_stmt_da()->is_error() ? (thd)->get_stmt_da()->sql_errno() : 0,\
(thd)->thread_id, (thd)->security_ctx->user,\
(thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
(thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_base.cc 2011-06-15 22:31:43 +0000
@@ -182,7 +182,7 @@ static void check_unused(void)
{
share= (TABLE_SHARE*) my_hash_element(&table_def_cache, idx);
- I_P_List_iterator<TABLE, TABLE_share> it(share->free_tables);
+ TABLE_SHARE::TABLE_list::Iterator it(share->free_tables);
while ((entry= it++))
{
/* We must not have TABLEs in the free list that have their file closed. */
@@ -676,8 +676,11 @@ get_table_share_with_discover(THD *thd,
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
- if (share || (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE))
+ if (share || (thd->is_error() &&
+ thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE))
+ {
DBUG_RETURN(share);
+ }
*error= 0;
@@ -854,7 +857,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *t
share->db.str)+1,
share->table_name.str);
(*start_list)->in_use= 0;
- I_P_List_iterator<TABLE, TABLE_share> it(share->used_tables);
+ TABLE_SHARE::TABLE_list::Iterator it(share->used_tables);
while (it++)
++(*start_list)->in_use;
(*start_list)->locked= 0; /* Obsolete. */
@@ -935,7 +938,7 @@ void free_io_cache(TABLE *table)
static void kill_delayed_threads_for_table(TABLE_SHARE *share)
{
- I_P_List_iterator<TABLE, TABLE_share> it(share->used_tables);
+ TABLE_SHARE::TABLE_list::Iterator it(share->used_tables);
TABLE *tab;
mysql_mutex_assert_owner(&LOCK_open);
@@ -1728,14 +1731,14 @@ bool close_temporary_tables(THD *thd)
qinfo.db_len= db.length();
thd->variables.character_set_client= cs_save;
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
if ((error= (mysql_bin_log.write(&qinfo) || error)))
{
/*
If we're here following THD::cleanup, thence the connection
has been closed already. So lets print a message to the
error log instead of pushing yet another error into the
- stmt_da.
+ Diagnostics_area.
Also, we keep the error flag so that we propagate the error
up in the stack. This way, if we're the SQL thread we notice
@@ -1746,7 +1749,7 @@ bool close_temporary_tables(THD *thd)
sql_print_error("Failed to write the DROP statement for "
"temporary tables to binary log");
}
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
thd->thread_specific_used= save_thread_specific_used;
@@ -4013,7 +4016,7 @@ recover_from_failed_open(THD *thd)
ha_create_table_from_engine(thd, m_failed_table->db,
m_failed_table->table_name);
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->clear_warning_info(thd->query_id);
thd->clear_error(); // Clear error message
thd->mdl_context.release_transactional_locks();
break;
@@ -9012,7 +9015,7 @@ void tdc_remove_table(THD *thd, enum_tdc
{
if (share->ref_count)
{
- I_P_List_iterator<TABLE, TABLE_share> it(share->free_tables);
+ TABLE_SHARE::TABLE_list::Iterator it(share->free_tables);
#ifndef DBUG_OFF
if (remove_type == TDC_RT_REMOVE_ALL)
{
@@ -9020,7 +9023,7 @@ void tdc_remove_table(THD *thd, enum_tdc
}
else if (remove_type == TDC_RT_REMOVE_NOT_OWN)
{
- I_P_List_iterator<TABLE, TABLE_share> it2(share->used_tables);
+ TABLE_SHARE::TABLE_list::Iterator it2(share->used_tables);
while ((table= it2++))
if (table->in_use != thd)
{
=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc 2011-05-31 13:52:09 +0000
+++ b/sql/sql_cache.cc 2011-06-09 08:58:41 +0000
@@ -993,7 +993,7 @@ void Query_cache::end_of_result(THD *thd
DBUG_VOID_RETURN;
/* Ensure that only complete results are cached. */
- DBUG_ASSERT(thd->stmt_da->is_eof());
+ DBUG_ASSERT(thd->get_stmt_da()->is_eof());
if (thd->killed)
{
@@ -1756,8 +1756,8 @@ def_week_frmt: %lu, in_trans: %d, autoco
response, we can't handle it anyway.
*/
(void) trans_commit_stmt(thd);
- if (!thd->stmt_da->is_set())
- thd->stmt_da->disable_status();
+ if (!thd->get_stmt_da()->is_set())
+ thd->get_stmt_da()->disable_status();
BLOCK_UNLOCK_RD(query_block);
MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-06-06 19:24:25 +0000
+++ b/sql/sql_class.cc 2011-06-18 20:34:45 +0000
@@ -596,7 +596,7 @@ int thd_tx_isolation(const THD *thd)
extern "C"
void thd_inc_row_count(THD *thd)
{
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
}
@@ -738,8 +738,6 @@ THD::THD(bool enable_plugins)
first_successful_insert_id_in_cur_stmt(0),
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
m_examined_row_count(0),
- warning_info(&main_warning_info),
- stmt_da(&main_da),
m_statement_psi(NULL),
is_fatal_error(0),
transaction_rollback_request(0),
@@ -755,7 +753,8 @@ THD::THD(bool enable_plugins)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */
m_enable_plugins(enable_plugins),
- main_warning_info(0, false)
+ main_da(0, false),
+ m_stmt_da(&main_da)
{
ulong tmp;
@@ -1010,6 +1009,8 @@ MYSQL_ERROR* THD::raise_condition(uint s
MYSQL_ERROR::enum_warning_level level,
const char* msg)
{
+ Diagnostics_area *da= get_stmt_da();
+ Warning_info *wi= da->get_warning_info();
MYSQL_ERROR *cond= NULL;
DBUG_ENTER("THD::raise_condition");
@@ -1017,7 +1018,7 @@ MYSQL_ERROR* THD::raise_condition(uint s
(level == MYSQL_ERROR::WARN_LEVEL_NOTE))
DBUG_RETURN(NULL);
- warning_info->opt_clear_warning_info(query_id);
+ wi->opt_clear_warning_info(query_id);
/*
TODO: replace by DBUG_ASSERT(sql_errno != 0) once all bugs similar to
@@ -1077,10 +1078,10 @@ MYSQL_ERROR* THD::raise_condition(uint s
}
else
{
- if (! stmt_da->is_error())
+ if (!da->is_error())
{
set_row_count_func(-1);
- stmt_da->set_error_status(this, sql_errno, msg, sqlstate);
+ da->set_error_status(this, sql_errno, msg, sqlstate);
}
}
}
@@ -1090,7 +1091,7 @@ MYSQL_ERROR* THD::raise_condition(uint s
/* When simulating OOM, skip writing to error log to avoid mtr errors */
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(NULL););
- cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
+ cond= wi->push_warning(this, sql_errno, sqlstate, level, msg);
DBUG_RETURN(cond);
}
@@ -3973,16 +3974,24 @@ void THD::set_mysys_var(struct st_my_thr
void THD::leave_locked_tables_mode()
{
+ if (locked_tables_mode == LTM_LOCK_TABLES)
+ {
+ /*
+ When leaving LOCK TABLES mode we have to change the duration of most
+ of the metadata locks being held, except for HANDLER and GRL locks,
+ to transactional for them to be properly released at UNLOCK TABLES.
+ */
+ 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_set_explicit_lock_duration(this);
+ }
locked_tables_mode= LTM_NONE;
- 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_set_explicit_lock_duration(this);
}
void THD::get_definer(LEX_USER *definer)
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-05-31 13:52:09 +0000
+++ b/sql/sql_class.h 2011-06-16 16:06:32 +0000
@@ -2281,8 +2281,6 @@ public:
table_map used_tables;
USER_CONN *user_connect;
const CHARSET_INFO *db_charset;
- Warning_info *warning_info;
- Diagnostics_area *stmt_da;
#if defined(ENABLED_PROFILING)
PROFILING profiling;
#endif
@@ -2787,8 +2785,8 @@ public:
inline void clear_error()
{
DBUG_ENTER("clear_error");
- if (stmt_da->is_error())
- stmt_da->reset_diagnostics_area();
+ if (get_stmt_da()->is_error())
+ get_stmt_da()->reset_diagnostics_area();
is_slave_error= 0;
DBUG_VOID_RETURN;
}
@@ -2815,7 +2813,7 @@ public:
*/
inline void fatal_error()
{
- DBUG_ASSERT(stmt_da->is_error() || killed);
+ DBUG_ASSERT(get_stmt_da()->is_error() || killed);
is_fatal_error= 1;
DBUG_PRINT("error",("Fatal error set"));
}
@@ -2832,7 +2830,25 @@ public:
To raise this flag, use my_error().
*/
- inline bool is_error() const { return stmt_da->is_error(); }
+ inline bool is_error() const { return get_stmt_da()->is_error(); }
+
+ /// Returns Warning-information-area for the current diagnostics area.
+ Warning_info *get_stmt_wi()
+ { return get_stmt_da()->get_warning_info(); }
+
+ /// Returns Diagnostics-area for the current statement.
+ Diagnostics_area *get_stmt_da()
+ { return m_stmt_da; }
+
+ /// Returns Diagnostics-area for the current statement.
+ const Diagnostics_area *get_stmt_da() const
+ { return m_stmt_da; }
+
+ /// Sets Diagnostics-area for the current statement.
+ void set_stmt_da(Diagnostics_area *da)
+ { m_stmt_da= da; }
+
+public:
inline const CHARSET_INFO *charset()
{ return variables.character_set_client; }
void update_charset();
@@ -3186,7 +3202,19 @@ public:
{
DBUG_ASSERT(locked_tables_mode == LTM_NONE);
- mdl_context.set_explicit_duration_for_all_locks();
+ if (mode_arg == LTM_LOCK_TABLES)
+ {
+ /*
+ When entering LOCK TABLES mode we should set explicit duration
+ for all metadata locks acquired so far in order to avoid releasing
+ them till UNLOCK TABLES statement.
+ We don't do this when entering prelocked mode since sub-statements
+ don't release metadata locks and restoring status-quo after leaving
+ prelocking mode gets complicated.
+ */
+ mdl_context.set_explicit_duration_for_all_locks();
+ }
+
locked_tables_mode= mode_arg;
}
void leave_locked_tables_mode();
@@ -3223,8 +3251,8 @@ private:
tree itself is reused between executions and thus is stored elsewhere.
*/
MEM_ROOT main_mem_root;
- Warning_info main_warning_info;
Diagnostics_area main_da;
+ Diagnostics_area *m_stmt_da;
/**
It will be set TURE if CURRENT_USER() is called in account management
@@ -3247,24 +3275,24 @@ private:
};
-/** A short cut for thd->stmt_da->set_ok_status(). */
+/** A short cut for thd->get_stmt_da()->set_ok_status(). */
inline void
my_ok(THD *thd, ulonglong affected_rows= 0, ulonglong id= 0,
const char *message= NULL)
{
thd->set_row_count_func(affected_rows);
- thd->stmt_da->set_ok_status(thd, affected_rows, id, message);
+ thd->get_stmt_da()->set_ok_status(thd, affected_rows, id, message);
}
-/** A short cut for thd->stmt_da->set_eof_status(). */
+/** A short cut for thd->get_stmt_da()->set_eof_status(). */
inline void
my_eof(THD *thd)
{
thd->set_row_count_func(-1);
- thd->stmt_da->set_eof_status(thd);
+ thd->get_stmt_da()->set_eof_status(thd);
}
#define tmp_disable_binlog(A) \
=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc 2011-06-06 19:24:25 +0000
+++ b/sql/sql_connect.cc 2011-06-18 20:34:45 +0000
@@ -631,7 +631,8 @@ void end_connection(THD *thd)
thd->thread_id,(thd->db ? thd->db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip,
- (thd->stmt_da->is_error() ? thd->stmt_da->message() :
+ (thd->get_stmt_da()->is_error() ?
+ thd->get_stmt_da()->message() :
ER(ER_UNKNOWN_ERROR)));
}
}
@@ -669,7 +670,7 @@ void prepare_new_connection_state(THD* t
thd->thread_id,(thd->db ? thd->db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, "init_connect command failed");
- sql_print_warning("%s", thd->stmt_da->message());
+ sql_print_warning("%s", thd->get_stmt_da()->message());
}
thd->proc_info=0;
thd->set_time();
=== modified file 'sql/sql_derived.cc'
--- a/sql/sql_derived.cc 2011-03-08 19:14:42 +0000
+++ b/sql/sql_derived.cc 2011-06-09 08:58:41 +0000
@@ -184,9 +184,9 @@ exit:
if (orig_table_list->view)
{
if (thd->is_error() &&
- (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
- thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
- thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST))
+ (thd->get_stmt_da()->sql_errno() == ER_BAD_FIELD_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
+ thd->get_stmt_da()->sql_errno() == ER_SP_DOES_NOT_EXIST))
{
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), orig_table_list->db,
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_error.cc 2011-06-17 13:48:44 +0000
@@ -318,6 +318,21 @@ MYSQL_ERROR::set_sqlstate(const char* sq
m_returned_sqlstate[SQLSTATE_LENGTH]= '\0';
}
+Diagnostics_area::Diagnostics_area()
+ : m_main_wi(0, false),
+ m_current_wi(&m_main_wi)
+{
+ reset_diagnostics_area();
+}
+
+Diagnostics_area::Diagnostics_area(ulonglong warn_id,
+ bool allow_unlimited_warnings)
+ : m_main_wi(warn_id, allow_unlimited_warnings),
+ m_current_wi(&m_main_wi)
+{
+ reset_diagnostics_area();
+}
+
/**
Clear this diagnostics area.
@@ -363,7 +378,7 @@ Diagnostics_area::set_ok_status(THD *thd
if (is_error() || is_disabled())
return;
- m_statement_warn_count= thd->warning_info->statement_warn_count();
+ m_statement_warn_count= thd->get_stmt_wi()->statement_warn_count();
m_affected_rows= affected_rows_arg;
m_last_insert_id= last_insert_id_arg;
if (message_arg)
@@ -398,7 +413,7 @@ Diagnostics_area::set_eof_status(THD *th
anyway.
*/
m_statement_warn_count= (thd->spcont ?
- 0 : thd->warning_info->statement_warn_count());
+ 0 : thd->get_stmt_wi()->statement_warn_count());
m_status= DA_EOF;
DBUG_VOID_RETURN;
@@ -484,9 +499,9 @@ Warning_info::~Warning_info()
void Warning_info::clear_warning_info(ulonglong warn_id_arg)
{
m_warn_id= warn_id_arg;
+ m_warn_list.empty();
free_root(&m_warn_root, MYF(0));
memset(m_warn_count, 0, sizeof(m_warn_count));
- m_warn_list.empty();
m_statement_warn_count= 0;
m_current_row_for_warning= 1; /* Start counting from the first row */
}
@@ -495,7 +510,7 @@ void Warning_info::clear_warning_info(ul
Append warnings only if the original contents of the routine
warning info was replaced.
*/
-void Warning_info::merge_with_routine_info(THD *thd, Warning_info *source)
+void Warning_info::merge_with_routine_info(THD *thd, const Warning_info *source)
{
/*
If a routine body is empty or if a routine did not
@@ -544,13 +559,13 @@ MYSQL_ERROR *Warning_info::push_warning(
if (! m_read_only)
{
if (m_allow_unlimited_warnings ||
- m_warn_list.elements < thd->variables.max_error_count)
+ m_warn_list.elements() < thd->variables.max_error_count)
{
cond= new (& m_warn_root) MYSQL_ERROR(& m_warn_root);
if (cond)
{
cond->set(sql_errno, sqlstate, level, msg);
- m_warn_list.push_back(cond, &m_warn_root);
+ m_warn_list.push_back(cond);
}
}
m_warn_count[(uint) level]++;
@@ -667,7 +682,7 @@ bool mysqld_show_warnings(THD *thd, ulon
List<Item> field_list;
DBUG_ENTER("mysqld_show_warnings");
- DBUG_ASSERT(thd->warning_info->is_read_only());
+ DBUG_ASSERT(thd->get_stmt_wi()->is_read_only());
field_list.push_back(new Item_empty_string("Level", 7));
field_list.push_back(new Item_return_int("Code",4, MYSQL_TYPE_LONG));
@@ -677,7 +692,7 @@ bool mysqld_show_warnings(THD *thd, ulon
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
- MYSQL_ERROR *err;
+ const MYSQL_ERROR *err;
SELECT_LEX *sel= &thd->lex->select_lex;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
ulonglong idx= 0;
@@ -685,7 +700,7 @@ bool mysqld_show_warnings(THD *thd, ulon
unit->set_limit(sel);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
while ((err= it++))
{
/* Skip levels that the user is not interested in */
@@ -708,7 +723,7 @@ bool mysqld_show_warnings(THD *thd, ulon
}
my_eof(thd);
- thd->warning_info->set_read_only(FALSE);
+ thd->get_stmt_wi()->set_read_only(FALSE);
DBUG_RETURN(FALSE);
}
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2011-04-15 12:14:35 +0000
+++ b/sql/sql_error.h 2011-06-17 14:19:35 +0000
@@ -19,118 +19,11 @@
#include "sql_list.h" /* Sql_alloc, MEM_ROOT */
#include "m_string.h" /* LEX_STRING */
#include "sql_string.h" /* String */
+#include "sql_plist.h" /* I_P_List */
#include "mysql_com.h" /* MYSQL_ERRMSG_SIZE */
class THD;
-/**
- Stores status of the currently executed statement.
- Cleared at the beginning of the statement, and then
- can hold either OK, ERROR, or EOF status.
- Can not be assigned twice per statement.
-*/
-
-class Diagnostics_area
-{
-public:
- enum enum_diagnostics_status
- {
- /** The area is cleared at start of a statement. */
- DA_EMPTY= 0,
- /** Set whenever one calls my_ok(). */
- DA_OK,
- /** Set whenever one calls my_eof(). */
- DA_EOF,
- /** Set whenever one calls my_error() or my_message(). */
- DA_ERROR,
- /** Set in case of a custom response, such as one from COM_STMT_PREPARE. */
- DA_DISABLED
- };
- /** True if status information is sent to the client. */
- bool is_sent;
- /** Set to make set_error_status after set_{ok,eof}_status possible. */
- bool can_overwrite_status;
-
- void set_ok_status(THD *thd, ulonglong affected_rows_arg,
- ulonglong last_insert_id_arg,
- const char *message);
- void set_eof_status(THD *thd);
- void set_error_status(THD *thd, uint sql_errno_arg, const char *message_arg,
- const char *sqlstate);
-
- void disable_status();
-
- void reset_diagnostics_area();
-
- bool is_set() const { return m_status != DA_EMPTY; }
- bool is_error() const { return m_status == DA_ERROR; }
- bool is_eof() const { return m_status == DA_EOF; }
- bool is_ok() const { return m_status == DA_OK; }
- bool is_disabled() const { return m_status == DA_DISABLED; }
- enum_diagnostics_status status() const { return m_status; }
-
- const char *message() const
- { DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK); return m_message; }
-
- uint sql_errno() const
- { DBUG_ASSERT(m_status == DA_ERROR); return m_sql_errno; }
-
- const char* get_sqlstate() const
- { DBUG_ASSERT(m_status == DA_ERROR); return m_sqlstate; }
-
- ulonglong affected_rows() const
- { DBUG_ASSERT(m_status == DA_OK); return m_affected_rows; }
-
- ulonglong last_insert_id() const
- { DBUG_ASSERT(m_status == DA_OK); return m_last_insert_id; }
-
- uint statement_warn_count() const
- {
- DBUG_ASSERT(m_status == DA_OK || m_status == DA_EOF);
- return m_statement_warn_count;
- }
-
- Diagnostics_area() { reset_diagnostics_area(); }
-
-private:
- /** Message buffer. Can be used by OK or ERROR status. */
- char m_message[MYSQL_ERRMSG_SIZE];
- /**
- SQL error number. One of ER_ codes from share/errmsg.txt.
- Set by set_error_status.
- */
- uint m_sql_errno;
-
- char m_sqlstate[SQLSTATE_LENGTH+1];
-
- /**
- 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
- function ROW_COUNT() and is cleared only by statements that
- update its value, such as INSERT, UPDATE, DELETE and few others.
- This member is cleared at the beginning of the next statement.
-
- We could possibly merge the two, but life cycle of thd->row_count_func
- can not be changed.
- */
- ulonglong m_affected_rows;
- /**
- Similarly to the previous member, this is a replacement of
- thd->first_successful_insert_id_in_prev_stmt, which is used
- to implement LAST_INSERT_ID().
- */
- ulonglong m_last_insert_id;
- /**
- Number of warnings of this last statement. May differ from
- the number of warnings returned by SHOW WARNINGS e.g. in case
- the statement doesn't clear the warnings, and doesn't generate
- them.
- */
- uint m_statement_warn_count;
- enum_diagnostics_status m_status;
-};
-
///////////////////////////////////////////////////////////////////////////
/**
@@ -308,6 +201,11 @@ private:
/** Severity (error, warning, note) of this condition. */
MYSQL_ERROR::enum_warning_level m_level;
+
+ /** Pointers for participating in the list of conditions. */
+ MYSQL_ERROR *next_in_wi;
+ MYSQL_ERROR **prev_in_wi;
+
/** Memory root to use to hold condition item values. */
MEM_ROOT *m_mem_root;
};
@@ -320,11 +218,20 @@ private:
class Warning_info
{
+ /** The type of the counted and doubly linked list of conditions. */
+ typedef I_P_List<MYSQL_ERROR,
+ I_P_List_adapter<MYSQL_ERROR,
+ &MYSQL_ERROR::next_in_wi,
+ &MYSQL_ERROR::prev_in_wi>,
+ I_P_List_counter,
+ I_P_List_fast_push_back<MYSQL_ERROR> >
+ MYSQL_ERROR_list;
+
/** A memory root to allocate warnings and errors */
MEM_ROOT m_warn_root;
/** List of warnings of all severities (levels). */
- List <MYSQL_ERROR> m_warn_list;
+ MYSQL_ERROR_list m_warn_list;
/** A break down of the number of warnings per severity (level). */
uint m_warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
@@ -352,11 +259,20 @@ class Warning_info
private:
Warning_info(const Warning_info &rhs); /* Not implemented */
Warning_info& operator=(const Warning_info &rhs); /* Not implemented */
-public:
+public:
Warning_info(ulonglong warn_id_arg, bool allow_unlimited_warnings);
~Warning_info();
+ /** Type of the warning list. */
+ typedef MYSQL_ERROR_list List;
+
+ /** Iterator used to iterate through the warning list. */
+ typedef List::Iterator Iterator;
+
+ /** Const iterator used to iterate through the warning list. */
+ typedef List::Const_Iterator Const_iterator;
+
/**
Reset the warning information. Clear all warnings,
the number of warnings, reset current row counter
@@ -379,19 +295,15 @@ public:
clear_warning_info(query_id);
}
- void append_warning_info(THD *thd, Warning_info *source)
- {
- append_warnings(thd, & source->warn_list());
- }
-
/**
Concatenate the list of warnings.
It's considered tolerable to lose a warning.
*/
- void append_warnings(THD *thd, List<MYSQL_ERROR> *src)
+ void append_warning_info(THD *thd, const Warning_info *source)
{
- MYSQL_ERROR *err;
- List_iterator_fast<MYSQL_ERROR> it(*src);
+ const MYSQL_ERROR *err;
+ Const_iterator it(source->m_warn_list);
+
/*
Don't use ::push_warning() to avoid invocation of condition
handlers or escalation of warnings to errors.
@@ -403,7 +315,7 @@ public:
/**
Conditional merge of related warning information areas.
*/
- void merge_with_routine_info(THD *thd, Warning_info *source);
+ void merge_with_routine_info(THD *thd, const Warning_info *source);
/**
Reset between two COM_ commands. Warnings are preserved
@@ -419,7 +331,7 @@ public:
ulong warn_count() const
{
/*
- This may be higher than warn_list.elements if we have
+ This may be higher than warn_list.elements() if we have
had more warnings than thd->variables.max_error_count.
*/
return (m_warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_NOTE] +
@@ -428,10 +340,9 @@ public:
}
/**
- This is for iteration purposes. We return a non-constant reference
- since List doesn't have constant iterators.
+ Returns a const iterator pointing to the beginning of the warning list.
*/
- List<MYSQL_ERROR> &warn_list() { return m_warn_list; }
+ Const_iterator iterator() const { return m_warn_list; }
/**
The number of errors, or number of rows returned by SHOW ERRORS,
@@ -446,7 +357,7 @@ public:
ulonglong warn_id() const { return m_warn_id; }
/** Do we have any errors and warnings that we can *show*? */
- bool is_empty() const { return m_warn_list.elements == 0; }
+ bool is_empty() const { return m_warn_list.is_empty(); }
/** Increment the current row counter to point at the next row. */
void inc_current_row_for_warning() { m_current_row_for_warning++; }
@@ -524,11 +435,138 @@ public:
char *ptr() { return err_buffer; }
};
+///////////////////////////////////////////////////////////////////////////
+
+/**
+ Stores status of the currently executed statement.
+ Cleared at the beginning of the statement, and then
+ can hold either OK, ERROR, or EOF status.
+ Can not be assigned twice per statement.
+*/
+
+class Diagnostics_area
+{
+public:
+ enum enum_diagnostics_status
+ {
+ /** The area is cleared at start of a statement. */
+ DA_EMPTY= 0,
+ /** Set whenever one calls my_ok(). */
+ DA_OK,
+ /** Set whenever one calls my_eof(). */
+ DA_EOF,
+ /** Set whenever one calls my_error() or my_message(). */
+ DA_ERROR,
+ /** Set in case of a custom response, such as one from COM_STMT_PREPARE. */
+ DA_DISABLED
+ };
+ /** True if status information is sent to the client. */
+ bool is_sent;
+ /** Set to make set_error_status after set_{ok,eof}_status possible. */
+ bool can_overwrite_status;
+
+ void set_ok_status(THD *thd, ulonglong affected_rows_arg,
+ ulonglong last_insert_id_arg,
+ const char *message);
+ void set_eof_status(THD *thd);
+ void set_error_status(THD *thd, uint sql_errno_arg, const char *message_arg,
+ const char *sqlstate);
+
+ void disable_status();
+
+ void reset_diagnostics_area();
+
+ bool is_set() const { return m_status != DA_EMPTY; }
+ bool is_error() const { return m_status == DA_ERROR; }
+ bool is_eof() const { return m_status == DA_EOF; }
+ bool is_ok() const { return m_status == DA_OK; }
+ bool is_disabled() const { return m_status == DA_DISABLED; }
+ enum_diagnostics_status status() const { return m_status; }
+
+ const char *message() const
+ { DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK); return m_message; }
+
+ uint sql_errno() const
+ { DBUG_ASSERT(m_status == DA_ERROR); return m_sql_errno; }
+
+ const char* get_sqlstate() const
+ { DBUG_ASSERT(m_status == DA_ERROR); return m_sqlstate; }
+
+ ulonglong affected_rows() const
+ { DBUG_ASSERT(m_status == DA_OK); return m_affected_rows; }
+
+ ulonglong last_insert_id() const
+ { DBUG_ASSERT(m_status == DA_OK); return m_last_insert_id; }
+
+ uint statement_warn_count() const
+ {
+ DBUG_ASSERT(m_status == DA_OK || m_status == DA_EOF);
+ return m_statement_warn_count;
+ }
+
+public:
+ Diagnostics_area();
+ Diagnostics_area(ulonglong warn_id, bool allow_unlimited_warnings);
+
+public:
+ inline Warning_info *get_warning_info()
+ { return m_current_wi; }
+
+ inline const Warning_info *get_warning_info() const
+ { return m_current_wi; }
+
+ inline void set_warning_info(Warning_info *wi)
+ { m_current_wi= wi; }
+
+private:
+ /** Message buffer. Can be used by OK or ERROR status. */
+ char m_message[MYSQL_ERRMSG_SIZE];
+ /**
+ SQL error number. One of ER_ codes from share/errmsg.txt.
+ Set by set_error_status.
+ */
+ uint m_sql_errno;
+
+ char m_sqlstate[SQLSTATE_LENGTH+1];
+
+ /**
+ 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
+ function ROW_COUNT() and is cleared only by statements that
+ update its value, such as INSERT, UPDATE, DELETE and few others.
+ This member is cleared at the beginning of the next statement.
+
+ We could possibly merge the two, but life cycle of thd->row_count_func
+ can not be changed.
+ */
+ ulonglong m_affected_rows;
+ /**
+ Similarly to the previous member, this is a replacement of
+ thd->first_successful_insert_id_in_prev_stmt, which is used
+ to implement LAST_INSERT_ID().
+ */
+ ulonglong m_last_insert_id;
+ /**
+ Number of warnings of this last statement. May differ from
+ the number of warnings returned by SHOW WARNINGS e.g. in case
+ the statement doesn't clear the warnings, and doesn't generate
+ them.
+ */
+ uint m_statement_warn_count;
+ enum_diagnostics_status m_status;
+
+ Warning_info m_main_wi;
+ Warning_info *m_current_wi;
+};
+
+///////////////////////////////////////////////////////////////////////////
+
void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
uint code, const char *msg);
void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
- uint code, const char *format, ...);
+ uint code, const char *format, ...);
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
uint32 convert_error_message(char *to, uint32 to_length,
const CHARSET_INFO *to_cs,
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2011-05-30 06:25:47 +0000
+++ b/sql/sql_insert.cc 2011-06-10 16:57:01 +0000
@@ -931,7 +931,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
error=write_record(thd, table ,&info);
if (error)
break;
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
}
free_underlaid_joins(thd, &thd->lex->select_lex);
@@ -1086,11 +1086,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(lock_type == TL_WRITE_DELAYED) ? (ulong) 0 :
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted + updated),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
::my_ok(thd, info.copied + info.deleted + updated, id, buff);
}
thd->abort_on_warning= 0;
@@ -2153,10 +2153,11 @@ bool delayed_get_table(THD *thd, MDL_req
want to send "Server shutdown in progress" in the
INSERT THREAD.
*/
- if (di->thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
+ if (di->thd.get_stmt_da()->sql_errno() == ER_SERVER_SHUTDOWN)
my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
else
- my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(),
+ my_message(di->thd.get_stmt_da()->sql_errno(),
+ di->thd.get_stmt_da()->message(),
MYF(0));
}
di->unlock();
@@ -2241,10 +2242,12 @@ TABLE *Delayed_insert::get_local_table(T
killed using THD::notify_shared_lock() or
kill_delayed_threads_for_table().
*/
- if (!thd.is_error() || thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
+ if (!thd.is_error() ||
+ thd.get_stmt_da()->sql_errno() == ER_SERVER_SHUTDOWN)
my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
else
- my_message(thd.stmt_da->sql_errno(), thd.stmt_da->message(), MYF(0));
+ my_message(thd.get_stmt_da()->sql_errno(),
+ thd.get_stmt_da()->message(), MYF(0));
goto error;
}
}
@@ -2627,8 +2630,8 @@ pthread_handler_t handle_delayed_insert(
if (my_thread_init())
{
/* Can't use my_error since store_globals has not yet been called */
- thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES), NULL);
+ thd->get_stmt_da()->set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES), NULL);
di->handler_thread_initialized= TRUE;
}
else
@@ -2638,8 +2641,8 @@ pthread_handler_t handle_delayed_insert(
if (init_thr_lock() || thd->store_globals())
{
/* Can't use my_error since store_globals has perhaps failed */
- thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES), NULL);
+ thd->get_stmt_da()->set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES), NULL);
di->handler_thread_initialized= TRUE;
thd->fatal_error();
goto err;
@@ -3048,7 +3051,7 @@ bool Delayed_insert::handle_inserts(void
{
/* This should never happen */
table->file->print_error(error,MYF(0));
- sql_print_error("%s", thd.stmt_da->message());
+ sql_print_error("%s", thd.get_stmt_da()->message());
DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed in loop"));
goto err;
}
@@ -3093,7 +3096,7 @@ bool Delayed_insert::handle_inserts(void
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{ // This shouldn't happen
table->file->print_error(error,MYF(0));
- sql_print_error("%s", thd.stmt_da->message());
+ sql_print_error("%s", thd.get_stmt_da()->message());
DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed after loop"));
goto err;
}
@@ -3519,7 +3522,7 @@ bool select_insert::send_eof()
error= (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
table->file->ha_end_bulk_insert() : 0);
if (!error && thd->is_error())
- error= thd->stmt_da->sql_errno();
+ error= thd->get_stmt_da()->sql_errno();
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
@@ -3570,11 +3573,11 @@ bool select_insert::send_eof()
if (info.ignore)
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted+info.updated),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
row_count= info.copied + info.deleted +
((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
info.touched : info.updated);
=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_lex.cc 2011-06-10 09:52:57 +0000
@@ -380,6 +380,8 @@ void lex_start(THD *thd)
lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
lex->select_lex.init_order();
lex->select_lex.group_list.empty();
+ if (lex->select_lex.group_list_ptrs)
+ lex->select_lex.group_list_ptrs->clear();
lex->describe= DESCRIBE_NONE;
lex->subqueries= FALSE;
lex->context_analysis_only= 0;
@@ -1776,6 +1778,8 @@ void st_select_lex::init_select()
st_select_lex_node::init_select();
sj_nests.empty();
group_list.empty();
+ if (group_list_ptrs)
+ group_list_ptrs->clear();
type= db= 0;
having= 0;
table_join_options= 0;
@@ -3059,6 +3063,8 @@ static void fix_prepare_info_in_table_li
The passed WHERE and HAVING are to be saved for the future executions.
This function saves it, and returns a copy which can be thrashed during
this execution of the statement. By saving/thrashing here we mean only
+ We also save the chain of ORDER::next in group_list, in case
+ the list is modified by remove_const().
AND/OR trees.
The function also calls fix_prepare_info_in_table_list that saves all
ON expressions.
@@ -3070,6 +3076,19 @@ void st_select_lex::fix_prepare_informat
if (!thd->stmt_arena->is_conventional() && first_execution)
{
first_execution= 0;
+ if (group_list.first)
+ {
+ if (!group_list_ptrs)
+ {
+ void *mem= thd->stmt_arena->alloc(sizeof(Group_list_ptrs));
+ group_list_ptrs= new (mem) Group_list_ptrs(thd->stmt_arena->mem_root);
+ }
+ group_list_ptrs->reserve(group_list.elements);
+ for (ORDER *order= group_list.first; order; order= order->next)
+ {
+ group_list_ptrs->push_back(order);
+ }
+ }
if (*conds)
{
prep_where= *conds;
=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h 2011-05-12 17:29:19 +0000
+++ b/sql/sql_lex.h 2011-06-10 09:52:57 +0000
@@ -24,6 +24,7 @@
#include "sql_trigger.h"
#include "item.h" /* From item_subselect.h: subselect_union_engine */
#include "thr_lock.h" /* thr_lock_type, TL_UNLOCK */
+#include "mem_root_array.h"
/* YACC and LEX Definitions */
@@ -185,6 +186,7 @@ enum enum_drop_mode
#define TL_OPTION_ALIAS 8
typedef List<Item> List_item;
+typedef Mem_root_array<ORDER*, true> Group_list_ptrs;
/* SERVERS CACHE CHANGES */
typedef struct st_lex_server_options
@@ -628,7 +630,16 @@ public:
enum olap_type olap;
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
SQL_I_List<TABLE_LIST> table_list;
- SQL_I_List<ORDER> group_list; /* GROUP BY clause. */
+
+ /*
+ GROUP BY clause.
+ This list may be mutated during optimization (by remove_const()),
+ so for prepared statements, we keep a copy of the ORDER.next pointers in
+ group_list_ptrs, and re-establish the original list before each execution.
+ */
+ SQL_I_List<ORDER> group_list;
+ Group_list_ptrs *group_list_ptrs;
+
List<Item> item_list; /* list of fields & expressions */
List<String> interval_list;
bool is_item_list_lookup;
@@ -819,7 +830,8 @@ public:
bool test_limit();
friend void lex_start(THD *thd);
- st_select_lex() : n_sum_items(0), n_child_sum_items(0) {}
+ st_select_lex() : group_list_ptrs(NULL), n_sum_items(0), n_child_sum_items(0)
+ {}
void make_empty_select()
{
init_query();
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_load.cc 2011-06-10 16:57:01 +0000
@@ -590,7 +590,7 @@ int mysql_load(THD *thd,sql_exchange *ex
}
sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
@@ -833,7 +833,7 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
}
@@ -857,7 +857,7 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
}
if (thd->killed ||
@@ -893,9 +893,9 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
}
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -959,7 +959,7 @@ read_sep_field(THD *thd, COPY_INFO &info
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
DBUG_RETURN(1);
}
field->set_null();
@@ -1031,7 +1031,7 @@ read_sep_field(THD *thd, COPY_INFO &info
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
DBUG_RETURN(1);
}
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
@@ -1046,7 +1046,7 @@ read_sep_field(THD *thd, COPY_INFO &info
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
}
else if (item->type() == Item::STRING_ITEM)
{
@@ -1092,11 +1092,11 @@ read_sep_field(THD *thd, COPY_INFO &info
thd->cuted_fields++; /* To long row */
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
if (thd->killed)
DBUG_RETURN(1);
}
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -1230,7 +1230,7 @@ read_xml_field(THD *thd, COPY_INFO &info
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_stmt_wi()->current_row_for_warning());
}
else
((Item_user_var_as_out_param *)item)->set_null_value(cs);
@@ -1260,7 +1260,7 @@ read_xml_field(THD *thd, COPY_INFO &info
We don't need to reset auto-increment field since we are restoring
its default value at the beginning of each loop iteration.
*/
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error) || thd->is_error());
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-06-06 19:24:25 +0000
+++ b/sql/sql_parse.cc 2011-06-18 20:34:45 +0000
@@ -797,7 +797,7 @@ bool do_command(THD *thd)
Consider moving to init_connect() instead.
*/
thd->clear_error(); // Clear error message
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
net_new_transaction(net);
@@ -1189,7 +1189,7 @@ bool dispatch_command(enum enum_server_c
}
/* PSI end */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->stmt_da);
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
/* DTRACE end */
if (MYSQL_QUERY_DONE_ENABLED())
@@ -1335,7 +1335,7 @@ bool dispatch_command(enum enum_server_c
/* We don't calculate statistics for this command */
general_log_print(thd, command, NullS);
net->error=0; // Don't give 'abort' message
- thd->stmt_da->disable_status(); // Don't send anything back
+ thd->get_stmt_da()->disable_status(); // Don't send anything back
error=TRUE; // End server
break;
#ifndef EMBEDDED_LIBRARY
@@ -1475,7 +1475,7 @@ bool dispatch_command(enum enum_server_c
#else
(void) my_net_write(net, (uchar*) buff, length);
(void) net_flush(net);
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
#endif
break;
}
@@ -1550,7 +1550,8 @@ bool dispatch_command(enum enum_server_c
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0);
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_STATUS,
- thd->stmt_da->is_error() ? thd->stmt_da->sql_errno() : 0,
+ thd->get_stmt_da()->is_error() ?
+ thd->get_stmt_da()->sql_errno() : 0,
command_name[command].str);
log_slow_statement(thd);
@@ -1563,7 +1564,7 @@ bool dispatch_command(enum enum_server_c
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
/* Performance Schema Interface instrumentation, end */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->stmt_da);
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
/* DTRACE instrumentation, end */
@@ -2040,12 +2041,12 @@ mysql_execute_command(THD *thd)
variables, but for now this is probably good enough.
*/
if ((sql_command_flags[lex->sql_command] & CF_DIAGNOSTIC_STMT) != 0)
- thd->warning_info->set_read_only(TRUE);
+ thd->get_stmt_wi()->set_read_only(TRUE);
else
{
- thd->warning_info->set_read_only(FALSE);
+ thd->get_stmt_wi()->set_read_only(FALSE);
if (all_tables)
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->opt_clear_warning_info(thd->query_id);
}
#ifdef HAVE_REPLICATION
@@ -2186,6 +2187,11 @@ mysql_execute_command(THD *thd)
*/
if (stmt_causes_implicit_commit(thd, CF_IMPLICT_COMMIT_BEGIN))
{
+ /*
+ Note that this should never happen inside of stored functions
+ or triggers as all such statements prohibited there.
+ */
+ DBUG_ASSERT(! thd->in_sub_stmt);
/* Commit or rollback the statement transaction. */
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
/* Commit the normal transaction if one is active. */
@@ -4542,7 +4548,7 @@ finish:
/* report error issued during command execution */
if (thd->killed_errno())
{
- if (! thd->stmt_da->is_set())
+ if (! thd->get_stmt_da()->is_set())
thd->send_kill_message();
}
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
@@ -4555,9 +4561,9 @@ finish:
else
{
/* If commit fails, we should be able to reset the OK status. */
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
}
@@ -4576,10 +4582,10 @@ finish:
/* No transaction control allowed in sub-statements. */
DBUG_ASSERT(! thd->in_sub_stmt);
/* If commit fails, we should be able to reset the OK status. */
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
/* Commit the normal transaction if one is active. */
trans_commit_implicit(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
thd->mdl_context.release_transactional_locks();
}
else if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
@@ -5458,8 +5464,8 @@ void THD::reset_for_next_command()
thd->user_var_events_alloc= thd->mem_root;
}
thd->clear_error();
- thd->stmt_da->reset_diagnostics_area();
- thd->warning_info->reset_for_next_command();
+ thd->get_stmt_da()->reset_diagnostics_area();
+ thd->get_stmt_wi()->reset_for_next_command();
thd->rand_used= 0;
thd->m_sent_row_count= thd->m_examined_row_count= 0;
thd->thd_marker.emb_on_expr_nest= NULL;
=== modified file 'sql/sql_plist.h'
--- a/sql/sql_plist.h 2011-04-13 11:31:44 +0000
+++ b/sql/sql_plist.h 2011-06-15 22:31:43 +0000
@@ -1,6 +1,6 @@
#ifndef SQL_PLIST_H
#define SQL_PLIST_H
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, 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
@@ -18,7 +18,7 @@
#include <my_global.h>
-template <typename T, typename B, typename C, typename I>
+template <typename T, typename L>
class I_P_List_iterator;
class I_P_List_null_counter;
template <typename T> class I_P_List_no_push_back;
@@ -142,10 +142,14 @@ public:
I::set_last(&rhs.m_first);
C::swap(rhs);
}
+ typedef B Adapter;
+ typedef I_P_List<T, B, C, I> Base;
+ typedef I_P_List_iterator<T, Base> Iterator;
+ typedef I_P_List_iterator<const T, Base> Const_Iterator;
#ifndef _lint
- friend class I_P_List_iterator<T, B, C, I>;
+ friend class I_P_List_iterator<T, Base>;
+ friend class I_P_List_iterator<const T, Base>;
#endif
- typedef I_P_List_iterator<T, B, C, I> Iterator;
};
@@ -153,19 +157,17 @@ public:
Iterator for I_P_List.
*/
-template <typename T, typename B,
- typename C = I_P_List_null_counter,
- typename I = I_P_List_no_push_back<T> >
+template <typename T, typename L>
class I_P_List_iterator
{
- const I_P_List<T, B, C, I> *list;
+ const L *list;
T *current;
public:
- I_P_List_iterator(const I_P_List<T, B, C, I> &a)
+ I_P_List_iterator(const L &a)
: list(&a), current(a.m_first) {}
- I_P_List_iterator(const I_P_List<T, B, C, I> &a, T* current_arg)
+ I_P_List_iterator(const L &a, T* current_arg)
: list(&a), current(current_arg) {}
- inline void init(const I_P_List<T, B, C, I> &a)
+ inline void init(const L &a)
{
list= &a;
current= a.m_first;
@@ -174,12 +176,12 @@ public:
{
T *result= current;
if (result)
- current= *B::next_ptr(current);
+ current= *L::Adapter::next_ptr(current);
return result;
}
inline T* operator++()
{
- current= *B::next_ptr(current);
+ current= *L::Adapter::next_ptr(current);
return current;
}
inline void rewind()
@@ -198,7 +200,7 @@ template <typename T, T* T::*next, T** T
struct I_P_List_adapter
{
static inline T **next_ptr(T *el) { return &(el->*next); }
-
+ static inline const T* const* next_ptr(const T *el) { return &(el->*next); }
static inline T ***prev_ptr(T *el) { return &(el->*prev); }
};
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_prepare.cc 2011-06-10 16:57:01 +0000
@@ -340,7 +340,7 @@ static bool send_prep_stmt(Prepared_stat
int2store(buff+5, columns);
int2store(buff+7, stmt->param_count);
buff[9]= 0; // Guard against a 4.1 client
- tmp= min(stmt->thd->warning_info->statement_warn_count(), 65535);
+ tmp= min(stmt->thd->get_stmt_wi()->statement_warn_count(), 65535);
int2store(buff+10, tmp);
/*
@@ -357,7 +357,7 @@ static bool send_prep_stmt(Prepared_stat
if (!error)
/* Flag that a response has already been sent */
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
DBUG_RETURN(error);
}
@@ -370,7 +370,7 @@ static bool send_prep_stmt(Prepared_stat
thd->client_stmt_id= stmt->id;
thd->client_param_count= stmt->param_count;
thd->clear_error();
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
return 0;
}
@@ -1957,7 +1957,7 @@ static bool check_prepared_statement(Pre
/* Reset warning count for each query that uses tables */
if (tables)
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->opt_clear_warning_info(thd->query_id);
if (sql_command_flags[sql_command] & CF_HA_CLOSE)
mysql_ha_rm_tables(thd, tables);
@@ -2428,6 +2428,14 @@ void reinit_stmt_before_use(THD *thd, LE
DBUG_ASSERT(sl->join == 0);
ORDER *order;
/* Fix GROUP list */
+ if (sl->group_list_ptrs && sl->group_list_ptrs->size() > 0)
+ {
+ for (uint ix= 0; ix < sl->group_list_ptrs->size() - 1; ++ix)
+ {
+ order= sl->group_list_ptrs->at(ix);
+ order->next= sl->group_list_ptrs->at(ix+1);
+ }
+ }
for (order= sl->group_list.first; order; order= order->next)
order->item= &order->item_ptr;
/* Fix ORDER list */
@@ -2745,7 +2753,7 @@ void mysqld_stmt_close(THD *thd, char *p
Prepared_statement *stmt;
DBUG_ENTER("mysqld_stmt_close");
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
if (!(stmt= find_prepared_statement(thd, stmt_id)))
DBUG_VOID_RETURN;
@@ -2821,7 +2829,7 @@ void mysql_stmt_get_longdata(THD *thd, c
status_var_increment(thd->status_var.com_stmt_send_long_data);
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
#ifndef EMBEDDED_LIBRARY
/* Minimal size of long data packet is 6 bytes */
if (packet_length < MYSQL_LONG_DATA_HEADER)
@@ -2850,26 +2858,23 @@ void mysql_stmt_get_longdata(THD *thd, c
param= stmt->param_array[param_number];
- Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da;
- Warning_info new_warnning_info(thd->query_id, false);
- Warning_info *save_warinig_info= thd->warning_info;
+ Diagnostics_area new_stmt_da(thd->query_id, false);
+ Diagnostics_area *save_stmt_da= thd->get_stmt_da();
- thd->stmt_da= &new_stmt_da;
- thd->warning_info= &new_warnning_info;
+ thd->set_stmt_da(&new_stmt_da);
#ifndef EMBEDDED_LIBRARY
param->set_longdata(packet, (ulong) (packet_end - packet));
#else
param->set_longdata(thd->extra_data, thd->extra_length);
#endif
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
{
stmt->state= Query_arena::STMT_ERROR;
- stmt->last_errno= thd->stmt_da->sql_errno();
- strncpy(stmt->last_error, thd->stmt_da->message(), MYSQL_ERRMSG_SIZE);
+ stmt->last_errno= thd->get_stmt_da()->sql_errno();
+ strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
}
- thd->stmt_da= save_stmt_da;
- thd->warning_info= save_warinig_info;
+ thd->set_stmt_da(save_stmt_da);
general_log_print(thd, thd->get_command(), NullS);
@@ -2945,8 +2950,8 @@ Reprepare_observer::report_error(THD *th
that this thread execution stops and returns to the caller,
backtracking all the way to Prepared_statement::execute_loop().
*/
- thd->stmt_da->set_error_status(thd, ER_NEED_REPREPARE,
- ER(ER_NEED_REPREPARE), "HY000");
+ thd->get_stmt_da()->set_error_status(thd, ER_NEED_REPREPARE,
+ ER(ER_NEED_REPREPARE), "HY000");
m_invalidated= TRUE;
return TRUE;
@@ -3454,7 +3459,7 @@ reexecute:
reprepare_observer.is_invalidated() &&
reprepare_attempt++ < MAX_REPREPARE_ATTEMPTS)
{
- DBUG_ASSERT(thd->stmt_da->sql_errno() == ER_NEED_REPREPARE);
+ DBUG_ASSERT(thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE);
thd->clear_error();
error= reprepare();
@@ -3556,7 +3561,7 @@ Prepared_statement::reprepare()
Sic: we can't simply silence warnings during reprepare, because if
it's failed, we need to return all the warnings to the user.
*/
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->clear_warning_info(thd->query_id);
}
return error;
}
@@ -3918,7 +3923,7 @@ Ed_result_set::Ed_result_set(List<Ed_row
*/
Ed_connection::Ed_connection(THD *thd)
- :m_warning_info(thd->query_id, false),
+ :m_diagnostics_area(thd->query_id, false),
m_thd(thd),
m_rsets(0),
m_current_rset(0)
@@ -3944,7 +3949,7 @@ Ed_connection::free_old_result()
}
m_current_rset= m_rsets;
m_diagnostics_area.reset_diagnostics_area();
- m_warning_info.clear_warning_info(m_thd->query_id);
+ m_diagnostics_area.get_warning_info()->clear_warning_info(m_thd->query_id);
}
@@ -3981,23 +3986,20 @@ bool Ed_connection::execute_direct(Serve
Protocol_local protocol_local(m_thd, this);
Prepared_statement stmt(m_thd);
Protocol *save_protocol= m_thd->protocol;
- Diagnostics_area *save_diagnostics_area= m_thd->stmt_da;
- Warning_info *save_warning_info= m_thd->warning_info;
+ Diagnostics_area *save_diagnostics_area= m_thd->get_stmt_da();
DBUG_ENTER("Ed_connection::execute_direct");
free_old_result(); /* Delete all data from previous execution, if any */
m_thd->protocol= &protocol_local;
- m_thd->stmt_da= &m_diagnostics_area;
- m_thd->warning_info= &m_warning_info;
+ m_thd->set_stmt_da(&m_diagnostics_area);
rc= stmt.execute_server_runnable(server_runnable);
m_thd->protocol->end_statement();
m_thd->protocol= save_protocol;
- m_thd->stmt_da= save_diagnostics_area;
- m_thd->warning_info= save_warning_info;
+ m_thd->set_stmt_da(save_diagnostics_area);
/*
Protocol_local makes use of m_current_rset to keep
track of the last result set, while adding result sets to the end.
=== modified file 'sql/sql_prepare.h'
--- a/sql/sql_prepare.h 2010-07-02 18:15:21 +0000
+++ b/sql/sql_prepare.h 2011-06-15 22:31:43 +0000
@@ -252,16 +252,9 @@ public:
*/
ulong get_warn_count() const
{
- return m_warning_info.warn_count();
+ return m_diagnostics_area.get_warning_info()->warn_count();
}
- /**
- Get the server warnings as a result set.
- The result set has fixed metadata:
- The first column is the level.
- The second is a numeric code.
- The third is warning text.
- */
- List<MYSQL_ERROR> *get_warn_list() { return &m_warning_info.warn_list(); }
+
/**
The following members are only valid if execute_direct()
or move_to_next_result() returned an error.
@@ -310,7 +303,6 @@ public:
~Ed_connection() { free_old_result(); }
private:
Diagnostics_area m_diagnostics_area;
- Warning_info m_warning_info;
/**
Execute direct interface does not support multi-statements, only
multi-results. So we never have a situation when we have
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_select.cc 2011-06-10 16:57:01 +0000
@@ -1270,14 +1270,8 @@ static void save_index_subquery_explain_
join_tab->packed_info |= TAB_INFO_USING_INDEX;
if (where)
join_tab->packed_info |= TAB_INFO_USING_WHERE;
- for (uint i = 0; i < join_tab->ref.key_parts; i++)
- {
- if (join_tab->ref.cond_guards[i])
- {
- join_tab->packed_info |= TAB_INFO_FULL_SCAN_ON_NULL;
- break;
- }
- }
+ if (join_tab->has_guarded_conds())
+ join_tab->packed_info|= TAB_INFO_FULL_SCAN_ON_NULL;
}
@@ -10118,7 +10112,7 @@ static bool uses_index_fields_only(Item
contains a subquery. If this is the case we do not include this
part of the condition.
*/
- return !item->with_subselect;
+ return !item->has_subquery();
}
const Item::Type item_type= item->type();
@@ -11971,7 +11965,7 @@ remove_const(JOIN *join,ORDER *first_ord
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
- if (order->item[0]->with_subselect &&
+ if (order->item[0]->has_subquery() &&
!(join->select_lex->options & SELECT_DESCRIBE))
order->item[0]->val_str(&order->item[0]->str_value);
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
@@ -14821,24 +14815,41 @@ internal_remove_eq_conds(THD *thd, Item
Field *field=((Item_field*) args[0])->field;
/* fix to replace 'NULL' dates with '0' (shreeve@stripped) */
/*
- datetime_field IS NULL has to be modified to
- datetime_field == 0
+ See BUG#12594011
+ Documentation says that
+ SELECT datetime_notnull d FROM t1 WHERE d IS NULL
+ shall return rows where d=='0000-00-00'
+
+ Thus, for DATE and DATETIME columns defined as NOT NULL,
+ "date_notnull IS NULL" has to be modified to
+ "date_notnull IS NULL OR date_notnull == 0" (if outer join)
+ "date_notnull == 0" (otherwise)
+
*/
if (((field->type() == MYSQL_TYPE_DATE) ||
(field->type() == MYSQL_TYPE_DATETIME)) &&
- (field->flags & NOT_NULL_FLAG) && !field->table->maybe_null)
+ (field->flags & NOT_NULL_FLAG))
{
- Item *new_cond;
- if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2))))
- {
- cond=new_cond;
- /*
- Item_func_eq can't be fixed after creation so we do not check
- cond->fixed, also it do not need tables so we use 0 as second
- argument.
- */
- cond->fix_fields(thd, &cond);
- }
+ Item *item0= new(thd->mem_root) Item_int((longlong)0, 1);
+ Item *eq_cond= new(thd->mem_root) Item_func_eq(args[0], item0);
+ if (!eq_cond)
+ return cond;
+
+ if (field->table->pos_in_table_list->outer_join)
+ {
+ // outer join: transform "col IS NULL" to "col IS NULL or col=0"
+ Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, cond);
+ if (!or_cond)
+ return cond;
+ cond= or_cond;
+ }
+ else
+ {
+ // not outer join: transform "col IS NULL" to "col=0"
+ cond= eq_cond;
+ }
+
+ cond->fix_fields(thd, &cond);
}
}
if (cond->const_item())
@@ -17661,7 +17672,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
/* Set first_unmatched for the last inner table of this group */
join_tab->last_inner->first_unmatched= join_tab;
}
- join->thd->warning_info->reset_current_row_for_warning();
+ join->thd->get_stmt_wi()->reset_current_row_for_warning();
error= (*join_tab->read_first_record)(join_tab);
@@ -17988,7 +17999,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
enum enum_nested_loop_state rc;
/* A match from join_tab is found for the current partial join. */
rc= (*join_tab->next_select)(join, join_tab+1, 0);
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_stmt_wi()->inc_current_row_for_warning();
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
DBUG_RETURN(rc);
@@ -18020,7 +18031,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
}
else
{
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_stmt_wi()->inc_current_row_for_warning();
if (join_tab->not_null_compl)
{
/* a NULL-complemented row is not in a table so cannot be locked */
@@ -18035,7 +18046,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
with the beginning coinciding with the current partial join.
*/
join->examined_rows++;
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_stmt_wi()->inc_current_row_for_warning();
if (join_tab->not_null_compl)
join_tab->read_record.unlock_row(join_tab);
}
@@ -19722,27 +19733,23 @@ static Item *
part_of_refkey(TABLE *table,Field *field)
{
if (!table->reginfo.join_tab)
- return (Item*) 0; // field from outer non-select (UPDATE,...)
+ return NULL; // field from outer non-select (UPDATE,...)
uint ref_parts=table->reginfo.join_tab->ref.key_parts;
if (ref_parts)
{
- KEY_PART_INFO *key_part=
- table->key_info[table->reginfo.join_tab->ref.key].key_part;
- uint part;
+ if (table->reginfo.join_tab->has_guarded_conds())
+ return NULL;
- for (part=0 ; part < ref_parts ; part++)
- {
- if (table->reginfo.join_tab->ref.cond_guards[part])
- return 0;
- }
+ const KEY_PART_INFO *key_part=
+ table->key_info[table->reginfo.join_tab->ref.key].key_part;
- for (part=0 ; part < ref_parts ; part++,key_part++)
+ for (uint part=0 ; part < ref_parts ; part++,key_part++)
if (field->eq(key_part->field) &&
!(key_part->key_part_flag & HA_PART_KEY_SEG))
return table->reginfo.join_tab->ref.items[part];
}
- return (Item*) 0;
+ return NULL;
}
@@ -23479,14 +23486,8 @@ void select_describe(JOIN *join, bool ne
extra.append(STRING_WITH_LEN("; End materialize"));
}
- for (uint part= 0; part < tab->ref.key_parts; part++)
- {
- if (tab->ref.cond_guards[part])
- {
- extra.append(STRING_WITH_LEN("; Full scan on NULL key"));
- break;
- }
- }
+ if (tab->has_guarded_conds())
+ extra.append(STRING_WITH_LEN("; Full scan on NULL key"));
if (i > 0 && tab[-1].next_select == sub_select_cache)
{
=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc 2011-04-19 03:29:06 +0000
+++ b/sql/sql_servers.cc 2011-06-09 08:58:41 +0000
@@ -261,9 +261,9 @@ bool servers_reload(THD *thd)
Execution might have been interrupted; only print the error message
if an error condition has been raised.
*/
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
sql_print_error("Can't open and lock privilege tables: %s",
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
return_val= FALSE;
goto end;
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_show.cc 2011-06-15 22:31:43 +0000
@@ -3130,7 +3130,7 @@ fill_schema_table_by_open(THD *thd, bool
of backward compatibility.
*/
if (!is_show_fields_or_keys && result && thd->is_error() &&
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
{
/*
Hide error for a non-existing table.
@@ -3220,7 +3220,7 @@ static int fill_schema_table_names(THD *
default:
DBUG_ASSERT(0);
}
- if (thd->is_error() && thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ if (thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
{
thd->clear_error();
return 0;
@@ -4118,13 +4118,13 @@ err:
column with the error text, and clear the error so that the operation
can continue.
*/
- const char *error= thd->is_error() ? thd->stmt_da->message() : "";
+ const char *error= thd->is_error() ? thd->get_stmt_da()->message() : "";
table->field[20]->store(error, strlen(error), cs);
if (thd->is_error())
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
}
}
@@ -4281,7 +4281,7 @@ static int get_schema_column_record(THD
*/
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
res= 0;
}
@@ -4942,7 +4942,7 @@ static int get_schema_stat_record(THD *t
*/
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
res= 0;
}
@@ -5161,7 +5161,7 @@ static int get_schema_views_record(THD *
DBUG_RETURN(1);
if (res && thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
}
if (res)
thd->clear_error();
@@ -5195,7 +5195,7 @@ static int get_schema_constraints_record
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5298,7 +5298,7 @@ static int get_schema_triggers_record(TH
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5379,7 +5379,7 @@ static int get_schema_key_column_usage_r
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5666,7 +5666,7 @@ static int get_schema_partitions_record(
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -6195,7 +6195,7 @@ get_referential_constraints_record(THD *
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -6803,25 +6803,26 @@ static bool do_fill_table(THD *thd,
// Warning_info, so "useful warnings" get rejected. In order to avoid
// that problem we create a Warning_info instance, which is capable of
// storing "unlimited" number of warnings.
- Warning_info wi(thd->query_id, true);
- Warning_info *wi_saved= thd->warning_info;
+ Diagnostics_area *da= thd->get_stmt_da();
+ Warning_info *wi= da->get_warning_info();
+ Warning_info wi_tmp(thd->query_id, true);
- thd->warning_info= &wi;
+ da->set_warning_info(&wi_tmp);
bool res= table_list->schema_table->fill_table(
thd, table_list, join_table->condition());
- thd->warning_info= wi_saved;
+ da->set_warning_info(wi);
// Pass an error if any.
- if (thd->stmt_da->is_error())
+ if (da->is_error())
{
- thd->warning_info->push_warning(thd,
- thd->stmt_da->sql_errno(),
- thd->stmt_da->get_sqlstate(),
- MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->stmt_da->message());
+ wi->push_warning(thd,
+ da->sql_errno(),
+ da->get_sqlstate(),
+ MYSQL_ERROR::WARN_LEVEL_ERROR,
+ da->message());
}
// Pass warnings (if any).
@@ -6829,14 +6830,13 @@ static bool do_fill_table(THD *thd,
// Filter out warnings with WARN_LEVEL_ERROR level, because they
// correspond to the errors which were filtered out in fill_table().
-
- List_iterator_fast<MYSQL_ERROR> it(wi.warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= wi_tmp.iterator();
+ const MYSQL_ERROR *err;
while ((err= it++))
{
if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_ERROR)
- thd->warning_info->push_warning(thd, err);
+ wi->push_warning(thd, err);
}
return res;
=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc 2011-03-09 20:54:55 +0000
+++ b/sql/sql_signal.cc 2011-06-10 16:57:01 +0000
@@ -467,9 +467,9 @@ bool Sql_cmd_signal::execute(THD *thd)
This has roots in the SQL standard specification for SIGNAL.
*/
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
thd->set_row_count_func(0);
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_stmt_wi()->clear_warning_info(thd->query_id);
result= raise_condition(thd, &cond);
@@ -484,7 +484,7 @@ bool Sql_cmd_resignal::execute(THD *thd)
DBUG_ENTER("Sql_cmd_resignal::execute");
- thd->warning_info->m_warn_id= thd->query_id;
+ thd->get_stmt_wi()->m_warn_id= thd->query_id;
if (! thd->spcont || ! (signaled= thd->spcont->raised_condition()))
{
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-06-01 09:11:28 +0000
+++ b/sql/sql_table.cc 2011-06-16 23:45:58 +0000
@@ -2942,8 +2942,8 @@ const CHARSET_INFO* get_sql_field_charse
bool check_duplicate_warning(THD *thd, char *msg, ulong length)
{
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
+ Warning_info::Const_iterator it= thd->get_stmt_wi()->iterator();
+ const MYSQL_ERROR *err;
while ((err= it++))
{
if (strncmp(msg, err->get_message_text(), length) == 0)
@@ -4786,6 +4786,11 @@ bool mysql_create_like_table(THD* thd, T
local_create_info.options|= create_info->options & HA_LEX_CREATE_TMP_TABLE;
/* Reset auto-increment counter for the new table. */
local_create_info.auto_increment_value= 0;
+ /*
+ Do not inherit values of DATA and INDEX DIRECTORY options from
+ the original table. This is documented behavior.
+ */
+ local_create_info.data_file_name= local_create_info.index_file_name= NULL;
if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name,
&local_create_info, &local_alter_info,
@@ -5572,6 +5577,12 @@ mysql_prepare_alter_table(THD *thd, TABL
if (drop)
{
drop_it.remove();
+ /*
+ ALTER TABLE DROP COLUMN always changes table data even in cases
+ when new version of the table has the same structure as the old
+ one.
+ */
+ alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
continue;
}
/* Check if field is changed */
@@ -5649,7 +5660,14 @@ mysql_prepare_alter_table(THD *thd, TABL
if (!def->after)
new_create_list.push_back(def);
else if (def->after == first_keyword)
+ {
new_create_list.push_front(def);
+ /*
+ Re-ordering columns in table can't be done using in-place algorithm
+ as it always changes table data.
+ */
+ alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
+ }
else
{
Create_field *find;
@@ -5665,6 +5683,10 @@ mysql_prepare_alter_table(THD *thd, TABL
goto err;
}
find_it.after(def); // Put element after this
+ /*
+ Re-ordering columns in table can't be done using in-place algorithm
+ as it always changes table data.
+ */
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
}
}
@@ -7053,7 +7075,7 @@ bool mysql_alter_table(THD *thd,char *ne
end_temporary:
my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
(ulong) (copied + deleted), (ulong) deleted,
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
my_ok(thd, copied + deleted, 0L, tmp_name);
DBUG_RETURN(FALSE);
@@ -7080,7 +7102,7 @@ err:
Report error here.
*/
if (alter_info->error_if_not_empty &&
- thd->warning_info->current_row_for_warning())
+ thd->get_stmt_wi()->current_row_for_warning())
{
const char *f_val= 0;
enum enum_mysql_timestamp_type t_type= MYSQL_TIMESTAMP_DATE;
@@ -7285,7 +7307,7 @@ copy_data_between_tables(TABLE *from,TAB
init_read_record(&info, thd, from, (SQL_SELECT *) 0, 1, 1, FALSE);
if (ignore)
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- thd->warning_info->reset_current_row_for_warning();
+ thd->get_stmt_wi()->reset_current_row_for_warning();
restore_record(to, s->default_values); // Create empty record
while (!(error=info.read_record(&info)))
{
@@ -7344,7 +7366,7 @@ copy_data_between_tables(TABLE *from,TAB
}
else
found_count++;
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
}
end_read_record(&info);
free_io_cache(from);
=== modified file 'sql/sql_test.cc'
--- a/sql/sql_test.cc 2011-05-18 08:29:46 +0000
+++ b/sql/sql_test.cc 2011-06-15 22:31:43 +0000
@@ -91,7 +91,7 @@ static void print_cached_tables(void)
{
share= (TABLE_SHARE*) my_hash_element(&table_def_cache, idx);
- I_P_List_iterator<TABLE, TABLE_share> it(share->used_tables);
+ TABLE_SHARE::TABLE_list::Iterator it(share->used_tables);
while ((entry= it++))
{
printf("%-14.14s %-32s%6ld%8ld%6d %s\n",
=== modified file 'sql/sql_time.cc'
--- a/sql/sql_time.cc 2011-03-09 20:54:55 +0000
+++ b/sql/sql_time.cc 2011-06-10 16:57:01 +0000
@@ -817,7 +817,7 @@ void make_truncated_value_warning(THD *t
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
type_str, str.c_ptr(), field_name,
- (ulong) thd->warning_info->current_row_for_warning());
+ (ulong) thd->get_stmt_wi()->current_row_for_warning());
else
{
if (time_type > MYSQL_TIMESTAMP_ERROR)
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_trigger.cc 2011-06-10 07:38:06 +0000
@@ -31,6 +31,7 @@
#include "sql_acl.h" // *_ACL, is_acl_user
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sp_cache.h" // sp_invalidate_cache
+#include <mysys_err.h>
/*************************************************************************/
@@ -305,6 +306,55 @@ private:
/**
+ An error handler that catches all non-OOM errors which can occur during
+ parsing of trigger body. Such errors are ignored and corresponding error
+ message is used to construct a more verbose error message which contains
+ name of problematic trigger. This error message is later emitted when
+ one tries to perform DML or some of DDL on this table.
+ Also, if possible, grabs name of the trigger being parsed so it can be
+ used to correctly drop problematic trigger.
+*/
+class Deprecated_trigger_syntax_handler : public Internal_error_handler
+{
+private:
+
+ char m_message[MYSQL_ERRMSG_SIZE];
+ LEX_STRING *m_trigger_name;
+
+public:
+
+ Deprecated_trigger_syntax_handler() : m_trigger_name(NULL) {}
+
+ virtual bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* message,
+ MYSQL_ERROR ** cond_hdl)
+ {
+ if (sql_errno != EE_OUTOFMEMORY &&
+ sql_errno != ER_OUT_OF_RESOURCES)
+ {
+ if(thd->lex->spname)
+ m_trigger_name= &thd->lex->spname->m_name;
+ if (m_trigger_name)
+ my_snprintf(m_message, sizeof(m_message),
+ ER(ER_ERROR_IN_TRIGGER_BODY),
+ m_trigger_name->str, message);
+ else
+ my_snprintf(m_message, sizeof(m_message),
+ ER(ER_ERROR_IN_UNKNOWN_TRIGGER_BODY), message);
+ return true;
+ }
+ return false;
+ }
+
+ LEX_STRING *get_trigger_name() { return m_trigger_name; }
+ char *get_error_message() { return m_message; }
+};
+
+
+/**
Create or drop trigger for table.
@param thd current thread context (including trigger definition in LEX)
@@ -591,6 +641,8 @@ bool Table_triggers_list::create_trigger
LEX_STRING *trg_connection_cl_name;
LEX_STRING *trg_db_cl_name;
+ if (check_for_broken_triggers())
+ return true;
/* Trigger must be in the same schema as target table. */
if (my_strcasecmp(table_alias_charset, table->s->db.str,
@@ -864,7 +916,7 @@ static bool rm_trigger_file(char *path,
@param path char buffer of size FN_REFLEN to be used
for constructing path to .TRN file.
@param db trigger's database name
- @param table_name trigger's name
+ @param trigger_name trigger's name
@retval
False success
@@ -1329,12 +1381,11 @@ bool Table_triggers_list::check_n_load(T
lex_start(thd);
thd->spcont= NULL;
- if (parse_sql(thd, & parser_state, creation_ctx))
- {
- /* Currently sphead is always deleted in case of a parse error */
- DBUG_ASSERT(lex.sphead == 0);
- goto err_with_lex_cleanup;
- }
+ Deprecated_trigger_syntax_handler error_handler;
+ thd->push_internal_handler(&error_handler);
+ bool parse_error= parse_sql(thd, & parser_state, creation_ctx);
+ thd->pop_internal_handler();
+
/*
Not strictly necessary to invoke this method here, since we know
that we've parsed CREATE TRIGGER and not an
@@ -1345,6 +1396,54 @@ bool Table_triggers_list::check_n_load(T
*/
lex.set_trg_event_type_for_tables();
+ if (parse_error)
+ {
+ if (!triggers->m_has_unparseable_trigger)
+ triggers->set_parse_error_message(error_handler.get_error_message());
+ /* Currently sphead is always set to NULL in case of a parse error */
+ DBUG_ASSERT(lex.sphead == 0);
+ if (error_handler.get_trigger_name())
+ {
+ LEX_STRING *trigger_name;
+ const LEX_STRING *orig_trigger_name= error_handler.get_trigger_name();
+
+ if (!(trigger_name= alloc_lex_string(&table->mem_root)) ||
+ !(trigger_name->str= strmake_root(&table->mem_root,
+ orig_trigger_name->str,
+ orig_trigger_name->length)))
+ goto err_with_lex_cleanup;
+
+ trigger_name->length= orig_trigger_name->length;
+
+ if (triggers->names_list.push_back(trigger_name,
+ &table->mem_root))
+ goto err_with_lex_cleanup;
+ }
+ else
+ {
+ /*
+ The Table_triggers_list is not constructed as a list of
+ trigger objects as one would expect, but rather of lists of
+ properties of equal length. Thus, even if we don't get the
+ trigger name, we still fill all in all the lists with
+ placeholders as we might otherwise create a skew in the
+ lists. Obviously, this has to be refactored.
+ */
+ LEX_STRING *empty= alloc_lex_string(&table->mem_root);
+ if (!empty)
+ goto err_with_lex_cleanup;
+
+ empty->str= const_cast<char*>("");
+ empty->length= 0;
+ if (triggers->names_list.push_back(empty, &table->mem_root))
+ goto err_with_lex_cleanup;
+ }
+ lex_end(&lex);
+ continue;
+ }
+
+ lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
+
int event= lex.trg_chistics.event;
int action_time= lex.trg_chistics.action_time;
@@ -1411,9 +1510,8 @@ bool Table_triggers_list::check_n_load(T
char fname[NAME_LEN + 1];
DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) ||
(check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) &&
- !my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) &&
- (!my_strcasecmp(table_alias_charset, lex.query_tables->table_name,
- table_name) ||
+ !my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))));
+ DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, table_name) ||
(check_n_cut_mysql50_prefix(table_name, fname, sizeof(fname)) &&
!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, fname))));
#endif
@@ -1695,6 +1793,13 @@ bool Table_triggers_list::drop_all_trigg
while ((trigger= it_name++))
{
+ /*
+ Trigger, which body we failed to parse during call
+ Table_triggers_list::check_n_load(), might be missing name.
+ Such triggers have zero-length name and are skipped here.
+ */
+ if (trigger->length == 0)
+ continue;
if (rm_trigname_file(path, db, trigger->str))
{
/*
@@ -1913,6 +2018,11 @@ bool Table_triggers_list::change_table_n
}
if (table.triggers)
{
+ if (table.triggers->check_for_broken_triggers())
+ {
+ result= 1;
+ goto end;
+ }
LEX_STRING old_table_name= { (char *) old_alias, strlen(old_alias) };
LEX_STRING new_table_name= { (char *) new_table, strlen(new_table) };
/*
@@ -2001,6 +2111,9 @@ bool Table_triggers_list::process_trigge
sp_head *sp_trigger= bodies[event][time_type];
SELECT_LEX *save_current_select;
+ if (check_for_broken_triggers())
+ return true;
+
if (sp_trigger == NULL)
return FALSE;
@@ -2134,6 +2247,22 @@ void Table_triggers_list::mark_fields_us
}
+/**
+ Signals to the Table_triggers_list that a parse error has occured when
+ reading a trigger from file. This makes the Table_triggers_list enter an
+ error state flagged by m_has_unparseable_trigger == true. The error message
+ will be used whenever a statement invoking or manipulating triggers is
+ issued against the Table_triggers_list's table.
+
+ @param error_message The error message thrown by the parser.
+ */
+void Table_triggers_list::set_parse_error_message(char *error_message)
+{
+ m_has_unparseable_trigger= true;
+ strcpy(m_parse_error_message, error_message);
+}
+
+
/**
Trigger BUG#14090 compatibility hook.
=== modified file 'sql/sql_trigger.h'
--- a/sql/sql_trigger.h 2011-05-26 15:20:09 +0000
+++ b/sql/sql_trigger.h 2011-06-10 07:38:06 +0000
@@ -97,6 +97,27 @@ class Table_triggers_list: public Sql_al
*/
GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX];
+ /**
+ This flag indicates that one of the triggers was not parsed successfully,
+ and as a precaution the object has entered a state where all trigger
+ access results in errors until all such triggers are dropped. It is not
+ safe to add triggers since we don't know if the broken trigger has the
+ same name or event type. Nor is it safe to invoke any trigger for the
+ aforementioned reasons. The only safe operations are drop_trigger and
+ drop_all_triggers.
+
+ @see Table_triggers_list::set_parse_error
+ */
+ bool m_has_unparseable_trigger;
+
+ /**
+ This error will be displayed when the user tries to manipulate or invoke
+ triggers on a table that has broken triggers. It will get set only once
+ per statement and thus will contain the first parse error encountered in
+ the trigger file.
+ */
+ char m_parse_error_message[MYSQL_ERRMSG_SIZE];
+
public:
/**
Field responsible for storing triggers definitions in file.
@@ -118,8 +139,9 @@ public:
/* End of character ser context. */
- Table_triggers_list(TABLE *table_arg):
- record1_field(0), trigger_table(table_arg)
+ Table_triggers_list(TABLE *table_arg)
+ :record1_field(0), trigger_table(table_arg),
+ m_has_unparseable_trigger(false)
{
memset(bodies, 0, sizeof(bodies));
memset(trigger_fields, 0, sizeof(trigger_fields));
@@ -176,6 +198,8 @@ public:
void mark_fields_used(trg_event_type event);
+ void set_parse_error_message(char *error_message);
+
friend class Item_trigger_field;
bool add_tables_and_routines_for_triggers(THD *thd,
@@ -193,6 +217,16 @@ private:
const char *new_db_name,
LEX_STRING *old_table_name,
LEX_STRING *new_table_name);
+
+ bool check_for_broken_triggers()
+ {
+ if (m_has_unparseable_trigger)
+ {
+ my_message(ER_PARSE_ERROR, m_parse_error_message, MYF(0));
+ return true;
+ }
+ return false;
+ }
};
extern const LEX_STRING trg_action_time_type_names[];
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2011-05-26 15:20:09 +0000
+++ b/sql/sql_update.cc 2011-06-16 06:30:16 +0000
@@ -791,7 +791,7 @@ int mysql_update(THD *thd,
}
else
table->file->unlock_row();
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_stmt_wi()->inc_current_row_for_warning();
if (thd->is_error())
{
error= 1;
@@ -897,7 +897,7 @@ int mysql_update(THD *thd,
char buff[MYSQL_ERRMSG_SIZE];
my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
(ulong) updated,
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_stmt_wi()->statement_warn_count());
my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
id, buff);
DBUG_PRINT("info",("%ld records updated", (long) updated));
@@ -1069,17 +1069,27 @@ bool unsafe_key_update(TABLE_LIST *leave
return true;
}
- if (primkey_clustered &&
- (bitmap_is_set(table1->write_set, table1->s->primary_key) ||
- bitmap_is_set(table2->write_set, table2->s->primary_key)))
+ if (primkey_clustered)
{
- // Clustered primary key is updated
- my_error(ER_MULTI_UPDATE_KEY_CONFLICT, MYF(0),
- tl->belong_to_view ? tl->belong_to_view->alias
- : tl->alias,
- tl2->belong_to_view ? tl2->belong_to_view->alias
- : tl2->alias);
- return true;
+ // The primary key can cover multiple columns
+ KEY key_info= table1->key_info[table1->s->primary_key];
+ KEY_PART_INFO *key_part= key_info.key_part;
+ KEY_PART_INFO *key_part_end= key_part + key_info.key_parts;
+
+ for (;key_part != key_part_end; ++key_part)
+ {
+ if (bitmap_is_set(table1->write_set, key_part->fieldnr-1) ||
+ bitmap_is_set(table2->write_set, key_part->fieldnr-1))
+ {
+ // Clustered primary key is updated
+ my_error(ER_MULTI_UPDATE_KEY_CONFLICT, MYF(0),
+ tl->belong_to_view ? tl->belong_to_view->alias
+ : tl->alias,
+ tl2->belong_to_view ? tl2->belong_to_view->alias
+ : tl2->alias);
+ return true;
+ }
+ }
}
}
}
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2011-05-26 15:20:09 +0000
+++ b/sql/sql_yacc.yy 2011-06-09 18:18:22 +0000
@@ -2262,16 +2262,19 @@ opt_ev_status:
| ENABLE_SYM
{
Lex->event_parse_data->status= Event_parse_data::ENABLED;
+ Lex->event_parse_data->status_changed= true;
$$= 1;
}
| DISABLE_SYM ON SLAVE
{
Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
+ Lex->event_parse_data->status_changed= true;
$$= 1;
}
| DISABLE_SYM
{
Lex->event_parse_data->status= Event_parse_data::DISABLED;
+ Lex->event_parse_data->status_changed= true;
$$= 1;
}
;
=== modified file 'sql/structs.h'
--- a/sql/structs.h 2011-04-26 08:49:10 +0000
+++ b/sql/structs.h 2011-06-06 19:16:54 +0000
@@ -299,105 +299,139 @@ public:
};
};
-/* List of Discrete_interval objects */
+/// List of Discrete_interval objects
class Discrete_intervals_list {
+
+/**
+ Discrete_intervals_list objects are used to remember the
+ intervals of autoincrement values that have been used by the
+ current INSERT statement, so that the values can be written to the
+ binary log. However, the binary log can currently only store the
+ beginning of the first interval (because WL#3404 is not yet
+ implemented). Hence, it is currently not necessary to store
+ anything else than the first interval, in the list. When WL#3404 is
+ implemented, we should change the '# define' below.
+*/
+#define DISCRETE_INTERVAL_LIST_HAS_MAX_ONE_ELEMENT 1
+
private:
+ /**
+ To avoid heap allocation in the common case when there is only one
+ interval in the list, we store the first interval here.
+ */
+ Discrete_interval first_interval;
Discrete_interval *head;
Discrete_interval *tail;
- /*
+ /**
When many intervals are provided at the beginning of the execution of a
statement (in a replication slave or SET INSERT_ID), "current" points to
the interval being consumed by the thread now (so "current" goes from
"head" to "tail" then to NULL).
*/
Discrete_interval *current;
- uint elements; // number of elements
- void set_members(Discrete_interval *h, Discrete_interval *t,
- Discrete_interval *c, uint el)
- {
- head= h;
- tail= t;
- current= c;
- elements= el;
+ uint elements; ///< number of elements
+ void operator=(Discrete_intervals_list &); // prevent use of this
+ bool append(Discrete_interval *new_interval)
+ {
+ if (unlikely(new_interval == NULL))
+ return true;
+ DBUG_PRINT("info",("adding new auto_increment interval"));
+ if (head == NULL)
+ head= current= new_interval;
+ else
+ tail->next= new_interval;
+ tail= new_interval;
+ elements++;
+ return false;
}
- void operator=(Discrete_intervals_list &); /* prevent use of these */
- Discrete_intervals_list(const Discrete_intervals_list &);
-
-public:
- Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {};
- void empty_no_free()
+ void copy_shallow(const Discrete_intervals_list *other)
{
- set_members(NULL, NULL, NULL, 0);
+ const Discrete_interval *o_first_interval= &other->first_interval;
+ first_interval= other->first_interval;
+ head= other->head == o_first_interval ? &first_interval : other->head;
+ tail= other->tail == o_first_interval ? &first_interval : other->tail;
+ current=
+ other->current == o_first_interval ? &first_interval : other->current;
+ elements= other->elements;
}
+ Discrete_intervals_list(const Discrete_intervals_list &other)
+ { copy_shallow(&other); }
+
+public:
+ Discrete_intervals_list()
+ : head(NULL), tail(NULL), current(NULL), elements(0) {}
void empty()
{
- for (Discrete_interval *i= head; i;)
+ if (head)
{
- Discrete_interval *next= i->next;
- delete i;
- i= next;
+ // first element, not on heap, should not be delete-d; start with next:
+ for (Discrete_interval *i= head->next; i;)
+ {
+#ifdef DISCRETE_INTERVAL_LIST_HAS_MAX_ONE_ELEMENT
+ DBUG_ASSERT(0);
+#endif
+ Discrete_interval *next= i->next;
+ delete i;
+ i= next;
+ }
}
- empty_no_free();
+ head= tail= current= NULL;
+ elements= 0;
}
- void copy_shallow(const Discrete_intervals_list * dli)
+ void swap(Discrete_intervals_list *other)
{
- head= dli->get_head();
- tail= dli->get_tail();
- current= dli->get_current();
- elements= dli->nb_elements();
+ const Discrete_intervals_list tmp(*other);
+ other->copy_shallow(this);
+ copy_shallow(&tmp);
}
- void swap (Discrete_intervals_list * dli)
+ const Discrete_interval *get_next()
{
- Discrete_interval *h, *t, *c;
- uint el;
- h= dli->get_head();
- t= dli->get_tail();
- c= dli->get_current();
- el= dli->nb_elements();
- dli->copy_shallow(this);
- set_members(h, t, c, el);
- }
- const Discrete_interval* get_next()
- {
- Discrete_interval *tmp= current;
+ const Discrete_interval *tmp= current;
if (current != NULL)
current= current->next;
return tmp;
}
~Discrete_intervals_list() { empty(); };
+ /**
+ Appends an interval to the list.
+
+ @param start start of interval
+ @val how many values it contains
+ @param incr what increment between each value
+ @retval true error
+ @retval false success
+ */
bool append(ulonglong start, ulonglong val, ulonglong incr)
{
- DBUG_ENTER("Discrete_intervals_list::append");
- /* first, see if this can be merged with previous */
- if ((head == NULL) || tail->merge_if_contiguous(start, val, incr))
+ // If there are no intervals, add one.
+ if (head == NULL)
{
- /* it cannot, so need to add a new interval */
- Discrete_interval *new_interval= new Discrete_interval(start, val, incr);
- DBUG_RETURN(append(new_interval));
+ first_interval.replace(start, val, incr);
+ return append(&first_interval);
}
- DBUG_RETURN(0);
- }
-
- bool append(Discrete_interval *new_interval)
- {
- DBUG_ENTER("Discrete_intervals_list::append");
- if (unlikely(new_interval == NULL))
- DBUG_RETURN(1);
- DBUG_PRINT("info",("adding new auto_increment interval"));
- if (head == NULL)
- head= current= new_interval;
- else
- tail->next= new_interval;
- tail= new_interval;
- elements++;
- DBUG_RETURN(0);
+ // If this interval can be merged with previous, do that.
+ if (tail->merge_if_contiguous(start, val, incr) == 0)
+ return false;
+ // If this interval cannot be merged, append it.
+#ifdef DISCRETE_INTERVAL_LIST_HAS_MAX_ONE_ELEMENT
+ /*
+ We cannot create yet another interval as we already contain one. This
+ situation can happen. Assume innodb_autoinc_lock_mode>=1 and
+ CREATE TABLE T(A INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
+ INSERT INTO T VALUES (NULL),(NULL),(1025),(NULL);
+ Then InnoDB will reserve [1,4] (because of 4 rows) then
+ [1026,1026]. Only the first interval is important for
+ statement-based binary logging as it tells the starting point. So we
+ ignore the second interval:
+ */
+ return false;
+#else
+ return append(new Discrete_interval(start, val, incr));
+#endif
}
ulonglong minimum() const { return (head ? head->minimum() : 0); };
ulonglong maximum() const { return (head ? tail->maximum() : 0); };
uint nb_elements() const { return elements; }
- Discrete_interval* get_head() const { return head; };
- Discrete_interval* get_tail() const { return tail; };
- Discrete_interval* get_current() const { return current; };
};
#endif /* STRUCTS_INCLUDED */
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-05-27 15:46:36 +0000
+++ b/sql/sys_vars.cc 2011-06-18 20:34:45 +0000
@@ -2854,7 +2854,7 @@ static Sys_var_session_special Sys_rand_
static ulonglong read_error_count(THD *thd)
{
- return thd->warning_info->error_count();
+ return thd->get_stmt_wi()->error_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_error_count(
@@ -2866,7 +2866,7 @@ static Sys_var_session_special Sys_error
static ulonglong read_warning_count(THD *thd)
{
- return thd->warning_info->warn_count();
+ return thd->get_stmt_wi()->warn_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_warning_count(
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2011-05-26 15:20:09 +0000
+++ b/sql/table.cc 2011-06-15 22:31:43 +0000
@@ -3215,7 +3215,7 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
if (gvisitor->m_lock_open_count++ == 0)
mysql_mutex_lock(&LOCK_open);
- I_P_List_iterator <TABLE, TABLE_share> tables_it(used_tables);
+ TABLE_SHARE::TABLE_list::Iterator tables_it(used_tables);
/*
In case of multiple searches running in parallel, avoid going
@@ -3841,26 +3841,32 @@ void TABLE_LIST::hide_view_error(THD *th
/* Hide "Unknown column" or "Unknown function" error */
DBUG_ASSERT(thd->is_error());
- if (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
- thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST ||
- thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
- thd->stmt_da->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_TABLE_NOT_LOCKED ||
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
- {
- TABLE_LIST *top= top_table();
- thd->clear_error();
- my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str);
- }
- else if (thd->stmt_da->sql_errno() == ER_NO_DEFAULT_FOR_FIELD)
- {
- TABLE_LIST *top= top_table();
- thd->clear_error();
- // TODO: make correct error message
- my_error(ER_NO_DEFAULT_FOR_VIEW_FIELD, MYF(0),
- top->view_db.str, top->view_name.str);
+ switch (thd->get_stmt_da()->sql_errno()) {
+ case ER_BAD_FIELD_ERROR:
+ case ER_SP_DOES_NOT_EXIST:
+ case ER_FUNC_INEXISTENT_NAME_COLLISION:
+ case ER_PROCACCESS_DENIED_ERROR:
+ case ER_COLUMNACCESS_DENIED_ERROR:
+ case ER_TABLEACCESS_DENIED_ERROR:
+ case ER_TABLE_NOT_LOCKED:
+ case ER_NO_SUCH_TABLE:
+ {
+ TABLE_LIST *top= top_table();
+ thd->clear_error();
+ my_error(ER_VIEW_INVALID, MYF(0),
+ top->view_db.str, top->view_name.str);
+ break;
+ }
+
+ case ER_NO_DEFAULT_FOR_FIELD:
+ {
+ TABLE_LIST *top= top_table();
+ thd->clear_error();
+ // TODO: make correct error message
+ my_error(ER_NO_DEFAULT_FOR_VIEW_FIELD, MYF(0),
+ top->view_db.str, top->view_name.str);
+ break;
+ }
}
}
=== modified file 'sql/table.h'
--- a/sql/table.h 2011-05-26 15:20:09 +0000
+++ b/sql/table.h 2011-06-16 06:30:16 +0000
@@ -600,8 +600,9 @@ struct TABLE_SHARE
Doubly-linked (back-linked) lists of used and unused TABLE objects
for this share.
*/
- I_P_List <TABLE, TABLE_share> used_tables;
- I_P_List <TABLE, TABLE_share> free_tables;
+ typedef I_P_List <TABLE, TABLE_share> TABLE_list;
+ TABLE_list used_tables;
+ TABLE_list free_tables;
/* The following is copied to each TABLE on OPEN */
Field **field;
@@ -669,8 +670,8 @@ struct TABLE_SHARE
uint db_options_in_use; /* Options in use */
uint db_record_offset; /* if HA_REC_IN_SEQ */
uint rowid_field_offset; /* Field_nr +1 to rowid field */
- /* Index of auto-updated TIMESTAMP field in field array */
- uint primary_key;
+ /* Primary key index number, used in TABLE::key_info[] */
+ uint primary_key;
uint next_number_index; /* autoincrement key number */
uint next_number_key_offset; /* autoinc keypart offset in a key */
uint next_number_keypart; /* autoinc keypart number in a key */
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2011-05-16 14:30:54 +0000
+++ b/sql/transaction.cc 2011-06-09 08:58:41 +0000
@@ -752,7 +752,7 @@ bool trans_xa_rollback(THD *thd)
ha_commit_or_rollback_by_xid(thd->lex->xid, 0);
xid_cache_delete(xs);
}
- DBUG_RETURN(thd->stmt_da->is_error());
+ DBUG_RETURN(thd->get_stmt_da()->is_error());
}
if (xa_state != XA_IDLE && xa_state != XA_PREPARED && xa_state != XA_ROLLBACK_ONLY)
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc 2011-05-26 15:20:09 +0000
+++ b/sql/tztime.cc 2011-06-09 08:58:41 +0000
@@ -1671,7 +1671,7 @@ my_tz_init(THD *org_thd, const char *def
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT))
{
sql_print_warning("Can't open and lock time zone table: %s "
- "trying to live without them", thd->stmt_da->message());
+ "trying to live without them", thd->get_stmt_da()->message());
/* We will try emulate that everything is ok */
return_val= time_zone_tables_exist= 0;
goto end_with_setting_default_tz;
=== modified file 'storage/archive/azio.c'
--- a/storage/archive/azio.c 2010-07-26 15:54:20 +0000
+++ b/storage/archive/azio.c 2011-06-03 07:49:05 +0000
@@ -114,6 +114,15 @@ int az_open (azio_stream *s, const char
errno = 0;
s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
+ DBUG_EXECUTE_IF("simulate_archive_open_failure",
+ {
+ if (s->file >= 0)
+ {
+ my_close(s->file, MYF(0));
+ s->file= -1;
+ my_errno= EMFILE;
+ }
+ });
if (s->file < 0 )
{
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2011-05-10 13:41:34 +0000
+++ b/storage/archive/ha_archive.cc 2011-06-03 08:00:42 +0000
@@ -1680,11 +1680,12 @@ int ha_archive::check(THD* thd, HA_CHECK
azflush(&(share->archive_write), Z_SYNC_FLUSH);
mysql_mutex_unlock(&share->mutex);
+ if (init_archive_reader())
+ DBUG_RETURN(HA_ADMIN_CORRUPT);
/*
Now we will rewind the archive file so that we are positioned at the
start of the file.
*/
- init_archive_reader();
read_data_header(&archive);
while (!(rc= get_row(&archive, table->record[0])))
count--;
=== modified file 'storage/innobase/btr/btr0btr.c'
--- a/storage/innobase/btr/btr0btr.c 2011-04-13 08:34:16 +0000
+++ b/storage/innobase/btr/btr0btr.c 2011-06-16 13:15:48 +0000
@@ -2278,7 +2278,7 @@ btr_attach_half_pages(
/*==================*/
dict_index_t* index, /*!< in: the index tree */
buf_block_t* block, /*!< in/out: page to be split */
- rec_t* split_rec, /*!< in: first record on upper
+ const rec_t* split_rec, /*!< in: first record on upper
half page */
buf_block_t* new_block, /*!< in/out: the new half page */
ulint direction, /*!< in: FSP_UP or FSP_DOWN */
@@ -2971,15 +2971,16 @@ btr_node_ptr_delete(
ut_a(err == DB_SUCCESS);
if (!compressed) {
- btr_cur_compress_if_useful(&cursor, mtr);
+ btr_cur_compress_if_useful(&cursor, FALSE, mtr);
}
}
/*************************************************************//**
If page is the only on its level, this function moves its records to the
-father page, thus reducing the tree height. */
+father page, thus reducing the tree height.
+@return father block */
static
-void
+buf_block_t*
btr_lift_page_up(
/*=============*/
dict_index_t* index, /*!< in: index tree */
@@ -3096,6 +3097,8 @@ btr_lift_page_up(
}
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
+
+ return(father_block);
}
/*************************************************************//**
@@ -3112,11 +3115,13 @@ UNIV_INTERN
ibool
btr_compress(
/*=========*/
- btr_cur_t* cursor, /*!< in: cursor on the page to merge or lift;
- the page must not be empty: in record delete
- use btr_discard_page if the page would become
- empty */
- mtr_t* mtr) /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge
+ or lift; the page must not be empty:
+ when deleting records, use btr_discard_page()
+ if the page would become empty */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
dict_index_t* index;
ulint space;
@@ -3134,12 +3139,14 @@ btr_compress(
ulint* offsets;
ulint data_size;
ulint n_recs;
+ ulint nth_rec = 0; /* remove bogus warning */
ulint max_ins_size;
ulint max_ins_size_reorg;
block = btr_cur_get_block(cursor);
page = btr_cur_get_page(cursor);
index = btr_cur_get_index(cursor);
+
ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table));
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
@@ -3160,6 +3167,10 @@ btr_compress(
offsets = btr_page_get_father_block(NULL, heap, index, block, mtr,
&father_cursor);
+ if (adjust) {
+ nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor));
+ }
+
/* Decide the page to which we try to merge and which will inherit
the locks */
@@ -3186,9 +3197,9 @@ btr_compress(
} else {
/* The page is the only one on the level, lift the records
to the father */
- btr_lift_page_up(index, block, mtr);
- mem_heap_free(heap);
- return(TRUE);
+
+ merge_block = btr_lift_page_up(index, block, mtr);
+ goto func_exit;
}
n_recs = page_get_n_recs(page);
@@ -3270,6 +3281,10 @@ err_exit:
btr_node_ptr_delete(index, block, mtr);
lock_update_merge_left(merge_block, orig_pred, block);
+
+ if (adjust) {
+ nth_rec += page_rec_get_n_recs_before(orig_pred);
+ }
} else {
rec_t* orig_succ;
#ifdef UNIV_BTR_DEBUG
@@ -3334,7 +3349,6 @@ err_exit:
}
btr_blob_dbg_remove(page, index, "btr_compress");
- mem_heap_free(heap);
if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) {
/* Update the free bits of the B-tree page in the
@@ -3386,6 +3400,16 @@ err_exit:
btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_block, mtr));
+func_exit:
+ mem_heap_free(heap);
+
+ if (adjust) {
+ btr_cur_position(
+ index,
+ page_rec_get_nth(merge_block->frame, nth_rec),
+ merge_block, cursor);
+ }
+
return(TRUE);
}
=== modified file 'storage/innobase/btr/btr0cur.c'
--- a/storage/innobase/btr/btr0cur.c 2011-05-24 08:42:51 +0000
+++ b/storage/innobase/btr/btr0cur.c 2011-06-17 20:32:42 +0000
@@ -1970,7 +1970,6 @@ btr_cur_optimistic_update(
ulint old_rec_size;
dtuple_t* new_entry;
roll_ptr_t roll_ptr;
- trx_t* trx;
mem_heap_t* heap;
ulint i;
ulint n_ext;
@@ -1987,6 +1986,10 @@ btr_cur_optimistic_update(
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(rec, offsets)
+ || trx_is_recv(thr_get_trx(thr)));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops && thr) {
@@ -2109,13 +2112,11 @@ any_extern:
page_cur_move_to_prev(page_cursor);
- trx = thr_get_trx(thr);
-
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
roll_ptr);
row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
- trx->id);
+ thr_get_trx(thr)->id);
}
/* There are no externally stored columns in new_entry */
@@ -2201,7 +2202,9 @@ btr_cur_pessimistic_update(
/*=======================*/
ulint flags, /*!< in: undo logging, locking, and rollback
flags */
- btr_cur_t* cursor, /*!< in: cursor on the record to update */
+ btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
+ cursor may become invalid if *big_rec == NULL
+ || !(flags & BTR_KEEP_POS_FLAG) */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
be stored externally by the caller, or NULL */
@@ -2340,7 +2343,7 @@ btr_cur_pessimistic_update(
record to be inserted: we have to remember which fields were such */
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
- offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, heap);
+ ut_ad(rec_offs_validate(rec, index, offsets));
n_ext += btr_push_update_extern_fields(new_entry, update, *heap);
if (UNIV_LIKELY_NULL(page_zip)) {
@@ -2363,6 +2366,10 @@ make_external:
err = DB_TOO_BIG_RECORD;
goto return_after_reservations;
}
+
+ ut_ad(page_is_leaf(page));
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(flags & BTR_KEEP_POS_FLAG);
}
/* Store state of explicit locks on rec on the page infimum record,
@@ -2390,6 +2397,8 @@ make_external:
rec = btr_cur_insert_if_possible(cursor, new_entry, n_ext, mtr);
if (rec) {
+ page_cursor->rec = rec;
+
lock_rec_restore_from_page_infimum(btr_cur_get_block(cursor),
rec, block);
@@ -2403,7 +2412,10 @@ make_external:
rec, index, offsets, mtr);
}
- btr_cur_compress_if_useful(cursor, mtr);
+ btr_cur_compress_if_useful(
+ cursor,
+ big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
+ mtr);
if (page_zip && !dict_index_is_clust(index)
&& page_is_leaf(page)) {
@@ -2423,6 +2435,21 @@ make_external:
}
}
+ if (big_rec_vec) {
+ ut_ad(page_is_leaf(page));
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(flags & BTR_KEEP_POS_FLAG);
+
+ /* btr_page_split_and_insert() in
+ btr_cur_pessimistic_insert() invokes
+ mtr_memo_release(mtr, index->lock, MTR_MEMO_X_LOCK).
+ We must keep the index->lock when we created a
+ big_rec, so that row_upd_clust_rec() can store the
+ big_rec in the same mini-transaction. */
+
+ mtr_x_lock(dict_index_get_lock(index), mtr);
+ }
+
/* Was the record to be updated positioned as the first user
record on its page? */
was_first = page_cur_is_before_first(page_cursor);
@@ -2438,6 +2465,7 @@ make_external:
ut_a(rec);
ut_a(err == DB_SUCCESS);
ut_a(dummy_big_rec == NULL);
+ page_cursor->rec = rec;
if (dict_index_is_sec_or_ibuf(index)) {
/* Update PAGE_MAX_TRX_ID in the index page header.
@@ -2496,6 +2524,39 @@ return_after_reservations:
return(err);
}
+/**************************************************************//**
+Commits and restarts a mini-transaction so that it will retain an
+x-lock on index->lock and the cursor page. */
+UNIV_INTERN
+void
+btr_cur_mtr_commit_and_start(
+/*=========================*/
+ btr_cur_t* cursor, /*!< in: cursor */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ buf_block_t* block;
+
+ block = btr_cur_get_block(cursor);
+
+ ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(cursor->index),
+ MTR_MEMO_X_LOCK));
+ ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+ /* Keep the locks across the mtr_commit(mtr). */
+ rw_lock_x_lock(dict_index_get_lock(cursor->index));
+ rw_lock_x_lock(&block->lock);
+ mutex_enter(&block->mutex);
+ buf_block_buf_fix_inc(block, __FILE__, __LINE__);
+ mutex_exit(&block->mutex);
+ /* Write out the redo log. */
+ mtr_commit(mtr);
+ mtr_start(mtr);
+ /* Reassociate the locks with the mini-transaction.
+ They will be released on mtr_commit(mtr). */
+ mtr_memo_push(mtr, dict_index_get_lock(cursor->index),
+ MTR_MEMO_X_LOCK);
+ mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
+}
+
/*==================== B-TREE DELETE MARK AND UNMARK ===============*/
/****************************************************************//**
@@ -2876,10 +2937,12 @@ UNIV_INTERN
ibool
btr_cur_compress_if_useful(
/*=======================*/
- btr_cur_t* cursor, /*!< in: cursor on the page to compress;
- cursor does not stay valid if compression
- occurs */
- mtr_t* mtr) /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress;
+ cursor does not stay valid if !adjust and
+ compression occurs */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ut_ad(mtr_memo_contains(mtr,
dict_index_get_lock(btr_cur_get_index(cursor)),
@@ -2888,7 +2951,7 @@ btr_cur_compress_if_useful(
MTR_MEMO_PAGE_X_FIX));
return(btr_cur_compress_recommendation(cursor, mtr)
- && btr_compress(cursor, mtr));
+ && btr_compress(cursor, adjust, mtr));
}
/*******************************************************//**
@@ -3130,7 +3193,7 @@ return_after_reservations:
mem_heap_free(heap);
if (ret == FALSE) {
- ret = btr_cur_compress_if_useful(cursor, mtr);
+ ret = btr_cur_compress_if_useful(cursor, FALSE, mtr);
}
if (n_extents > 0) {
@@ -4092,7 +4155,7 @@ btr_blob_free(
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
- if (buf_LRU_free_block(&block->page, all) != BUF_LRU_FREED
+ if (!buf_LRU_free_block(&block->page, all)
&& all && block->page.zip.data) {
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
=== modified file 'storage/innobase/buf/buf0buddy.c'
--- a/storage/innobase/buf/buf0buddy.c 2011-03-23 13:43:14 +0000
+++ b/storage/innobase/buf/buf0buddy.c 2011-06-17 20:32:42 +0000
@@ -56,6 +56,14 @@ buf_buddy_get(
}
}
+/** Validate a given zip_free list. */
+#define BUF_BUDDY_LIST_VALIDATE(b, i) \
+ UT_LIST_VALIDATE(list, buf_page_t, \
+ b->zip_free[i], \
+ ut_ad(buf_page_get_state( \
+ ut_list_node_313) \
+ == BUF_BLOCK_ZIP_FREE))
+
/**********************************************************************//**
Add a block to the head of the appropriate buddy free list. */
UNIV_INLINE
@@ -67,21 +75,11 @@ buf_buddy_add_to_free(
ulint i) /*!< in: index of
buf_pool->zip_free[] */
{
-#ifdef UNIV_DEBUG_VALGRIND
- buf_page_t* b = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
-
- if (b) UNIV_MEM_VALID(b, BUF_BUDDY_LOW << i);
-#endif /* UNIV_DEBUG_VALGRIND */
-
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
ut_ad(buf_pool->zip_free[i].start != bpage);
UT_LIST_ADD_FIRST(list, buf_pool->zip_free[i], bpage);
-#ifdef UNIV_DEBUG_VALGRIND
- if (b) UNIV_MEM_FREE(b, BUF_BUDDY_LOW << i);
- UNIV_MEM_ASSERT_AND_FREE(bpage, BUF_BUDDY_LOW << i);
-#endif /* UNIV_DEBUG_VALGRIND */
}
/**********************************************************************//**
@@ -95,25 +93,18 @@ buf_buddy_remove_from_free(
ulint i) /*!< in: index of
buf_pool->zip_free[] */
{
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef UNIV_DEBUG
buf_page_t* prev = UT_LIST_GET_PREV(list, bpage);
buf_page_t* next = UT_LIST_GET_NEXT(list, bpage);
- if (prev) UNIV_MEM_VALID(prev, BUF_BUDDY_LOW << i);
- if (next) UNIV_MEM_VALID(next, BUF_BUDDY_LOW << i);
-
ut_ad(!prev || buf_page_get_state(prev) == BUF_BLOCK_ZIP_FREE);
ut_ad(!next || buf_page_get_state(next) == BUF_BLOCK_ZIP_FREE);
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* UNIV_DEBUG */
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
UT_LIST_REMOVE(list, buf_pool->zip_free[i], bpage);
-#ifdef UNIV_DEBUG_VALGRIND
- if (prev) UNIV_MEM_FREE(prev, BUF_BUDDY_LOW << i);
- if (next) UNIV_MEM_FREE(next, BUF_BUDDY_LOW << i);
-#endif /* UNIV_DEBUG_VALGRIND */
}
/**********************************************************************//**
@@ -130,17 +121,13 @@ buf_buddy_alloc_zip(
ut_ad(buf_pool_mutex_own(buf_pool));
ut_a(i < BUF_BUDDY_SIZES);
+ ut_a(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
+
+ ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i));
-#ifndef UNIV_DEBUG_VALGRIND
- /* Valgrind would complain about accessing free memory. */
- ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
- ut_ad(buf_page_get_state(ut_list_node_313)
- == BUF_BLOCK_ZIP_FREE)));
-#endif /* !UNIV_DEBUG_VALGRIND */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
if (bpage) {
- UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
buf_buddy_remove_from_free(buf_pool, bpage, i);
@@ -159,13 +146,10 @@ buf_buddy_alloc_zip(
}
}
-#ifdef UNIV_DEBUG
if (bpage) {
- memset(bpage, ~i, BUF_BUDDY_LOW << i);
+ ut_d(memset(bpage, ~i, BUF_BUDDY_LOW << i));
+ UNIV_MEM_ALLOC(bpage, BUF_BUDDY_SIZES << i);
}
-#endif /* UNIV_DEBUG */
-
- UNIV_MEM_ALLOC(bpage, BUF_BUDDY_SIZES << i);
return(bpage);
}
@@ -253,6 +237,7 @@ buf_buddy_alloc_from(
{
ulint offs = BUF_BUDDY_LOW << j;
ut_ad(j <= BUF_BUDDY_SIZES);
+ ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
ut_ad(j >= i);
ut_ad(!ut_align_offset(buf, offs));
@@ -266,13 +251,7 @@ buf_buddy_alloc_from(
bpage = (buf_page_t*) ((byte*) buf + offs);
ut_d(memset(bpage, j, BUF_BUDDY_LOW << j));
bpage->state = BUF_BLOCK_ZIP_FREE;
-#ifndef UNIV_DEBUG_VALGRIND
- /* Valgrind would complain about accessing free memory. */
- ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
- ut_ad(buf_page_get_state(
- ut_list_node_313)
- == BUF_BLOCK_ZIP_FREE)));
-#endif /* !UNIV_DEBUG_VALGRIND */
+ ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i));
buf_buddy_add_to_free(buf_pool, bpage, j);
}
@@ -282,8 +261,8 @@ buf_buddy_alloc_from(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
-The buf_pool->mutex may only be released and reacquired if lru != NULL.
-@return allocated block, possibly NULL if lru==NULL */
+The buf_pool_mutex may be released and reacquired.
+@return allocated block, never NULL */
UNIV_INTERN
void*
buf_buddy_alloc_low(
@@ -295,13 +274,14 @@ buf_buddy_alloc_low(
will be assigned TRUE if storage was
allocated from the LRU list and
buf_pool->mutex was temporarily
- released, or NULL if the LRU list
- should not be used */
+ released, */
{
buf_block_t* block;
+ ut_ad(lru);
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
+ ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
if (i < BUF_BUDDY_SIZES) {
/* Try to allocate from the buddy system. */
@@ -320,11 +300,6 @@ buf_buddy_alloc_low(
goto alloc_big;
}
- if (!lru) {
-
- return(NULL);
- }
-
/* Try replacing an uncompressed page in the buffer pool. */
buf_pool_mutex_exit(buf_pool);
block = buf_LRU_get_free_block(buf_pool);
@@ -343,69 +318,6 @@ func_exit:
}
/**********************************************************************//**
-Try to relocate the control block of a compressed page.
-@return TRUE if relocated */
-static
-ibool
-buf_buddy_relocate_block(
-/*=====================*/
- buf_page_t* bpage, /*!< in: block to relocate */
- buf_page_t* dpage) /*!< in: free block to relocate to */
-{
- buf_page_t* b;
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- ulint fold = buf_page_address_fold(bpage->space,
- bpage->offset);
- rw_lock_t* hash_lock = buf_page_hash_lock_get(buf_pool, fold);
-
- ut_ad(buf_pool_mutex_own(buf_pool));
-
- switch (buf_page_get_state(bpage)) {
- case BUF_BLOCK_ZIP_FREE:
- case BUF_BLOCK_NOT_USED:
- case BUF_BLOCK_READY_FOR_USE:
- case BUF_BLOCK_FILE_PAGE:
- case BUF_BLOCK_MEMORY:
- case BUF_BLOCK_REMOVE_HASH:
- ut_error;
- case BUF_BLOCK_ZIP_DIRTY:
- /* Cannot relocate dirty pages. */
- return(FALSE);
-
- case BUF_BLOCK_ZIP_PAGE:
- break;
- }
-
- rw_lock_x_lock(hash_lock);
- mutex_enter(&buf_pool->zip_mutex);
-
- if (!buf_page_can_relocate(bpage)) {
- rw_lock_x_unlock(hash_lock);
- mutex_exit(&buf_pool->zip_mutex);
- return(FALSE);
- }
-
- buf_relocate(bpage, dpage);
- ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
-
- /* relocate buf_pool->zip_clean */
- b = UT_LIST_GET_PREV(list, dpage);
- UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage);
-
- if (b) {
- UT_LIST_INSERT_AFTER(list, buf_pool->zip_clean, b, dpage);
- } else {
- UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage);
- }
-
- UNIV_MEM_INVALID(bpage, sizeof *bpage);
-
- rw_lock_x_unlock(hash_lock);
- mutex_exit(&buf_pool->zip_mutex);
- return(TRUE);
-}
-
-/**********************************************************************//**
Try to relocate a block.
@return TRUE if relocated */
static
@@ -421,106 +333,89 @@ buf_buddy_relocate(
buf_page_t* bpage;
const ulint size = BUF_BUDDY_LOW << i;
ullint usec = ut_time_us(NULL);
+ mutex_t* mutex;
+ ulint space;
+ ulint page_no;
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
+ ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
UNIV_MEM_ASSERT_W(dst, size);
/* We assume that all memory from buf_buddy_alloc()
- is used for either compressed pages or buf_page_t
- objects covering compressed pages. */
+ is used for compressed page frames. */
/* We look inside the allocated objects returned by
- buf_buddy_alloc() and assume that anything of
- UNIV_ZIP_SIZE_MIN or larger is a compressed page that contains
- a valid space_id and page_no in the page header. Should the
- fields be invalid, we will be unable to relocate the block.
- We also assume that anything that fits sizeof(buf_page_t)
- actually is a properly initialized buf_page_t object. */
-
- if (size >= UNIV_ZIP_SIZE_MIN) {
- /* This is a compressed page. */
- mutex_t* mutex;
-
- /* The src block may be split into smaller blocks,
- some of which may be free. Thus, the
- mach_read_from_4() calls below may attempt to read
- from free memory. The memory is "owned" by the buddy
- allocator (and it has been allocated from the buffer
- pool), so there is nothing wrong about this. The
- mach_read_from_4() calls here will only trigger bogus
- Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
- ulint space = mach_read_from_4(
- (const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint page_no = mach_read_from_4(
- (const byte*) src + FIL_PAGE_OFFSET);
- /* Suppress Valgrind warnings about conditional jump
- on uninitialized value. */
- UNIV_MEM_VALID(&space, sizeof space);
- UNIV_MEM_VALID(&page_no, sizeof page_no);
- bpage = buf_page_hash_get(buf_pool, space, page_no);
-
- if (!bpage || bpage->zip.data != src) {
- /* The block has probably been freshly
- allocated by buf_LRU_get_free_block() but not
- added to buf_pool->page_hash yet. Obviously,
- it cannot be relocated. */
+ buf_buddy_alloc() and assume that each block is a compressed
+ page that contains a valid space_id and page_no in the page
+ header. Should the fields be invalid, we will be unable to
+ relocate the block. */
+
+
+ /* The src block may be split into smaller blocks,
+ some of which may be free. Thus, the
+ mach_read_from_4() calls below may attempt to read
+ from free memory. The memory is "owned" by the buddy
+ allocator (and it has been allocated from the buffer
+ pool), so there is nothing wrong about this. The
+ mach_read_from_4() calls here will only trigger bogus
+ Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
+ space = mach_read_from_4((const byte*) src +
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ page_no = mach_read_from_4((const byte*) src +
+ FIL_PAGE_OFFSET);
+ /* Suppress Valgrind warnings about conditional jump
+ on uninitialized value. */
+ UNIV_MEM_VALID(&space, sizeof space);
+ UNIV_MEM_VALID(&page_no, sizeof page_no);
+ bpage = buf_page_hash_get(buf_pool, space, page_no);
+
+ if (!bpage || bpage->zip.data != src) {
+ /* The block has probably been freshly
+ allocated by buf_LRU_get_free_block() but not
+ added to buf_pool->page_hash yet. Obviously,
+ it cannot be relocated. */
- return(FALSE);
- }
-
- if (page_zip_get_size(&bpage->zip) != size) {
- /* The block is of different size. We would
- have to relocate all blocks covered by src.
- For the sake of simplicity, give up. */
- ut_ad(page_zip_get_size(&bpage->zip) < size);
+ return(FALSE);
+ }
- return(FALSE);
- }
+ if (page_zip_get_size(&bpage->zip) != size) {
+ /* The block is of different size. We would
+ have to relocate all blocks covered by src.
+ For the sake of simplicity, give up. */
+ ut_ad(page_zip_get_size(&bpage->zip) < size);
- /* The block must have been allocated, but it may
- contain uninitialized data. */
- UNIV_MEM_ASSERT_W(src, size);
-
- mutex = buf_page_get_mutex(bpage);
-
- mutex_enter(mutex);
-
- if (buf_page_can_relocate(bpage)) {
- /* Relocate the compressed page. */
- ut_a(bpage->zip.data == src);
- memcpy(dst, src, size);
- bpage->zip.data = dst;
- mutex_exit(mutex);
-success:
- UNIV_MEM_INVALID(src, size);
- {
- buf_buddy_stat_t* buddy_stat
- = &buf_pool->buddy_stat[i];
- buddy_stat->relocated++;
- buddy_stat->relocated_usec
- += ut_time_us(NULL) - usec;
- }
- return(TRUE);
- }
+ return(FALSE);
+ }
+ /* The block must have been allocated, but it may
+ contain uninitialized data. */
+ UNIV_MEM_ASSERT_W(src, size);
+
+ mutex = buf_page_get_mutex(bpage);
+
+ mutex_enter(mutex);
+
+ if (buf_page_can_relocate(bpage)) {
+ /* Relocate the compressed page. */
+ ut_a(bpage->zip.data == src);
+ memcpy(dst, src, size);
+ bpage->zip.data = dst;
mutex_exit(mutex);
- } else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
- /* This must be a buf_page_t object. */
-#if UNIV_WORD_SIZE == 4
- /* On 32-bit systems, there is no padding in
- buf_page_t. On other systems, Valgrind could complain
- about uninitialized pad bytes. */
- UNIV_MEM_ASSERT_RW(src, size);
-#endif
- if (buf_buddy_relocate_block(src, dst)) {
-
- goto success;
+ UNIV_MEM_INVALID(src, size);
+ {
+ buf_buddy_stat_t* buddy_stat
+ = &buf_pool->buddy_stat[i];
+ buddy_stat->relocated++;
+ buddy_stat->relocated_usec
+ += ut_time_us(NULL) - usec;
}
+ return(TRUE);
}
+ mutex_exit(mutex);
return(FALSE);
}
@@ -542,12 +437,13 @@ buf_buddy_free_low(
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(i <= BUF_BUDDY_SIZES);
+ ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
ut_ad(buf_pool->buddy_stat[i].used > 0);
buf_pool->buddy_stat[i].used--;
recombine:
UNIV_MEM_ASSERT_AND_ALLOC(buf, BUF_BUDDY_LOW << i);
- ut_d(((buf_page_t*) buf)->state = BUF_BLOCK_ZIP_FREE);
+ ((buf_page_t*) buf)->state = BUF_BLOCK_ZIP_FREE;
if (i == BUF_BUDDY_SIZES) {
buf_buddy_block_free(buf_pool, buf);
@@ -558,32 +454,36 @@ recombine:
ut_ad(buf == ut_align_down(buf, BUF_BUDDY_LOW << i));
ut_ad(!buf_pool_contains_zip(buf_pool, buf));
- /* Try to combine adjacent blocks. */
-
- buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i);
-
-#ifndef UNIV_DEBUG_VALGRIND
- /* Valgrind would complain about accessing free memory. */
-
- if (buddy->state != BUF_BLOCK_ZIP_FREE) {
-
- goto buddy_nonfree;
+ /* Do not recombine blocks if there are few free blocks.
+ We may waste up to 15360*max_len bytes to free blocks
+ (1024 + 2048 + 4096 + 8192 = 15360) */
+ if (UT_LIST_GET_LEN(buf_pool->zip_free[i]) < 16) {
+ goto func_exit;
}
-
- /* The field buddy->state can only be trusted for free blocks.
- If buddy->state == BUF_BLOCK_ZIP_FREE, the block is free if
- it is in the free list. */
+
+ /* Try to combine adjacent blocks. */
+ buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i);
+
+ #ifndef UNIV_DEBUG_VALGRIND
+ /* When Valgrind instrumentation is not enabled, we can read
+ buddy->state to quickly determine that a block is not free.
+ When the block is not free, buddy->state belongs to a compressed
+ page frame that may be flagged uninitialized in our Valgrind
+ instrumentation. */
+
+ if (buddy->state != BUF_BLOCK_ZIP_FREE) {
+
+ goto buddy_nonfree;
+ }
#endif /* !UNIV_DEBUG_VALGRIND */
for (bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage; ) {
- UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
if (bpage == buddy) {
-buddy_free:
/* The buddy is free: recombine */
buf_buddy_remove_from_free(buf_pool, bpage, i);
-buddy_free2:
+buddy_is_free:
ut_ad(buf_page_get_state(buddy) == BUF_BLOCK_ZIP_FREE);
ut_ad(!buf_pool_contains_zip(buf_pool, buddy));
i++;
@@ -593,21 +493,15 @@ buddy_free2:
}
ut_a(bpage != buf);
-
- {
- buf_page_t* next = UT_LIST_GET_NEXT(list, bpage);
- UNIV_MEM_ASSERT_AND_FREE(bpage, BUF_BUDDY_LOW << i);
- bpage = next;
- }
+ UNIV_MEM_ASSERT_W(bpage, BUF_BUDDY_LOW << i);
+ bpage = UT_LIST_GET_NEXT(list, bpage);
}
#ifndef UNIV_DEBUG_VALGRIND
buddy_nonfree:
- /* Valgrind would complain about accessing free memory. */
- ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
- ut_ad(buf_page_get_state(ut_list_node_313)
- == BUF_BLOCK_ZIP_FREE)));
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* !UNIV_DEBUG_VALGRIND */
+
+ ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i));
/* The buddy is not free. Is there a free block of this size? */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
@@ -615,102 +509,25 @@ buddy_nonfree:
if (bpage) {
/* Remove the block from the free list, because a successful
buf_buddy_relocate() will overwrite bpage->list. */
-
- UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
buf_buddy_remove_from_free(buf_pool, bpage, i);
/* Try to relocate the buddy of buf to the free block. */
if (buf_buddy_relocate(buf_pool, buddy, bpage, i)) {
- ut_d(buddy->state = BUF_BLOCK_ZIP_FREE);
- goto buddy_free2;
+ buddy->state = BUF_BLOCK_ZIP_FREE;
+ goto buddy_is_free;
}
buf_buddy_add_to_free(buf_pool, bpage, i);
-
- /* Try to relocate the buddy of the free block to buf. */
- buddy = (buf_page_t*) buf_buddy_get(((byte*) bpage),
- BUF_BUDDY_LOW << i);
-
-#ifndef UNIV_DEBUG_VALGRIND
- /* Valgrind would complain about accessing free memory. */
-
- /* The buddy must not be (completely) free, because we
- always recombine adjacent free blocks.
-
- (Parts of the buddy can be free in
- buf_pool->zip_free[j] with j < i.) */
- ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
- ut_ad(buf_page_get_state(
- ut_list_node_313)
- == BUF_BLOCK_ZIP_FREE
- && ut_list_node_313 != buddy)));
-#endif /* !UNIV_DEBUG_VALGRIND */
-
- if (buf_buddy_relocate(buf_pool, buddy, buf, i)) {
-
- buf = bpage;
- UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
- ut_d(buddy->state = BUF_BLOCK_ZIP_FREE);
- goto buddy_free;
- }
}
+func_exit:
/* Free the block to the buddy list. */
bpage = buf;
-#ifdef UNIV_DEBUG
- if (i < buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)) {
- /* This area has most likely been allocated for at
- least one compressed-only block descriptor. Check
- that there are no live objects in the area. This is
- not a complete check: it may yield false positives as
- well as false negatives. Also, due to buddy blocks
- being recombined, it is possible (although unlikely)
- that this branch is never reached. */
-
- char* c;
-
-# ifndef UNIV_DEBUG_VALGRIND
- /* Valgrind would complain about accessing
- uninitialized memory. Besides, Valgrind performs a
- more exhaustive check, at every memory access. */
- const buf_page_t* b = buf;
- const buf_page_t* const b_end = (buf_page_t*)
- ((char*) b + (BUF_BUDDY_LOW << i));
-
- for (; b < b_end; b++) {
- /* Avoid false positives (and cause false
- negatives) by checking for b->space < 1000. */
-
- if ((b->state == BUF_BLOCK_ZIP_PAGE
- || b->state == BUF_BLOCK_ZIP_DIRTY)
- && b->space > 0 && b->space < 1000) {
- fprintf(stderr,
- "buddy dirty %p %u (%u,%u) %p,%lu\n",
- (void*) b,
- b->state, b->space, b->offset,
- buf, i);
- }
- }
-# endif /* !UNIV_DEBUG_VALGRIND */
- /* Scramble the block. This should make any pointers
- invalid and trigger a segmentation violation. Because
- the scrambling can be reversed, it may be possible to
- track down the object pointing to the freed data by
- dereferencing the unscrambled bpage->LRU or
- bpage->list pointers. */
- for (c = (char*) buf + (BUF_BUDDY_LOW << i);
- c-- > (char*) buf; ) {
- /* We can live with possible loss of data here due
- to conversion from ulint to char. */
- *c = (char) (~*c ^ i);
- }
- } else {
- /* Fill large blocks with a constant pattern. */
- memset(bpage, i, BUF_BUDDY_LOW << i);
- }
-#endif /* UNIV_DEBUG */
+ /* Fill large blocks with a constant pattern. */
+ ut_d(memset(bpage, i, BUF_BUDDY_LOW << i));
+ UNIV_MEM_INVALID(bpage, BUF_BUDDY_LOW << i);
bpage->state = BUF_BLOCK_ZIP_FREE;
buf_buddy_add_to_free(buf_pool, bpage, i);
}
=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c 2011-05-24 08:42:51 +0000
+++ b/storage/innobase/buf/buf0buf.c 2011-06-17 20:32:42 +0000
@@ -1107,70 +1107,6 @@ buf_chunk_not_freed(
return(NULL);
}
-/*********************************************************************//**
-Checks that all blocks in the buffer chunk are in BUF_BLOCK_NOT_USED state.
-@return TRUE if all freed */
-static
-ibool
-buf_chunk_all_free(
-/*===============*/
- const buf_chunk_t* chunk) /*!< in: chunk being checked */
-{
- const buf_block_t* block;
- ulint i;
-
- block = chunk->blocks;
-
- for (i = chunk->size; i--; block++) {
-
- if (buf_block_get_state(block) != BUF_BLOCK_NOT_USED) {
-
- return(FALSE);
- }
- }
-
- return(TRUE);
-}
-
-/********************************************************************//**
-Frees a chunk of buffer frames. */
-static
-void
-buf_chunk_free(
-/*===========*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- buf_chunk_t* chunk) /*!< out: chunk of buffers */
-{
- buf_block_t* block;
- const buf_block_t* block_end;
-
- ut_ad(buf_pool_mutex_own(buf_pool));
-
- block_end = chunk->blocks + chunk->size;
-
- for (block = chunk->blocks; block < block_end; block++) {
- ut_a(buf_block_get_state(block) == BUF_BLOCK_NOT_USED);
- ut_a(!block->page.zip.data);
-
- ut_ad(!block->page.in_LRU_list);
- ut_ad(!block->in_unzip_LRU_list);
- ut_ad(!block->page.in_flush_list);
- /* Remove the block from the free list. */
- ut_ad(block->page.in_free_list);
- UT_LIST_REMOVE(list, buf_pool->free, (&block->page));
-
- /* Free the latches. */
- mutex_free(&block->mutex);
- rw_lock_free(&block->lock);
-#ifdef UNIV_SYNC_DEBUG
- rw_lock_free(&block->debug_latch);
-#endif /* UNIV_SYNC_DEBUG */
- UNIV_MEM_UNDESC(block);
- }
-
- os_mem_free_large(chunk->mem, chunk->mem_size);
-}
-
/********************************************************************//**
Set buffer pool size variables after resizing it */
static
@@ -1294,8 +1230,6 @@ buf_pool_free_instance(
chunk = chunks + buf_pool->n_chunks;
while (--chunk >= chunks) {
- /* Bypass the checks of buf_chunk_free(), since they
- would fail at shutdown. */
os_mem_free_large(chunk->mem, chunk->mem_size);
}
@@ -1557,303 +1491,6 @@ buf_relocate(
}
/********************************************************************//**
-Shrinks a buffer pool instance. */
-static
-void
-buf_pool_shrink_instance(
-/*=====================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- ulint chunk_size) /*!< in: number of pages to remove */
-{
- buf_chunk_t* chunks;
- buf_chunk_t* chunk;
- ulint max_size;
- ulint max_free_size;
- buf_chunk_t* max_chunk;
- buf_chunk_t* max_free_chunk;
-
- ut_ad(!buf_pool_mutex_own(buf_pool));
-
-try_again:
- btr_search_disable(); /* Empty the adaptive hash index again */
- buf_pool_mutex_enter(buf_pool);
-
-shrink_again:
- if (buf_pool->n_chunks <= 1) {
-
- /* Cannot shrink if there is only one chunk */
- goto func_done;
- }
-
- /* Search for the largest free chunk
- not larger than the size difference */
- chunks = buf_pool->chunks;
- chunk = chunks + buf_pool->n_chunks;
- max_size = max_free_size = 0;
- max_chunk = max_free_chunk = NULL;
-
- while (--chunk >= chunks) {
- if (chunk->size <= chunk_size
- && chunk->size > max_free_size) {
- if (chunk->size > max_size) {
- max_size = chunk->size;
- max_chunk = chunk;
- }
-
- if (buf_chunk_all_free(chunk)) {
- max_free_size = chunk->size;
- max_free_chunk = chunk;
- }
- }
- }
-
- if (!max_free_size) {
-
- ulint dirty = 0;
- ulint nonfree = 0;
- buf_block_t* block;
- buf_block_t* bend;
-
- /* Cannot shrink: try again later
- (do not assign srv_buf_pool_old_size) */
- if (!max_chunk) {
-
- goto func_exit;
- }
-
- block = max_chunk->blocks;
- bend = block + max_chunk->size;
-
- /* Move the blocks of chunk to the end of the
- LRU list and try to flush them. */
- for (; block < bend; block++) {
- switch (buf_block_get_state(block)) {
- case BUF_BLOCK_NOT_USED:
- continue;
- case BUF_BLOCK_FILE_PAGE:
- break;
- default:
- nonfree++;
- continue;
- }
-
- mutex_enter(&block->mutex);
- /* The following calls will temporarily
- release block->mutex and buf_pool->mutex.
- Therefore, we have to always retry,
- even if !dirty && !nonfree. */
-
- if (!buf_flush_ready_for_replace(&block->page)) {
-
- buf_LRU_make_block_old(&block->page);
- mutex_exit(&block->mutex);
- dirty++;
- } else {
- mutex_exit(&block->mutex);
- if (buf_LRU_free_block(&block->page, TRUE)
- != BUF_LRU_FREED) {
- nonfree++;
- }
- }
- }
-
- buf_pool_mutex_exit(buf_pool);
-
- /* Request for a flush of the chunk if it helps.
- Do not flush if there are non-free blocks, since
- flushing will not make the chunk freeable. */
- if (nonfree) {
- /* Avoid busy-waiting. */
- os_thread_sleep(100000);
- } else if (dirty
- && buf_flush_LRU(buf_pool, dirty)
- == ULINT_UNDEFINED) {
-
- buf_flush_wait_batch_end(buf_pool, BUF_FLUSH_LRU);
- }
-
- goto try_again;
- }
-
- max_size = max_free_size;
- max_chunk = max_free_chunk;
-
- buf_pool->old_pool_size = buf_pool->curr_pool_size;
-
- /* Rewrite buf_pool->chunks. Copy everything but max_chunk. */
- chunks = mem_alloc((buf_pool->n_chunks - 1) * sizeof *chunks);
- memcpy(chunks, buf_pool->chunks,
- (max_chunk - buf_pool->chunks) * sizeof *chunks);
- memcpy(chunks + (max_chunk - buf_pool->chunks),
- max_chunk + 1,
- buf_pool->chunks + buf_pool->n_chunks
- - (max_chunk + 1));
- ut_a(buf_pool->curr_size > max_chunk->size);
- buf_pool->curr_size -= max_chunk->size;
- buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
- chunk_size -= max_chunk->size;
- buf_chunk_free(buf_pool, max_chunk);
- mem_free(buf_pool->chunks);
- buf_pool->chunks = chunks;
- buf_pool->n_chunks--;
-
- /* Allow a slack of one megabyte. */
- if (chunk_size > 1048576 / UNIV_PAGE_SIZE) {
-
- goto shrink_again;
- }
- goto func_exit;
-
-func_done:
- buf_pool->old_pool_size = buf_pool->curr_pool_size;
-func_exit:
- buf_pool_mutex_exit(buf_pool);
- btr_search_enable();
-}
-
-/********************************************************************//**
-Shrinks the buffer pool. */
-static
-void
-buf_pool_shrink(
-/*============*/
- ulint chunk_size) /*!< in: number of pages to remove */
-{
- ulint i;
-
- for (i = 0; i < srv_buf_pool_instances; i++) {
- buf_pool_t* buf_pool;
- ulint instance_chunk_size;
-
- instance_chunk_size = chunk_size / srv_buf_pool_instances;
- buf_pool = buf_pool_from_array(i);
- buf_pool_shrink_instance(buf_pool, instance_chunk_size);
- }
-
- buf_pool_set_sizes();
-}
-
-/********************************************************************//**
-Rebuild buf_pool->page_hash for a buffer pool instance. */
-static
-void
-buf_pool_page_hash_rebuild_instance(
-/*================================*/
- buf_pool_t* buf_pool) /*!< in: buffer pool instance */
-{
- ulint i;
- buf_page_t* b;
- buf_chunk_t* chunk;
- ulint n_chunks;
- hash_table_t* zip_hash;
- hash_table_t* page_hash;
-
- buf_pool_mutex_enter(buf_pool);
-
- hash_lock_x_all(buf_pool->page_hash);
-
- /* Free, create, and populate the hash table. */
- ha_clear(buf_pool->page_hash);
-
- /*FIXME: This is broken. When we free the hash_table we
- free the sync_obj array as well. We either have to have a
- mechanism where it is guaranteed that nobody will try to
- acquire any of the page_hash locks or think some other
- way to implement this. It doesn't matter as of now because
- buffer pool resize code is not used currently. */
- hash_table_free(buf_pool->page_hash);
-
- ut_a(srv_n_page_hash_locks != 0);
- ut_a(srv_n_page_hash_locks <= MAX_PAGE_HASH_LOCKS);
-
- buf_pool->page_hash = page_hash
- = ha_create(2 * buf_pool->curr_size,
- srv_n_page_hash_locks,
- MEM_HEAP_FOR_PAGE_HASH,
- SYNC_BUF_PAGE_HASH);
-
- zip_hash = hash_create(2 * buf_pool->curr_size);
-
- HASH_MIGRATE(buf_pool->zip_hash, zip_hash, buf_page_t, hash,
- BUF_POOL_ZIP_FOLD_BPAGE);
-
- hash_table_free(buf_pool->zip_hash);
- buf_pool->zip_hash = zip_hash;
-
- /* Insert the uncompressed file pages to buf_pool->page_hash. */
-
- chunk = buf_pool->chunks;
- n_chunks = buf_pool->n_chunks;
-
- for (i = 0; i < n_chunks; i++, chunk++) {
- ulint j;
- buf_block_t* block = chunk->blocks;
-
- for (j = 0; j < chunk->size; j++, block++) {
- if (buf_block_get_state(block)
- == BUF_BLOCK_FILE_PAGE) {
- ut_ad(!block->page.in_zip_hash);
- ut_ad(block->page.in_page_hash);
-
- HASH_INSERT(buf_page_t, hash, page_hash,
- buf_page_address_fold(
- block->page.space,
- block->page.offset),
- &block->page);
- }
- }
- }
-
- /* Insert the compressed-only pages to buf_pool->page_hash.
- All such blocks are either in buf_pool->zip_clean or
- in buf_pool->flush_list. */
-
- for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
- b = UT_LIST_GET_NEXT(list, b)) {
- ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
- ut_ad(!b->in_flush_list);
- ut_ad(b->in_LRU_list);
- ut_ad(b->in_page_hash);
- ut_ad(!b->in_zip_hash);
-
- HASH_INSERT(buf_page_t, hash, page_hash,
- buf_page_address_fold(b->space, b->offset), b);
- }
-
- buf_flush_list_mutex_enter(buf_pool);
- for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
- b = UT_LIST_GET_NEXT(list, b)) {
- ut_ad(b->in_flush_list);
- ut_ad(b->in_LRU_list);
- ut_ad(b->in_page_hash);
- ut_ad(!b->in_zip_hash);
-
- switch (buf_page_get_state(b)) {
- case BUF_BLOCK_ZIP_DIRTY:
- HASH_INSERT(buf_page_t, hash, page_hash,
- buf_page_address_fold(b->space,
- b->offset), b);
- break;
- case BUF_BLOCK_FILE_PAGE:
- /* uncompressed page */
- break;
- case BUF_BLOCK_ZIP_FREE:
- case BUF_BLOCK_ZIP_PAGE:
- case BUF_BLOCK_NOT_USED:
- case BUF_BLOCK_READY_FOR_USE:
- case BUF_BLOCK_MEMORY:
- case BUF_BLOCK_REMOVE_HASH:
- ut_error;
- break;
- }
- }
-
- hash_unlock_x_all(buf_pool->page_hash);
- buf_flush_list_mutex_exit(buf_pool);
- buf_pool_mutex_exit(buf_pool);
-}
-
-/********************************************************************
Determine if a block is a sentinel for a buffer pool watch.
@return TRUE if a sentinel for a buffer pool watch, FALSE if not */
UNIV_INTERN
@@ -2004,123 +1641,6 @@ page_found:
return(NULL);
}
-/********************************************************************//**
-Rebuild buf_pool->page_hash. */
-static
-void
-buf_pool_page_hash_rebuild(void)
-/*============================*/
-{
- ulint i;
-
- for (i = 0; i < srv_buf_pool_instances; i++) {
- buf_pool_page_hash_rebuild_instance(buf_pool_from_array(i));
- }
-}
-
-/********************************************************************//**
-Increase the buffer pool size of one buffer pool instance. */
-static
-void
-buf_pool_increase_instance(
-/*=======================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instane */
- ulint change_size) /*!< in: new size of the pool */
-{
- buf_chunk_t* chunks;
- buf_chunk_t* chunk;
-
- buf_pool_mutex_enter(buf_pool);
- chunks = mem_alloc((buf_pool->n_chunks + 1) * sizeof *chunks);
-
- memcpy(chunks, buf_pool->chunks, buf_pool->n_chunks * sizeof *chunks);
-
- chunk = &chunks[buf_pool->n_chunks];
-
- if (!buf_chunk_init(buf_pool, chunk, change_size)) {
- mem_free(chunks);
- } else {
- buf_pool->old_pool_size = buf_pool->curr_pool_size;
- buf_pool->curr_size += chunk->size;
- buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
- mem_free(buf_pool->chunks);
- buf_pool->chunks = chunks;
- buf_pool->n_chunks++;
- }
-
- buf_pool_mutex_exit(buf_pool);
-}
-
-/********************************************************************//**
-Increase the buffer pool size. */
-static
-void
-buf_pool_increase(
-/*==============*/
- ulint change_size)
-{
- ulint i;
-
- for (i = 0; i < srv_buf_pool_instances; i++) {
- buf_pool_increase_instance(
- buf_pool_from_array(i),
- change_size / srv_buf_pool_instances);
- }
-
- buf_pool_set_sizes();
-}
-
-/********************************************************************//**
-Resizes the buffer pool. */
-UNIV_INTERN
-void
-buf_pool_resize(void)
-/*=================*/
-{
- ulint change_size;
- ulint min_change_size = 1048576 * srv_buf_pool_instances;
-
- buf_pool_mutex_enter_all();
-
- if (srv_buf_pool_old_size == srv_buf_pool_size) {
-
- buf_pool_mutex_exit_all();
-
- return;
-
- } else if (srv_buf_pool_curr_size + min_change_size
- > srv_buf_pool_size) {
-
- change_size = (srv_buf_pool_curr_size - srv_buf_pool_size)
- / UNIV_PAGE_SIZE;
-
- buf_pool_mutex_exit_all();
-
- /* Disable adaptive hash indexes and empty the index
- in order to free up memory in the buffer pool chunks. */
- buf_pool_shrink(change_size);
-
- } else if (srv_buf_pool_curr_size + min_change_size
- < srv_buf_pool_size) {
-
- /* Enlarge the buffer pool by at least one megabyte */
-
- change_size = srv_buf_pool_size - srv_buf_pool_curr_size;
-
- buf_pool_mutex_exit_all();
-
- buf_pool_increase(change_size);
- } else {
- srv_buf_pool_size = srv_buf_pool_old_size;
-
- buf_pool_mutex_exit_all();
-
- return;
- }
-
- buf_pool_page_hash_rebuild();
-}
-
/****************************************************************//**
Remove the sentinel block for the watch before replacing it with a real block.
buf_page_watch_clear() or buf_page_watch_occurred() will notice that
@@ -2924,12 +2444,8 @@ loop:
rw_lock_s_lock(hash_lock);
if (block) {
/* If the guess is a compressed page descriptor that
- has been allocated by buf_buddy_alloc(), it may have
- been invalidated by buf_buddy_relocate(). In that
- case, block could point to something that happens to
- contain the expected bits in block->page. Similarly,
- the guess may be pointing to a buffer pool chunk that
- has been released when resizing the buffer pool. */
+ has been allocated by buf_page_alloc_descriptor(),
+ it may have been freed by buf_relocate(). */
if (!buf_block_is_uncompressed(buf_pool, block)
|| offset != block->page.offset
@@ -2950,7 +2466,6 @@ loop:
buf_pool, space, offset, fold);
}
-loop2:
if (!block || buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
rw_lock_s_unlock(hash_lock);
block = NULL;
@@ -3096,15 +2611,10 @@ wait_until_unfixed:
buf_LRU_block_free_non_file_page(block);
buf_pool_mutex_exit(buf_pool);
mutex_exit(&block->mutex);
-
- block = (buf_block_t*) hash_bpage;
-
rw_lock_x_unlock(hash_lock);
- rw_lock_s_lock(hash_lock);
- /* Note that we are still holding the
- hash_lock which is fine as this is what
- we expect when we move to loop2 above. */
- goto loop2;
+
+ block = NULL;
+ goto loop;
}
if (UNIV_UNLIKELY
@@ -3138,8 +2648,10 @@ wait_until_unfixed:
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_REMOVE(list, buf_pool->zip_clean,
&block->page);
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
ut_ad(!block->page.in_flush_list);
} else {
/* Relocate buf_pool->flush_list. */
@@ -3166,11 +2678,10 @@ wait_until_unfixed:
mutex_exit(&buf_pool->zip_mutex);
buf_pool->n_pend_unzip++;
- bpage->state = BUF_BLOCK_ZIP_FREE;
- buf_buddy_free(buf_pool, bpage, sizeof *bpage);
-
buf_pool_mutex_exit(buf_pool);
+ buf_page_free_descriptor(bpage);
+
/* Decompress the page and apply buffered operations
while not holding buf_pool->mutex or block->mutex. */
success = buf_zip_decompress(block, srv_use_checksums);
@@ -3236,7 +2747,7 @@ wait_until_unfixed:
relocated or enter or exit the buf_pool while we
are holding the buf_pool->mutex. */
- if (buf_LRU_free_block(&block->page, TRUE) == BUF_LRU_FREED) {
+ if (buf_LRU_free_block(&block->page, TRUE)) {
buf_pool_mutex_exit(buf_pool);
rw_lock_x_lock(hash_lock);
@@ -3933,17 +3444,12 @@ err_exit:
mutex_exit(&block->mutex);
} else {
rw_lock_x_unlock(hash_lock);
- /* Defer buf_buddy_alloc() until after the block has
- been found not to exist. The buf_buddy_alloc() and
- buf_buddy_free() calls may be expensive because of
- buf_buddy_relocate(). */
/* The compressed page must be allocated before the
control block (bpage), in order to avoid the
invocation of buf_buddy_relocate_block() on
uninitialized data. */
data = buf_buddy_alloc(buf_pool, zip_size, &lru);
- bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru);
/* Initialize the buf_pool pointer. */
bpage->buf_pool_index = buf_pool_index(buf_pool);
@@ -3965,8 +3471,6 @@ err_exit:
/* The block was added by some other thread. */
rw_lock_x_unlock(hash_lock);
watch_page = NULL;
- bpage->state = BUF_BLOCK_ZIP_FREE;
- buf_buddy_free(buf_pool, bpage, sizeof *bpage);
buf_buddy_free(buf_pool, data, zip_size);
bpage = NULL;
@@ -3974,6 +3478,8 @@ err_exit:
}
}
+ bpage = buf_page_alloc_descriptor();
+
page_zip_des_init(&bpage->zip);
page_zip_set_size(&bpage->zip, zip_size);
bpage->zip.data = data;
@@ -4016,7 +3522,9 @@ err_exit:
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(bpage);
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
buf_page_set_io_fix(bpage, BUF_IO_READ);
=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c 2011-05-12 13:54:33 +0000
+++ b/storage/innobase/buf/buf0flu.c 2011-06-16 12:33:20 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2011, 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
@@ -539,7 +539,9 @@ buf_flush_remove(
case BUF_BLOCK_ZIP_DIRTY:
buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE);
UT_LIST_REMOVE(list, buf_pool->flush_list, bpage);
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(bpage);
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
break;
case BUF_BLOCK_FILE_PAGE:
UT_LIST_REMOVE(list, buf_pool->flush_list, bpage);
=== modified file 'storage/innobase/buf/buf0lru.c'
--- a/storage/innobase/buf/buf0lru.c 2011-04-13 08:34:16 +0000
+++ b/storage/innobase/buf/buf0lru.c 2011-06-17 20:32:42 +0000
@@ -358,7 +358,9 @@ scan_again:
while (bpage != NULL) {
buf_page_t* prev_bpage;
- ibool prev_bpage_buf_fix = FALSE;
+ ulint fold;
+ rw_lock_t* hash_lock = NULL;
+ mutex_t* block_mutex = NULL;
ut_a(buf_page_in_file(bpage));
@@ -371,136 +373,97 @@ scan_again:
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
the space that is being invalidated. */
+ goto next_page;
} else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* We cannot remove this page during this scan
yet; maybe the system is currently reading it
in, or flushing the modifications to the file */
all_freed = FALSE;
+ goto next_page;
} else {
- ulint fold = buf_page_address_fold(bpage->space,
- bpage->offset);
- rw_lock_t* hash_lock = buf_page_hash_lock_get(buf_pool,
- fold);
-
- mutex_t* block_mutex = buf_page_get_mutex(bpage);
+ fold = buf_page_address_fold(bpage->space,
+ bpage->offset);
+ hash_lock = buf_page_hash_lock_get(buf_pool, fold);
+ block_mutex = buf_page_get_mutex(bpage);
rw_lock_x_lock(hash_lock);
mutex_enter(block_mutex);
if (bpage->buf_fix_count > 0) {
+ rw_lock_x_unlock(hash_lock);
+ mutex_exit(block_mutex);
+
/* We cannot remove this page during
this scan yet; maybe the system is
currently reading it in, or flushing
the modifications to the file */
all_freed = FALSE;
- rw_lock_x_unlock(hash_lock);
- mutex_exit(block_mutex);
goto next_page;
}
+ }
+
+ ut_ad(mutex_own(block_mutex));
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(rw_lock_own(hash_lock, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
#ifdef UNIV_DEBUG
- if (buf_debug_prints) {
- fprintf(stderr,
- "Dropping space %lu page %lu\n",
- (ulong) buf_page_get_space(bpage),
- (ulong) buf_page_get_page_no(bpage));
- }
+ if (buf_debug_prints) {
+ fprintf(stderr,
+ "Dropping space %lu page %lu\n",
+ (ulong) buf_page_get_space(bpage),
+ (ulong) buf_page_get_page_no(bpage));
+ }
#endif
- if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
- /* This is a compressed-only block
- descriptor. Ensure that prev_bpage
- cannot be relocated when bpage is freed. */
- if (UNIV_LIKELY(prev_bpage != NULL)) {
- switch (buf_page_get_state(
- prev_bpage)) {
- case BUF_BLOCK_FILE_PAGE:
- /* Descriptors of uncompressed
- blocks will not be relocated,
- because we are holding the
- buf_pool->mutex. */
- break;
- case BUF_BLOCK_ZIP_PAGE:
- case BUF_BLOCK_ZIP_DIRTY:
- /* Descriptors of compressed-
- only blocks can be relocated,
- unless they are buffer-fixed.
- Because both bpage and
- prev_bpage are protected by
- buf_pool_zip_mutex, it is
- not necessary to acquire
- further mutexes. */
- ut_ad(&buf_pool->zip_mutex
- == block_mutex);
- ut_ad(mutex_own(block_mutex));
- prev_bpage_buf_fix = TRUE;
- prev_bpage->buf_fix_count++;
- break;
- default:
- ut_error;
- }
- }
- } else if (((buf_block_t*) bpage)->is_hashed) {
- ulint page_no;
- ulint zip_size;
+ if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
+ /* This is a compressed-only block
+ descriptor. Do nothing. */
+ } else if (((buf_block_t*) bpage)->is_hashed) {
+ ulint page_no;
+ ulint zip_size;
- buf_pool_mutex_exit(buf_pool);
+ buf_pool_mutex_exit(buf_pool);
- zip_size = buf_page_get_zip_size(bpage);
- page_no = buf_page_get_page_no(bpage);
+ zip_size = buf_page_get_zip_size(bpage);
+ page_no = buf_page_get_page_no(bpage);
- rw_lock_x_unlock(hash_lock);
- mutex_exit(block_mutex);
-
- /* Note that the following call will acquire
- an S-latch on the page */
+ rw_lock_x_unlock(hash_lock);
+ mutex_exit(block_mutex);
- btr_search_drop_page_hash_when_freed(
- id, zip_size, page_no);
- goto scan_again;
- }
+ /* Note that the following call will acquire
+ an S-latch on the page */
- if (bpage->oldest_modification != 0) {
+ btr_search_drop_page_hash_when_freed(
+ id, zip_size, page_no);
+ goto scan_again;
+ }
- buf_flush_remove(bpage);
- }
+ if (bpage->oldest_modification != 0) {
- /* Remove from the LRU list. */
+ buf_flush_remove(bpage);
+ }
- if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
- != BUF_BLOCK_ZIP_FREE) {
- buf_LRU_block_free_hashed_page((buf_block_t*)
- bpage);
- } else {
- /* The block_mutex should have been
- released by buf_LRU_block_remove_hashed_page() */
- ut_ad(block_mutex == &buf_pool->zip_mutex);
- ut_ad(!mutex_own(block_mutex));
-
- if (prev_bpage_buf_fix) {
- /* We temporarily buffer-fixed
- prev_bpage, so that
- buf_buddy_free() could not
- relocate it, in case it was a
- compressed-only block
- descriptor. */
-
- mutex_enter(block_mutex);
- ut_ad(prev_bpage->buf_fix_count > 0);
- prev_bpage->buf_fix_count--;
- mutex_exit(block_mutex);
- }
+ /* Remove from the LRU list. */
- }
+ if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
+ != BUF_BLOCK_ZIP_FREE) {
+ buf_LRU_block_free_hashed_page((buf_block_t*)
+ bpage);
+ } else {
+ /* The block_mutex should have been
+ released by buf_LRU_block_remove_hashed_page() */
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
+ }
+ ut_ad(!mutex_own(block_mutex));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(hash_lock, RW_LOCK_EX)
- && !rw_lock_own(hash_lock, RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(hash_lock, RW_LOCK_EX)
+ && !rw_lock_own(hash_lock, RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
- ut_ad(!mutex_own(block_mutex));
- }
+ ut_ad(!mutex_own(block_mutex));
next_page:
bpage = prev_bpage;
@@ -541,6 +504,7 @@ buf_LRU_invalidate_tablespace(
}
}
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -573,6 +537,7 @@ buf_LRU_insert_zip_clean(
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, bpage);
}
}
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/******************************************************************//**
Try to free an uncompressed page of a compressed block from the unzip
@@ -616,31 +581,16 @@ buf_LRU_free_from_unzip_LRU_list(
UNIV_LIKELY(block != NULL) && UNIV_LIKELY(distance > 0);
block = UT_LIST_GET_PREV(unzip_LRU, block), distance--) {
- enum buf_lru_free_block_status freed;
+ ibool freed;
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(block->in_unzip_LRU_list);
ut_ad(block->page.in_LRU_list);
freed = buf_LRU_free_block(&block->page, FALSE);
- switch (freed) {
- case BUF_LRU_FREED:
+ if (freed) {
return(TRUE);
-
- case BUF_LRU_CANNOT_RELOCATE:
- /* If we failed to relocate, try
- regular LRU eviction. */
- return(FALSE);
-
- case BUF_LRU_NOT_FREED:
- /* The block was buffer-fixed or I/O-fixed.
- Keep looking. */
- continue;
}
-
- /* inappropriate return value from
- buf_LRU_free_block() */
- ut_error;
}
return(FALSE);
@@ -673,16 +623,15 @@ buf_LRU_free_from_common_LRU_list(
UNIV_LIKELY(bpage != NULL) && UNIV_LIKELY(distance > 0);
bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) {
- enum buf_lru_free_block_status freed;
- unsigned accessed;
+ ibool freed;
+ unsigned accessed;
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
accessed = buf_page_is_accessed(bpage);
freed = buf_LRU_free_block(bpage, TRUE);
- switch (freed) {
- case BUF_LRU_FREED:
+ if (freed) {
/* Keep track of pages that are evicted without
ever being accessed. This gives us a measure of
the effectiveness of readahead */
@@ -690,21 +639,7 @@ buf_LRU_free_from_common_LRU_list(
++buf_pool->stat.n_ra_pages_evicted;
}
return(TRUE);
-
- case BUF_LRU_NOT_FREED:
- /* The block was dirty, buffer-fixed, or I/O-fixed.
- Keep looking. */
- continue;
-
- case BUF_LRU_CANNOT_RELOCATE:
- /* This should never occur, because we
- want to discard the compressed page too. */
- break;
}
-
- /* inappropriate return value from
- buf_LRU_free_block() */
- ut_error;
}
return(FALSE);
@@ -1430,16 +1365,15 @@ buf_LRU_make_block_old(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns BUF_LRU_FREED, it will temporarily
+NOTE: If this function returns TRUE, it will temporarily
release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
The caller must hold buf_pool->mutex and must not hold any
buf_page_get_mutex() when calling this function.
-@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
-BUF_LRU_NOT_FREED otherwise. */
+@return TRUE if freed, FALSE otherwise. */
UNIV_INTERN
-enum buf_lru_free_block_status
+ibool
buf_LRU_free_block(
/*===============*/
buf_page_t* bpage, /*!< in: block to be freed */
@@ -1448,7 +1382,6 @@ buf_LRU_free_block(
{
buf_page_t* b = NULL;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- enum buf_lru_free_block_status ret;
enum buf_page_state page_state;
const ulint fold = buf_page_address_fold(bpage->space,
bpage->offset);
@@ -1473,7 +1406,7 @@ buf_LRU_free_block(
if (!buf_page_can_relocate(bpage)) {
/* Do not free buffer-fixed or I/O-fixed blocks. */
- goto no_free_exit;
+ goto func_exit;
}
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -1485,7 +1418,7 @@ buf_LRU_free_block(
/* Do not completely free dirty blocks. */
if (bpage->oldest_modification) {
- goto no_free_exit;
+ goto func_exit;
}
} else if ((bpage->oldest_modification)
&& (buf_page_get_state(bpage)
@@ -1494,42 +1427,17 @@ buf_LRU_free_block(
ut_ad(buf_page_get_state(bpage)
== BUF_BLOCK_ZIP_DIRTY);
- goto no_free_exit;
-
- } else if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
-
- mutex_exit(block_mutex);
- /* Allocate the control block for the compressed page.
- If it cannot be allocated (without freeing a block
- from the LRU list), refuse to free bpage. */
- buf_pool_mutex_exit_forbid(buf_pool);
- b = buf_buddy_alloc(buf_pool, sizeof *b, NULL);
- buf_pool_mutex_exit_allow(buf_pool);
-
- mutex_enter(block_mutex);
-
- /* The block may get buffer fixed while we released
- the block mutex. In that case we free the newly
- allocated descriptor and return */
- if (!buf_page_can_relocate(bpage)) {
- if (b) {
- buf_buddy_free(buf_pool, b, sizeof(*b));
- }
-no_free_exit:
- ret = BUF_LRU_NOT_FREED;
func_exit:
- rw_lock_x_unlock(hash_lock);
- mutex_exit(block_mutex);
- return(ret);
- }
-
- if (UNIV_UNLIKELY(!b)) {
- ret = BUF_LRU_CANNOT_RELOCATE;
- goto func_exit;
- }
+ rw_lock_x_unlock(hash_lock);
+ mutex_exit(block_mutex);
+ return(FALSE);
+ } else if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
+ b = buf_page_alloc_descriptor();
+ ut_a(b);
memcpy(b, bpage, sizeof *b);
}
+
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
@@ -1563,7 +1471,7 @@ func_exit:
#endif /* UNIV_SYNC_DEBUG */
if (page_state == BUF_BLOCK_ZIP_FREE) {
- return(BUF_LRU_FREED);
+ return(TRUE);
}
ut_ad(page_state == BUF_BLOCK_REMOVE_HASH);
@@ -1662,7 +1570,9 @@ func_exit:
}
if (b->state == BUF_BLOCK_ZIP_PAGE) {
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(b);
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
} else {
/* Relocate on buf_pool->flush_list. */
buf_flush_relocate_on_flush_list(bpage, b);
@@ -1722,7 +1632,7 @@ func_exit:
}
buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
- return(BUF_LRU_FREED);
+ return(TRUE);
}
/******************************************************************//**
@@ -1952,7 +1862,9 @@ buf_LRU_block_remove_hashed_page(
ut_a(bpage->zip.data);
ut_a(buf_page_get_zip_size(bpage));
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage);
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
mutex_exit(&buf_pool->zip_mutex);
rw_lock_x_unlock(hash_lock);
@@ -1962,11 +1874,9 @@ buf_LRU_block_remove_hashed_page(
buf_pool, bpage->zip.data,
page_zip_get_size(&bpage->zip));
- bpage->state = BUF_BLOCK_ZIP_FREE;
- buf_buddy_free(buf_pool, bpage, sizeof(*bpage));
buf_pool_mutex_exit_allow(buf_pool);
+ buf_page_free_descriptor(bpage);
- UNIV_MEM_UNDESC(bpage);
return(BUF_BLOCK_ZIP_FREE);
case BUF_BLOCK_FILE_PAGE:
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2011-06-01 09:11:28 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2011-06-02 07:05:42 +0000
@@ -12089,7 +12089,7 @@ static MYSQL_SYSVAR_ULONG(purge_batch_si
PLUGIN_VAR_OPCMDARG,
"Number of UNDO log pages to purge in one batch from the history list.",
NULL, NULL,
- 20, /* Default setting */
+ 300, /* Default setting */
1, /* Minimum value */
5000, 0); /* Maximum value */
=== modified file 'storage/innobase/include/btr0btr.h'
--- a/storage/innobase/include/btr0btr.h 2011-02-08 12:16:14 +0000
+++ b/storage/innobase/include/btr0btr.h 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -481,11 +481,14 @@ UNIV_INTERN
ibool
btr_compress(
/*=========*/
- btr_cur_t* cursor, /*!< in: cursor on the page to merge or lift;
- the page must not be empty: in record delete
- use btr_discard_page if the page would become
- empty */
- mtr_t* mtr); /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge
+ or lift; the page must not be empty:
+ when deleting records, use btr_discard_page()
+ if the page would become empty */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/*************************************************************//**
Discards a page from a B-tree. This is used to remove the last record from
a B-tree page: the whole page must be removed at the same time. This cannot
=== modified file 'storage/innobase/include/btr0cur.h'
--- a/storage/innobase/include/btr0cur.h 2011-02-15 10:42:53 +0000
+++ b/storage/innobase/include/btr0cur.h 2011-06-16 09:26:09 +0000
@@ -36,6 +36,9 @@ Created 10/16/1994 Heikki Tuuri
#define BTR_NO_LOCKING_FLAG 2 /* do no record lock checking */
#define BTR_KEEP_SYS_FLAG 4 /* sys fields will be found from the
update vector or inserted entry */
+#define BTR_KEEP_POS_FLAG 8 /* btr_cur_pessimistic_update()
+ must keep cursor position when
+ moving columns to big_rec */
#ifndef UNIV_HOTBACKUP
#include "que0types.h"
@@ -312,7 +315,9 @@ btr_cur_pessimistic_update(
/*=======================*/
ulint flags, /*!< in: undo logging, locking, and rollback
flags */
- btr_cur_t* cursor, /*!< in: cursor on the record to update */
+ btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
+ cursor may become invalid if *big_rec == NULL
+ || !(flags & BTR_KEEP_POS_FLAG) */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
be stored externally by the caller, or NULL */
@@ -324,6 +329,16 @@ btr_cur_pessimistic_update(
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr); /*!< in: mtr; must be committed before
latching any further pages */
+/*****************************************************************
+Commits and restarts a mini-transaction so that it will retain an
+x-lock on index->lock and the cursor page. */
+UNIV_INTERN
+void
+btr_cur_mtr_commit_and_start(
+/*=========================*/
+ btr_cur_t* cursor, /*!< in: cursor */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ UNIV_COLD __attribute__((nonnull));
/***********************************************************//**
Marks a clustered index record deleted. Writes an undo log record to
undo log on this delete marking. Writes in the trx id field the id
@@ -366,10 +381,13 @@ UNIV_INTERN
ibool
btr_cur_compress_if_useful(
/*=======================*/
- btr_cur_t* cursor, /*!< in: cursor on the page to compress;
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress;
cursor does not stay valid if compression
occurs */
- mtr_t* mtr); /*!< in: mtr */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/*******************************************************//**
Removes the record on which the tree cursor is positioned. It is assumed
that the mtr has an x-latch on the page where the cursor is positioned,
=== modified file 'storage/innobase/include/btr0cur.ic'
--- a/storage/innobase/include/btr0cur.ic 2011-02-15 10:42:53 +0000
+++ b/storage/innobase/include/btr0cur.ic 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -140,7 +140,7 @@ btr_cur_compress_recommendation(
btr_cur_t* cursor, /*!< in: btr cursor */
mtr_t* mtr) /*!< in: mtr */
{
- page_t* page;
+ const page_t* page;
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX));
=== modified file 'storage/innobase/include/buf0buddy.h'
--- a/storage/innobase/include/buf0buddy.h 2010-10-20 11:53:25 +0000
+++ b/storage/innobase/include/buf0buddy.h 2011-06-17 20:32:42 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2006, 2011, 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
@@ -37,25 +37,24 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any
-block->mutex. The buf_pool->mutex may only be released and reacquired
-if lru != NULL. This function should only be used for allocating
-compressed page frames or control blocks (buf_page_t). Allocated
-control blocks must be properly initialized immediately after
-buf_buddy_alloc() has returned the memory, before releasing
-buf_pool->mutex.
-@return allocated block, possibly NULL if lru == NULL */
+block->mutex. The buf_pool_mutex may be released and reacquired.
+This function should only be used for allocating compressed page frames.
+@return allocated block, never NULL */
UNIV_INLINE
void*
buf_buddy_alloc(
/*============*/
- buf_pool_t* buf_pool,
- /*!< buffer pool in which the block resides */
- ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
- ibool* lru) /*!< in: pointer to a variable that will be assigned
- TRUE if storage was allocated from the LRU list
- and buf_pool->mutex was temporarily released,
- or NULL if the LRU list should not be used */
- __attribute__((malloc));
+ buf_pool_t* buf_pool, /*!< in: buffer pool in which
+ the page resides */
+ ulint size, /*!< in: compressed page size
+ (between UNIV_ZIP_SIZE_MIN and
+ UNIV_PAGE_SIZE) */
+ ibool* lru) /*!< in: pointer to a variable
+ that will be assigned TRUE if
+ storage was allocated from the
+ LRU list and buf_pool->mutex was
+ temporarily released */
+ __attribute__((malloc, nonnull));
/**********************************************************************//**
Release a block. */
=== modified file 'storage/innobase/include/buf0buddy.ic'
--- a/storage/innobase/include/buf0buddy.ic 2010-10-20 11:53:25 +0000
+++ b/storage/innobase/include/buf0buddy.ic 2011-06-17 20:32:42 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2006, 2011, 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
@@ -36,8 +36,8 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
-The buf_pool->mutex may only be released and reacquired if lru != NULL.
-@return allocated block, possibly NULL if lru==NULL */
+The buf_pool_mutex may be released and reacquired.
+@return allocated block, never NULL */
UNIV_INTERN
void*
buf_buddy_alloc_low(
@@ -48,9 +48,8 @@ buf_buddy_alloc_low(
or BUF_BUDDY_SIZES */
ibool* lru) /*!< in: pointer to a variable that will be assigned
TRUE if storage was allocated from the LRU list
- and buf_pool->mutex was temporarily released,
- or NULL if the LRU list should not be used */
- __attribute__((malloc));
+ and buf_pool_mutex was temporarily released */
+ __attribute__((malloc, nonnull));
/**********************************************************************//**
Deallocate a block. */
@@ -77,6 +76,8 @@ buf_buddy_get_slot(
ulint i;
ulint s;
+ ut_ad(size >= UNIV_ZIP_SIZE_MIN);
+
for (i = 0, s = BUF_BUDDY_LOW; s < size; i++, s <<= 1) {
}
@@ -87,29 +88,28 @@ buf_buddy_get_slot(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any
-block->mutex. The buf_pool->mutex may only be released and reacquired
-if lru != NULL. This function should only be used for allocating
-compressed page frames or control blocks (buf_page_t). Allocated
-control blocks must be properly initialized immediately after
-buf_buddy_alloc() has returned the memory, before releasing
-buf_pool->mutex.
-@return allocated block, possibly NULL if lru == NULL */
+block->mutex. The buf_pool_mutex may be released and reacquired.
+This function should only be used for allocating compressed page frames.
+@return allocated block, never NULL */
UNIV_INLINE
void*
buf_buddy_alloc(
/*============*/
buf_pool_t* buf_pool, /*!< in: buffer pool in which
the page resides */
- ulint size, /*!< in: block size, up to
- UNIV_PAGE_SIZE */
+ ulint size, /*!< in: compressed page size
+ (between UNIV_ZIP_SIZE_MIN and
+ UNIV_PAGE_SIZE) */
ibool* lru) /*!< in: pointer to a variable
that will be assigned TRUE if
storage was allocated from the
LRU list and buf_pool->mutex was
- temporarily released, or NULL if
- the LRU list should not be used */
+ temporarily released */
{
ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(ut_is_2pow(size));
+ ut_ad(size >= UNIV_ZIP_SIZE_MIN);
+ ut_ad(size <= UNIV_PAGE_SIZE);
return(buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size), lru));
}
@@ -127,6 +127,9 @@ buf_buddy_free(
UNIV_PAGE_SIZE */
{
ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(ut_is_2pow(size));
+ ut_ad(size >= UNIV_ZIP_SIZE_MIN);
+ ut_ad(size <= UNIV_PAGE_SIZE);
buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size));
}
=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h 2011-05-24 08:42:51 +0000
+++ b/storage/innobase/include/buf0buf.h 2011-06-17 20:32:42 +0000
@@ -252,12 +252,6 @@ buf_relocate(
BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */
buf_page_t* dpage) /*!< in/out: destination control block */
__attribute__((nonnull));
-/********************************************************************//**
-Resizes the buffer pool. */
-UNIV_INTERN
-void
-buf_pool_resize(void);
-/*=================*/
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
@@ -281,6 +275,22 @@ lsn_t
buf_pool_get_oldest_modification(void);
/*==================================*/
/********************************************************************//**
+Allocates a buf_page_t descriptor. This function must succeed. In case
+of failure we assert in this function. */
+UNIV_INLINE
+buf_page_t*
+buf_page_alloc_descriptor(void)
+/*===========================*/
+ __attribute__((malloc));
+/********************************************************************//**
+Free a buf_page_t descriptor. */
+UNIV_INLINE
+void
+buf_page_free_descriptor(
+/*=====================*/
+ buf_page_t* bpage) /*!< in: bpage descriptor to free. */
+ __attribute__((nonnull));
+/********************************************************************//**
Allocates a buffer block.
@return own: the allocated block, in state BUF_BLOCK_MEMORY */
UNIV_INTERN
@@ -587,6 +597,31 @@ buf_block_get_modify_clock(
#else /* !UNIV_HOTBACKUP */
# define buf_block_modify_clock_inc(block) ((void) 0)
#endif /* !UNIV_HOTBACKUP */
+/*******************************************************************//**
+Increments the bufferfix count. */
+UNIV_INLINE
+void
+buf_block_buf_fix_inc_func(
+/*=======================*/
+#ifdef UNIV_SYNC_DEBUG
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line */
+#endif /* UNIV_SYNC_DEBUG */
+ buf_block_t* block) /*!< in/out: block to bufferfix */
+ __attribute__((nonnull));
+#ifdef UNIV_SYNC_DEBUG
+/** Increments the bufferfix count.
+@param b in/out: block to bufferfix
+@param f in: file name where requested
+@param l in: line number where requested */
+# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
+#else /* UNIV_SYNC_DEBUG */
+/** Increments the bufferfix count.
+@param b in/out: block to bufferfix
+@param f in: file name where requested
+@param l in: line number where requested */
+# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
+#endif /* UNIV_SYNC_DEBUG */
/********************************************************************//**
Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value
@@ -1261,7 +1296,7 @@ ulint
buf_get_free_list_len(void);
/*=======================*/
-/********************************************************************
+/********************************************************************//**
Determine if a block is a sentinel for a buffer pool watch.
@return TRUE if a sentinel for a buffer pool watch, FALSE if not */
UNIV_INTERN
@@ -1829,8 +1864,10 @@ struct buf_pool_struct{
frames and buf_page_t descriptors of blocks that exist
in the buffer pool only in compressed form. */
/* @{ */
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES];
/*!< buddy free lists */
=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic 2011-04-19 13:16:51 +0000
+++ b/storage/innobase/include/buf0buf.ic 2011-06-17 20:32:42 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -766,6 +766,35 @@ buf_block_get_lock_hash_val(
}
/********************************************************************//**
+Allocates a buf_page_t descriptor. This function must succeed. In case
+of failure we assert in this function.
+@return: the allocated descriptor. */
+UNIV_INLINE
+buf_page_t*
+buf_page_alloc_descriptor(void)
+/*===========================*/
+{
+ buf_page_t* bpage;
+
+ bpage = (buf_page_t*) ut_malloc(sizeof *bpage);
+ ut_d(memset(bpage, 0, sizeof *bpage));
+ UNIV_MEM_ALLOC(bpage, sizeof *bpage);
+
+ return(bpage);
+}
+
+/********************************************************************//**
+Free a buf_page_t descriptor. */
+UNIV_INLINE
+void
+buf_page_free_descriptor(
+/*=====================*/
+ buf_page_t* bpage) /*!< in: bpage descriptor to free. */
+{
+ ut_free(bpage);
+}
+
+/********************************************************************//**
Frees a buffer block which does not contain a file page. */
UNIV_INLINE
void
@@ -909,19 +938,6 @@ buf_block_buf_fix_inc_func(
block->page.buf_fix_count++;
}
-#ifdef UNIV_SYNC_DEBUG
-/** Increments the bufferfix count.
-@param b in/out: block to bufferfix
-@param f in: file name where requested
-@param l in: line number where requested */
-# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
-#else /* UNIV_SYNC_DEBUG */
-/** Increments the bufferfix count.
-@param b in/out: block to bufferfix
-@param f in: file name where requested
-@param l in: line number where requested */
-# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
-#endif /* UNIV_SYNC_DEBUG */
/*******************************************************************//**
Decrements the bufferfix count. */
@@ -1270,7 +1286,7 @@ buf_block_dbg_add_level(
where we have acquired latch */
ulint level) /*!< in: latching order level */
{
- sync_thread_add_level(&block->lock, level);
+ sync_thread_add_level(&block->lock, level, FALSE);
}
#endif /* UNIV_SYNC_DEBUG */
/********************************************************************//**
=== modified file 'storage/innobase/include/buf0lru.h'
--- a/storage/innobase/include/buf0lru.h 2011-04-13 08:34:16 +0000
+++ b/storage/innobase/include/buf0lru.h 2011-06-17 20:32:42 +0000
@@ -31,18 +31,6 @@ Created 11/5/1995 Heikki Tuuri
#include "ut0byte.h"
#include "buf0types.h"
-/** The return type of buf_LRU_free_block() */
-enum buf_lru_free_block_status {
- /** freed */
- BUF_LRU_FREED = 0,
- /** not freed because the caller asked to remove the
- uncompressed frame but the control block cannot be
- relocated */
- BUF_LRU_CANNOT_RELOCATE,
- /** not freed because of some other reason */
- BUF_LRU_NOT_FREED
-};
-
/******************************************************************//**
Tries to remove LRU flushed blocks from the end of the LRU list and put them
to the free list. This is beneficial for the efficiency of the insert buffer
@@ -86,6 +74,7 @@ void
buf_LRU_invalidate_tablespace(
/*==========================*/
ulint id); /*!< in: space id */
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -93,21 +82,21 @@ void
buf_LRU_insert_zip_clean(
/*=====================*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/******************************************************************//**
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns BUF_LRU_FREED, it will temporarily
+NOTE: If this function returns TRUE, it will temporarily
release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
The caller must hold buf_pool->mutex and must not hold any
buf_page_get_mutex() when calling this function.
-@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
-BUF_LRU_NOT_FREED otherwise. */
+@return TRUE if freed, FALSE otherwise. */
UNIV_INTERN
-enum buf_lru_free_block_status
+ibool
buf_LRU_free_block(
/*===============*/
buf_page_t* bpage, /*!< in: block to be freed */
=== modified file 'storage/innobase/include/buf0types.h'
--- a/storage/innobase/include/buf0types.h 2010-10-21 08:03:18 +0000
+++ b/storage/innobase/include/buf0types.h 2011-06-17 20:32:42 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, 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
@@ -59,17 +59,10 @@ enum buf_io_fix {
/** Parameters of binary buddy system for compressed pages (buf0buddy.h) */
/* @{ */
-#if UNIV_WORD_SIZE <= 4 /* 32-bit system */
-/** Base-2 logarithm of the smallest buddy block size */
-# define BUF_BUDDY_LOW_SHIFT 6
-#else /* 64-bit system */
-/** Base-2 logarithm of the smallest buddy block size */
-# define BUF_BUDDY_LOW_SHIFT 7
-#endif
+#define BUF_BUDDY_LOW_SHIFT UNIV_ZIP_SIZE_SHIFT_MIN
+
#define BUF_BUDDY_LOW (1 << BUF_BUDDY_LOW_SHIFT)
- /*!< minimum block size in the binary
- buddy system; must be at least
- sizeof(buf_page_t) */
+
#define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT)
/*!< number of buddy sizes */
=== modified file 'storage/innobase/include/page0cur.ic'
--- a/storage/innobase/include/page0cur.ic 2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/page0cur.ic 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -27,6 +27,8 @@ Created 10/4/1994 Heikki Tuuri
#include "buf0types.h"
#ifdef UNIV_DEBUG
+# include "rem0cmp.h"
+
/*********************************************************//**
Gets pointer to the page frame where the cursor is positioned.
@return page */
@@ -268,6 +270,7 @@ page_cur_tuple_insert(
index, rec, offsets, mtr);
}
+ ut_ad(!rec || !cmp_dtuple_rec(tuple, rec, offsets));
mem_heap_free(heap);
return(rec);
}
=== modified file 'storage/innobase/include/page0page.h'
--- a/storage/innobase/include/page0page.h 2011-05-09 08:48:47 +0000
+++ b/storage/innobase/include/page0page.h 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -284,16 +284,42 @@ page_get_supremum_offset(
const page_t* page); /*!< in: page which must have record(s) */
#define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
#define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
+
/************************************************************//**
-Returns the middle record of record list. If there are an even number
-of records in the list, returns the first record of upper half-list.
-@return middle record */
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
UNIV_INTERN
+const rec_t*
+page_rec_get_nth_const(
+/*===================*/
+ const page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
+ __attribute__((nonnull, warn_unused_result));
+/************************************************************//**
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
+UNIV_INLINE
+rec_t*
+page_rec_get_nth(
+/*=============*/
+ page_t* page, /*< in: page */
+ ulint nth) /*!< in: nth record */
+ __attribute__((nonnull, warn_unused_result));
+
+#ifndef UNIV_HOTBACKUP
+/************************************************************//**
+Returns the middle record of the records on the page. If there is an
+even number of records in the list, returns the first record of the
+upper half-list.
+@return middle record */
+UNIV_INLINE
rec_t*
page_get_middle_rec(
/*================*/
- page_t* page); /*!< in: page */
-#ifndef UNIV_HOTBACKUP
+ page_t* page) /*!< in: page */
+ __attribute__((nonnull, warn_unused_result));
/*************************************************************//**
Compares a data tuple to a physical record. Differs from the function
cmp_dtuple_rec_with_match in the way that the record must reside on an
@@ -348,6 +374,7 @@ page_get_n_recs(
/***************************************************************//**
Returns the number of records before the given record in chain.
The number includes infimum and supremum records.
+This is the inverse function of page_rec_get_nth().
@return number of records */
UNIV_INTERN
ulint
@@ -618,6 +645,7 @@ rec_t*
page_rec_find_owner_rec(
/*====================*/
rec_t* rec); /*!< in: the physical record */
+#ifndef UNIV_HOTBACKUP
/***********************************************************************//**
Write a 32-bit field in a data dictionary record. */
UNIV_INLINE
@@ -626,9 +654,10 @@ page_rec_write_field(
/*=================*/
rec_t* rec, /*!< in/out: record to update */
ulint i, /*!< in: index of the field to update */
- ulint page_no,/*!< in: value to write */
+ ulint val, /*!< in: value to write */
mtr_t* mtr) /*!< in/out: mini-transaction */
__attribute__((nonnull));
+#endif /* !UNIV_HOTBACKUP */
/************************************************************//**
Returns the maximum combined size of records which can be inserted on top
of record heap.
=== modified file 'storage/innobase/include/page0page.ic'
--- a/storage/innobase/include/page0page.ic 2011-05-09 08:48:47 +0000
+++ b/storage/innobase/include/page0page.ic 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -419,7 +419,37 @@ page_rec_is_infimum(
return(page_rec_is_infimum_low(page_offset(rec)));
}
+/************************************************************//**
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
+UNIV_INLINE
+rec_t*
+page_rec_get_nth(
+/*=============*/
+ page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
+{
+ return((rec_t*) page_rec_get_nth_const(page, nth));
+}
+
#ifndef UNIV_HOTBACKUP
+/************************************************************//**
+Returns the middle record of the records on the page. If there is an
+even number of records in the list, returns the first record of the
+upper half-list.
+@return middle record */
+UNIV_INLINE
+rec_t*
+page_get_middle_rec(
+/*================*/
+ page_t* page) /*!< in: page */
+{
+ ulint middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
+
+ return(page_rec_get_nth(page, middle));
+}
+
/*************************************************************//**
Compares a data tuple to a physical record. Differs from the function
cmp_dtuple_rec_with_match in the way that the record must reside on an
@@ -959,6 +989,7 @@ page_get_free_space_of_empty(
- 2 * PAGE_DIR_SLOT_SIZE));
}
+#ifndef UNIV_HOTBACKUP
/***********************************************************************//**
Write a 32-bit field in a data dictionary record. */
UNIV_INLINE
@@ -979,6 +1010,7 @@ page_rec_write_field(
mlog_write_ulint(data, val, MLOG_4BYTES, mtr);
}
+#endif /* !UNIV_HOTBACKUP */
/************************************************************//**
Each user record on a page, and also the deleted user records in the heap
=== modified file 'storage/innobase/include/rem0rec.h'
--- a/storage/innobase/include/rem0rec.h 2011-03-22 12:34:16 +0000
+++ b/storage/innobase/include/rem0rec.h 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -480,6 +480,18 @@ ulint
rec_offs_any_extern(
/*================*/
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+/******************************************************//**
+Determine if the offsets are for a record containing null BLOB pointers.
+@return first field containing a null BLOB pointer, or NULL if none found */
+UNIV_INLINE
+const byte*
+rec_offs_any_null_extern(
+/*=====================*/
+ const rec_t* rec, /*!< in: record */
+ const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+ __attribute__((nonnull, warn_unused_result));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@return nonzero if externally stored */
=== modified file 'storage/innobase/include/rem0rec.ic'
--- a/storage/innobase/include/rem0rec.ic 2011-03-22 12:34:16 +0000
+++ b/storage/innobase/include/rem0rec.ic 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -26,6 +26,7 @@ Created 5/30/1994 Heikki Tuuri
#include "mach0data.h"
#include "ut0byte.h"
#include "dict0dict.h"
+#include "btr0types.h"
/* Compact flag ORed to the extra size returned by rec_get_offsets() */
#define REC_OFFS_COMPACT ((ulint) 1 << 31)
@@ -1087,6 +1088,44 @@ rec_offs_any_extern(
return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL));
}
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+/******************************************************//**
+Determine if the offsets are for a record containing null BLOB pointers.
+@return first field containing a null BLOB pointer, or NULL if none found */
+UNIV_INLINE
+const byte*
+rec_offs_any_null_extern(
+/*=====================*/
+ const rec_t* rec, /*!< in: record */
+ const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+{
+ ulint i;
+ ut_ad(rec_offs_validate(rec, NULL, offsets));
+
+ if (!rec_offs_any_extern(offsets)) {
+ return(NULL);
+ }
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint len;
+ const byte* field
+ = rec_get_nth_field(rec, offsets, i, &len);
+
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ if (!memcmp(field + len
+ - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE)) {
+ return(field);
+ }
+ }
+ }
+
+ return(NULL);
+}
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@return nonzero if externally stored */
=== modified file 'storage/innobase/include/sync0rw.ic'
--- a/storage/innobase/include/sync0rw.ic 2011-04-12 01:21:37 +0000
+++ b/storage/innobase/include/sync0rw.ic 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -603,16 +603,16 @@ rw_lock_x_unlock_direct(
ut_ad((lock->lock_word % X_LOCK_DECR) == 0);
-#ifdef UNIV_SYNC_DEBUG
- rw_lock_remove_debug_info(lock, 0, RW_LOCK_EX);
-#endif
-
if (lock->lock_word == 0) {
lock->recursive = FALSE;
UNIV_MEM_INVALID(&lock->writer_thread,
sizeof lock->writer_thread);
}
+#ifdef UNIV_SYNC_DEBUG
+ rw_lock_remove_debug_info(lock, 0, RW_LOCK_EX);
+#endif
+
lock->lock_word += X_LOCK_DECR;
ut_ad(!lock->waiters);
=== modified file 'storage/innobase/include/sync0sync.h'
--- a/storage/innobase/include/sync0sync.h 2011-04-12 13:27:46 +0000
+++ b/storage/innobase/include/sync0sync.h 2011-06-16 09:26:09 +0000
@@ -407,8 +407,10 @@ void
sync_thread_add_level(
/*==================*/
void* latch, /*!< in: pointer to a mutex or an rw-lock */
- ulint level); /*!< in: level in the latching order; if
+ ulint level, /*!< in: level in the latching order; if
SYNC_LEVEL_VARYING, nothing is done */
+ ibool relock) /*!< in: TRUE if re-entering an x-lock */
+ __attribute__((nonnull));
/******************************************************************//**
Removes a latch from the thread level array if it is found there.
@return TRUE if found in the array; it is no error if the latch is
@@ -807,7 +809,7 @@ os_atomic_dec_ulint_func(
/*=====================*/
mutex_t* mutex, /*!< in: mutex guarding the
decrement */
- ulint* var, /*!< in/out: variable to
+ volatile ulint* var, /*!< in/out: variable to
decrement */
ulint delta); /*!< in: delta to decrement */
/**********************************************************//**
@@ -818,7 +820,7 @@ os_atomic_inc_ulint_func(
/*=====================*/
mutex_t* mutex, /*!< in: mutex guarding the
increment */
- ulint* var, /*!< in/out: variable to
+ volatile ulint* var, /*!< in/out: variable to
increment */
ulint delta); /*!< in: delta to increment */
#endif /* !HAVE_ATOMIC_BUILTINS */
=== modified file 'storage/innobase/include/sync0sync.ic'
--- a/storage/innobase/include/sync0sync.ic 2010-10-26 23:14:42 +0000
+++ b/storage/innobase/include/sync0sync.ic 2011-06-03 05:59:24 +0000
@@ -372,7 +372,7 @@ void
os_atomic_dec_ulint_func(
/*=====================*/
mutex_t* mutex, /*!< in: mutex guarding the dec */
- ulint* var, /*!< in/out: variable to decrement */
+ volatile ulint* var, /*!< in/out: variable to decrement */
ulint delta) /*!< in: delta to decrement */
{
mutex_enter(mutex);
@@ -393,7 +393,7 @@ void
os_atomic_inc_ulint_func(
/*=====================*/
mutex_t* mutex, /*!< in: mutex guarding the increment */
- ulint* var, /*!< in/out: variable to increment */
+ volatile ulint* var, /*!< in/out: variable to increment */
ulint delta) /*!< in: delta to increment */
{
mutex_enter(mutex);
=== modified file 'storage/innobase/include/trx0purge.h'
--- a/storage/innobase/include/trx0purge.h 2011-05-18 12:16:34 +0000
+++ b/storage/innobase/include/trx0purge.h 2011-06-02 07:05:42 +0000
@@ -117,11 +117,9 @@ struct trx_purge_struct{
obtaining an s-latch here. */
read_view_t* view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
- ulint n_submitted; /*!< Count of total tasks submitted
+ volatile ulint n_submitted; /*!< Count of total tasks submitted
to the task queue */
- ulint n_executing; /*!< Count of currently executing purge
- worker threads */
- ulint n_completed; /*!< Count of total tasks completed */
+ volatile ulint n_completed; /*!< Count of total tasks completed */
/*------------------------------*/
/* The following two fields form the 'purge pointer' which advances
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h 2011-05-11 00:39:50 +0000
+++ b/storage/innobase/include/trx0trx.h 2011-06-06 09:35:20 +0000
@@ -486,6 +486,18 @@ struct trx_lock_struct {
ib_vector_t* table_locks; /*!< All table locks requested by this
transaction, including AUTOINC locks */
+
+ ibool cancel; /*!< TRUE if the transaction is being
+ rolled back either via deadlock
+ detection or due to lock timeout. The
+ caller has to acquire the trx_t::mutex
+ in order to cancel the locks. In
+ lock_trx_table_locks_remove() we
+ check for this cancel of a transaction's
+ locks and avoid reacquiring the trx
+ mutex to prevent recursive deadlocks.
+ Protected by both the lock sys mutex
+ and the trx_t::mutex. */
};
#define TRX_MAGIC_N 91118598
@@ -540,7 +552,6 @@ struct trx_struct{
state and lock
(except some fields of lock, which
are protected by lock_sys->mutex) */
-
trx_state_t state; /*!< State of the trx from the point
of view of concurrency control:
TRX_STATE_NOT_STARTED (!in_trx_list),
=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i 2011-05-10 12:56:07 +0000
+++ b/storage/innobase/include/univ.i 2011-06-16 09:26:09 +0000
@@ -2,7 +2,6 @@
Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2009, Sun Microsystems, Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c 2011-05-27 03:36:33 +0000
+++ b/storage/innobase/lock/lock0lock.c 2011-06-06 09:35:20 +0000
@@ -4393,7 +4393,8 @@ lock_trx_table_locks_remove(
ut_ad(lock_mutex_own());
- if (!trx->lock.was_chosen_as_deadlock_victim) {
+ /* It is safe to read this because we are holding the lock mutex */
+ if (!trx->lock.cancel) {
trx_mutex_enter(trx);
} else {
ut_ad(trx_mutex_own(trx));
@@ -4415,7 +4416,7 @@ lock_trx_table_locks_remove(
if (lock == lock_to_remove) {
ib_vector_set(trx->lock.table_locks, i, NULL);
- if (!trx->lock.was_chosen_as_deadlock_victim) {
+ if (!trx->lock.cancel) {
trx_mutex_exit(trx);
}
@@ -4423,7 +4424,7 @@ lock_trx_table_locks_remove(
}
}
- if (!trx->lock.was_chosen_as_deadlock_victim) {
+ if (!trx->lock.cancel) {
trx_mutex_exit(trx);
}
@@ -6246,6 +6247,8 @@ lock_cancel_waiting_and_release(
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
+ lock->trx->lock.cancel = TRUE;
+
if (lock_get_type_low(lock) == LOCK_REC) {
lock_rec_dequeue_from_page(lock);
@@ -6271,6 +6274,8 @@ lock_cancel_waiting_and_release(
if (thr != NULL) {
lock_wait_release_thread_if_suspended(thr);
}
+
+ lock->trx->lock.cancel = FALSE;
}
/*********************************************************************//**
=== modified file 'storage/innobase/page/page0cur.c'
--- a/storage/innobase/page/page0cur.c 2011-02-08 12:16:14 +0000
+++ b/storage/innobase/page/page0cur.c 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -1180,14 +1180,15 @@ page_cur_insert_rec_zip_reorg(
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
pos = page_rec_get_n_recs_before(rec);
+ ut_ad(pos > 0);
if (page_zip_reorganize(block, index, mtr)) {
/* The page was reorganized: Find rec by seeking to pos,
and update *current_rec. */
- rec = page + PAGE_NEW_INFIMUM;
-
- while (--pos) {
- rec = page + rec_get_next_offs(rec, TRUE);
+ if (pos > 1) {
+ rec = page_rec_get_nth(page, pos - 1);
+ } else {
+ rec = page + PAGE_NEW_INFIMUM;
}
*current_rec = rec;
@@ -1283,6 +1284,12 @@ page_cur_insert_rec_zip(
insert_rec = page_cur_insert_rec_zip_reorg(
current_rec, block, index, insert_rec,
page, page_zip, mtr);
+#ifdef UNIV_DEBUG
+ if (insert_rec) {
+ rec_offs_make_valid(
+ insert_rec, index, offsets);
+ }
+#endif /* UNIV_DEBUG */
}
return(insert_rec);
=== modified file 'storage/innobase/page/page0page.c'
--- a/storage/innobase/page/page0page.c 2011-05-09 08:48:47 +0000
+++ b/storage/innobase/page/page0page.c 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -1465,55 +1465,54 @@ page_dir_balance_slot(
}
}
-#ifndef UNIV_HOTBACKUP
/************************************************************//**
-Returns the middle record of the record list. If there are an even number
-of records in the list, returns the first record of the upper half-list.
-@return middle record */
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
UNIV_INTERN
-rec_t*
-page_get_middle_rec(
-/*================*/
- page_t* page) /*!< in: page */
+const rec_t*
+page_rec_get_nth_const(
+/*===================*/
+ const page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
{
- page_dir_slot_t* slot;
- ulint middle;
+ const page_dir_slot_t* slot;
ulint i;
ulint n_owned;
- ulint count;
- rec_t* rec;
-
- /* This many records we must leave behind */
- middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
+ const rec_t* rec;
- count = 0;
+ ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
for (i = 0;; i++) {
slot = page_dir_get_nth_slot(page, i);
n_owned = page_dir_slot_get_n_owned(slot);
- if (count + n_owned > middle) {
+ if (n_owned > nth) {
break;
} else {
- count += n_owned;
+ nth -= n_owned;
}
}
ut_ad(i > 0);
slot = page_dir_get_nth_slot(page, i - 1);
- rec = (rec_t*) page_dir_slot_get_rec(slot);
- rec = page_rec_get_next(rec);
+ rec = page_dir_slot_get_rec(slot);
- /* There are now count records behind rec */
-
- for (i = 0; i < middle - count; i++) {
- rec = page_rec_get_next(rec);
+ if (page_is_comp(page)) {
+ do {
+ rec = page_rec_get_next_low(rec, TRUE);
+ ut_ad(rec);
+ } while (nth--);
+ } else {
+ do {
+ rec = page_rec_get_next_low(rec, FALSE);
+ ut_ad(rec);
+ } while (nth--);
}
return(rec);
}
-#endif /* !UNIV_HOTBACKUP */
/***************************************************************//**
Returns the number of records before the given record in chain.
@@ -1575,6 +1574,7 @@ page_rec_get_n_recs_before(
n--;
ut_ad(n >= 0);
+ ut_ad(n < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
return((ulint) n);
}
=== modified file 'storage/innobase/page/page0zip.c'
--- a/storage/innobase/page/page0zip.c 2011-05-31 09:30:59 +0000
+++ b/storage/innobase/page/page0zip.c 2011-06-16 12:33:20 +0000
@@ -3917,17 +3917,9 @@ page_zip_write_trx_id_and_roll_ptr(
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
}
-#ifdef UNIV_ZIP_DEBUG
-/** Set this variable in a debugger to disable page_zip_clear_rec().
-The only observable effect should be the compression ratio due to
-deleted records not being zeroed out. In rare cases, there can be
-page_zip_validate() failures on the node_ptr, trx_id and roll_ptr
-columns if the space is reallocated for a smaller record. */
-UNIV_INTERN ibool page_zip_clear_rec_disable;
-#endif /* UNIV_ZIP_DEBUG */
-
/**********************************************************************//**
-Clear an area on the uncompressed and compressed page, if possible. */
+Clear an area on the uncompressed and compressed page.
+Do not clear the data payload, as that would grow the modification log. */
static
void
page_zip_clear_rec(
@@ -3939,6 +3931,9 @@ page_zip_clear_rec(
{
ulint heap_no;
page_t* page = page_align(rec);
+ byte* storage;
+ byte* field;
+ ulint len;
/* page_zip_validate() would fail here if a record
containing externally stored columns is being deleted. */
ut_ad(rec_offs_validate(rec, index, offsets));
@@ -3954,60 +3949,46 @@ page_zip_clear_rec(
UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
- if (
-#ifdef UNIV_ZIP_DEBUG
- !page_zip_clear_rec_disable &&
-#endif /* UNIV_ZIP_DEBUG */
- page_zip->m_end
- + 1 + ((heap_no - 1) >= 64)/* size of the log entry */
- + page_zip_get_trailer_len(page_zip,
- dict_index_is_clust(index), NULL)
- < page_zip_get_size(page_zip)) {
- byte* data;
-
- /* Clear only the data bytes, because the allocator and
- the decompressor depend on the extra bytes. */
- memset(rec, 0, rec_offs_data_size(offsets));
-
- if (!page_is_leaf(page)) {
- /* Clear node_ptr on the compressed page. */
- byte* storage = page_zip->data
- + page_zip_get_size(page_zip)
- - (page_dir_get_n_heap(page)
- - PAGE_HEAP_NO_USER_LOW)
- * PAGE_ZIP_DIR_SLOT_SIZE;
-
- memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
- 0, REC_NODE_PTR_SIZE);
- } else if (dict_index_is_clust(index)) {
- /* Clear trx_id and roll_ptr on the compressed page. */
- byte* storage = page_zip->data
- + page_zip_get_size(page_zip)
- - (page_dir_get_n_heap(page)
- - PAGE_HEAP_NO_USER_LOW)
- * PAGE_ZIP_DIR_SLOT_SIZE;
-
- memset(storage - (heap_no - 1)
- * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN),
- 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
- }
-
- /* Log that the data was zeroed out. */
- data = page_zip->data + page_zip->m_end;
- ut_ad(!*data);
- if (UNIV_UNLIKELY(heap_no - 1 >= 64)) {
- *data++ = (byte) (0x80 | (heap_no - 1) >> 7);
- ut_ad(!*data);
- }
- *data++ = (byte) ((heap_no - 1) << 1 | 1);
- ut_ad(!*data);
- ut_ad((ulint) (data - page_zip->data)
- < page_zip_get_size(page_zip));
- page_zip->m_end = data - page_zip->data;
- page_zip->m_nonempty = TRUE;
- } else if (page_is_leaf(page) && dict_index_is_clust(index)) {
- /* Do not clear the record, because there is not enough space
- to log the operation. */
+ if (!page_is_leaf(page)) {
+ /* Clear node_ptr. On the compressed page,
+ there is an array of node_ptr immediately before the
+ dense page directory, at the very end of the page. */
+ storage = page_zip->data
+ + page_zip_get_size(page_zip)
+ - (page_dir_get_n_heap(page)
+ - PAGE_HEAP_NO_USER_LOW)
+ * PAGE_ZIP_DIR_SLOT_SIZE;
+ ut_ad(dict_index_get_n_unique_in_tree(index) ==
+ rec_offs_n_fields(offsets) - 1);
+ field = rec_get_nth_field(rec, offsets,
+ rec_offs_n_fields(offsets) - 1,
+ &len);
+ ut_ad(len == REC_NODE_PTR_SIZE);
+
+ ut_ad(!rec_offs_any_extern(offsets));
+ memset(field, 0, REC_NODE_PTR_SIZE);
+ memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
+ 0, REC_NODE_PTR_SIZE);
+ } else if (dict_index_is_clust(index)) {
+ /* Clear trx_id and roll_ptr. On the compressed page,
+ there is an array of these fields immediately before the
+ dense page directory, at the very end of the page. */
+ const ulint trx_id_pos
+ = dict_col_get_clust_pos(
+ dict_table_get_sys_col(
+ index->table, DATA_TRX_ID), index);
+ storage = page_zip->data
+ + page_zip_get_size(page_zip)
+ - (page_dir_get_n_heap(page)
+ - PAGE_HEAP_NO_USER_LOW)
+ * PAGE_ZIP_DIR_SLOT_SIZE;
+ field = rec_get_nth_field(rec, offsets, trx_id_pos, &len);
+ ut_ad(len == DATA_TRX_ID_LEN);
+
+ memset(field, 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
+ memset(storage - (heap_no - 1)
+ * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN),
+ 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
if (rec_offs_any_extern(offsets)) {
ulint i;
@@ -4016,15 +3997,18 @@ page_zip_clear_rec(
/* Clear all BLOB pointers in order to make
page_zip_validate() pass. */
if (rec_offs_nth_extern(offsets, i)) {
- ulint len;
- byte* field = rec_get_nth_field(
+ field = rec_get_nth_field(
rec, offsets, i, &len);
+ ut_ad(len
+ == BTR_EXTERN_FIELD_REF_SIZE);
memset(field + len
- BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE);
}
}
}
+ } else {
+ ut_ad(!rec_offs_any_extern(offsets));
}
#ifdef UNIV_ZIP_DEBUG
=== modified file 'storage/innobase/rem/rem0rec.c'
--- a/storage/innobase/rem/rem0rec.c 2011-05-31 09:30:59 +0000
+++ b/storage/innobase/rem/rem0rec.c 2011-06-16 12:33:20 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -408,7 +408,7 @@ rec_init_offsets(
do {
ulint len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
- len = offs += 4;
+ len = offs += REC_NODE_PTR_SIZE;
goto resolved;
}
@@ -640,7 +640,7 @@ rec_get_offsets_reverse(
do {
ulint len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
- len = offs += 4;
+ len = offs += REC_NODE_PTR_SIZE;
goto resolved;
}
@@ -1131,9 +1131,9 @@ rec_convert_dtuple_to_rec_comp(
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
ut_ad(dtype_get_prtype(type) & DATA_NOT_NULL);
- ut_ad(len == 4);
+ ut_ad(len == REC_NODE_PTR_SIZE);
memcpy(end, dfield_get_data(field), len);
- end += 4;
+ end += REC_NODE_PTR_SIZE;
break;
}
=== modified file 'storage/innobase/row/row0ins.c'
--- a/storage/innobase/row/row0ins.c 2011-02-15 10:42:53 +0000
+++ b/storage/innobase/row/row0ins.c 2011-06-16 09:26:09 +0000
@@ -342,9 +342,9 @@ row_ins_clust_index_entry_by_modify(
return(DB_LOCK_TABLE_FULL);
}
- err = btr_cur_pessimistic_update(0, cursor,
- heap, big_rec, update,
- 0, thr, mtr);
+ err = btr_cur_pessimistic_update(
+ BTR_KEEP_POS_FLAG, cursor, heap, big_rec, update,
+ 0, thr, mtr);
}
return(err);
@@ -1982,6 +1982,8 @@ row_ins_index_entry_low(
ulint search_mode;
ibool modify = FALSE;
rec_t* insert_rec;
+ rec_t* rec;
+ ulint* offsets;
ulint err;
ulint n_unique;
big_rec_t* big_rec = NULL;
@@ -2083,6 +2085,42 @@ row_ins_index_entry_low(
err = row_ins_clust_index_entry_by_modify(
mode, &cursor, &heap, &big_rec, entry,
thr, &mtr);
+
+ if (big_rec) {
+ ut_a(err == DB_SUCCESS);
+ /* Write out the externally stored
+ columns while still x-latching
+ index->lock and block->lock. We have
+ to mtr_commit(mtr) first, so that the
+ redo log will be written in the
+ correct order. Otherwise, we would run
+ into trouble on crash recovery if mtr
+ freed B-tree pages on which some of
+ the big_rec fields will be written. */
+ btr_cur_mtr_commit_and_start(&cursor, &mtr);
+
+ rec = btr_cur_get_rec(&cursor);
+ offsets = rec_get_offsets(
+ rec, index, NULL,
+ ULINT_UNDEFINED, &heap);
+
+ err = btr_store_big_rec_extern_fields(
+ index, btr_cur_get_block(&cursor),
+ rec, offsets, &mtr, FALSE, big_rec);
+ /* If writing big_rec fails (for
+ example, because of DB_OUT_OF_FILE_SPACE),
+ the record will be corrupted. Even if
+ we did not update any externally
+ stored columns, our update could cause
+ the record to grow so that a
+ non-updated column was selected for
+ external storage. This non-update
+ would not have been written to the
+ undo log, and thus the record cannot
+ be rolled back. */
+ ut_a(err == DB_SUCCESS);
+ goto stored_big_rec;
+ }
} else {
ut_ad(!n_ext);
err = row_ins_sec_index_entry_by_modify(
@@ -2111,8 +2149,6 @@ function_exit:
mtr_commit(&mtr);
if (UNIV_LIKELY_NULL(big_rec)) {
- rec_t* rec;
- ulint* offsets;
mtr_start(&mtr);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
@@ -2126,6 +2162,7 @@ function_exit:
index, btr_cur_get_block(&cursor),
rec, offsets, &mtr, FALSE, big_rec);
+stored_big_rec:
if (modify) {
dtuple_big_rec_free(big_rec);
} else {
=== modified file 'storage/innobase/row/row0row.c'
--- a/storage/innobase/row/row0row.c 2011-05-31 09:30:59 +0000
+++ b/storage/innobase/row/row0row.c 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, 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
@@ -192,6 +192,10 @@ row_build(
ut_ad(index && rec && heap);
ut_ad(dict_index_is_clust(index));
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets_,
@@ -200,6 +204,36 @@ row_build(
ut_ad(rec_offs_validate(rec, index, offsets));
}
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ if (UNIV_LIKELY_NULL(rec_offs_any_null_extern(rec, offsets))) {
+ /* This condition can occur during crash recovery before
+ trx_rollback_active() has completed execution.
+
+ This condition is possible if the server crashed
+ during an insert or update before
+ btr_store_big_rec_extern_fields() did mtr_commit() all
+ BLOB pointers to the clustered index record.
+
+ Look up the transaction that holds the implicit lock
+ on this record, and assert that it was recovered (and
+ will soon be rolled back). */
+
+ ulint trx_id_pos = dict_index_get_sys_col_pos(
+ index, DATA_TRX_ID);
+ ulint len;
+ trx_id_t trx_id = trx_read_trx_id(
+ rec_get_nth_field(rec, offsets, trx_id_pos, &len));
+ const trx_t* trx;
+ ut_a(len == 6);
+
+ rw_lock_s_lock(&trx_sys->lock);
+ trx = trx_get_on_id(trx_id);
+ ut_a(trx);
+ ut_a(trx->is_recovered);
+ rw_lock_s_unlock(&trx_sys->lock);
+ }
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
if (type != ROW_COPY_POINTERS) {
/* Take a copy of rec to heap */
buf = mem_heap_alloc(heap, rec_offs_size(offsets));
@@ -383,6 +417,10 @@ row_rec_to_index_entry(
rec = rec_copy(buf, rec, offsets);
/* Avoid a debug assertion in rec_offs_validate(). */
rec_offs_make_valid(rec, index, offsets);
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ } else {
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
}
entry = row_rec_to_index_entry_low(rec, index, offsets, n_ext, heap);
=== modified file 'storage/innobase/row/row0upd.c'
--- a/storage/innobase/row/row0upd.c 2011-05-31 09:30:59 +0000
+++ b/storage/innobase/row/row0upd.c 2011-06-16 09:26:09 +0000
@@ -1995,28 +1995,43 @@ row_upd_clust_rec(
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
dict_table_is_comp(index->table)));
- err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG, btr_cur,
- &heap, &big_rec, node->update,
- node->cmpl_info, thr, mtr);
- mtr_commit(mtr);
-
- if (err == DB_SUCCESS && big_rec) {
+ err = btr_cur_pessimistic_update(
+ BTR_NO_LOCKING_FLAG | BTR_KEEP_POS_FLAG, btr_cur,
+ &heap, &big_rec, node->update, node->cmpl_info, thr, mtr);
+ if (big_rec) {
ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* rec;
rec_offs_init(offsets_);
- mtr_start(mtr);
+ ut_a(err == DB_SUCCESS);
+ /* Write out the externally stored columns while still
+ x-latching index->lock and block->lock. We have to
+ mtr_commit(mtr) first, so that the redo log will be
+ written in the correct order. Otherwise, we would run
+ into trouble on crash recovery if mtr freed B-tree
+ pages on which some of the big_rec fields will be
+ written. */
+ btr_cur_mtr_commit_and_start(btr_cur, mtr);
- ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(btr_cur), rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
mtr, TRUE, big_rec);
- mtr_commit(mtr);
+ /* If writing big_rec fails (for example, because of
+ DB_OUT_OF_FILE_SPACE), the record will be corrupted.
+ Even if we did not update any externally stored
+ columns, our update could cause the record to grow so
+ that a non-updated column was selected for external
+ storage. This non-update would not have been written
+ to the undo log, and thus the record cannot be rolled
+ back. */
+ ut_a(err == DB_SUCCESS);
}
+ mtr_commit(mtr);
+
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
=== modified file 'storage/innobase/row/row0vers.c'
--- a/storage/innobase/row/row0vers.c 2011-05-04 11:29:29 +0000
+++ b/storage/innobase/row/row0vers.c 2011-06-16 09:26:09 +0000
@@ -557,6 +557,11 @@ row_vers_build_for_consistent_read(
/* The view already sees this version: we can
copy it to in_heap and return */
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(
+ version, *offsets));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
buf = mem_heap_alloc(in_heap,
rec_offs_size(*offsets));
*old_vers = rec_copy(buf, version, *offsets);
@@ -590,6 +595,10 @@ row_vers_build_for_consistent_read(
*offsets = rec_get_offsets(prev_version, index, *offsets,
ULINT_UNDEFINED, offset_heap);
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(prev_version, *offsets));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
trx_id = row_get_rec_trx_id(prev_version, index, *offsets);
if (read_view_sees_trx_id(view, trx_id)) {
@@ -684,6 +693,10 @@ row_vers_build_for_semi_consistent_read(
/* We found a version that belongs to a
committed transaction: return it. */
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(version, *offsets));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
if (rec == version) {
*old_vers = rec;
err = DB_SUCCESS;
@@ -741,6 +754,9 @@ row_vers_build_for_semi_consistent_read(
version = prev_version;
*offsets = rec_get_offsets(version, index, *offsets,
ULINT_UNDEFINED, offset_heap);
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(version, *offsets));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
}/* for (;;) */
if (heap) {
=== removed directory 'storage/innobase/scripts'
=== removed file 'storage/innobase/scripts/persistent_storage.sql'
--- a/storage/innobase/scripts/persistent_storage.sql 2011-05-30 13:56:01 +0000
+++ b/storage/innobase/scripts/persistent_storage.sql 1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
-DROP TABLE IF EXISTS mysql.innodb_table_stats;
-CREATE TABLE mysql.innodb_table_stats (
- database_name VARCHAR(64) NOT NULL,
- table_name VARCHAR(64) NOT NULL,
- stats_timestamp TIMESTAMP NOT NULL,
- n_rows BIGINT UNSIGNED NOT NULL,
- clustered_index_size BIGINT UNSIGNED NOT NULL,
- sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL,
- PRIMARY KEY (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS mysql.innodb_index_stats;
-CREATE TABLE mysql.innodb_index_stats (
- database_name VARCHAR(64) NOT NULL,
- table_name VARCHAR(64) NOT NULL,
- index_name VARCHAR(64) NOT NULL,
- stat_timestamp TIMESTAMP NOT NULL,
- /* there are at least:
- stat_name='size'
- stat_name='n_leaf_pages'
- stat_name='n_diff_pfx%' */
- stat_name VARCHAR(64) NOT NULL,
- stat_value BIGINT UNSIGNED NOT NULL,
- sample_size BIGINT UNSIGNED,
- stat_description VARCHAR(1024) NOT NULL,
- PRIMARY KEY (database_name, table_name, index_name, stat_name),
- FOREIGN KEY (database_name, table_name)
- REFERENCES mysql.innodb_table_stats (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c 2011-05-04 09:54:04 +0000
+++ b/storage/innobase/srv/srv0srv.c 2011-06-02 07:11:45 +0000
@@ -1850,7 +1850,7 @@ srv_master_do_purge(void)
/* Nothing to purge. */
n_pages_purged = 0;
} else {
- n_pages_purged = trx_purge(0, srv_purge_batch_size);
+ n_pages_purged = trx_purge(1, srv_purge_batch_size);
}
total_pages_purged += n_pages_purged;
@@ -2303,8 +2303,6 @@ srv_task_execute(void)
ut_a(srv_force_recovery < SRV_FORCE_NO_BACKGROUND);
- os_atomic_inc_ulint(&purge_sys->bh_mutex, &purge_sys->n_executing, 1);
-
mutex_enter(&srv_sys->tasks_mutex);
if (UT_LIST_GET_LEN(srv_sys->tasks) > 0) {
@@ -2326,8 +2324,6 @@ srv_task_execute(void)
&purge_sys->bh_mutex, &purge_sys->n_completed, 1);
}
- os_atomic_dec_ulint(&purge_sys->bh_mutex, &purge_sys->n_executing, 1);
-
return(thr != NULL);
}
@@ -2404,50 +2400,62 @@ void
srv_do_purge(
/*=========*/
ulint n_threads, /*!< in: number of threads to use */
- ulint batch_size, /*!< in: purge batch size */
ulint* n_total_purged) /*!< in/out: total pages purged */
{
- if (n_threads <= 1) {
- ulint n_pages_purged;
+ ulint n_pages_purged;
+ static ulint n_use_threads = 0;
+ static ulint rseg_history_len = 0;
- /* Purge until there are no more records to
- purge and there is no change in configuration
- or server state. */
+ ut_a(n_threads > 0);
- do {
- n_pages_purged = trx_purge(0, batch_size);
+ /* Purge until there are no more records to purge and there is
+ no change in configuration or server state. If the user has
+ configured more than one purge thread then we treat that as a
+ pool of threads and only use the extra threads if purge can't
+ keep up with updates. */
- *n_total_purged += n_pages_purged;
+ if (n_use_threads == 0) {
+ n_use_threads = n_threads;
+ }
- } while (n_pages_purged > 0 && !srv_fast_shutdown);
+ do {
+ if (trx_sys->rseg_history_len > rseg_history_len) {
- } else {
- ulint n_pages_purged;
+ /* History length is now longer than what it was
+ when we took the last snapshot. Use more threads. */
- do {
- n_pages_purged = trx_purge(n_threads, batch_size);
+ if (n_use_threads < n_threads) {
+ ++n_use_threads;
+ }
- *n_total_purged += n_pages_purged;
+ } else if (n_use_threads > 1) {
+ /* History length same or smaller since last snapshot,
+ use fewer threads. */
- /* During shutdown the worker threads can
- exit when they detect a change in state.
- Force the coordinator thread to do the purge
- tasks from the work queue. */
+ --n_use_threads;
+ }
- while (srv_get_task_queue_length() > 0) {
+ /* Ensure that the purge threads are less than what
+ was configured. */
- ibool success;
+ ut_a(n_use_threads > 0);
+ ut_a(n_use_threads <= n_threads);
- ut_a(srv_shutdown_state);
+ /* Take a snapshot of the history list before purge. */
+ rseg_history_len = trx_sys->rseg_history_len;
+#if 0
+ fprintf(stderr, "%lu:%lu %lu\n",
+ rseg_history_len, trx_sys->rseg_history_len,
+ n_use_threads);
+#endif
+ n_pages_purged = trx_purge(n_use_threads, srv_purge_batch_size);
- success = srv_task_execute();
- ut_a(success);
- }
+ *n_total_purged += n_pages_purged;
+
+ } while (srv_shutdown_state == SRV_SHUTDOWN_NONE
+ && srv_fast_shutdown == 0
+ && n_pages_purged > 0);
- } while (trx_sys->rseg_history_len > 100
- && srv_shutdown_state == SRV_SHUTDOWN_NONE
- && srv_fast_shutdown == 0);
- }
}
/*********************************************************************//**
@@ -2488,31 +2496,14 @@ srv_purge_coordinator_thread(
while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
- ulint n_threads = srv_n_purge_threads;
- ulint batch_size = srv_purge_batch_size;
-
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
-
- /* If shutdown is signalled, then switch
- to single threaded purge. There are no user
- threads to contended with and secondly purge
- worker threads can exit silently, causing a
- potential hang. We try and avoid that as much
- as we can until the underlying problem is fixed
- properly. */
-
- n_threads = 1;
- }
-
- /* If there are very few records to purge or the last
+ /* If there are no records to purge or the last
purge didn't purge any records then wait for activity.
We peek at the history len without holding any mutex
because in the worst case we will end up waiting for
the next purge event. */
- if (trx_sys->rseg_history_len < batch_size
- || (n_total_purged == 0
- && retries >= TRX_SYS_N_RSEGS)) {
+ if (trx_sys->rseg_history_len == 0
+ || (n_total_purged == 0 && retries >= TRX_SYS_N_RSEGS)) {
srv_suspend_thread(slot);
@@ -2535,7 +2526,7 @@ srv_purge_coordinator_thread(
n_total_purged = 0;
}
- srv_do_purge(n_threads, batch_size, &n_total_purged);
+ srv_do_purge(srv_n_purge_threads, &n_total_purged);
}
/* The task queue should always be empty, independent of fast
=== modified file 'storage/innobase/sync/sync0rw.c'
--- a/storage/innobase/sync/sync0rw.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/sync/sync0rw.c 2011-06-16 09:26:09 +0000
@@ -786,7 +786,9 @@ rw_lock_add_debug_info(
rw_lock_debug_mutex_exit();
if ((pass == 0) && (lock_type != RW_LOCK_WAIT_EX)) {
- sync_thread_add_level(lock, lock->level);
+ sync_thread_add_level(lock, lock->level,
+ lock_type == RW_LOCK_EX
+ && lock->lock_word < 0);
}
}
=== modified file 'storage/innobase/sync/sync0sync.c'
--- a/storage/innobase/sync/sync0sync.c 2011-04-21 01:07:46 +0000
+++ b/storage/innobase/sync/sync0sync.c 2011-06-16 09:26:09 +0000
@@ -690,7 +690,7 @@ mutex_set_debug_info(
ut_ad(mutex);
ut_ad(file_name);
- sync_thread_add_level(mutex, mutex->level);
+ sync_thread_add_level(mutex, mutex->level, FALSE);
mutex->file_name = file_name;
mutex->line = line;
@@ -1133,8 +1133,9 @@ void
sync_thread_add_level(
/*==================*/
void* latch, /*!< in: pointer to a mutex or an rw-lock */
- ulint level) /*!< in: level in the latching order; if
+ ulint level, /*!< in: level in the latching order; if
SYNC_LEVEL_VARYING, nothing is done */
+ ibool relock) /*!< in: TRUE if re-entering an x-lock */
{
ulint i;
sync_level_t* slot;
@@ -1185,6 +1186,10 @@ sync_thread_add_level(
array = thread_slot->levels;
+ if (relock) {
+ goto levels_ok;
+ }
+
/* NOTE that there is a problem with _NODE and _LEAF levels: if the
B-tree height changes, then a leaf can change to an internal node
or the other way around. We do not know at present if this can cause
@@ -1367,6 +1372,7 @@ sync_thread_add_level(
ut_error;
}
+levels_ok:
if (array->next_free == ULINT_UNDEFINED) {
ut_a(array->n_elems < array->max_elems);
=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c 2011-05-19 09:19:12 +0000
+++ b/storage/innobase/trx/trx0purge.c 2011-06-02 07:05:42 +0000
@@ -972,7 +972,7 @@ trx_purge_fetch_next_rec(
/*******************************************************************//**
This function runs a purge batch.
@return number of undo log pages handled in the batch */
-UNIV_INTERN
+static
ulint
trx_purge_attach_undo_recs(
/*=======================*/
@@ -986,11 +986,13 @@ trx_purge_attach_undo_recs(
ulint n_pages_handled = 0;
ulint n_thrs = UT_LIST_GET_LEN(purge_sys->query->thrs);
+ ut_a(n_purge_threads > 0);
+
*limit = purge_sys->iter;
/* Debug code to validate some pre-requisites and reset done flag. */
for (thr = UT_LIST_GET_FIRST(purge_sys->query->thrs);
- thr != NULL;
+ thr != NULL && i < n_purge_threads;
thr = UT_LIST_GET_NEXT(thrs, thr), ++i) {
purge_node_t* node;
@@ -1005,7 +1007,9 @@ trx_purge_attach_undo_recs(
node->done = FALSE;
}
- ut_a(i == n_purge_threads || (n_purge_threads == 0 && i == 1));
+ /* There should never be fewer nodes than threads, the inverse
+ however is allowed because we only use purge threads as needed. */
+ ut_a(i == n_purge_threads);
/* Fetch and parse the UNDO records. The UNDO records are added
to a per purge node vector. */
@@ -1014,7 +1018,9 @@ trx_purge_attach_undo_recs(
ut_ad(trx_purge_check_limit());
- do {
+ i = 0;
+
+ for (;;) {
purge_node_t* node;
trx_purge_rec_t* purge_rec;
@@ -1061,10 +1067,12 @@ trx_purge_attach_undo_recs(
thr = UT_LIST_GET_NEXT(thrs, thr);
- if (thr == NULL) {
+ if (!(++i % n_purge_threads)) {
thr = UT_LIST_GET_FIRST(purge_sys->query->thrs);
}
- } while (thr);
+
+ ut_a(thr != NULL);
+ }
ut_ad(trx_purge_check_limit());
@@ -1116,55 +1124,45 @@ static
void
trx_purge_wait_for_workers_to_complete(
/*===================================*/
- trx_purge_t* purge_sys) /*!< in: purge instance */
+ trx_purge_t* purge_sys) /*!< in: purge instance */
{
- /* Ensure that the work queue empties out. Note, we are doing
- a dirty read of purge_sys->n_completed and purge_sys->n_executing. */
- while (purge_sys->n_submitted > purge_sys->n_completed
- || purge_sys->n_executing > 0) {
-
- if (srv_get_task_queue_length() == 0
- && purge_sys->n_executing == 0) {
-
- ut_a(purge_sys->n_submitted == purge_sys->n_completed);
- break;
+ ulint n_submitted = purge_sys->n_submitted;
- } else if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
- /* This is problematic because the worker threads can
- simply exit via os_event_wait(). We could end up
- looping here forever waiting for the task queue to
- drain. Another problem is that a worker thread can
- be active but it hasn't incrementd the n_executing
- field yet. Our only hope is to poll here for a fixed
- time interval. Given that the server is shutting down,
- a few microseconds waiting to check the worker threads
- should be acceptable. */
+#ifdef HAVE_ATOMIC_BUILTINS
+ /* Ensure that the work queue empties out. */
+ while (!os_compare_and_swap_ulint(
+ &purge_sys->n_completed, n_submitted, n_submitted)) {
+#else
+ mutex_enter(&purge_sys->bh_mutex);
+
+ while (purge_sys->n_completed < n_submitted) {
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+#ifndef HAVE_ATOMIC_BUILTINS
+ mutex_exit(&purge_sys->bh_mutex);
+#endif /* !HAVE_ATOMIC_BUILTINS */
- os_thread_sleep(500000);
-
- if (srv_get_task_queue_length() > 0) {
- break;
- }
+ if (srv_get_task_queue_length() > 0) {
+ srv_release_threads(SRV_WORKER, 1);
}
- srv_release_threads(SRV_WORKER, 1);
+ os_thread_yield();
- /* This is an arbitrary choice. */
- os_thread_sleep(4000);
+#ifndef HAVE_ATOMIC_BUILTINS
+ mutex_enter(&purge_sys->bh_mutex);
+#endif /* !HAVE_ATOMIC_BUILTINS */
}
- /* If shutdown is signalled then the worker threads can
- simply exit via os_event_wait(). The thread initiating the
- purge should be prepared to handle this case. */
- if (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-
- /* None of the worker threads should be doing any work. */
- ut_a(purge_sys->n_executing == 0);
-
- /* There should be no outstanding tasks as long
- as the worker threads are active. */
- ut_a(srv_get_task_queue_length() == 0);
- }
+#ifndef HAVE_ATOMIC_BUILTINS
+ mutex_exit(&purge_sys->bh_mutex);
+#endif /* !HAVE_ATOMIC_BUILTINS */
+
+ /* None of the worker threads should be doing any work. */
+ ut_a(purge_sys->n_submitted == purge_sys->n_completed);
+
+ /* There should be no outstanding tasks as long
+ as the worker threads are active. */
+ ut_a(srv_get_task_queue_length() == 0);
}
/******************************************************************//**
@@ -1204,6 +1202,8 @@ trx_purge(
que_thr_t* thr = NULL;
ulint n_pages_handled;
+ ut_a(n_purge_threads > 0);
+
srv_dml_needed_delay = trx_purge_dml_delay();
/* The number of tasks submitted should be completed. */
@@ -1226,7 +1226,7 @@ trx_purge(
n_purge_threads, purge_sys, &purge_sys->limit, batch_size);
/* Do we do an asynchronous purge or not ? */
- if (n_purge_threads > 0) {
+ if (n_purge_threads > 1) {
ulint i = 0;
/* Submit the tasks to the work queue. */
=== modified file 'storage/innobase/trx/trx0rec.c'
--- a/storage/innobase/trx/trx0rec.c 2011-05-31 09:30:59 +0000
+++ b/storage/innobase/trx/trx0rec.c 2011-06-16 09:26:09 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, 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
@@ -1546,6 +1546,10 @@ trx_undo_prev_version_build(
ut_a(table_id == index->table->id);
ut_a(ptr);
+# if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+# endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
ulint n_ext;
=== modified file 'storage/myisam/mi_update.c'
--- a/storage/myisam/mi_update.c 2011-01-11 09:09:21 +0000
+++ b/storage/myisam/mi_update.c 2011-06-07 16:00:42 +0000
@@ -192,8 +192,8 @@ err:
save_errno=my_errno;
if (changed)
key_changed|= HA_STATE_CHANGED;
- if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM ||
- my_errno == HA_ERR_RECORD_FILE_FULL)
+ if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
+ my_errno == HA_ERR_NULL_IN_SPATIAL || my_errno == HA_ERR_OUT_OF_MEM)
{
info->errkey= (int) i;
flag=0;
@@ -211,8 +211,9 @@ err:
{
uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
uint old_length= _mi_make_key(info,i,old_key,oldrec,pos);
- if ((flag++ && _mi_ck_delete(info,i,new_key,new_length)) ||
- _mi_ck_write(info,i,old_key,old_length))
+ if ((flag++ &&
+ share->keyinfo[i].ck_delete(info, i, new_key, new_length)) ||
+ share->keyinfo[i].ck_insert(info, i, old_key, old_length))
break;
}
}
=== modified file 'storage/myisam/mi_write.c'
--- a/storage/myisam/mi_write.c 2011-03-28 08:51:35 +0000
+++ b/storage/myisam/mi_write.c 2011-06-07 16:00:42 +0000
@@ -204,7 +204,7 @@ err:
else
{
uint key_length=_mi_make_key(info,i,buff,record,filepos);
- if (_mi_ck_delete(info,i,buff,key_length))
+ if (share->keyinfo[i].ck_delete(info, i, buff, key_length))
{
if (local_lock_tree)
mysql_rwlock_unlock(&share->key_root_lock[i]);
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2011-05-31 13:52:09 +0000
+++ b/tests/mysql_client_test.c 2011-06-10 15:29:04 +0000
@@ -19593,6 +19593,81 @@ static void test_bug11766854()
DBUG_VOID_RETURN;
}
+/**
+ Bug#12337762: 60075: MYSQL_LIST_FIELDS() RETURNS WRONG CHARSET FOR
+ CHAR/VARCHAR/TEXT COLUMNS IN VIEWS
+*/
+static void test_bug12337762()
+{
+ int rc,i=0;
+ MYSQL_RES *result;
+ MYSQL_FIELD *field;
+ unsigned int tab_charsetnr[3]= {0};
+
+ DBUG_ENTER("test_bug12337762");
+ myheader("test_bug12337762");
+
+ /*
+ Creating table with specific charset.
+ */
+ rc= mysql_query(mysql, "drop table if exists charset_tab");
+ rc= mysql_query(mysql, "create table charset_tab("\
+ "txt1 varchar(32) character set Latin1,"\
+ "txt2 varchar(32) character set Latin1 collate latin1_bin,"\
+ "txt3 varchar(32) character set utf8 collate utf8_bin"\
+ ")");
+
+ DIE_UNLESS(rc == 0);
+ DIE_IF(mysql_errno(mysql));
+
+ /*
+ Creating view from table created earlier.
+ */
+ rc= mysql_query(mysql, "drop view if exists charset_view");
+ rc= mysql_query(mysql, "create view charset_view as "\
+ "select * from charset_tab;");
+ DIE_UNLESS(rc == 0);
+ DIE_IF(mysql_errno(mysql));
+
+ /*
+ Checking field information for table.
+ */
+ result= mysql_list_fields(mysql, "charset_tab", NULL);
+ DIE_IF(mysql_errno(mysql));
+ i=0;
+ while((field= mysql_fetch_field(result)))
+ {
+ printf("field name %s\n", field->name);
+ printf("field table %s\n", field->table);
+ printf("field type %d\n", field->type);
+ printf("field charset %d\n", field->charsetnr);
+ tab_charsetnr[i++]= field->charsetnr;
+ printf("\n");
+ }
+ mysql_free_result(result);
+
+ /*
+ Checking field information for view.
+ */
+ result= mysql_list_fields(mysql, "charset_view", NULL);
+ DIE_IF(mysql_errno(mysql));
+ i=0;
+ while((field= mysql_fetch_field(result)))
+ {
+ printf("field name %s\n", field->name);
+ printf("field table %s\n", field->table);
+ printf("field type %d\n", field->type);
+ printf("field charset %d\n", field->charsetnr);
+ printf("\n");
+ /*
+ charset value for field must be same for both, view and table.
+ */
+ DIE_UNLESS(field->charsetnr == tab_charsetnr[i++]);
+ }
+ mysql_free_result(result);
+
+ DBUG_VOID_RETURN;
+}
/**
Bug#54790: Use of non-blocking mode for sockets limits performance
@@ -19692,10 +19767,10 @@ static struct my_option client_test_long
&opt_getopt_ll_test, &opt_getopt_ll_test, 0,
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
{"plugin_dir", 0, "Directory for client-side plugins.",
- (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+ &opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", 0, "Default authentication client-side plugin to use.",
- (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+ &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -19979,6 +20054,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug56976", test_bug56976 },
{ "test_bug11766854", test_bug11766854 },
{ "test_bug54790", test_bug54790 },
+ { "test_bug12337762", test_bug12337762 },
{ 0, 0 }
};
@@ -20117,29 +20193,29 @@ int main(int argc, char **argv)
if (!argc)
{
for (fptr= my_tests; fptr->name; fptr++)
- (*fptr->function)();
+ (*fptr->function)();
}
else
{
for ( ; *argv ; argv++)
{
- for (fptr= my_tests; fptr->name; fptr++)
- {
- if (!strcmp(fptr->name, *argv))
- {
- (*fptr->function)();
- break;
- }
- }
- if (!fptr->name)
- {
- fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
- fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
- my_progname);
- client_disconnect(mysql, 1);
- free_defaults(defaults_argv);
- exit(1);
- }
+ for (fptr= my_tests; fptr->name; fptr++)
+ {
+ if (!strcmp(fptr->name, *argv))
+ {
+ (*fptr->function)();
+ break;
+ }
+ }
+ if (!fptr->name)
+ {
+ fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
+ fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
+ my_progname);
+ client_disconnect(mysql, 1);
+ free_defaults(defaults_argv);
+ exit(1);
+ }
}
}
Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20110618203445-fsbp0fl08jdeehar.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (chris.powers:3307) | Christopher Powers | 19 Jun |