summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--cmake/abi_check.cmake18
-rw-r--r--cmake/do_abi_check.cmake5
-rw-r--r--include/mysql/plugin_audit.h.pp196
-rw-r--r--include/mysql/plugin_ftparser.h.pp (renamed from include/mysql/plugin.h.pp)92
-rwxr-xr-xmysql-test/mysql-test-run.pl5
-rw-r--r--mysql-test/r/create.result1
-rw-r--r--mysql-test/r/ctype_utf32.result13
-rw-r--r--mysql-test/r/func_group.result12
-rw-r--r--mysql-test/r/handler_read_last.result60
-rw-r--r--mysql-test/r/insert_select.result1
-rw-r--r--mysql-test/r/join.result1
-rw-r--r--mysql-test/r/join_outer.result1
-rw-r--r--mysql-test/r/mysql.result3
-rw-r--r--mysql-test/r/mysql_not_windows.result5
-rw-r--r--mysql-test/r/mysqld--help-notwin.result6
-rw-r--r--mysql-test/r/mysqld--help-win.result6
-rw-r--r--mysql-test/r/null_key.result1
-rw-r--r--mysql-test/r/partition.result6
-rw-r--r--mysql-test/r/select.result1
-rw-r--r--mysql-test/r/single_delete_update.result42
-rw-r--r--mysql-test/r/subselect3.result1
-rw-r--r--mysql-test/r/update.result10
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_log_bin.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_multi.result4
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_3.result2
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_4.result2
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_5.result2
-rw-r--r--mysql-test/suite/perfschema/r/short_option_1.result27
-rw-r--r--mysql-test/suite/perfschema/r/short_option_2.result9
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result4
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result4
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result6
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_3.test49
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_4.test49
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_5.test52
-rw-r--r--mysql-test/suite/perfschema/t/short_option_1-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/short_option_1.test35
-rw-r--r--mysql-test/suite/perfschema/t/short_option_2-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/short_option_2.test29
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result6
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result6
-rw-r--r--mysql-test/t/ctype_utf32.test11
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/handler_read_last.test40
-rw-r--r--mysql-test/t/mysql.test6
-rw-r--r--mysql-test/t/mysql_not_windows.test15
-rw-r--r--mysys/my_getopt.c83
-rw-r--r--sql/item.cc9
-rw-r--r--sql/mysqld.cc1
-rw-r--r--sql/set_var.cc11
-rw-r--r--sql/sys_vars.cc4
-rw-r--r--storage/myisam/mi_key.c11
-rw-r--r--storage/perfschema/pfs.cc75
-rw-r--r--storage/perfschema/pfs_server.h6
-rw-r--r--storage/perfschema/pfs_stat.h16
67 files changed, 976 insertions, 162 deletions
diff --git a/Makefile.am b/Makefile.am
index 7ab9a9aa061..dcb55bdfa86 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -264,7 +264,8 @@ test-full-qa:
# Headers which need to be checked for abi/api compatibility.
#
-API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
+API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin_audit.h \
+ $(top_srcdir)/include/mysql/plugin_ftparser.h \
$(top_srcdir)/include/mysql.h \
$(top_srcdir)/include/mysql/psi/psi_abi_v1.h \
$(top_srcdir)/include/mysql/psi/psi_abi_v2.h
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 7911b7848a8..b9ff9f7af73 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -15,7 +15,8 @@
#
# Headers which need to be checked for abi/api compatibility are in
-# API_PREPROCESSOR_HEADER.
+# API_PREPROCESSOR_HEADER. plugin.h is tested implicitly via
+# plugin_audit.h and plugin_ftparser.h.
#
# We use gcc specific preprocessing command and sed/diff, so it will
# only be run on Unix and only if gcc is used.
@@ -27,7 +28,8 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(COMPILER ${CMAKE_C_COMPILER})
ENDIF()
SET(API_PREPROCESSOR_HEADER
- ${CMAKE_SOURCE_DIR}/include/mysql/plugin.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h
${CMAKE_SOURCE_DIR}/include/mysql.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
@@ -38,18 +40,18 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCOMPILER=${COMPILER}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
- "-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ADD_CUSTOM_TARGET(abi_check_all
COMMAND ${CMAKE_COMMAND}
- -DCMAKE_C_COMPILER=${COMPILER}
- -DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
- -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
- "-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
- -P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
+ -DCOMPILER=${COMPILER}
+ -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
+ -DBINARY_DIR=${CMAKE_BINARY_DIR}
+ "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ENDIF()
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index aa7784e7372..78006bd018c 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -56,8 +56,9 @@ FOREACH(file ${ABI_HEADERS})
SET(tmpfile ${file}.pp.tmp)
EXECUTE_PROCESS(
COMMAND ${COMPILER}
- -E -nostdinc -dI -I${SOURCE_DIR}/include -I${BINARY_DIR}/include
- -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql ${file}
+ -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
+ ${file}
ERROR_QUIET OUTPUT_FILE ${tmpfile})
EXECUTE_PROCESS(
COMMAND sed -e
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
new file mode 100644
index 00000000000..8481b2c92be
--- /dev/null
+++ b/include/mysql/plugin_audit.h.pp
@@ -0,0 +1,196 @@
+#include "plugin.h"
+#include <mysql/services.h>
+#include <mysql/service_my_snprintf.h>
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+#include <mysql/service_thd_alloc.h>
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[128];
+};
+typedef struct st_mysql_xid MYSQL_XID;
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
+ SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+ SHOW_always_last
+};
+struct st_mysql_show_var {
+ const char *name;
+ char *value;
+ enum enum_mysql_show_type type;
+};
+typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
+struct st_mysql_sys_var;
+struct st_mysql_value;
+typedef int (*mysql_var_check_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+typedef void (*mysql_var_update_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+struct st_mysql_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
+};
+#include "plugin_ftparser.h"
+#include "plugin.h"
+enum enum_ftparser_mode
+{
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ struct charset_info_st *cs;
+ char *doc;
+ int length;
+ int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+int thd_in_lock_tables(const void* thd);
+int thd_tablespace_op(const void* thd);
+long long thd_test_options(const void* thd, long long test_options);
+int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
+void **thd_ha_data(const void* thd, const struct handlerton *hton);
+void thd_storage_lock_wait(void* thd, long long value);
+int thd_tx_isolation(const void* thd);
+char *thd_security_context(void* thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+void thd_inc_row_count(void* thd);
+int mysql_tmpfile(const char *prefix);
+int thd_killed(const void* thd);
+unsigned long thd_get_thread_id(const void* thd);
+void thd_get_xid(const void* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(void* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+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;
+ const char *general_user;
+ unsigned int general_user_length;
+ const char *general_command;
+ unsigned int general_command_length;
+ const char *general_query;
+ unsigned int general_query_length;
+ struct charset_info_st *general_charset;
+ unsigned long long general_time;
+ unsigned long long general_rows;
+};
+struct st_mysql_audit
+{
+ int interface_version;
+ void (*release_thd)(void*);
+ void (*event_notify)(void*, const struct mysql_event *);
+ unsigned long class_mask[1];
+};
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin_ftparser.h.pp
index 55d62b8daab..bc77ef48eb7 100644
--- a/include/mysql/plugin.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,3 +1,4 @@
+#include "plugin.h"
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -74,7 +75,51 @@ struct st_mysql_plugin
void * __reserved1;
};
#include "plugin_ftparser.h"
-#include "plugin.h"
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+int thd_in_lock_tables(const void* thd);
+int thd_tablespace_op(const void* thd);
+long long thd_test_options(const void* thd, long long test_options);
+int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
+void **thd_ha_data(const void* thd, const struct handlerton *hton);
+void thd_storage_lock_wait(void* thd, long long value);
+int thd_tx_isolation(const void* thd);
+char *thd_security_context(void* thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+void thd_inc_row_count(void* thd);
+int mysql_tmpfile(const char *prefix);
+int thd_killed(const void* thd);
+unsigned long thd_get_thread_id(const void* thd);
+void thd_get_xid(const void* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(void* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+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);
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -121,48 +166,3 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
-struct st_mysql_daemon
-{
- int interface_version;
-};
-struct st_mysql_information_schema
-{
- int interface_version;
-};
-struct st_mysql_storage_engine
-{
- int interface_version;
-};
-struct handlerton;
- struct Mysql_replication {
- int interface_version;
- };
-struct st_mysql_value
-{
- int (*value_type)(struct st_mysql_value *);
- const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
- int (*val_real)(struct st_mysql_value *, double *realbuf);
- int (*val_int)(struct st_mysql_value *, long long *intbuf);
- int (*is_unsigned)(struct st_mysql_value *);
-};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-const char *thd_proc_info(void* thd, const char *info);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-void thd_storage_lock_wait(void* thd, long long value);
-int thd_tx_isolation(const void* thd);
-char *thd_security_context(void* thd, char *buffer, unsigned int length,
- unsigned int max_query_len);
-void thd_inc_row_count(void* thd);
-int mysql_tmpfile(const char *prefix);
-int thd_killed(const void* thd);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
- const char *key, unsigned int key_length,
- int using_trx);
-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);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1b965e7079d..661f38e442c 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2155,9 +2155,8 @@ sub environment_setup {
# mysqlhotcopy
# ----------------------------------------------------
my $mysqlhotcopy=
- mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy");
- # Since mysqltest interprets the real path as "false" in an if,
- # use 1 ("true") to indicate "not exists" so it can be tested for
+ mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy") ||
+ mtr_pl_maybe_exists("$path_client_bindir/mysqlhotcopy");
if ($mysqlhotcopy)
{
$ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index a84ce6aaddf..d5f3945fb6b 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1542,6 +1542,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 79e714eab47..eb8ef31c8e4 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1114,5 +1114,18 @@ format(123,2,'no_NO')
123,00
DROP TABLE t1;
#
+# Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
+#
+CREATE TABLE t1 (
+b char(250) CHARACTER SET utf32,
+key (b)
+) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('d'),('f');
+SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
+b
+d
+f
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 45c93971852..a9b3e98a26f 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1715,7 +1715,7 @@ drop table t1;
#
End of 5.1 tests
#
-# Bug#55648: Server crash on MIX/MAX on maximum time value
+# Bug#55648: Server crash on MIN/MAX on maximum time value
#
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
@@ -1725,3 +1725,13 @@ MAX(c1)
838:59:59
DROP TABLE t1;
# End of the bug#55648
+#
+# Bug#56120: Failed assertion on MIN/MAX on negative time value
+#
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('-00:00:01');
+SELECT MAX(c1),MIN(c1) FROM t1;
+MAX(c1) MIN(c1)
+-00:00:01 -00:00:01
+DROP TABLE t1;
+# End of the bug#56120
diff --git a/mysql-test/r/handler_read_last.result b/mysql-test/r/handler_read_last.result
new file mode 100644
index 00000000000..a21e9ed9564
--- /dev/null
+++ b/mysql-test/r/handler_read_last.result
@@ -0,0 +1,60 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, INDEX (a));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 1;
+a
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
+a
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 1
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 3;
+a
+NULL
+NULL
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 2
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
+a
+NULL
+NULL
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 1
+Handler_read_next 0
+Handler_read_prev 2
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+DROP TABLE t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index f12c9a0a61a..b0858894b71 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -694,6 +694,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 9f87ea082db..260f7170fc5 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -854,6 +854,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 847a00cad94..0af32d8f749 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1238,6 +1238,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 5
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 88c74d4c497..3c53faff526 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -432,8 +432,5 @@ Bug #47147: mysql client option --skip-column-names does not apply to vertical o
*************************** 1. row ***************************
1
-Bug #54466 client 5.5 built from source lacks "pager" support
-a
-1
End of tests
diff --git a/mysql-test/r/mysql_not_windows.result b/mysql-test/r/mysql_not_windows.result
new file mode 100644
index 00000000000..d5670a1a9ca
--- /dev/null
+++ b/mysql-test/r/mysql_not_windows.result
@@ -0,0 +1,5 @@
+Bug #54466 client 5.5 built from source lacks "pager" support
+a
+1
+
+End of tests
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 533f35c1113..51703531d8b 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -860,9 +860,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index 9b6b0f53b01..661be6e5678 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -864,9 +864,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 58c587fe588..fd523168e7c 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -424,6 +424,7 @@ SHOW STATUS LIKE "handler_read%";
Variable_name Value
Handler_read_first 0
Handler_read_key 6
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 55366bd2e07..dfcd9dde73d 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -359,6 +359,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -377,6 +378,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -407,6 +409,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -423,6 +426,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -439,6 +443,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -455,6 +460,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index b193a269288..e8628d72a46 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4338,6 +4338,7 @@ SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
index 921d308097c..72419c6ec9d 100644
--- a/mysql-test/r/single_delete_update.result
+++ b/mysql-test/r/single_delete_update.result
@@ -25,6 +25,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -41,6 +42,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -74,6 +76,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -90,6 +93,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -120,6 +124,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -136,6 +141,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -170,6 +176,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -186,6 +193,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -214,6 +222,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -230,6 +239,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -256,6 +266,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -272,6 +283,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -301,6 +313,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -322,6 +335,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -357,6 +371,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -373,6 +388,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -406,6 +422,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -422,6 +439,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -464,6 +482,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -486,6 +505,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -502,6 +522,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -536,6 +557,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -552,6 +574,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -590,6 +613,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -606,6 +630,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -641,6 +666,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -657,6 +683,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -691,6 +718,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -707,6 +735,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -735,6 +764,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -751,6 +781,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -778,6 +809,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -794,6 +826,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -824,6 +857,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -845,6 +879,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -884,6 +919,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -900,6 +936,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 5
@@ -938,6 +975,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -954,6 +992,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -990,6 +1029,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -1012,6 +1052,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -1028,6 +1069,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 5
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 586e2e7822b..2962a12d9a2 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -113,6 +113,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 05ab1b71018..54170ae3dad 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -273,6 +273,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -284,6 +285,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 2
@@ -294,6 +296,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -304,6 +307,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -315,6 +319,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -368,6 +373,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 1
@@ -405,6 +411,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -415,6 +422,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -424,6 +432,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -433,6 +442,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
index 0699f8c4a59..e3792f8272d 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
@@ -193,4 +193,4 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 2 # table_id: #
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 2 # COMMIT
-mysqld-bin.000001 # Query 2 # use `test`; drop table t2
+mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t2` /* generated by server */
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
index d018f67dd71..423b9f71ac6 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
@@ -7,5 +7,5 @@ create table t1 (a int primary key, b int) engine=ndb;
insert into t1 values (1, 1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-bin.000001 # Query 1 # use `test`; drop table if exists t1
+mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
drop database mysqltest;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
index 0260d49f75f..ab952430d2d 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
@@ -47,8 +47,8 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 1 # table_id: #
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 1 # COMMIT
-mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t1
-mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t2
+mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t1` /* generated by server */
+mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
mysqld-bin.000001 # Query 1 # BEGIN
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
index e1af4aea092..3fbb2660eb6 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
@@ -37,7 +37,7 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 1 # table_id: #
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 1 # COMMIT
-mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE t2
+mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE `t2` /* generated by server */
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
@@ -73,7 +73,7 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 2 # table_id: #
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 2 # COMMIT
-mysqld-bin.000001 # Query 2 # use `test`; drop table t1
+mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t1` /* generated by server */
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops
diff --git a/mysql-test/suite/perfschema/r/bad_option_3.result b/mysql-test/suite/perfschema/r/bad_option_3.result
new file mode 100644
index 00000000000..ec717d6f7d2
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_3.result
@@ -0,0 +1,2 @@
+Found: unknown option '-x'
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/bad_option_4.result b/mysql-test/suite/perfschema/r/bad_option_4.result
new file mode 100644
index 00000000000..812ee546200
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_4.result
@@ -0,0 +1,2 @@
+Found: Can't change dir to.*bad_option_h_param
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/bad_option_5.result b/mysql-test/suite/perfschema/r/bad_option_5.result
new file mode 100644
index 00000000000..b318b6e0482
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_5.result
@@ -0,0 +1,2 @@
+Found: unknown option '-X'
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/short_option_1.result b/mysql-test/suite/perfschema/r/short_option_1.result
new file mode 100644
index 00000000000..ad48fe05ad9
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/short_option_1.result
@@ -0,0 +1,27 @@
+select 'Ok, the server started' as result;
+result
+Ok, the server started
+select @@SQL_MODE;
+@@SQL_MODE
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+select @@character_set_server;
+@@character_set_server
+utf8
+show variables like 'character_set_system';
+Variable_name Value
+character_set_system utf8
+show variables like 'log';
+Variable_name Value
+log ON
+show variables like 'general_log';
+Variable_name Value
+general_log ON
+show variables like 'new';
+Variable_name Value
+new ON
+show variables like 'log_warnings';
+Variable_name Value
+log_warnings 3
diff --git a/mysql-test/suite/perfschema/r/short_option_2.result b/mysql-test/suite/perfschema/r/short_option_2.result
new file mode 100644
index 00000000000..0587fdef73b
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/short_option_2.result
@@ -0,0 +1,9 @@
+select 'Ok, the server started' as result;
+result
+Ok, the server started
+select @@SQL_MODE;
+@@SQL_MODE
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+select @@log_warnings;
+@@log_warnings
+5
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index 48891adce73..0241313863d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index cb1d64bf1e7..fe3e5646218 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index 3856d241d73..974d933ed8d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 0
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index e52f04cbae7..303c31d1f08 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 0
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index aab39dfb619..11b91f80b04 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 0
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index 0665058a469..8cda000e36a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -46,8 +46,8 @@ performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 0
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index 721f9957b1e..6cd7c180ddc 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
+performance_schema_max_mutex_instances 1000000
performance_schema_max_rwlock_classes 0
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index 63398bce1f5..4393f9ea57b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -45,8 +45,8 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 0
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
@@ -56,7 +56,7 @@ show engine PERFORMANCE_SCHEMA status;
show status like "performance_schema%";
show variables like "performance_schema_max_rwlock_classes";
Variable_name Value
-performance_schema_max_rwlock_classes 20
+performance_schema_max_rwlock_classes 30
select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
where name like "wait/synch/rwlock/%";
count(*) > 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index 006f0fc6002..20e6f18a284 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index e0377e10583..28fe6923991 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 5f72cb4eba1..de09d9daa07 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 2639fb8e540..30546496050 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -45,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/t/bad_option_3.test b/mysql-test/suite/perfschema/t/bad_option_3.test
new file mode 100644
index 00000000000..1a9efb61fdf
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_3.test
@@ -0,0 +1,49 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_3.txt;
+--error 0,1
+--remove_file $outfile
+--error 2
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -x > $outfile 2>&1
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_3.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("unknown option '-x'",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/bad_option_4.test b/mysql-test/suite/perfschema/t/bad_option_4.test
new file mode 100644
index 00000000000..c13df1b614d
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_4.test
@@ -0,0 +1,49 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_4.txt;
+--error 0,1
+--remove_file $outfile
+--error 1
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -h bad_option_h_param > $outfile 2>&1
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_4.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("Can't change dir to.*bad_option_h_param",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/bad_option_5.test b/mysql-test/suite/perfschema/t/bad_option_5.test
new file mode 100644
index 00000000000..d0ae1370859
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_5.test
@@ -0,0 +1,52 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_5.txt;
+--error 0,1
+--remove_file $outfile
+--error 2
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -aXbroken > $outfile 2>&1
+
+# -aXbroken should be parsed as -a -Xbroken, or --ansi -Xbroken,
+# therefore the -X option is what the server should complain about
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_5.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("unknown option '-X'",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/short_option_1-master.opt b/mysql-test/suite/perfschema/t/short_option_1-master.opt
new file mode 100644
index 00000000000..6a6e8d4c5ca
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_1-master.opt
@@ -0,0 +1 @@
+-a -n -Cutf8 --collation=utf8_bin -l -T12 -W3
diff --git a/mysql-test/suite/perfschema/t/short_option_1.test b/mysql-test/suite/perfschema/t/short_option_1.test
new file mode 100644
index 00000000000..1d3e0835188
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_1.test
@@ -0,0 +1,35 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check server start for short server start options
+
+select 'Ok, the server started' as result;
+
+# See the associated -master.opt file.
+
+select @@SQL_MODE;
+show variables like 'sql_mode';
+
+select @@character_set_server;
+show variables like 'character_set_system';
+
+show variables like 'log';
+show variables like 'general_log';
+
+show variables like 'new';
+
+show variables like 'log_warnings';
+
diff --git a/mysql-test/suite/perfschema/t/short_option_2-master.opt b/mysql-test/suite/perfschema/t/short_option_2-master.opt
new file mode 100644
index 00000000000..5cf7590a1c8
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_2-master.opt
@@ -0,0 +1 @@
+-aW5
diff --git a/mysql-test/suite/perfschema/t/short_option_2.test b/mysql-test/suite/perfschema/t/short_option_2.test
new file mode 100644
index 00000000000..eb528dfcf72
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_2.test
@@ -0,0 +1,29 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check server start for short server start options
+
+select 'Ok, the server started' as result;
+
+# See the associated -master.opt file.
+# -aW5 should be parsed as -a -W5, which are two separate short options
+# stuffed inside a single argv[i] argument.
+
+# Should contain ANSI, since we started the server with -a (stands for --ansi)
+select @@SQL_MODE;
+
+# Should be 5, since we started the server with -W5
+select @@log_warnings;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 375717ee171..ef563d71342 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -25,7 +25,7 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -204,7 +204,7 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -240,7 +240,7 @@ slave-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
slave-bin.000001 # Write_rows # # table_id: #
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
-slave-bin.000001 # Query # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
index 14d3baee1b0..36a7ae0016b 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
@@ -37,7 +37,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
**** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
@@ -72,7 +72,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -86,4 +86,4 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index 668b3b033bd..3ea497868ee 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -819,5 +819,16 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
+--echo # Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
+--echo #
+CREATE TABLE t1 (
+ b char(250) CHARACTER SET utf32,
+ key (b)
+) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('d'),('f');
+SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
+DROP TABLE t1;
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 2914bb15d18..04c52dd32bd 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1086,7 +1086,7 @@ drop table t1;
--echo End of 5.1 tests
--echo #
---echo # Bug#55648: Server crash on MIX/MAX on maximum time value
+--echo # Bug#55648: Server crash on MIN/MAX on maximum time value
--echo #
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
@@ -1095,3 +1095,12 @@ SELECT MAX(c1) FROM t1;
DROP TABLE t1;
--echo # End of the bug#55648
+--echo #
+--echo # Bug#56120: Failed assertion on MIN/MAX on negative time value
+--echo #
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('-00:00:01');
+SELECT MAX(c1),MIN(c1) FROM t1;
+DROP TABLE t1;
+--echo # End of the bug#56120
+
diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test
new file mode 100644
index 00000000000..376829b9baf
--- /dev/null
+++ b/mysql-test/t/handler_read_last.test
@@ -0,0 +1,40 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, INDEX (a));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 1;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 3;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 765ef31f9fd..3a2084aef08 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -425,11 +425,5 @@ drop table t1;
--echo
--exec $MYSQL --skip-column-names --vertical test -e "select 1 as a"
-#
-# Bug #54466 client 5.5 built from source lacks "pager" support
-#
---echo Bug #54466 client 5.5 built from source lacks "pager" support
---exec $MYSQL --pager test -e "select 1 as a"
-
--echo
--echo End of tests
diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test
new file mode 100644
index 00000000000..66853677f7b
--- /dev/null
+++ b/mysql-test/t/mysql_not_windows.test
@@ -0,0 +1,15 @@
+-- source include/not_windows.inc
+# This test should work in embedded server after we fix mysqltest
+-- source include/not_embedded.inc
+#
+# Testing the MySQL command line client(mysql)
+#
+
+#
+# Bug #54466 client 5.5 built from source lacks "pager" support
+#
+--echo Bug #54466 client 5.5 built from source lacks "pager" support
+--exec $MYSQL --pager test -e "select 1 as a"
+
+--echo
+--echo End of tests
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 1c5bf0b6b1c..4faaadb3f70 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -98,6 +98,49 @@ void my_getopt_register_get_addr(my_getopt_value func_addr)
matches with one of the options in struct 'my_option'.
Check that option was given an argument if it requires one
Call the optional 'get_one_option()' function once for each option.
+
+ Note that handle_options() can be invoked multiple times to
+ parse a command line in several steps.
+ In this case, use the global flag @c my_getopt_skip_unknown to indicate
+ that options unknown in the current step should be preserved in the
+ command line for later parsing in subsequent steps.
+
+ For 'long' options (--a_long_option), @c my_getopt_skip_unknown is
+ fully supported. Command line parameters such as:
+ - "--a_long_option"
+ - "--a_long_option=value"
+ - "--a_long_option value"
+ will be preserved as is when the option is not known.
+
+ For 'short' options (-S), support for @c my_getopt_skip_unknown
+ comes with some limitation, because several short options
+ can also be specified together in the same command line argument,
+ as in "-XYZ".
+
+ The first use case supported is: all short options are declared.
+ handle_options() will be able to interpret "-XYZ" as one of:
+ - an unknown X option
+ - "-X -Y -Z", three short options with no arguments
+ - "-X -YZ", where Y is a short option with argument Z
+ - "-XYZ", where X is a short option with argument YZ
+ based on the full short options specifications.
+
+ The second use case supported is: no short option is declared.
+ handle_options() will reject "-XYZ" as unknown, to be parsed later.
+
+ The use case that is explicitly not supported is to provide
+ only a partial list of short options to handle_options().
+ This function can not be expected to extract some option Y
+ in the middle of the string "-XYZ" in these conditions,
+ without knowing if X will be declared an option later.
+
+ Note that this limitation only impacts parsing of several
+ short options from the same command line argument,
+ as in "mysqld -anW5".
+ When each short option is properly separated out in the command line
+ argument, for example in "mysqld -a -n -w5", the code would actually
+ work even with partial options specs given at each stage.
+
@param [in, out] argc command line options (count)
@param [in, out] argv command line options (values)
@param [in] longopts descriptor of all valid options
@@ -464,14 +507,40 @@ int handle_options(int *argc, char ***argv,
}
if (!opt_found)
{
- if (my_getopt_print_errors)
- my_getopt_error_reporter(ERROR_LEVEL,
- "%s: unknown option '-%c'",
- my_progname, *optend);
- return EXIT_UNKNOWN_OPTION;
+ if (my_getopt_skip_unknown)
+ {
+ /*
+ We are currently parsing a single argv[] argument
+ of the form "-XYZ".
+ One or the argument found (say Y) is not an option.
+ Hack the string "-XYZ" to make a "-YZ" substring in it,
+ and push that to the output as an unrecognized parameter.
+ */
+ DBUG_ASSERT(optend > *pos);
+ DBUG_ASSERT(optend >= cur_arg);
+ DBUG_ASSERT(optend <= *pos + strlen(*pos));
+ DBUG_ASSERT(*optend);
+ optend--;
+ optend[0]= '-'; /* replace 'X' or '-' by '-' */
+ (*argv)[argvpos++]= optend;
+ /*
+ Do not continue to parse at the current "-XYZ" argument,
+ skip to the next argv[] argument instead.
+ */
+ optend= (char*) " ";
+ }
+ else
+ {
+ if (my_getopt_print_errors)
+ my_getopt_error_reporter(ERROR_LEVEL,
+ "%s: unknown option '-%c'",
+ my_progname, *optend);
+ return EXIT_UNKNOWN_OPTION;
+ }
}
}
- (*argc)--; /* option handled (short), decrease argument count */
+ if (opt_found)
+ (*argc)--; /* option handled (short), decrease argument count */
continue;
}
if ((error= setval(optp, value, argument, set_maximum_value)))
@@ -479,7 +548,7 @@ int handle_options(int *argc, char ***argv,
if (get_one_option && get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
- (*argc)--; /* option handled (short or long), decrease argument count */
+ (*argc)--; /* option handled (long), decrease argument count */
}
else /* non-option found */
(*argv)[argvpos++]= cur_arg;
diff --git a/sql/item.cc b/sql/item.cc
index 24f57342668..427146e11dc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -7510,9 +7510,14 @@ String *Item_cache_datetime::val_str(String *str)
return NULL;
if (cached_field_type == MYSQL_TYPE_TIME)
{
- ulonglong time= int_value;
- DBUG_ASSERT(time <= TIME_MAX_VALUE);
+ longlong time= int_value;
set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME);
+ if (time < 0)
+ {
+ time= -time;
+ ltime.neg= TRUE;
+ }
+ DBUG_ASSERT(time <= TIME_MAX_VALUE);
ltime.second= time % 100;
time/= 100;
ltime.minute= time % 100;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0cd3ecdf47d..d144f7e82aa 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6439,6 +6439,7 @@ SHOW_VAR status_vars[]= {
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
+ {"Handler_read_last", (char*) offsetof(STATUS_VAR, ha_read_last_count), SHOW_LONG_STATUS},
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9daaf883ea8..501c6382056 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -153,6 +153,17 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func),
is_os_charset(FALSE)
{
+ /*
+ There is a limitation in handle_options() related to short options:
+ - either all short options should be declared when parsing in multiple stages,
+ - or none should be declared.
+ Because a lot of short options are used in the normal parsing phase
+ for mysqld, we enforce here that no short option is present
+ in the first (PARSE_EARLY) stage.
+ See handle_options() for details.
+ */
+ DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255);
+
name.str= name_arg;
name.length= strlen(name_arg);
DBUG_ASSERT(name.length <= NAME_CHAR_LEN);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index fdda514986b..f63a43ccd76 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -145,7 +145,7 @@ static Sys_var_ulong Sys_pfs_max_mutex_instances(
"performance_schema_max_mutex_instances",
"Maximum number of instrumented MUTEX objects.",
READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
DEFAULT(PFS_MAX_MUTEX),
BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
@@ -161,7 +161,7 @@ static Sys_var_ulong Sys_pfs_max_rwlock_instances(
"performance_schema_max_rwlock_instances",
"Maximum number of instrumented RWLOCK objects.",
READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
DEFAULT(PFS_MAX_RWLOCK),
BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index bce42b64e99..75038fce070 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -253,18 +253,17 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
pos=old;
if (keyseg->flag & HA_SPACE_PACK)
{
- uchar *end=pos+length;
if (type == HA_KEYTYPE_NUM)
{
- while (pos < end && pos[0] == ' ')
- pos++;
+ uchar *end= pos + length;
+ while (pos < end && pos[0] == ' ')
+ pos++;
+ length= (uint) (end - pos);
}
else if (type != HA_KEYTYPE_BINARY)
{
- while (end > pos && end[-1] == ' ')
- end--;
+ length= cs->cset->lengthsp(cs, (char*) pos, length);
}
- length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((uchar*) key,pos,(size_t) char_length);
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 245664bc2b6..139064ab212 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1625,18 +1625,26 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
- if (rc == 0 && wait->m_timer_state == TIMER_STATE_TIMED)
+ if (rc == 0)
{
/* Thread safe: we are protected by the instrumented mutex */
- PFS_single_stat_chain *stat;
PFS_mutex *mutex= pfs_locker->m_target.m_mutex;
+ PFS_single_stat_chain *stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class);
mutex->m_owner= wait->m_thread;
mutex->m_last_locked= wait->m_timer_end;
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time);
- stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&mutex->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1682,20 +1690,26 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc)
The statistics generated are not safe, which is why they are
just statistics, not facts.
*/
- PFS_single_stat_chain *stat;
PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
+ PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
+
if (rwlock->m_readers == 0)
rwlock->m_last_read= wait->m_timer_end;
rwlock->m_writer= NULL;
rwlock->m_readers++;
+ /* If timed then aggregate stats, else increment the value counts only */
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
- stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
aggregate_single_stat_chain(stat, wait_time);
}
+ else
+ {
+ increment_single_stat_chain(&rwlock->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1735,21 +1749,26 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc)
if (rc == 0)
{
/* Thread safe : we are protected by the instrumented rwlock */
- PFS_single_stat_chain *stat;
PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
+ PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
rwlock->m_writer= wait->m_thread;
rwlock->m_last_written= wait->m_timer_end;
/* Reset the readers stats, they could be off */
rwlock->m_readers= 0;
rwlock->m_last_read= 0;
+ /* If timed then aggregate stats, else increment the value counts only */
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
- stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
aggregate_single_stat_chain(stat, wait_time);
}
+ else
+ {
+ increment_single_stat_chain(&rwlock->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1803,16 +1822,21 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc)
in condition B.
This is accepted, the data will be slightly inaccurate.
*/
- PFS_single_stat_chain *stat;
PFS_cond *cond= pfs_locker->m_target.m_cond;
+ PFS_single_stat_chain *stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class);
+ /* If timed then aggregate stats, else increment the value counts only */
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&cond->m_wait_stat, wait_time);
- stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class);
aggregate_single_stat_chain(stat, wait_time);
}
+ else
+ {
+ increment_single_stat_chain(&cond->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1855,12 +1879,18 @@ static void end_table_wait_v1(PSI_table_locker* locker)
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
+ PFS_table *table= pfs_locker->m_target.m_table;
+
+ /* If timed then aggregate stats, else increment the value counts only */
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
- PFS_table *table= pfs_locker->m_target.m_table;
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&table->m_wait_stat, wait_time);
}
+ else
+ {
+ increment_single_stat_chain(&table->m_wait_stat);
+ }
/*
There is currently no per table and per thread aggregation.
@@ -1962,14 +1992,21 @@ static void end_file_wait_v1(PSI_file_locker *locker,
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
- PFS_single_stat_chain *stat;
PFS_file *file= pfs_locker->m_target.m_file;
+ PFS_single_stat_chain *stat= find_per_thread_file_class_wait_stat(wait->m_thread, file->m_class);
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&file->m_wait_stat, wait_time);
- stat= find_per_thread_file_class_wait_stat(wait->m_thread,
- file->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&file->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&file->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
PFS_file_class *klass= file->m_class;
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index a7af27c1038..8cb68cd52b1 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -25,13 +25,13 @@
#define PFS_MAX_MUTEX_CLASS 200
#endif
#ifndef PFS_MAX_MUTEX
- #define PFS_MAX_MUTEX 1000
+ #define PFS_MAX_MUTEX 1000000
#endif
#ifndef PFS_MAX_RWLOCK_CLASS
- #define PFS_MAX_RWLOCK_CLASS 20
+ #define PFS_MAX_RWLOCK_CLASS 30
#endif
#ifndef PFS_MAX_RWLOCK
- #define PFS_MAX_RWLOCK 1000
+ #define PFS_MAX_RWLOCK 1000000
#endif
#ifndef PFS_MAX_COND_CLASS
#define PFS_MAX_COND_CLASS 80
diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h
index c78d5c83039..5955a515d1a 100644
--- a/storage/perfschema/pfs_stat.h
+++ b/storage/perfschema/pfs_stat.h
@@ -83,6 +83,22 @@ inline void aggregate_single_stat_chain(PFS_single_stat_chain *stat,
while (stat);
}
+/**
+ Increment the value counts in a statistic chain.
+ Used for instruments that are 'ENABLED' but not 'TIMED'.
+ @param stat the aggregated statistic chain
+*/
+inline void increment_single_stat_chain(PFS_single_stat_chain *stat)
+{
+ do
+ {
+ if (*stat->m_control_flag)
+ stat->m_count++;
+ stat= stat->m_parent;
+ }
+ while (stat);
+}
+
/** Statistics for COND usage. */
struct PFS_cond_stat
{