summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-05-05 15:23:47 +0200
committerSergei Golubchik <serg@mariadb.org>2015-05-05 15:23:47 +0200
commit1d3ea9ecd8c7f7e022eb4ee5e98326fc850d59b1 (patch)
treef9abc493fa045bb684b884b81ae58c94e3e8ea38
parentdd0207bda440c2e44ba5223d0635538bc2974890 (diff)
parentd71d4119055f0184f5edd24e86fa3d6a5c71aa89 (diff)
downloadmariadb-git-1d3ea9ecd8c7f7e022eb4ee5e98326fc850d59b1.tar.gz
perfschema 5.6.24
including the big commit commit 305130361bf72726de220f3d2b2787395e10be61 Author: Marc Alff <marc.alff@oracle.com> Date: Tue Feb 10 11:31:32 2015 +0100 WL#8354 BACKPORT DIGEST IMPROVEMENTS TO MYSQL 5.6 (with the following commits) and related changes in sql/
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/mysql/psi/mysql_statement.h26
-rw-r--r--include/mysql/psi/psi.h57
-rw-r--r--include/mysql/psi/psi_abi_v0.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp24
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp2
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--mysql-test/r/mysqld--help.result3
-rw-r--r--mysql-test/suite/perfschema/include/sizing_auto.inc12
-rw-r--r--mysql-test/suite/perfschema/include/socket_event.inc2
-rw-r--r--mysql-test/suite/perfschema/include/start_server_common.inc4
-rw-r--r--mysql-test/suite/perfschema/include/table_aggregate_load.inc4
-rw-r--r--mysql-test/suite/perfschema/r/digest_null_literal.result27
-rw-r--r--mysql-test/suite/perfschema/r/ortho_iter.result30
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result5
-rw-r--r--mysql-test/suite/perfschema/r/sizing_default.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_high.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_low.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_med.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_idle.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_stages.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_statements.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_waits.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_innodb.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest.result12
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_account.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_host.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_actors.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_objects.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stage_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statement_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_hdl.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_user.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_nothing.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result5
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest.result5
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_consumers.result5
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_long_query.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/t/digest_null_literal.test32
-rw-r--r--mysql-test/suite/perfschema/t/ortho_iter.test5
-rw-r--r--mysql-test/suite/perfschema/t/privilege_table_io.test4
-rw-r--r--mysql-test/suite/perfschema/t/sizing_off.test4
-rw-r--r--mysql-test/suite/perfschema/t/start_server_low_digest-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/start_server_low_digest.test21
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--sql/CMakeLists.txt30
-rw-r--r--sql/event_scheduler.cc5
-rw-r--r--sql/gen_lex_token.cc353
-rw-r--r--sql/log_event.cc16
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/mysqld.h1
-rw-r--r--sql/sp_head.cc5
-rw-r--r--sql/sql_class.cc9
-rw-r--r--sql/sql_class.h9
-rw-r--r--sql/sql_cursor.cc4
-rw-r--r--sql/sql_digest.cc683
-rw-r--r--sql/sql_digest.h130
-rw-r--r--sql/sql_digest_stream.h51
-rw-r--r--sql/sql_lex.cc27
-rw-r--r--sql/sql_lex.h30
-rw-r--r--sql/sql_parse.cc50
-rw-r--r--sql/sql_yacc.yy8
-rw-r--r--sql/sys_vars.cc6
-rw-r--r--storage/perfschema/CMakeLists.txt22
-rw-r--r--storage/perfschema/pfs.cc83
-rw-r--r--storage/perfschema/pfs_account.cc2
-rw-r--r--storage/perfschema/pfs_column_types.h2
-rw-r--r--storage/perfschema/pfs_digest.cc526
-rw-r--r--storage/perfschema/pfs_digest.h148
-rw-r--r--storage/perfschema/pfs_engine_table.cc56
-rw-r--r--storage/perfschema/pfs_events_statements.cc38
-rw-r--r--storage/perfschema/pfs_events_statements.h10
-rw-r--r--storage/perfschema/pfs_host.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc52
-rw-r--r--storage/perfschema/pfs_instr.h4
-rw-r--r--storage/perfschema/pfs_server.cc2
-rw-r--r--storage/perfschema/pfs_server.h4
-rw-r--r--storage/perfschema/pfs_user.cc2
-rw-r--r--storage/perfschema/table_events_statements.cc46
-rw-r--r--storage/perfschema/table_events_statements.h7
-rw-r--r--storage/perfschema/table_helper.cc22
-rw-r--r--storage/perfschema/table_helper.h6
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt11
-rw-r--r--storage/perfschema/unittest/pfs-t.cc6
-rw-r--r--storage/perfschema/unittest/pfs_account-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_host-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc7
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc4
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc (renamed from storage/perfschema/unittest/stub_server_misc.h)11
-rw-r--r--storage/perfschema/unittest/pfs_user-oom-t.cc3
151 files changed, 2138 insertions, 1681 deletions
diff --git a/.gitignore b/.gitignore
index 768872b9064..e7871c66357 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,6 +136,8 @@ sql-bench/test-select
sql-bench/test-table-elimination
sql-bench/test-transactions
sql-bench/test-wisconsin
+sql/lex_token.h
+sql/gen_lex_token
sql/gen_lex_hash
sql/lex_hash.h
sql/mysql_tzinfo_to_sql
@@ -164,8 +166,6 @@ storage/myisam/myisamlog
storage/myisam/myisampack
storage/myisam/rt_test
storage/myisam/sp_test
-storage/perfschema/gen_pfs_lex_token
-storage/perfschema/pfs_lex_token.h
storage/tokudb/ft-index/buildheader/db.h
storage/tokudb/ft-index/buildheader/make_tdb
storage/tokudb/ft-index/buildheader/runcat.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7f07d93add..b274f80b773 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -443,7 +443,7 @@ ADD_SUBDIRECTORY(packaging/solaris)
IF(NOT CMAKE_CROSSCOMPILING)
SET(EXPORTED comp_err comp_sql factorial)
IF(NOT WITHOUT_SERVER)
- SET(EXPORTED ${EXPORTED} gen_lex_hash gen_pfs_lex_token)
+ SET(EXPORTED ${EXPORTED} gen_lex_hash gen_lex_token)
ENDIF()
# minimal target to build only binaries for export
ADD_CUSTOM_TARGET(import_executables DEPENDS ${EXPORTED})
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index d7a76ee25e4..3d5943fa55a 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -41,7 +41,6 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_STATEMENT_INTERFACE
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
#define MYSQL_DIGEST_START(LOCKER) \
inline_mysql_digest_start(LOCKER)
@@ -49,17 +48,13 @@
#define MYSQL_DIGEST_START(LOCKER) \
NULL
#endif
-#else
- #define MYSQL_DIGEST_START(LOCKER) \
- NULL
-#endif
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
- #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
- inline_mysql_add_token(LOCKER, T, Y)
+ #define MYSQL_DIGEST_END(LOCKER, DIGEST) \
+ inline_mysql_digest_end(LOCKER, DIGEST)
#else
- #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
- NULL
+ #define MYSQL_DIGEST_END(LOCKER, DIGEST) \
+ do {} while (0)
#endif
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -132,20 +127,17 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
PSI_digest_locker* digest_locker= NULL;
if (likely(locker != NULL))
- digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
+ digest_locker= PSI_DIGEST_CALL(digest_start)(locker);
return digest_locker;
}
#endif
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
-static inline struct PSI_digest_locker *
-inline_mysql_add_token(PSI_digest_locker *locker, uint token,
- void *yylval)
+static inline void
+inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
{
if (likely(locker != NULL))
- locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
- (OPAQUE_LEX_YYSTYPE*)yylval);
- return locker;
+ PSI_DIGEST_CALL(digest_end)(locker, digest);
}
#endif
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 30f2709be0f..49202c4e88f 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -43,18 +43,8 @@
C_MODE_START
struct TABLE_SHARE;
-/*
- There are 3 known bison parsers in the server:
- - (1) the SQL parser itself, sql/sql_yacc.yy
- - (2) storage/innobase/fts/fts0pars.y
- - (3) storage/innobase/pars/pars0grm.y
- What is instrumented here are the tokens from the SQL query text (1),
- to make digests.
- Now, to avoid name pollution and conflicts with different YYSTYPE definitions,
- an opaque structure is used here.
- The real type to use when invoking the digest api is LEX_YYSTYPE.
-*/
-struct OPAQUE_LEX_YYSTYPE;
+
+struct sql_digest_storage;
/**
@file mysql/psi/psi.h
@@ -952,29 +942,6 @@ struct PSI_table_locker_state_v1
uint m_index;
};
-#define PSI_MAX_DIGEST_STORAGE_SIZE 1024
-
-/**
- Structure to store token count/array for a statement
- on which digest is to be calculated.
-*/
-struct PSI_digest_storage
-{
- my_bool m_full;
- int m_byte_count;
- /** Character set number. */
- uint m_charset_number;
- unsigned char m_token_array[PSI_MAX_DIGEST_STORAGE_SIZE];
-};
-typedef struct PSI_digest_storage PSI_digest_storage;
-
-struct PSI_digest_locker_state
-{
- int m_last_id_index;
- PSI_digest_storage m_digest_storage;
-};
-typedef struct PSI_digest_locker_state PSI_digest_locker_state;
-
/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
#define PSI_SCHEMA_NAME_LEN (64 * 3)
@@ -1037,7 +1004,7 @@ struct PSI_statement_locker_state_v1
/** Metric, number of sort scans. */
ulong m_sort_scan;
/** Statement digest. */
- PSI_digest_locker_state m_digest_state;
+ const struct sql_digest_storage *m_digest;
/** Current schema name. */
char m_schema_name[PSI_SCHEMA_NAME_LEN];
/** Length in bytes of @c m_schema_name. */
@@ -1902,11 +1869,15 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
*/
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
+/**
+ Get a digest locker for the current statement.
+ @param locker a statement locker for the running thread
+*/
typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
-typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
- (struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
+typedef void (*digest_end_v1_t)
+ (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
/**
Stores an array of connection attributes
@@ -2118,8 +2089,8 @@ struct PSI_v1
set_socket_thread_owner_v1_t set_socket_thread_owner;
/** @sa digest_start_v1_t. */
digest_start_v1_t digest_start;
- /** @sa digest_add_token_v1_t. */
- digest_add_token_v1_t digest_add_token;
+ /** @sa digest_end_v1_t. */
+ digest_end_v1_t digest_end;
/** @sa set_thread_connect_attrs_v1_t. */
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
@@ -2414,6 +2385,10 @@ extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
+#ifndef PSI_DIGEST_CALL
+#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
#ifndef PSI_TABLE_CALL
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
diff --git a/include/mysql/psi/psi_abi_v0.h.pp b/include/mysql/psi/psi_abi_v0.h.pp
index b46b38ed144..17d61016a68 100644
--- a/include/mysql/psi/psi_abi_v0.h.pp
+++ b/include/mysql/psi/psi_abi_v0.h.pp
@@ -1,7 +1,7 @@
#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index fa2bf724b5e..898b9871d2e 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,7 +1,7 @@
#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
@@ -241,20 +241,6 @@ struct PSI_table_locker_state_v1
void *m_wait;
uint m_index;
};
-struct PSI_digest_storage
-{
- my_bool m_full;
- int m_byte_count;
- uint m_charset_number;
- unsigned char m_token_array[1024];
-};
-typedef struct PSI_digest_storage PSI_digest_storage;
-struct PSI_digest_locker_state
-{
- int m_last_id_index;
- PSI_digest_storage m_digest_storage;
-};
-typedef struct PSI_digest_locker_state PSI_digest_locker_state;
struct PSI_statement_locker_state_v1
{
my_bool m_discarded;
@@ -280,7 +266,7 @@ struct PSI_statement_locker_state_v1
ulong m_sort_range;
ulong m_sort_rows;
ulong m_sort_scan;
- PSI_digest_locker_state m_digest_state;
+ const struct sql_digest_storage *m_digest;
char m_schema_name[(64 * 3)];
uint m_schema_name_length;
};
@@ -508,8 +494,8 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
-typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
- (struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
+typedef void (*digest_end_v1_t)
+ (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
const void *from_cs);
struct PSI_v1
@@ -610,7 +596,7 @@ struct PSI_v1
set_socket_info_v1_t set_socket_info;
set_socket_thread_owner_v1_t set_socket_thread_owner;
digest_start_v1_t digest_start;
- digest_add_token_v1_t digest_add_token;
+ digest_end_v1_t digest_end;
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
typedef struct PSI_v1 PSI;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index 458013b43e4..c3dba0a9b76 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,7 +1,7 @@
#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 0920be53baf..a244a41f4f6 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -44,7 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
../sql/field.cc ../sql/field_conv.cc
- ../sql/filesort_utils.cc
+ ../sql/filesort_utils.cc ../sql/sql_digest.cc
../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/signal_handler.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 360421514ac..0b8fb8e3d05 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -405,6 +405,8 @@ The following options may be given as the first argument:
Don't start more than this number of threads to handle
INSERT DELAYED statements. If set to zero INSERT DELAYED
will be not used
+ --max-digest-length=#
+ Maximum length considered for digest text.
--max-error-count=# Max number of errors/warnings to store for a statement
--max-heap-table-size=#
Don't allow creation of heap tables bigger than this
@@ -1172,6 +1174,7 @@ max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 100
max-connections 151
max-delayed-threads 20
+max-digest-length 1024
max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
diff --git a/mysql-test/suite/perfschema/include/sizing_auto.inc b/mysql-test/suite/perfschema/include/sizing_auto.inc
index 4c3451ce8b5..3bb4db2276f 100644
--- a/mysql-test/suite/perfschema/include/sizing_auto.inc
+++ b/mysql-test/suite/perfschema/include/sizing_auto.inc
@@ -4,13 +4,21 @@ show variables like "table_open_cache";
show variables like "max_connections";
# open_files_limit depends on OS configuration (ulimit -n)
#show variables like "open_files_limit";
-show variables like "%performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "%performance_schema%";
# Each test script should provide a different test.cnf file,
# with different settings.
# This output will show the sizes computed automatically.
# Note that this output is very dependent on the platform.
+# The output of SHOW ENGINE PERFORMANCE_SCHEMA STATUS
+# is very dependent on the platform,
+# so it is not printed here to ensure stability of the .results files.
+# To troubleshoot the performance schema memory consumption at different
+# configuration settings, comment the following line.
+# Debug only:
-show engine performance_schema status;
+# show engine performance_schema status;
diff --git a/mysql-test/suite/perfschema/include/socket_event.inc b/mysql-test/suite/perfschema/include/socket_event.inc
index ba81c37d5df..96c61045986 100644
--- a/mysql-test/suite/perfschema/include/socket_event.inc
+++ b/mysql-test/suite/perfschema/include/socket_event.inc
@@ -126,7 +126,7 @@ if($is_connect)
# Connect is visible.
# We hope that sleep 1 is long enough so that PERFORMANCE_SCHEMA
# can remove this row before we collect the after action state.
- let $wait_timeou= 5;
+ let $wait_timeout= 5;
let $wait_condition=
SELECT COUNT(*) = 0
$part;
diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc
index d15c3d48ded..41dcfd8ecb5 100644
--- a/mysql-test/suite/perfschema/include/start_server_common.inc
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc
@@ -68,7 +68,9 @@ select * from performance_schema.users;
--enable_result_log
# This has a stable output, printing the result:
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
# This has an unrepeatable output, it does depends too much on
# - the platform hardware (sizeof structures, padding)
diff --git a/mysql-test/suite/perfschema/include/table_aggregate_load.inc b/mysql-test/suite/perfschema/include/table_aggregate_load.inc
index 242768ead9e..f42ebe1fc76 100644
--- a/mysql-test/suite/perfschema/include/table_aggregate_load.inc
+++ b/mysql-test/suite/perfschema/include/table_aggregate_load.inc
@@ -29,7 +29,9 @@ truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
# Check the configuration is ok
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
echo "================== Step 1 ==================";
diff --git a/mysql-test/suite/perfschema/r/digest_null_literal.result b/mysql-test/suite/perfschema/r/digest_null_literal.result
new file mode 100644
index 00000000000..b0cefbbbaaf
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/digest_null_literal.result
@@ -0,0 +1,27 @@
+TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
+NULL
+NULL
+NULL
+NULL
+NULL NULL
+NULL NULL
+NULL NULL NULL 1 2 3 NULL NULL
+NULL NULL NULL 1 2 3 NULL NULL
+1 IS NULL
+0
+2 IS NOT NULL
+1
+1 IS NULL 2 IS NULL 3 IS NOT NULL 4 IS NOT NULL
+0 0 1 1
+SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
+FROM performance_schema.events_statements_summary_by_digest;
+SCHEMA_NAME DIGEST_TEXT COUNT_STAR
+test TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
+test SELECT ? 1
+test SELECT ? FROM DUAL 1
+test SELECT ?, ... 2
+test SELECT ? IS NULL 1
+test SELECT ? IS NOT NULL 1
+test SELECT ? IS NULL , ? IS NULL , ? IS NOT NULL , ? IS NOT NULL 1
+test CREATE TABLE foo ( a INTEGER DEFAULT ? , b INTEGER NOT NULL DEFAULT ? , c INTEGER NOT NULL ) 1
+test DROP TABLE foo 1
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index dafce4bf573..9081bfe5882 100644
--- a/mysql-test/suite/perfschema/r/ortho_iter.result
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result
@@ -94,7 +94,9 @@ close pfs_cursor;
signal sqlstate '01000' set message_text='Done', mysql_errno=12000;
end
$
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -118,7 +120,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
@@ -127,31 +128,6 @@ performance_schema_session_connect_attrs_size 2048
performance_schema_setup_actors_size 100
performance_schema_setup_objects_size 100
performance_schema_users_size 100
-show status like "performance_schema%";
-Variable_name Value
-Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
-Performance_schema_cond_instances_lost 0
-Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
-Performance_schema_file_handles_lost 0
-Performance_schema_file_instances_lost 0
-Performance_schema_hosts_lost 0
-Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
-Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
-Performance_schema_rwlock_instances_lost 0
-Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
-Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
-Performance_schema_table_handles_lost 0
-Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
-Performance_schema_thread_instances_lost 0
-Performance_schema_users_lost 0
call check_instrument("wait/synch/mutex/");
instr_name is_wait is_stage is_statement
wait/synch/mutex/ 1 0 0
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 838d17e61fe..126b2a58fae 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -22,7 +22,9 @@ flush privileges;
insert into test.marker set a = 1;
insert into test.marker set a = 1;
insert into test.marker set a = 1;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -46,7 +48,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/sizing_default.result b/mysql-test/suite/perfschema/r/sizing_default.result
index ef7f7069c19..d7c4e321204 100644
--- a/mysql-test/suite/perfschema/r/sizing_default.result
+++ b/mysql-test/suite/perfschema/r/sizing_default.result
@@ -7,7 +7,9 @@ table_open_cache 2000
show variables like "max_connections";
Variable_name Value
max_connections 151
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 9102
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 322
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 4000
performance_schema_max_table_instances 12500
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 2412
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 4020
-performance_schema events_waits_history.memory 739680
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 10000
-performance_schema events_waits_history_long.memory 1840000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 15906
-performance_schema mutex_instances.memory 2035968
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 9102
-performance_schema rwlock_instances.memory 1747584
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 3504
-performance_schema cond_instances.memory 448512
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 402
-performance_schema threads.memory 1132032
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 7693
-performance_schema file_instances.memory 5415872
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 153966
-performance_schema events_waits_summary_by_thread_by_event_name.memory 4926912
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 12500
-performance_schema (pfs_table_share).memory 277600000
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 4000
-performance_schema (pfs_table).memory 37120000
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 4020
-performance_schema events_stages_history.memory 353760
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 10000
-performance_schema events_stages_history_long.memory 880000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 60300
-performance_schema events_stages_summary_by_thread_by_event_name.memory 1929600
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 4020
-performance_schema events_statements_history.memory 12156480
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 10000
-performance_schema events_statements_history_long.memory 30240000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 67536
-performance_schema events_statements_summary_by_thread_by_event_name.memory 12426624
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 402
-performance_schema events_statements_current.memory 1215648
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 322
-performance_schema socket_instances.memory 103040
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 10000
-performance_schema events_statements_summary_by_digest.memory 14720000
-performance_schema session_connect_attrs.row_size 402
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 205824
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 10000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 7693
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 12500
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 422231328
diff --git a/mysql-test/suite/perfschema/r/sizing_high.result b/mysql-test/suite/perfschema/r/sizing_high.result
index 4d63c970782..c7c7b065992 100644
--- a/mysql-test/suite/perfschema/r/sizing_high.result
+++ b/mysql-test/suite/perfschema/r/sizing_high.result
@@ -7,7 +7,9 @@ table_open_cache 400
show variables like "max_connections";
Variable_name Value
max_connections 200
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 30800
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 420
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 800
performance_schema_max_table_instances 12500
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 3000
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 5000
-performance_schema events_waits_history.memory 920000
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 10000
-performance_schema events_waits_history_long.memory 1840000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 52200
-performance_schema mutex_instances.memory 6681600
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 30800
-performance_schema rwlock_instances.memory 5913600
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 10900
-performance_schema cond_instances.memory 1395200
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 500
-performance_schema threads.memory 1408000
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 23385
-performance_schema file_instances.memory 16463040
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 191500
-performance_schema events_waits_summary_by_thread_by_event_name.memory 6128000
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 12500
-performance_schema (pfs_table_share).memory 277600000
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 800
-performance_schema (pfs_table).memory 7424000
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 5000
-performance_schema events_stages_history.memory 440000
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 10000
-performance_schema events_stages_history_long.memory 880000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 75000
-performance_schema events_stages_summary_by_thread_by_event_name.memory 2400000
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 5000
-performance_schema events_statements_history.memory 15120000
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 10000
-performance_schema events_statements_history_long.memory 30240000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 84000
-performance_schema events_statements_summary_by_thread_by_event_name.memory 15456000
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 500
-performance_schema events_statements_current.memory 1512000
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 420
-performance_schema socket_instances.memory 134400
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 10000
-performance_schema events_statements_summary_by_digest.memory 14720000
-performance_schema session_connect_attrs.row_size 500
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 256000
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 10000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 23385
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 12500
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 421925632
diff --git a/mysql-test/suite/perfschema/r/sizing_low.result b/mysql-test/suite/perfschema/r/sizing_low.result
index d5aab2c2df3..213cc0b5f74 100644
--- a/mysql-test/suite/perfschema/r/sizing_low.result
+++ b/mysql-test/suite/perfschema/r/sizing_low.result
@@ -7,7 +7,9 @@ table_open_cache 100
show variables like "max_connections";
Variable_name Value
max_connections 50
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 10
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 1612
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 67
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 112
performance_schema_max_table_instances 445
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 672
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 560
-performance_schema events_waits_history.memory 103040
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 100
-performance_schema events_waits_history_long.memory 18400
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 2945
-performance_schema mutex_instances.memory 376960
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 1612
-performance_schema rwlock_instances.memory 309504
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 612
-performance_schema cond_instances.memory 78336
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 112
-performance_schema threads.memory 315392
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 1556
-performance_schema file_instances.memory 1095424
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 42896
-performance_schema events_waits_summary_by_thread_by_event_name.memory 1372672
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 445
-performance_schema (pfs_table_share).memory 9882560
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 112
-performance_schema (pfs_table).memory 1039360
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 10
-performance_schema (pfs_account).memory 2560
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 3830
-performance_schema events_waits_summary_by_account_by_event_name.memory 122560
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 1915
-performance_schema events_waits_summary_by_user_by_event_name.memory 61280
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 7660
-performance_schema events_waits_summary_by_host_by_event_name.memory 245120
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 5
-performance_schema (pfs_user).memory 640
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 20
-performance_schema (pfs_host).memory 2560
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 560
-performance_schema events_stages_history.memory 49280
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 100
-performance_schema events_stages_history_long.memory 8800
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 16800
-performance_schema events_stages_summary_by_thread_by_event_name.memory 537600
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 1500
-performance_schema events_stages_summary_by_account_by_event_name.memory 48000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 750
-performance_schema events_stages_summary_by_user_by_event_name.memory 24000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 3000
-performance_schema events_stages_summary_by_host_by_event_name.memory 96000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 560
-performance_schema events_statements_history.memory 1693440
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 100
-performance_schema events_statements_history_long.memory 302400
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 18816
-performance_schema events_statements_summary_by_thread_by_event_name.memory 3462144
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 1680
-performance_schema events_statements_summary_by_account_by_event_name.memory 309120
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 840
-performance_schema events_statements_summary_by_user_by_event_name.memory 154560
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 3360
-performance_schema events_statements_summary_by_host_by_event_name.memory 618240
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 112
-performance_schema events_statements_current.memory 338688
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 67
-performance_schema socket_instances.memory 21440
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 1000
-performance_schema events_statements_summary_by_digest.memory 1472000
-performance_schema session_connect_attrs.row_size 112
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 57344
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 10
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 1000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 1556
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 20
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 445
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 5
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 24771616
diff --git a/mysql-test/suite/perfschema/r/sizing_med.result b/mysql-test/suite/perfschema/r/sizing_med.result
index c2e7a4df4bf..fbe703c5ff5 100644
--- a/mysql-test/suite/perfschema/r/sizing_med.result
+++ b/mysql-test/suite/perfschema/r/sizing_med.result
@@ -7,7 +7,9 @@ table_open_cache 401
show variables like "max_connections";
Variable_name Value
max_connections 152
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 2222
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 232
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 573
performance_schema_max_table_instances 556
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 1734
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 2890
-performance_schema events_waits_history.memory 531760
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 1000
-performance_schema events_waits_history_long.memory 184000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 4230
-performance_schema mutex_instances.memory 541440
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 2222
-performance_schema rwlock_instances.memory 426624
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 1079
-performance_schema cond_instances.memory 138112
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 289
-performance_schema threads.memory 813824
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 1754
-performance_schema file_instances.memory 1234816
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 110687
-performance_schema events_waits_summary_by_thread_by_event_name.memory 3541984
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 556
-performance_schema (pfs_table_share).memory 12347648
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 573
-performance_schema (pfs_table).memory 5317440
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 2890
-performance_schema events_stages_history.memory 254320
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 1000
-performance_schema events_stages_history_long.memory 88000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 43350
-performance_schema events_stages_summary_by_thread_by_event_name.memory 1387200
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 2890
-performance_schema events_statements_history.memory 8739360
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 1000
-performance_schema events_statements_history_long.memory 3024000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 48552
-performance_schema events_statements_summary_by_thread_by_event_name.memory 8933568
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 289
-performance_schema events_statements_current.memory 873936
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 232
-performance_schema socket_instances.memory 74240
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 5000
-performance_schema events_statements_summary_by_digest.memory 7360000
-performance_schema session_connect_attrs.row_size 289
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 147968
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 5000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 1754
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 556
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 70954032
diff --git a/mysql-test/suite/perfschema/r/sizing_off.result b/mysql-test/suite/perfschema/r/sizing_off.result
index 0d95a8c0f1b..614ad7d2475 100644
--- a/mysql-test/suite/perfschema/r/sizing_off.result
+++ b/mysql-test/suite/perfschema/r/sizing_off.result
@@ -1,4 +1,6 @@
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema OFF
performance_schema_accounts_size -1
@@ -22,7 +24,6 @@ performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances -1
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles -1
performance_schema_max_table_instances -1
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
index b27ecd52226..9e0b9209b89 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
index 0b8e00a5653..99b18e851a4 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
index 8e8d1498b9f..5217f16a32f 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
index d4b02dedc2c..86c25348cd5 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result
index 0d7ea7d6294..d03c20a5878 100644
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest.result b/mysql-test/suite/perfschema/r/start_server_low_digest.result
new file mode 100644
index 00000000000..aff444250e0
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/start_server_low_digest.result
@@ -0,0 +1,12 @@
+USE performance_schema;
+truncate table events_statements_history_long;
+SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
+74
+####################################
+# QUERYING PS STATEMENT DIGEST
+####################################
+SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
+event_name digest digest_text sql_text
+statement/sql/truncate e1c917a43f978456fab15240f89372ca TRUNCATE TABLE truncate table events_statements_history_long
+statement/sql/select 4cc1c447d79877c4e8df0423fd0cde9a SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result
index b9ec719ed58..3e0324868a7 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_account.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_account.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 0
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
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 4fac77bc0cc..158dfb81ebe 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 75cd54776eb..3673600a078 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 9922fcaa016..1e819d26265 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 6e8735f6a1f..b439af66f8d 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result
index f5dae7c61d9..abb8a157ec6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_host.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_host.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 4b3c8790b58..c5fe555b749 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 92ec4cf61fc..d88d808a9ab 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 e4ac0d0fa8b..1155993e60c 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 3bba543f3b8..4d419817b0a 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 0
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
index 2c3ef382fb9..281ca17491c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
index 0b49b4d055a..1e5578daddc 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
index 9cf73c2b78d..ef1050d9fde 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
index 6da66d6ee75..97cbc807f3c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 0
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
index 532935bb0ff..a173447632d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
index 360571bc326..6de6cc3187e 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
index d458e3da9b1..fc0e680ebb7 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
index 78fe9223ef4..fca5ab82238 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 0
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
index 2682ea22f88..1fc13bf6ce3 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
index 9568e9ad56b..d51d3acf343 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
index c189d9a5024..784ed74e33c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 0
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
index a440cfe3302..da73df5c419 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 0
performance_schema_max_thread_classes 50
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 d9c945ea8cb..a84f0f3c0ef 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 f5ce5bebb51..3be29053b33 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
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result
index 53cb0051f97..d80a9a4a2c4 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_user.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_user.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
index 125274550eb..928307123d8 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
index 50212863574..d8ada5f9da5 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_nothing.result b/mysql-test/suite/perfschema/r/start_server_nothing.result
index 4e6994d670e..bf84848641c 100644
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 0
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 0
performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 0
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 0
performance_schema_max_table_handles 0
performance_schema_max_table_instances 0
performance_schema_max_thread_classes 0
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 08847829579..293607c41e9 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema OFF
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
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 0d7ea7d6294..d03c20a5878 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/statement_digest.result b/mysql-test/suite/perfschema/r/statement_digest.result
index 4669a6c25a1..e3df74a70d9 100644
--- a/mysql-test/suite/perfschema/r/statement_digest.result
+++ b/mysql-test/suite/perfschema/r/statement_digest.result
@@ -118,7 +118,7 @@ statements_digest d60830f376a7724280dfc422224bb475 SELECT ? FROM `t1` 1 0 0 0
statements_digest 09309c60c199a727b7ebed40975e8764 SELECT ?, ... FROM t1 2 0 0 0
statements_digest dc0dcaefa9a12455ffed04ac6f89e65d SELECT ? FROM t2 1 0 0 0
statements_digest d274a288509eae2cd7febf2f7fe36274 SELECT ?, ... FROM t2 2 0 0 0
-statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 1 1 0 0
+statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 2 2 0 0
statements_digest b919ecf2d5544bcdf95e76eb22231c42 INSERT INTO t2 VALUES (?) 1 1 0 0
statements_digest d9030eddb8dca8ee5fcaf79e6f254b41 INSERT INTO t3 VALUES (...) 4 4 0 0
statements_digest 2ad6d8279781b0fb40bdc8647dc94216 INSERT INTO t4 VALUES (...) 1 1 0 0
@@ -126,7 +126,6 @@ statements_digest 3248c16dc70111225fcffa99641e312b INSERT INTO t5 VALUES (...)
statements_digest 152b6c84a0cbfadcbecde01050eddd66 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
statements_digest c4cbce33b636e448c29e041b1d5c0eb1 INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
statements_digest 0bfac9fb577995b116e52ff4aaeaa5b8 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
-statements_digest f8d6ea06dfb87f5c40fd427f3f0ff4e7 INSERT INTO t1 VALUES ( NULL ) 1 1 0 0
statements_digest 819acce11785e12f2f73964115632db6 INSERT INTO t6 VALUES (...) 5 5 0 0
statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3 0 0 0
statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1 0 0 0
@@ -146,7 +145,7 @@ statements_digest 2bd1e1e6eb445f32e1d4b290c1961e6b DROP PROCEDURE p1 1 0 0 0
statements_digest 5799522044ce9a4fa48dce5f4a3b047a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
statements_digest 59cbdd7ffc78a23bc2f650f8158067c6 SELECT func (...) 2 0 0 0
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1 0 0 0
-statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0
+statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1 0 0 0
statements_digest bb0154f3d32233f696b95d4127d29a3b INSERT INTO t12 VALUES (?) 2 2 0 0
statements_digest a975545baf024e8a173be77032d8fd01 DROP TRIGGER trg 1 0 0 0
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_consumers.result b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
index b47c8127897..355905f71d8 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
@@ -131,7 +131,7 @@ statements_digest d60830f376a7724280dfc422224bb475 SELECT ? FROM `t1` 1
statements_digest 09309c60c199a727b7ebed40975e8764 SELECT ?, ... FROM t1 2
statements_digest dc0dcaefa9a12455ffed04ac6f89e65d SELECT ? FROM t2 1
statements_digest d274a288509eae2cd7febf2f7fe36274 SELECT ?, ... FROM t2 2
-statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 1
+statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 2
statements_digest b919ecf2d5544bcdf95e76eb22231c42 INSERT INTO t2 VALUES (?) 1
statements_digest d9030eddb8dca8ee5fcaf79e6f254b41 INSERT INTO t3 VALUES (...) 4
statements_digest 2ad6d8279781b0fb40bdc8647dc94216 INSERT INTO t4 VALUES (...) 1
@@ -139,7 +139,6 @@ statements_digest 3248c16dc70111225fcffa99641e312b INSERT INTO t5 VALUES (...)
statements_digest 152b6c84a0cbfadcbecde01050eddd66 INSERT INTO t1 VALUES (?) /* , ... */ 2
statements_digest c4cbce33b636e448c29e041b1d5c0eb1 INSERT INTO t3 VALUES (...) /* , ... */ 1
statements_digest 0bfac9fb577995b116e52ff4aaeaa5b8 INSERT INTO t5 VALUES (...) /* , ... */ 1
-statements_digest f8d6ea06dfb87f5c40fd427f3f0ff4e7 INSERT INTO t1 VALUES ( NULL ) 1
statements_digest 819acce11785e12f2f73964115632db6 INSERT INTO t6 VALUES (...) 5
statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3
statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1
@@ -159,7 +158,7 @@ statements_digest 2bd1e1e6eb445f32e1d4b290c1961e6b DROP PROCEDURE p1 1
statements_digest 5799522044ce9a4fa48dce5f4a3b047a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
statements_digest 59cbdd7ffc78a23bc2f650f8158067c6 SELECT func (...) 2
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1
-statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1
+statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1
statements_digest bb0154f3d32233f696b95d4127d29a3b INSERT INTO t12 VALUES (?) 2
statements_digest a975545baf024e8a173be77032d8fd01 DROP TRIGGER trg 1
SELECT digest, digest_text FROM performance_schema.events_statements_current;
diff --git a/mysql-test/suite/perfschema/r/statement_digest_long_query.result b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
index 6b00e13576f..f9943060c83 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
@@ -9,4 +9,4 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest;
schema_name digest digest_text count_star
performance_schema 7536ab4a65b991a0b1a8b9851e8457c3 TRUNCATE TABLE events_statements_summary_by_digest 1
-performance_schema 63f9aaeed7859671c6a42c75fcd43785 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1
+performance_schema 63f9aaeed7859671c6a42c75fcd43785 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? 1
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
index ea2980e5755..2613737a3da 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
index f51e8383019..e5aaf207820 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
index a7844b6b0e6..637d923ebdb 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
index 4d089c810a1..a41ae765a77 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
index 23bd1294445..2278744621e 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
@@ -37,7 +37,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -61,7 +63,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
index 7edfc3824bb..b3ada0d638a 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
@@ -36,7 +36,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -60,7 +62,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
index 99d2e7d4655..361a8a700d0 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
@@ -37,7 +37,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -61,7 +63,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
index f8c660bd932..97bb0e34e0d 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
@@ -36,7 +36,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -60,7 +62,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_off.result b/mysql-test/suite/perfschema/r/table_aggregate_off.result
index 73ed3550a77..f28f374c5dd 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_off.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
index 3906c6f6b84..f7760043ddd 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
index 0b579f54a66..0ee5eaddcaf 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
index e137525e5b0..025a7f27738 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
index 799555b685e..f655cd5bb93 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
index bf920a30af3..55bb5a6a71f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
index d100f2a5e08..7f9f9e99359 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
index a5d046f154c..7aa15b6a01d 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
index 413a566fefb..0732fce5853 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
index 4a5e7aeede1..c1f6fd56a97 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
index 25ba676993a..705e6ca7021 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
index 41292e5913e..04b7c7979c4 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
index fc7c523ed8c..ef1f31b19a4 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
index 210928a0c04..a7ac4fa860f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
index 9df65066d45..28bdcfb1d82 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
index a9109fa42d2..683dd9cc4a6 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
index 542b020f77a..d488066dd7f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
index ece0dadebd0..d3a4416fdfd 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
index 956540b9327..c69fc8a37d3 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
index 72f0240c6be..91110a94be5 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
index a93cc1b6499..b443ac28c17 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
index 0e1b7032af6..08a107acb2a 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
index fb1fd8fb207..07272c6e204 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
index f97272634b9..77c52780ae9 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
index ddf8ef7bf9d..6d7192285e3 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
index 588a378024a..160be444e7c 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
index 76c466d48cc..e915a8dfa95 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
index 2450456355a..82c1b65acff 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
index 72b46a2820b..9023a4b0a69 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/t/digest_null_literal.test b/mysql-test/suite/perfschema/t/digest_null_literal.test
new file mode 100644
index 00000000000..a3007ced1e2
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/digest_null_literal.test
@@ -0,0 +1,32 @@
+# ----------------------------------------------------
+# Tests for the performance schema statement Digests.
+# ----------------------------------------------------
+
+# Test case to show behavior of statements digest when
+# parsing a NULL literal
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source ../include/no_protocol.inc
+
+TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
+
+--disable_query_log
+
+select NULL;
+select NULL FROM DUAL;
+select NULL, NULL;
+select NULL, NULL, NULL, 1, 2, 3, NULL, NULL;
+
+select 1 IS NULL;
+select 2 IS NOT NULL;
+select 1 IS NULL, 2 IS NULL, 3 IS NOT NULL, 4 IS NOT NULL;
+
+create table foo (a int DEFAULT NULL, b int NOT NULL DEFAULT 1, c int NOT NULL);
+drop table foo;
+
+--enable_query_log
+
+SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
+ FROM performance_schema.events_statements_summary_by_digest;
+
diff --git a/mysql-test/suite/perfschema/t/ortho_iter.test b/mysql-test/suite/perfschema/t/ortho_iter.test
index a9990e17409..0a90831ae70 100644
--- a/mysql-test/suite/perfschema/t/ortho_iter.test
+++ b/mysql-test/suite/perfschema/t/ortho_iter.test
@@ -126,8 +126,9 @@ $
delimiter ;$
# Check the configuration is ok
-show variables like "performance_schema%";
-show status like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
call check_instrument("wait/synch/mutex/");
call check_instrument("wait/synch/rwlock/");
diff --git a/mysql-test/suite/perfschema/t/privilege_table_io.test b/mysql-test/suite/perfschema/t/privilege_table_io.test
index dc17fbcf67e..833fe85e8bb 100644
--- a/mysql-test/suite/perfschema/t/privilege_table_io.test
+++ b/mysql-test/suite/perfschema/t/privilege_table_io.test
@@ -36,7 +36,9 @@ insert into test.marker set a = 1;
# This will not, the ACL cache is already loaded
insert into test.marker set a = 1;
insert into test.marker set a = 1;
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
# Stop recording events + pull results
let $schema_to_dump= "test", "mysql";
diff --git a/mysql-test/suite/perfschema/t/sizing_off.test b/mysql-test/suite/perfschema/t/sizing_off.test
index 83b49572cb4..32729918bd1 100644
--- a/mysql-test/suite/perfschema/t/sizing_off.test
+++ b/mysql-test/suite/perfschema/t/sizing_off.test
@@ -2,5 +2,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt b/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt
new file mode 100644
index 00000000000..fc5065f9ae9
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt
@@ -0,0 +1 @@
+--max_digest_length=10
diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest.test b/mysql-test/suite/perfschema/t/start_server_low_digest.test
new file mode 100644
index 00000000000..953f4d31656
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_low_digest.test
@@ -0,0 +1,21 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema statement Digests.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source ../include/no_protocol.inc
+
+USE performance_schema;
+truncate table events_statements_history_long;
+
+# -----------------------------------------------------------------------
+# Test to show how the digest behaves with low value of
+# - performance_schema_max_digest_length
+# -----------------------------------------------------------------------
+SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
+
+--echo ####################################
+--echo # QUERYING PS STATEMENT DIGEST
+--echo ####################################
+SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 1bd4e394f6a..7f75b731255 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -10,5 +10,6 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
+max_digest_length
drop table t1;
drop table t2;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index fba1a68fa46..88ec26eb6f6 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -28,8 +28,26 @@ ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
)
+SET(GEN_DIGEST_SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+)
+
+SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES}
+ ${GEN_DIGEST_SOURCES}
+ PROPERTIES GENERATED 1)
+
+# Gen_lex_token
+# Make sure sql_yacc.h is generated before compiling gen_lex_token
+IF(NOT CMAKE_CROSSCOMPILING)
+ ADD_EXECUTABLE(gen_lex_token gen_lex_token.cc)
+ ADD_DEPENDENCIES(gen_lex_token GenServerSource)
+ENDIF()
-SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+ COMMAND gen_lex_token > lex_token.h
+ DEPENDS gen_lex_token
+)
ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER)
@@ -59,7 +77,8 @@ SET (SQL_SOURCE
slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
- sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
+ sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc
+ sql_digest.cc sql_do.cc
sql_error.cc sql_handler.cc sql_get_diagnostics.cc
sql_help.cc sql_insert.cc sql_lex.cc
sql_list.cc sql_load.cc sql_manager.cc
@@ -96,6 +115,7 @@ SET (SQL_SOURCE
table_cache.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
${GEN_SOURCES}
+ ${GEN_DIGEST_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
@@ -116,6 +136,7 @@ RECOMPILE_FOR_EMBEDDED)
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
ADD_DEPENDENCIES(sql GenServerSource)
+ADD_DEPENDENCIES(sql GenDigestServerSource)
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC}
@@ -245,6 +266,11 @@ ADD_CUSTOM_TARGET(
DEPENDS ${GEN_SOURCES}
)
+ADD_CUSTOM_TARGET(
+ GenDigestServerSource
+ DEPENDS ${GEN_DIGEST_SOURCES}
+)
+
#Need this only for embedded
SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE)
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index f2b3a77f414..5c4926c830c 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -301,6 +301,9 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
Event_job_data job_data;
bool res;
+ DBUG_ASSERT(thd->m_digest == NULL);
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
+
thd->thread_stack= &my_stack; // remember where our stack is
res= post_init_event_thread(thd);
@@ -329,6 +332,8 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
job_data.definer.str,
job_data.dbname.str, job_data.name.str);
end:
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
+ DBUG_ASSERT(thd->m_digest == NULL);
DBUG_PRINT("info", ("Done with Event %s.%s", event->dbname.str,
event->name.str));
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
new file mode 100644
index 00000000000..3584dd60c62
--- /dev/null
+++ b/sql/gen_lex_token.cc
@@ -0,0 +1,353 @@
+/*
+ Copyright (c) 2011, 2015, 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 */
+
+#include <my_global.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* We only need the tokens here */
+#define YYSTYPE_IS_DECLARED
+#include <sql_yacc.h>
+#include <lex.h>
+
+#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
+
+/*
+ This is a tool used during build only,
+ so MY_MAX_TOKEN does not need to be exact,
+ only big enough to hold:
+ - 256 character terminal tokens
+ - YYNTOKENS named terminal tokens
+ from bison.
+ See also YYMAXUTOK.
+*/
+#define MY_MAX_TOKEN 1000
+/** Generated token. */
+struct gen_lex_token_string
+{
+ const char *m_token_string;
+ int m_token_length;
+ bool m_append_space;
+ bool m_start_expr;
+};
+
+gen_lex_token_string compiled_token_array[MY_MAX_TOKEN];
+int max_token_seen= 0;
+
+char char_tokens[256];
+
+int tok_generic_value= 0;
+int tok_generic_value_list= 0;
+int tok_row_single_value= 0;
+int tok_row_single_value_list= 0;
+int tok_row_multiple_value= 0;
+int tok_row_multiple_value_list= 0;
+int tok_unused= 0;
+
+void set_token(int tok, const char *str)
+{
+ if (tok <= 0)
+ {
+ fprintf(stderr, "Bad token found\n");
+ exit(1);
+ }
+
+ if (tok > max_token_seen)
+ {
+ max_token_seen= tok;
+ }
+
+ if (max_token_seen >= MY_MAX_TOKEN)
+ {
+ fprintf(stderr, "Added that many new keywords ? Increase MY_MAX_TOKEN\n");
+ exit(1);
+ }
+
+ compiled_token_array[tok].m_token_string= str;
+ compiled_token_array[tok].m_token_length= strlen(str);
+ compiled_token_array[tok].m_append_space= true;
+ compiled_token_array[tok].m_start_expr= false;
+}
+
+void set_start_expr_token(int tok)
+{
+ compiled_token_array[tok].m_start_expr= true;
+}
+
+void compute_tokens()
+{
+ int tok;
+ unsigned int i;
+ char *str;
+
+ /*
+ Default value.
+ */
+ for (tok= 0; tok < MY_MAX_TOKEN; tok++)
+ {
+ compiled_token_array[tok].m_token_string= "(unknown)";
+ compiled_token_array[tok].m_token_length= 9;
+ compiled_token_array[tok].m_append_space= true;
+ compiled_token_array[tok].m_start_expr= false;
+ }
+
+ /*
+ Tokens made of just one terminal character
+ */
+ for (tok=0; tok < 256; tok++)
+ {
+ str= & char_tokens[tok];
+ str[0]= (char) tok;
+ compiled_token_array[tok].m_token_string= str;
+ compiled_token_array[tok].m_token_length= 1;
+ compiled_token_array[tok].m_append_space= true;
+ }
+
+ max_token_seen= 255;
+
+ /*
+ String terminal tokens, used in sql_yacc.yy
+ */
+ set_token(NEG, "~");
+ set_token(TABLE_REF_PRIORITY, "TABLE_REF_PRIORITY");
+
+ /*
+ Tokens hard coded in sql_lex.cc
+ */
+
+ set_token(WITH_CUBE_SYM, "WITH CUBE");
+ set_token(WITH_ROLLUP_SYM, "WITH ROLLUP");
+ set_token(NOT2_SYM, "!");
+ set_token(OR2_SYM, "|");
+ set_token(PARAM_MARKER, "?");
+ set_token(SET_VAR, ":=");
+ set_token(UNDERSCORE_CHARSET, "(_charset)");
+ set_token(END_OF_INPUT, "");
+
+ /*
+ Values.
+ These tokens are all normalized later,
+ so this strings will never be displayed.
+ */
+ set_token(BIN_NUM, "(bin)");
+ set_token(DECIMAL_NUM, "(decimal)");
+ set_token(FLOAT_NUM, "(float)");
+ set_token(HEX_NUM, "(hex)");
+ set_token(LEX_HOSTNAME, "(hostname)");
+ set_token(LONG_NUM, "(long)");
+ set_token(NUM, "(num)");
+ set_token(TEXT_STRING, "(text)");
+ set_token(NCHAR_STRING, "(nchar)");
+ set_token(ULONGLONG_NUM, "(ulonglong)");
+
+ /*
+ Identifiers.
+ */
+ set_token(IDENT, "(id)");
+ set_token(IDENT_QUOTED, "(id_quoted)");
+
+ /*
+ Unused tokens
+ */
+ set_token(LOCATOR_SYM, "LOCATOR");
+ set_token(SERVER_OPTIONS, "SERVER_OPTIONS");
+ set_token(UDF_RETURNS_SYM, "UDF_RETURNS");
+
+ /*
+ See symbols[] in sql/lex.h
+ */
+ for (i= 0; i< sizeof(symbols)/sizeof(symbols[0]); i++)
+ {
+ set_token(symbols[i].tok, symbols[i].name);
+ }
+
+ /*
+ See sql_functions[] in sql/lex.h
+ */
+ for (i= 0; i< sizeof(sql_functions)/sizeof(sql_functions[0]); i++)
+ {
+ set_token(sql_functions[i].tok, sql_functions[i].name);
+ }
+
+ /*
+ Additional FAKE tokens,
+ used internally to normalize a digest text.
+ */
+
+ max_token_seen++;
+ tok_generic_value= max_token_seen;
+ set_token(tok_generic_value, "?");
+
+ max_token_seen++;
+ tok_generic_value_list= max_token_seen;
+ set_token(tok_generic_value_list, "?, ...");
+
+ max_token_seen++;
+ tok_row_single_value= max_token_seen;
+ set_token(tok_row_single_value, "(?)");
+
+ max_token_seen++;
+ tok_row_single_value_list= max_token_seen;
+ set_token(tok_row_single_value_list, "(?) /* , ... */");
+
+ max_token_seen++;
+ tok_row_multiple_value= max_token_seen;
+ set_token(tok_row_multiple_value, "(...)");
+
+ max_token_seen++;
+ tok_row_multiple_value_list= max_token_seen;
+ set_token(tok_row_multiple_value_list, "(...) /* , ... */");
+
+ max_token_seen++;
+ tok_unused= max_token_seen;
+ set_token(tok_unused, "UNUSED");
+
+ /*
+ Fix whitespace for some special tokens.
+ */
+
+ /*
+ The lexer parses "@@variable" as '@', '@', 'variable',
+ returning a token for '@' alone.
+
+ This is incorrect, '@' is not really a token,
+ because the syntax "@ @ variable" (with spaces) is not accepted:
+ The lexer keeps some internal state after the '@' fake token.
+
+ To work around this, digest text are printed as "@@variable".
+ */
+ compiled_token_array[(int) '@'].m_append_space= false;
+
+ /*
+ Define additional properties for tokens.
+
+ List all the token that are followed by an expression.
+ This is needed to differentiate unary from binary
+ '+' and '-' operators, because we want to:
+ - reduce <unary +> <NUM> to <?>,
+ - preserve <...> <binary +> <NUM> as is.
+ */
+ set_start_expr_token('(');
+ set_start_expr_token(',');
+ set_start_expr_token(EVERY_SYM);
+ set_start_expr_token(AT_SYM);
+ set_start_expr_token(STARTS_SYM);
+ set_start_expr_token(ENDS_SYM);
+ set_start_expr_token(DEFAULT);
+ set_start_expr_token(RETURN_SYM);
+ set_start_expr_token(IF);
+ set_start_expr_token(ELSEIF_SYM);
+ set_start_expr_token(CASE_SYM);
+ set_start_expr_token(WHEN_SYM);
+ set_start_expr_token(WHILE_SYM);
+ set_start_expr_token(UNTIL_SYM);
+ set_start_expr_token(SELECT_SYM);
+
+ set_start_expr_token(OR_SYM);
+ set_start_expr_token(OR2_SYM);
+ set_start_expr_token(XOR);
+ set_start_expr_token(AND_SYM);
+ set_start_expr_token(AND_AND_SYM);
+ set_start_expr_token(NOT_SYM);
+ set_start_expr_token(BETWEEN_SYM);
+ set_start_expr_token(LIKE);
+ set_start_expr_token(REGEXP);
+
+ set_start_expr_token('|');
+ set_start_expr_token('&');
+ set_start_expr_token(SHIFT_LEFT);
+ set_start_expr_token(SHIFT_RIGHT);
+ set_start_expr_token('+');
+ set_start_expr_token('-');
+ set_start_expr_token(INTERVAL_SYM);
+ set_start_expr_token('*');
+ set_start_expr_token('/');
+ set_start_expr_token('%');
+ set_start_expr_token(DIV_SYM);
+ set_start_expr_token(MOD_SYM);
+ set_start_expr_token('^');
+}
+
+void print_tokens()
+{
+ int tok;
+
+ printf("#ifdef LEX_TOKEN_WITH_DEFINITION\n");
+ printf("lex_token_string lex_token_array[]=\n");
+ printf("{\n");
+ printf("/* PART 1: character tokens. */\n");
+
+ for (tok= 0; tok<256; tok++)
+ {
+ printf("/* %03d */ { \"\\x%02x\", 1, %s, %s},\n",
+ tok,
+ tok,
+ compiled_token_array[tok].m_append_space ? "true" : "false",
+ compiled_token_array[tok].m_start_expr ? "true" : "false");
+ }
+
+ printf("/* PART 2: named tokens. */\n");
+
+ for (tok= 256; tok<= max_token_seen; tok++)
+ {
+ printf("/* %03d */ { \"%s\", %d, %s, %s},\n",
+ tok,
+ compiled_token_array[tok].m_token_string,
+ compiled_token_array[tok].m_token_length,
+ compiled_token_array[tok].m_append_space ? "true" : "false",
+ compiled_token_array[tok].m_start_expr ? "true" : "false");
+ }
+
+ printf("/* DUMMY */ { \"\", 0, false, false}\n");
+ printf("};\n");
+ printf("#endif /* LEX_TOKEN_WITH_DEFINITION */\n");
+
+ printf("/* DIGEST specific tokens. */\n");
+ printf("#define TOK_GENERIC_VALUE %d\n", tok_generic_value);
+ printf("#define TOK_GENERIC_VALUE_LIST %d\n", tok_generic_value_list);
+ printf("#define TOK_ROW_SINGLE_VALUE %d\n", tok_row_single_value);
+ printf("#define TOK_ROW_SINGLE_VALUE_LIST %d\n", tok_row_single_value_list);
+ printf("#define TOK_ROW_MULTIPLE_VALUE %d\n", tok_row_multiple_value);
+ printf("#define TOK_ROW_MULTIPLE_VALUE_LIST %d\n", tok_row_multiple_value_list);
+ printf("#define TOK_UNUSED %d\n", tok_unused);
+}
+
+int main(int argc,char **argv)
+{
+ puts("/*");
+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2011"));
+ puts("*/");
+
+ printf("/*\n");
+ printf(" This file is generated, do not edit.\n");
+ printf(" See file sql/gen_lex_token.cc.\n");
+ printf("*/\n");
+ printf("struct lex_token_string\n");
+ printf("{\n");
+ printf(" const char *m_token_string;\n");
+ printf(" int m_token_length;\n");
+ printf(" bool m_append_space;\n");
+ printf(" bool m_start_expr;\n");
+ printf("};\n");
+ printf("typedef struct lex_token_string lex_token_string;\n");
+
+ compute_tokens();
+ print_tokens();
+
+ return 0;
+}
+
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5c5f5cdb9f1..29cb10c0abf 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -49,6 +49,7 @@
#include <base64.h>
#include <my_bitmap.h>
#include "rpl_utility.h"
+#include "sql_digest.h"
#define my_b_write_string(A, B) my_b_write((A), (B), (uint) (sizeof(B) - 1))
@@ -4282,12 +4283,17 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
Parser_state parser_state;
if (!parser_state.init(thd, thd->query(), thd->query_length()))
{
+ DBUG_ASSERT(thd->m_digest == NULL);
+ thd->m_digest= & thd->m_digest_state;
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
stmt_info_rpl.m_key,
thd->db, thd->db_length,
thd->charset());
THD_STAGE_INFO(thd, stage_init);
MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length());
+ if (thd->m_digest != NULL)
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
/* Finalize server status flags after executing a statement. */
@@ -4379,11 +4385,10 @@ compare_errors:
!ignored_error_code(expected_error))
{
rli->report(ERROR_LEVEL, 0, rgi->gtid_info(),
- "\
-Query caused different errors on master and slave. \
-Error on master: message (format)='%s' error code=%d ; \
-Error on slave: actual message='%s', error code=%d. \
-Default database: '%s'. Query: '%s'",
+ "Query caused different errors on master and slave. "
+ "Error on master: message (format)='%s' error code=%d ; "
+ "Error on slave: actual message='%s', error code=%d. "
+ "Default database: '%s'. Query: '%s'",
ER_SAFE(expected_error),
expected_error,
actual_error ? thd->get_stmt_da()->message() : "no error",
@@ -4479,6 +4484,7 @@ end:
/* Mark the statement completed. */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
/*
As a disk space optimization, future masters will not log an event for
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 2eaf8096795..6f28244f6c2 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -515,6 +515,7 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
ulong extra_max_connections;
+ulong max_digest_length= 0;
ulong slave_retried_transactions;
ulong feature_files_opened_with_delayed_keys;
ulonglong denied_connections;
@@ -5274,6 +5275,8 @@ int mysqld_main(int argc, char **argv)
pfs_param.m_hints.m_table_open_cache= tc_size;
pfs_param.m_hints.m_max_connections= max_connections;
pfs_param.m_hints.m_open_files_limit= open_files_limit;
+ /* the performance schema digest size is the same as the SQL layer */
+ pfs_param.m_max_digest_length= max_digest_length;
PSI_hook= initialize_performance_schema(&pfs_param);
if (PSI_hook == NULL)
{
diff --git a/sql/mysqld.h b/sql/mysqld.h
index f6d9dbea48a..5f47c9d5b4e 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -167,6 +167,7 @@ extern ulong query_cache_limit;
extern ulong query_cache_min_res_unit;
extern ulong slow_launch_threads, slow_launch_time;
extern MYSQL_PLUGIN_IMPORT ulong max_connections;
+extern ulong max_digest_length;
extern ulong max_connect_errors, connect_timeout;
extern my_bool slave_allow_batching;
extern my_bool allow_slave_start;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index d59e0aec541..e181e14611b 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1365,8 +1365,13 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
thd->user_var_events_alloc= thd->mem_root;
+ sql_digest_state *parent_digest= thd->m_digest;
+ thd->m_digest= NULL;
+
err_status= i->execute(thd, &ip);
+ thd->m_digest= parent_digest;
+
if (i->free_list)
cleanup_items(i->free_list);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1ef0827b943..ed2bddd7e8d 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -874,6 +874,7 @@ THD::THD()
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
m_examined_row_count(0),
accessed_rows_and_keys(0),
+ m_digest(NULL),
m_statement_psi(NULL),
m_idle_psi(NULL),
thread_id(0),
@@ -1044,6 +1045,13 @@ THD::THD()
substitute_null_with_insert_id = FALSE;
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
+ m_token_array= NULL;
+ if (max_digest_length > 0)
+ {
+ m_token_array= (unsigned char*) my_malloc(max_digest_length,
+ MYF(MY_WME|MY_THREAD_SPECIFIC));
+ }
+
m_internal_handler= NULL;
m_binlog_invoker= INVOKER_NONE;
arena_for_cached_items= 0;
@@ -1625,6 +1633,7 @@ THD::~THD()
#endif
free_root(&main_mem_root, MYF(0));
+ my_free(m_token_array);
main_da.free_memory();
if (status_var.memory_used != 0)
{
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0746ac79b97..a8d8444571e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -38,6 +38,8 @@
#include "violite.h" /* vio_is_connected */
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
THR_LOCK_INFO */
+#include "sql_digest_stream.h" // sql_digest_state
+
#include <mysql/psi/mysql_stage.h>
#include <mysql/psi/mysql_statement.h>
#include <mysql/psi/mysql_idle.h>
@@ -2505,6 +2507,13 @@ public:
PROFILING profiling;
#endif
+ /** Current statement digest. */
+ sql_digest_state *m_digest;
+ /** Current statement digest token array. */
+ unsigned char *m_token_array;
+ /** Top level statement digest. */
+ sql_digest_state m_digest_state;
+
/** Current statement instrumentation. */
PSI_statement_locker *m_statement_psi;
#ifdef HAVE_PSI_STATEMENT_INTERFACE
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 99b7b1e58d0..c09f3269d7a 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -98,6 +98,7 @@ public:
int mysql_open_cursor(THD *thd, select_result *result,
Server_side_cursor **pcursor)
{
+ sql_digest_state *parent_digest;
PSI_statement_locker *parent_locker;
select_result *save_result;
Select_materialize *result_materialize;
@@ -117,11 +118,14 @@ int mysql_open_cursor(THD *thd, select_result *result,
&thd->security_ctx->priv_user[0],
(char *) thd->security_ctx->host_or_ip,
2);
+ parent_digest= thd->m_digest;
parent_locker= thd->m_statement_psi;
+ thd->m_digest= NULL;
thd->m_statement_psi= NULL;
/* Mark that we can't use query cache with cursors */
thd->query_cache_is_applicable= 0;
rc= mysql_execute_command(thd);
+ thd->m_digest= parent_digest;
thd->m_statement_psi= parent_locker;
MYSQL_QUERY_EXEC_DONE(rc);
diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc
new file mode 100644
index 00000000000..324f2fbd428
--- /dev/null
+++ b/sql/sql_digest.cc
@@ -0,0 +1,683 @@
+/* Copyright (c) 2008, 2015, 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 */
+
+/*
+ This code needs extra visibility in the lexer structures
+*/
+
+#include "my_global.h"
+#include "my_md5.h"
+#include "mysqld_error.h"
+
+#include "sql_string.h"
+#include "sql_class.h"
+#include "sql_lex.h"
+#include "sql_digest.h"
+#include "sql_digest_stream.h"
+
+#include "sql_get_diagnostics.h"
+
+#ifdef NEVER
+#include "my_sys.h"
+#include "sql_signal.h"
+#endif
+
+/* Generated code */
+#include "sql_yacc.h"
+#define LEX_TOKEN_WITH_DEFINITION
+#include "lex_token.h"
+
+/* Name pollution from sql/sql_lex.h */
+#ifdef LEX_YYSTYPE
+#undef LEX_YYSTYPE
+#endif
+
+#define LEX_YYSTYPE YYSTYPE*
+
+#define SIZE_OF_A_TOKEN 2
+
+/**
+ Read a single token from token array.
+*/
+inline uint read_token(const sql_digest_storage *digest_storage,
+ uint index, uint *tok)
+{
+ uint safe_byte_count= digest_storage->m_byte_count;
+
+ if (index + SIZE_OF_A_TOKEN <= safe_byte_count &&
+ safe_byte_count <= digest_storage->m_token_array_length)
+ {
+ const unsigned char *src= & digest_storage->m_token_array[index];
+ *tok= src[0] | (src[1] << 8);
+ return index + SIZE_OF_A_TOKEN;
+ }
+
+ /* The input byte stream is exhausted. */
+ *tok= 0;
+ return MAX_DIGEST_STORAGE_SIZE + 1;
+}
+
+/**
+ Store a single token in token array.
+*/
+inline void store_token(sql_digest_storage* digest_storage, uint token)
+{
+ DBUG_ASSERT(digest_storage->m_byte_count <= digest_storage->m_token_array_length);
+
+ if (digest_storage->m_byte_count + SIZE_OF_A_TOKEN <= digest_storage->m_token_array_length)
+ {
+ unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
+ dest[0]= token & 0xff;
+ dest[1]= (token >> 8) & 0xff;
+ digest_storage->m_byte_count+= SIZE_OF_A_TOKEN;
+ }
+ else
+ {
+ digest_storage->m_full= true;
+ }
+}
+
+/**
+ Read an identifier from token array.
+*/
+inline uint read_identifier(const sql_digest_storage* digest_storage,
+ uint index, char ** id_string, int *id_length)
+{
+ uint new_index;
+ uint safe_byte_count= digest_storage->m_byte_count;
+
+ DBUG_ASSERT(index <= safe_byte_count);
+ DBUG_ASSERT(safe_byte_count <= digest_storage->m_token_array_length);
+
+ /*
+ token + length + string are written in an atomic way,
+ so we do always expect a length + string here
+ */
+
+ uint bytes_needed= SIZE_OF_A_TOKEN;
+ /* If we can read token and identifier length */
+ if ((index + bytes_needed) <= safe_byte_count)
+ {
+ const unsigned char *src= & digest_storage->m_token_array[index];
+ /* Read the length of identifier */
+ uint length= src[0] | (src[1] << 8);
+ bytes_needed+= length;
+ /* If we can read entire identifier from token array */
+ if ((index + bytes_needed) <= safe_byte_count)
+ {
+ *id_string= (char *) (src + 2);
+ *id_length= length;
+
+ new_index= index + bytes_needed;
+ DBUG_ASSERT(new_index <= safe_byte_count);
+ return new_index;
+ }
+ }
+
+ /* The input byte stream is exhausted. */
+ return MAX_DIGEST_STORAGE_SIZE + 1;
+}
+
+/**
+ Store an identifier in token array.
+*/
+inline void store_token_identifier(sql_digest_storage* digest_storage,
+ uint token,
+ size_t id_length, const char *id_name)
+{
+ DBUG_ASSERT(digest_storage->m_byte_count <= digest_storage->m_token_array_length);
+
+ size_t bytes_needed= 2 * SIZE_OF_A_TOKEN + id_length;
+ if (digest_storage->m_byte_count + bytes_needed <= (unsigned int)digest_storage->m_token_array_length)
+ {
+ unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
+ /* Write the token */
+ dest[0]= token & 0xff;
+ dest[1]= (token >> 8) & 0xff;
+ /* Write the string length */
+ dest[2]= id_length & 0xff;
+ dest[3]= (id_length >> 8) & 0xff;
+ /* Write the string data */
+ if (id_length > 0)
+ memcpy((char *)(dest + 4), id_name, id_length);
+ digest_storage->m_byte_count+= bytes_needed;
+ }
+ else
+ {
+ digest_storage->m_full= true;
+ }
+}
+
+void compute_digest_md5(const sql_digest_storage *digest_storage, unsigned char *md5)
+{
+ compute_md5_hash((char *) md5,
+ (const char *) digest_storage->m_token_array,
+ digest_storage->m_byte_count);
+}
+
+/*
+ Iterate token array and updates digest_text.
+*/
+void compute_digest_text(const sql_digest_storage* digest_storage,
+ String *digest_text)
+{
+ DBUG_ASSERT(digest_storage != NULL);
+ uint byte_count= digest_storage->m_byte_count;
+ String *digest_output= digest_text;
+ uint tok= 0;
+ uint current_byte= 0;
+ lex_token_string *tok_data;
+
+ /* Reset existing data */
+ digest_output->length(0);
+
+ if (byte_count > digest_storage->m_token_array_length)
+ {
+ digest_output->append("\0", 1);
+ return;
+ }
+
+ /* Convert text to utf8 */
+ const CHARSET_INFO *from_cs= get_charset(digest_storage->m_charset_number, MYF(0));
+ const CHARSET_INFO *to_cs= &my_charset_utf8_bin;
+
+ if (from_cs == NULL)
+ {
+ /*
+ Can happen, as we do dirty reads on digest_storage,
+ which can be written to in another thread.
+ */
+ digest_output->append("\0", 1);
+ return;
+ }
+
+ char id_buffer[NAME_LEN + 1]= {'\0'};
+ char *id_string;
+ size_t id_length;
+ bool convert_text= !my_charset_same(from_cs, to_cs);
+
+ while (current_byte < byte_count)
+ {
+ current_byte= read_token(digest_storage, current_byte, &tok);
+
+ if (tok <= 0 || tok >= array_elements(lex_token_array)
+ || current_byte > max_digest_length)
+ return;
+
+ tok_data= &lex_token_array[tok];
+
+ switch (tok)
+ {
+ /* All identifiers are printed with their name. */
+ case IDENT:
+ case IDENT_QUOTED:
+ {
+ char *id_ptr= NULL;
+ int id_len= 0;
+ uint err_cs= 0;
+
+ /* Get the next identifier from the storage buffer. */
+ current_byte= read_identifier(digest_storage, current_byte,
+ &id_ptr, &id_len);
+ if (current_byte > max_digest_length)
+ return;
+
+ if (convert_text)
+ {
+ /* Verify that the converted text will fit. */
+ if (to_cs->mbmaxlen*id_len > NAME_LEN)
+ {
+ digest_output->append("...", 3);
+ break;
+ }
+ /* Convert identifier string into the storage character set. */
+ id_length= my_convert(id_buffer, NAME_LEN, to_cs,
+ id_ptr, id_len, from_cs, &err_cs);
+ id_string= id_buffer;
+ }
+ else
+ {
+ id_string= id_ptr;
+ id_length= id_len;
+ }
+
+ if (id_length == 0 || err_cs != 0)
+ {
+ break;
+ }
+ /* Copy the converted identifier into the digest string. */
+ if (tok == IDENT_QUOTED)
+ digest_output->append("`", 1);
+ if (id_length > 0)
+ digest_output->append(id_string, id_length);
+ if (tok == IDENT_QUOTED)
+ digest_output->append("`", 1);
+ digest_output->append(" ", 1);
+ }
+ break;
+
+ /* Everything else is printed as is. */
+ default:
+ /*
+ Make sure not to overflow digest_text buffer.
+ +1 is to make sure extra space for ' '.
+ */
+ int tok_length= tok_data->m_token_length;
+
+ digest_output->append(tok_data->m_token_string, tok_length);
+ if (tok_data->m_append_space)
+ digest_output->append(" ", 1);
+ break;
+ }
+ }
+}
+
+static inline uint peek_token(const sql_digest_storage *digest, uint index)
+{
+ uint token;
+ DBUG_ASSERT(index + SIZE_OF_A_TOKEN <= digest->m_byte_count);
+ DBUG_ASSERT(digest->m_byte_count <= digest->m_token_array_length);
+
+ token= ((digest->m_token_array[index + 1])<<8) | digest->m_token_array[index];
+ return token;
+}
+
+/**
+ Function to read last two tokens from token array. If an identifier
+ is found, do not look for token before that.
+*/
+static inline void peek_last_two_tokens(const sql_digest_storage* digest_storage,
+ uint last_id_index, uint *t1, uint *t2)
+{
+ uint byte_count= digest_storage->m_byte_count;
+ uint peek_index= byte_count;
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take last token. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t1= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 2nd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t2= peek_token(digest_storage, peek_index);
+ }
+ else
+ {
+ *t2= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t1= TOK_UNUSED;
+ *t2= TOK_UNUSED;
+ }
+}
+
+/**
+ Function to read last three tokens from token array. If an identifier
+ is found, do not look for token before that.
+*/
+static inline void peek_last_three_tokens(const sql_digest_storage* digest_storage,
+ uint last_id_index, uint *t1, uint *t2, uint *t3)
+{
+ uint byte_count= digest_storage->m_byte_count;
+ uint peek_index= byte_count;
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take last token. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t1= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 2nd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t2= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 3rd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t3= peek_token(digest_storage, peek_index);
+ }
+ else
+ {
+ *t3= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t2= TOK_UNUSED;
+ *t3= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t1= TOK_UNUSED;
+ *t2= TOK_UNUSED;
+ *t3= TOK_UNUSED;
+ }
+}
+
+sql_digest_state* digest_add_token(sql_digest_state *state,
+ uint token,
+ LEX_YYSTYPE yylval)
+{
+ sql_digest_storage *digest_storage= NULL;
+
+ digest_storage= &state->m_digest_storage;
+
+ /*
+ Stop collecting further tokens if digest storage is full or
+ if END token is received.
+ */
+ if (digest_storage->m_full || token == END_OF_INPUT)
+ return NULL;
+
+ /*
+ Take last_token 2 tokens collected till now. These tokens will be used
+ in reduce for normalisation. Make sure not to consider ID tokens in reduce.
+ */
+ uint last_token;
+ uint last_token2;
+
+ switch (token)
+ {
+ case NUM:
+ case LONG_NUM:
+ case ULONGLONG_NUM:
+ case DECIMAL_NUM:
+ case FLOAT_NUM:
+ case BIN_NUM:
+ case HEX_NUM:
+ {
+ bool found_unary;
+ do
+ {
+ found_unary= false;
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token == '-') || (last_token == '+'))
+ {
+ /*
+ We need to differentiate:
+ - a <unary minus> operator
+ - a <unary plus> operator
+ from
+ - a <binary minus> operator
+ - a <binary plus> operator
+ to only reduce "a = -1" to "a = ?", and not change "b - 1" to "b ?"
+
+ Binary operators are found inside an expression,
+ while unary operators are found at the beginning of an expression, or after operators.
+
+ To achieve this, every token that is followed by an <expr> expression
+ in the SQL grammar is flagged.
+ See sql/sql_yacc.yy
+ See sql/gen_lex_token.cc
+
+ For example,
+ "(-1)" is parsed as "(", "-", NUM, ")", and lex_token_array["("].m_start_expr is true,
+ so reduction of the "-" NUM is done, the result is "(?)".
+ "(a-1)" is parsed as "(", ID, "-", NUM, ")", and lex_token_array[ID].m_start_expr is false,
+ so the operator is binary, no reduction is done, and the result is "(a-?)".
+ */
+ if (lex_token_array[last_token2].m_start_expr)
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) (NUM | LOG_NUM | ... | FLOAT_NUM)
+
+ REDUCE:
+ TOK_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) TOK_GENERIC_VALUE
+ */
+ token= TOK_GENERIC_VALUE;
+ digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+ found_unary= true;
+ }
+ }
+ } while (found_unary);
+ }
+ /* fall through, for case NULL_SYM below */
+ case LEX_HOSTNAME:
+ case TEXT_STRING:
+ case NCHAR_STRING:
+ case PARAM_MARKER:
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE := BIN_NUM | DECIMAL_NUM | ... | ULONGLONG_NUM
+ */
+ token= TOK_GENERIC_VALUE;
+
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_GENERIC_VALUE ||
+ last_token2 == TOK_GENERIC_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE ',' TOK_GENERIC_VALUE
+
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE_LIST ',' TOK_GENERIC_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_GENERIC_VALUE_LIST;
+ }
+ /*
+ Add this token or the resulting reduce to digest storage.
+ */
+ store_token(digest_storage, token);
+ break;
+ }
+ case ')':
+ {
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if (last_token == TOK_GENERIC_VALUE &&
+ last_token2 == '(')
+ {
+ /*
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE :=
+ '(' TOK_GENERIC_VALUE ')'
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_SINGLE_VALUE;
+
+ /* Read last two tokens again */
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_ROW_SINGLE_VALUE ||
+ last_token2 == TOK_ROW_SINGLE_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE_LIST :=
+ TOK_ROW_SINGLE_VALUE ',' TOK_ROW_SINGLE_VALUE
+
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE_LIST :=
+ TOK_ROW_SINGLE_VALUE_LIST ',' TOK_ROW_SINGLE_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_SINGLE_VALUE_LIST;
+ }
+ }
+ else if (last_token == TOK_GENERIC_VALUE_LIST &&
+ last_token2 == '(')
+ {
+ /*
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE :=
+ '(' TOK_GENERIC_VALUE_LIST ')'
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_MULTIPLE_VALUE;
+
+ /* Read last two tokens again */
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_ROW_MULTIPLE_VALUE ||
+ last_token2 == TOK_ROW_MULTIPLE_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE_LIST :=
+ TOK_ROW_MULTIPLE_VALUE ',' TOK_ROW_MULTIPLE_VALUE
+
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE_LIST :=
+ TOK_ROW_MULTIPLE_VALUE_LIST ',' TOK_ROW_MULTIPLE_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_MULTIPLE_VALUE_LIST;
+ }
+ }
+ /*
+ Add this token or the resulting reduce to digest storage.
+ */
+ store_token(digest_storage, token);
+ break;
+ }
+ case IDENT:
+ case IDENT_QUOTED:
+ {
+ YYSTYPE *lex_token= yylval;
+ char *yytext= lex_token->lex_str.str;
+ size_t yylen= lex_token->lex_str.length;
+
+ /* Add this token and identifier string to digest storage. */
+ store_token_identifier(digest_storage, token, yylen, yytext);
+
+ /* Update the index of last identifier found. */
+ state->m_last_id_index= digest_storage->m_byte_count;
+ break;
+ }
+ default:
+ {
+ /* Add this token to digest storage. */
+ store_token(digest_storage, token);
+ break;
+ }
+ }
+
+ return state;
+}
+
+sql_digest_state* digest_reduce_token(sql_digest_state *state,
+ uint token_left, uint token_right)
+{
+ sql_digest_storage *digest_storage= NULL;
+
+ digest_storage= &state->m_digest_storage;
+
+ /*
+ Stop collecting further tokens if digest storage is full.
+ */
+ if (digest_storage->m_full)
+ return NULL;
+
+ uint last_token;
+ uint last_token2;
+ uint last_token3;
+ uint token_to_push= TOK_UNUSED;
+
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ /*
+ There is only one caller of digest_reduce_token(),
+ see sql/sql_yacc.yy, rule literal := NULL_SYM.
+ REDUCE:
+ token_left := token_right
+ Used for:
+ TOK_GENERIC_VALUE := NULL_SYM
+ */
+
+ if (last_token == token_right)
+ {
+ /*
+ Current stream is like:
+ TOKEN_X TOKEN_RIGHT .
+ REDUCE to
+ TOKEN_X TOKEN_LEFT .
+ */
+ digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+ store_token(digest_storage, token_left);
+ }
+ else
+ {
+ /*
+ Current stream is like:
+ TOKEN_X TOKEN_RIGHT TOKEN_Y .
+ Pop TOKEN_Y
+ TOKEN_X TOKEN_RIGHT . TOKEN_Y
+ REDUCE to
+ TOKEN_X TOKEN_LEFT . TOKEN_Y
+ */
+ DBUG_ASSERT(last_token2 == token_right);
+ digest_storage->m_byte_count-= 2 * SIZE_OF_A_TOKEN;
+ store_token(digest_storage, token_left);
+ token_to_push= last_token;
+ }
+
+ peek_last_three_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2, &last_token3);
+
+ if ((last_token3 == TOK_GENERIC_VALUE ||
+ last_token3 == TOK_GENERIC_VALUE_LIST) &&
+ (last_token2 == ',') &&
+ (last_token == TOK_GENERIC_VALUE))
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE ',' TOK_GENERIC_VALUE
+
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE_LIST ',' TOK_GENERIC_VALUE
+ */
+ digest_storage->m_byte_count-= 3*SIZE_OF_A_TOKEN;
+ store_token(digest_storage, TOK_GENERIC_VALUE_LIST);
+ }
+
+ if (token_to_push != TOK_UNUSED)
+ {
+ /*
+ Push TOKEN_Y
+ */
+ store_token(digest_storage, token_to_push);
+ }
+
+ return state;
+}
+
diff --git a/sql/sql_digest.h b/sql/sql_digest.h
new file mode 100644
index 00000000000..ce159283d4d
--- /dev/null
+++ b/sql/sql_digest.h
@@ -0,0 +1,130 @@
+/* Copyright (c) 2008, 2015, 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 */
+
+#ifndef SQL_DIGEST_H
+#define SQL_DIGEST_H
+
+#include <string.h>
+class String;
+#include "my_md5.h"
+
+#define MAX_DIGEST_STORAGE_SIZE (1024*1024)
+
+/**
+ Structure to store token count/array for a statement
+ on which digest is to be calculated.
+*/
+struct sql_digest_storage
+{
+ bool m_full;
+ uint m_byte_count;
+ unsigned char m_md5[MD5_HASH_SIZE];
+ /** Character set number. */
+ uint m_charset_number;
+ /**
+ Token array.
+ Token array is an array of bytes to store tokens received during parsing.
+ Following is the way token array is formed.
+ ... &lt;non-id-token&gt; &lt;non-id-token&gt; &lt;id-token&gt; &lt;id_len&gt; &lt;id_text&gt; ...
+ For Example:
+ SELECT * FROM T1;
+ &lt;SELECT_TOKEN&gt; &lt;*&gt; &lt;FROM_TOKEN&gt; &lt;ID_TOKEN&gt; &lt;2&gt; &lt;T1&gt;
+ */
+ unsigned char *m_token_array;
+ /* Length of the token array to be considered for DIGEST_TEXT calculation. */
+ uint m_token_array_length;
+
+ sql_digest_storage()
+ {
+ reset(NULL, 0);
+ }
+
+ inline void reset(unsigned char *token_array, uint length)
+ {
+ m_token_array= token_array;
+ m_token_array_length= length;
+ reset();
+ }
+
+ inline void reset()
+ {
+ m_full= false;
+ m_byte_count= 0;
+ m_charset_number= 0;
+ if (m_token_array_length > 0)
+ {
+ memset(m_token_array, 0, m_token_array_length);
+ }
+ memset(m_md5, 0, MD5_HASH_SIZE);
+ }
+
+ inline bool is_empty()
+ {
+ return (m_byte_count == 0);
+ }
+
+ inline void copy(const sql_digest_storage *from)
+ {
+ /*
+ Keep in mind this is a dirty copy of something that may change,
+ as the thread producing the digest is executing concurrently,
+ without any lock enforced.
+ */
+ uint byte_count_copy= m_token_array_length < from->m_byte_count ?
+ m_token_array_length : from->m_byte_count;
+
+ if (byte_count_copy > 0)
+ {
+ m_full= from->m_full;
+ m_byte_count= byte_count_copy;
+ m_charset_number= from->m_charset_number;
+ memcpy(m_token_array, from->m_token_array, m_byte_count);
+ memcpy(m_md5, from->m_md5, MD5_HASH_SIZE);
+ }
+ else
+ {
+ m_full= false;
+ m_byte_count= 0;
+ m_charset_number= 0;
+ }
+ }
+};
+typedef struct sql_digest_storage sql_digest_storage;
+
+/**
+ Compute a digest hash.
+ @param digest_storage The digest
+ @param [out] md5 The computed digest hash. This parameter is a buffer of size @c MD5_HASH_SIZE.
+*/
+void compute_digest_md5(const sql_digest_storage *digest_storage, unsigned char *md5);
+
+/**
+ Compute a digest text.
+ A 'digest text' is a textual representation of a query,
+ where:
+ - comments are removed,
+ - non significant spaces are removed,
+ - literal values are replaced with a special '?' marker,
+ - lists of values are collapsed using a shorter notation
+ @param digest_storage The digest
+ @param [out] digest_text
+ @param digest_text_length Size of @c digest_text.
+ @param [out] truncated true if the text representation was truncated
+*/
+void compute_digest_text(const sql_digest_storage *digest_storage,
+ String *digest_text);
+
+#endif
+
diff --git a/sql/sql_digest_stream.h b/sql/sql_digest_stream.h
new file mode 100644
index 00000000000..55f7e2293c6
--- /dev/null
+++ b/sql/sql_digest_stream.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2008, 2015, 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 */
+
+#ifndef SQL_DIGEST_STREAM_H
+#define SQL_DIGEST_STREAM_H
+
+#include "sql_digest.h"
+
+/**
+ State data storage for @c digest_start, @c digest_add_token.
+ This structure extends the @c sql_digest_storage structure
+ with temporary state used only during parsing.
+*/
+struct sql_digest_state
+{
+ /**
+ Index, in the digest token array, of the last identifier seen.
+ Reduce rules used in the digest computation can not
+ apply to tokens seen before an identifier.
+ @sa digest_add_token
+ */
+ int m_last_id_index;
+ sql_digest_storage m_digest_storage;
+
+ inline void reset(unsigned char *token_array, uint length)
+ {
+ m_last_id_index= 0;
+ m_digest_storage.reset(token_array, length);
+ }
+
+ inline bool is_empty()
+ {
+ return m_digest_storage.is_empty();
+ }
+};
+typedef struct sql_digest_state sql_digest_state;
+
+#endif
+
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index ba7d101a4cd..d8f40897a59 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -436,6 +436,21 @@ void Lex_input_stream::body_utf8_append_literal(THD *thd,
m_cpp_utf8_processed_ptr= end_ptr;
}
+void Lex_input_stream::add_digest_token(uint token, LEX_YYSTYPE yylval)
+{
+ if (m_digest != NULL)
+ {
+ m_digest= digest_add_token(m_digest, token, yylval);
+ }
+}
+
+void Lex_input_stream::reduce_digest_token(uint token_left, uint token_right)
+{
+ if (m_digest != NULL)
+ {
+ m_digest= digest_reduce_token(m_digest, token_left, token_right);
+ }
+}
/*
This is called before every query that is to be parsed.
@@ -982,7 +997,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
lip->lookahead_token= -1;
*yylval= *(lip->lookahead_yylval);
lip->lookahead_yylval= NULL;
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval);
+ lip->add_digest_token(token, yylval);
return token;
}
@@ -1000,12 +1015,10 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
token= lex_one_token(yylval, thd);
switch(token) {
case CUBE_SYM:
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_CUBE_SYM,
- yylval);
+ lip->add_digest_token(WITH_CUBE_SYM, yylval);
return WITH_CUBE_SYM;
case ROLLUP_SYM:
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_ROLLUP_SYM,
- yylval);
+ lip->add_digest_token(WITH_ROLLUP_SYM, yylval);
return WITH_ROLLUP_SYM;
default:
/*
@@ -1014,7 +1027,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
lip->lookahead_yylval= lip->yylval;
lip->yylval= NULL;
lip->lookahead_token= token;
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH, yylval);
+ lip->add_digest_token(WITH, yylval);
return WITH;
}
break;
@@ -1022,7 +1035,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
break;
}
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval);
+ lip->add_digest_token(token, yylval);
return token;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 38f1417b40c..b17f0f4ec63 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -47,6 +47,7 @@ class sys_var;
class Item_func_match;
class File_parser;
class Key_part_spec;
+struct sql_digest_state;
#ifdef MYSQL_SERVER
/*
@@ -2048,6 +2049,10 @@ public:
/** LALR(2) resolution, value of the look ahead token.*/
LEX_YYSTYPE lookahead_yylval;
+ void add_digest_token(uint token, LEX_YYSTYPE yylval);
+
+ void reduce_digest_token(uint token_left, uint token_right);
+
private:
/** Pointer to the current position in the raw input stream. */
char *m_ptr;
@@ -2167,7 +2172,7 @@ public:
/**
Current statement digest instrumentation.
*/
- PSI_digest_locker* m_digest_psi;
+ sql_digest_state* m_digest;
};
/**
@@ -2863,6 +2868,18 @@ public:
};
/**
+ Input parameters to the parser.
+*/
+struct Parser_input
+{
+ bool m_compute_digest;
+
+ Parser_input()
+ : m_compute_digest(false)
+ {}
+};
+
+/**
Internal state of the parser.
The complete state consist of:
- state data used during lexical parsing,
@@ -2889,9 +2906,15 @@ public:
~Parser_state()
{}
+ Parser_input m_input;
Lex_input_stream m_lip;
Yacc_state m_yacc;
+ /**
+ Current performance digest instrumentation.
+ */
+ PSI_digest_locker* m_digest_psi;
+
void reset(char *found_semicolon, unsigned int length)
{
m_lip.reset(found_semicolon, length);
@@ -2899,6 +2922,11 @@ public:
}
};
+extern sql_digest_state *
+digest_add_token(sql_digest_state *state, uint token, LEX_YYSTYPE yylval);
+
+extern sql_digest_state *
+digest_reduce_token(sql_digest_state *state, uint token_left, uint token_right);
struct st_lex_local: public LEX
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9ecf168c60e..5635e9ad4b7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -83,6 +83,8 @@
#include "rpl_handler.h"
#include "rpl_mi.h"
+#include "sql_digest.h"
+
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
@@ -949,6 +951,7 @@ bool do_command(THD *thd)
/* Mark the statement completed. */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
if (net->error != 3)
{
@@ -998,6 +1001,7 @@ bool do_command(THD *thd)
out:
/* The statement instrumentation must be closed in all cases. */
+ DBUG_ASSERT(thd->m_digest == NULL);
DBUG_ASSERT(thd->m_statement_psi == NULL);
DBUG_RETURN(return_value);
}
@@ -1278,6 +1282,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case COM_QUERY:
{
+ DBUG_ASSERT(thd->m_digest == NULL);
+ thd->m_digest= & thd->m_digest_state;
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
+
if (alloc_query(thd, packet, packet_length))
break; // fatal error is set
MYSQL_QUERY_START(thd->query(), thd->thread_id,
@@ -1337,6 +1345,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* PSI end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
/* DTRACE end */
if (MYSQL_QUERY_DONE_ENABLED())
@@ -1357,6 +1366,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(char *) thd->security_ctx->host_or_ip);
/* PSI begin */
+ thd->m_digest= & thd->m_digest_state;
+
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
com_statement_info[command].m_key,
thd->db, thd->db_length,
@@ -1741,6 +1752,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Performance Schema Interface instrumentation, end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
thd->set_time();
dec_thread_running();
@@ -8551,11 +8563,27 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
thd->m_parser_state= parser_state;
-#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
- /* Start Digest */
- thd->m_parser_state->m_lip.m_digest_psi=
- MYSQL_DIGEST_START(do_pfs_digest ? thd->m_statement_psi : NULL);
-#endif
+ parser_state->m_digest_psi= NULL;
+ parser_state->m_lip.m_digest= NULL;
+
+ if (do_pfs_digest)
+ {
+ /* Start Digest */
+ parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi);
+
+ if (parser_state->m_input.m_compute_digest ||
+ (parser_state->m_digest_psi != NULL))
+ {
+ /*
+ If either:
+ - the caller wants to compute a digest
+ - the performance schema wants to compute a digest
+ set the digest listener in the lexer.
+ */
+ parser_state->m_lip.m_digest= thd->m_digest;
+ parser_state->m_lip.m_digest->m_digest_storage.m_charset_number= thd->charset()->number;
+ }
+ }
/* Parse the query. */
@@ -8588,6 +8616,18 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
/* That's it. */
ret_value= mysql_parse_status || thd->is_fatal_error;
+
+ if ((ret_value == 0) && (parser_state->m_digest_psi != NULL))
+ {
+ /*
+ On parsing success, record the digest in the performance schema.
+ */
+ DBUG_ASSERT(do_pfs_digest);
+ DBUG_ASSERT(thd->m_digest != NULL);
+ MYSQL_DIGEST_END(parser_state->m_digest_psi,
+ & thd->m_digest->m_digest_storage);
+ }
+
MYSQL_QUERY_PARSE_DONE(ret_value);
DBUG_RETURN(ret_value);
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 03022c7ed19..9c7898b1b02 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -63,6 +63,7 @@
#include "keycaches.h"
#include "set_var.h"
#include "rpl_mi.h"
+#include "lex_token.h"
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
@@ -13370,6 +13371,13 @@ literal:
| temporal_literal { $$= $1; }
| NULL_SYM
{
+ /*
+ For the digest computation, in this context only,
+ NULL is considered a literal, hence reduced to '?'
+ REDUCE:
+ TOK_GENERIC_VALUE := NULL_SYM
+ */
+ YYLIP->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
$$ = new (thd->mem_root) Item_null();
if ($$ == NULL)
MYSQL_YYABORT;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 21ea70def63..94466db5fd9 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1313,6 +1313,12 @@ static Sys_var_ulong Sys_max_connect_errors(
VALID_RANGE(1, UINT_MAX), DEFAULT(MAX_CONNECT_ERRORS),
BLOCK_SIZE(1));
+static Sys_var_long Sys_max_digest_length(
+ "max_digest_length", "Maximum length considered for digest text.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(max_digest_length),
+ CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 1024 * 1024), DEFAULT(1024), BLOCK_SIZE(1));
+
static bool check_max_delayed_threads(sys_var *self, THD *thd, set_var *var)
{
return var->type != OPT_GLOBAL &&
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index dcd0bbac15f..3b3ffae6357 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -21,31 +21,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
ADD_DEFINITIONS(-DMYSQL_SERVER)
-# Gen_pfs_lex_token
-IF(NOT CMAKE_CROSSCOMPILING)
- ADD_EXECUTABLE(gen_pfs_lex_token gen_pfs_lex_token.cc)
- # gen_pfs_lex_token itself depends on ${CMAKE_CURRENT_BINARY_DIR}/sql/sql_yacc.h
- ADD_DEPENDENCIES(gen_pfs_lex_token GenServerSource)
-ENDIF()
-
-ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pfs_lex_token.h
- COMMAND gen_pfs_lex_token > pfs_lex_token.h
- DEPENDS gen_pfs_lex_token
-)
-
-SET(PFS_GEN_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/pfs_lex_token.h
-)
-
-SET_SOURCE_FILES_PROPERTIES(${PFS_GEN_SOURCES} PROPERTIES GENERATED 1)
-
#
# Maintainer: keep this list sorted, to avoid merge collisions.
# Tip: ls -1 *.h, ls -1 *.cc
#
SET(PERFSCHEMA_SOURCES
-${PFS_GEN_SOURCES}
ha_perfschema.h
cursor_by_account.h
cursor_by_host.h
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index fa87269a054..ea8a04a78ae 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -4455,7 +4455,7 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
pfs->m_sort_scan= 0;
pfs->m_no_index_used= 0;
pfs->m_no_good_index_used= 0;
- digest_reset(& pfs->m_digest_storage);
+ pfs->m_digest_storage.reset();
/* New stages will have this statement as parent */
PFS_events_stages *child_stage= & pfs_thread->m_stage_current;
@@ -4484,11 +4484,7 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
if (flag_statements_digest)
{
- const CHARSET_INFO *cs= static_cast <const CHARSET_INFO*> (charset);
flags|= STATE_FLAG_DIGEST;
- state->m_digest_state.m_last_id_index= 0;
- digest_reset(& state->m_digest_state.m_digest_storage);
- state->m_digest_state.m_digest_storage.m_charset_number= cs->number;
}
state->m_discarded= false;
@@ -4512,6 +4508,8 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
state->m_no_index_used= 0;
state->m_no_good_index_used= 0;
+ state->m_digest= NULL;
+
state->m_schema_name_length= 0;
return reinterpret_cast<PSI_statement_locker*> (state);
@@ -4781,11 +4779,11 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
PFS_statement_stat *event_name_array;
uint index= klass->m_event_name_index;
PFS_statement_stat *stat;
-
+
/*
Capture statement stats by digest.
*/
- PSI_digest_storage *digest_storage= NULL;
+ const sql_digest_storage *digest_storage= NULL;
PFS_statement_stat *digest_stat= NULL;
if (flags & STATE_FLAG_THREAD)
@@ -4798,11 +4796,15 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
if (flags & STATE_FLAG_DIGEST)
{
- digest_storage= &state->m_digest_state.m_digest_storage;
- /* Populate PFS_statements_digest_stat with computed digest information.*/
- digest_stat= find_or_create_digest(thread, digest_storage,
- state->m_schema_name,
- state->m_schema_name_length);
+ digest_storage= state->m_digest;
+
+ if (digest_storage != NULL)
+ {
+ /* Populate PFS_statements_digest_stat with computed digest information.*/
+ digest_stat= find_or_create_digest(thread, digest_storage,
+ state->m_schema_name,
+ state->m_schema_name_length);
+ }
}
if (flags & STATE_FLAG_EVENT)
@@ -4839,7 +4841,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
pfs->m_timer_end= timer_end;
pfs->m_end_event_id= thread->m_event_id;
- if (flags & STATE_FLAG_DIGEST)
+ if (digest_storage != NULL)
{
/*
The following columns in events_statement_current:
@@ -4847,7 +4849,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
- DIGEST_TEXT
are computed from the digest storage.
*/
- digest_copy(& pfs->m_digest_storage, digest_storage);
+ pfs->m_digest_storage.copy(digest_storage);
}
if (flag_events_statements_history)
@@ -4870,11 +4872,15 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
if (thread != NULL)
{
/* Set digest stat. */
- digest_storage= &state->m_digest_state.m_digest_storage;
- /* Populate statements_digest_stat with computed digest information. */
- digest_stat= find_or_create_digest(thread, digest_storage,
- state->m_schema_name,
- state->m_schema_name_length);
+ digest_storage= state->m_digest;
+
+ if (digest_storage != NULL)
+ {
+ /* Populate statements_digest_stat with computed digest information. */
+ digest_stat= find_or_create_digest(thread, digest_storage,
+ state->m_schema_name,
+ state->m_schema_name_length);
+ }
}
}
@@ -4921,7 +4927,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
{
digest_stat->aggregate_counted();
}
-
+
digest_stat->m_lock_time+= state->m_lock_time;
digest_stat->m_rows_sent+= state->m_rows_sent;
digest_stat->m_rows_examined+= state->m_rows_examined;
@@ -5106,6 +5112,39 @@ static void set_socket_thread_owner_v1(PSI_socket *socket)
pfs_socket->m_thread_owner= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
}
+struct PSI_digest_locker*
+pfs_digest_start_v1(PSI_statement_locker *locker)
+{
+ PSI_statement_locker_state *statement_state;
+ statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
+ DBUG_ASSERT(statement_state != NULL);
+
+ if (statement_state->m_discarded)
+ return NULL;
+
+ if (statement_state->m_flags & STATE_FLAG_DIGEST)
+ {
+ return reinterpret_cast<PSI_digest_locker*> (locker);
+ }
+
+ return NULL;
+}
+
+void pfs_digest_end_v1(PSI_digest_locker *locker, const sql_digest_storage *digest)
+{
+ PSI_statement_locker_state *statement_state;
+ statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
+ DBUG_ASSERT(statement_state != NULL);
+ DBUG_ASSERT(digest != NULL);
+
+ if (statement_state->m_discarded)
+ return;
+
+ if (statement_state->m_flags & STATE_FLAG_DIGEST)
+ {
+ statement_state->m_digest= digest;
+ }
+}
/**
Implementation of the thread attribute connection interface
@@ -5243,7 +5282,7 @@ PSI_v1 PFS_v1=
set_socket_info_v1,
set_socket_thread_owner_v1,
pfs_digest_start_v1,
- pfs_digest_add_token_v1,
+ pfs_digest_end_v1,
set_thread_connect_attrs_v1,
};
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 0e4c6cb1d04..3eff670f44d 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h
index 23ef946ee82..c70ca220d84 100644
--- a/storage/perfschema/pfs_column_types.h
+++ b/storage/perfschema/pfs_column_types.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index c3c52bbd56d..5b61d6a14fe 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -28,54 +28,32 @@
#include "pfs_digest.h"
#include "pfs_global.h"
#include "table_helper.h"
-#include "my_md5.h"
#include "sql_lex.h"
#include "sql_get_diagnostics.h"
#include "sql_string.h"
#include <string.h>
-/* Generated code */
-#include "../sql/sql_yacc.h"
-#include "../storage/perfschema/pfs_lex_token.h"
-
-/* Name pollution from sql/sql_lex.h */
-#ifdef LEX_YYSTYPE
-#undef LEX_YYSTYPE
-#endif
-
-#define LEX_YYSTYPE YYSTYPE
-
-/**
- Token array :
- Token array is an array of bytes to store tokens received during parsing.
- Following is the way token array is formed.
-
- ...<non-id-token><non-id-token><id-token><id_len><id_text>...
-
- For Ex:
- SELECT * FROM T1;
- <SELECT_TOKEN><*><FROM_TOKEN><ID_TOKEN><2><T1>
-*/
-
ulong digest_max= 0;
ulong digest_lost= 0;
/** EVENTS_STATEMENTS_HISTORY_LONG circular buffer. */
PFS_statements_digest_stat *statements_digest_stat_array= NULL;
+static unsigned char *statements_digest_token_array= NULL;
/** Consumer flag for table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST. */
bool flag_statements_digest= true;
/**
Current index in Stat array where new record is to be inserted.
index 0 is reserved for "all else" case when entire array is full.
*/
-volatile uint32 digest_index= 1;
+volatile uint32 digest_index;
+bool digest_full= false;
LF_HASH digest_hash;
static bool digest_hash_inited= false;
/**
Initialize table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST.
- @param digest_sizing
+ @param param performance schema sizing
*/
int init_digest(const PFS_global_param *param)
{
@@ -87,19 +65,41 @@ int init_digest(const PFS_global_param *param)
*/
digest_max= param->m_digest_sizing;
digest_lost= 0;
+ digest_index= 1;
+ digest_full= false;
if (digest_max == 0)
return 0;
statements_digest_stat_array=
- PFS_MALLOC_ARRAY(digest_max, PFS_statements_digest_stat,
+ PFS_MALLOC_ARRAY(digest_max,
+ PFS_statements_digest_stat,
MYF(MY_ZEROFILL));
+
if (unlikely(statements_digest_stat_array == NULL))
+ {
+ cleanup_digest();
return 1;
+ }
+
+ if (pfs_max_digest_length > 0)
+ {
+ statements_digest_token_array=
+ PFS_MALLOC_ARRAY(digest_max * pfs_max_digest_length,
+ unsigned char,
+ MYF(MY_ZEROFILL));
+
+ if (unlikely(statements_digest_token_array == NULL))
+ {
+ cleanup_digest();
+ return 1;
+ }
+ }
for (index= 0; index < digest_max; index++)
{
- statements_digest_stat_array[index].reset_data();
+ statements_digest_stat_array[index].reset_data(statements_digest_token_array
+ + index * pfs_max_digest_length, pfs_max_digest_length);
}
return 0;
@@ -110,7 +110,9 @@ void cleanup_digest(void)
{
/* Free memory allocated to statements_digest_stat_array. */
pfs_free(statements_digest_stat_array);
+ pfs_free(statements_digest_token_array);
statements_digest_stat_array= NULL;
+ statements_digest_token_array= NULL;
}
C_MODE_START
@@ -170,10 +172,12 @@ static LF_PINS* get_digest_hash_pins(PFS_thread *thread)
PFS_statement_stat*
find_or_create_digest(PFS_thread *thread,
- PSI_digest_storage *digest_storage,
+ const sql_digest_storage *digest_storage,
const char *schema_name,
uint schema_name_length)
{
+ DBUG_ASSERT(digest_storage != NULL);
+
if (statements_digest_stat_array == NULL)
return NULL;
@@ -192,9 +196,8 @@ find_or_create_digest(PFS_thread *thread,
PFS_digest_key hash_key;
memset(& hash_key, 0, sizeof(hash_key));
/* Compute MD5 Hash of the tokens received. */
- compute_md5_hash((char *) hash_key.m_md5,
- (char *) digest_storage->m_token_array,
- digest_storage->m_byte_count);
+ compute_digest_md5(digest_storage, hash_key.m_md5);
+ memcpy((void*)& digest_storage->m_md5, &hash_key.m_md5, MD5_HASH_SIZE);
/* Add the current schema to the key */
hash_key.m_schema_name_length= schema_name_length;
if (schema_name_length > 0)
@@ -227,8 +230,7 @@ search:
lf_hash_search_unpin(pins);
- /* Dirty read of digest_index */
- if (digest_index == 0)
+ if (digest_full)
{
/* digest_stat array is full. Add stat at index 0 and return. */
pfs= &statements_digest_stat_array[0];
@@ -244,7 +246,7 @@ search:
if (safe_index >= digest_max)
{
/* The digest array is now full. */
- digest_index= 0;
+ digest_full= true;
pfs= &statements_digest_stat_array[0];
if (pfs->m_first_seen == 0)
@@ -263,7 +265,7 @@ search:
Copy digest storage to statement_digest_stat_array so that it could be
used later to generate digest text.
*/
- digest_copy(& pfs->m_digest_storage, digest_storage);
+ pfs->m_digest_storage.copy(digest_storage);
pfs->m_first_seen= now;
pfs->m_last_seen= now;
@@ -313,9 +315,9 @@ void purge_digest(PFS_thread* thread, PFS_digest_key *hash_key)
return;
}
-void PFS_statements_digest_stat::reset_data()
+void PFS_statements_digest_stat::reset_data(unsigned char *token_array, uint length)
{
- digest_reset(& m_digest_storage);
+ m_digest_storage.reset(token_array, length);
m_stat.reset();
m_first_seen= 0;
m_last_seen= 0;
@@ -345,7 +347,7 @@ void reset_esms_by_digest()
for (index= 0; index < digest_max; index++)
{
statements_digest_stat_array[index].reset_index(thread);
- statements_digest_stat_array[index].reset_data();
+ statements_digest_stat_array[index].reset_data(statements_digest_token_array + index * pfs_max_digest_length, pfs_max_digest_length);
}
/*
@@ -353,448 +355,6 @@ void reset_esms_by_digest()
to be inserted in statements_digest_stat_array.
*/
digest_index= 1;
+ digest_full= false;
}
-/*
- Iterate token array and updates digest_text.
-*/
-void get_digest_text(char* digest_text, PSI_digest_storage* digest_storage)
-{
- DBUG_ASSERT(digest_storage != NULL);
- bool truncated= false;
- int byte_count= digest_storage->m_byte_count;
- char *digest_output= digest_text;
- int bytes_needed= 0;
- uint tok= 0;
- int current_byte= 0;
- lex_token_string *tok_data;
- /* -4 is to make sure extra space for '...' and a '\0' at the end. */
- int bytes_available= COL_DIGEST_TEXT_SIZE - 4;
-
- if (byte_count <= 0 || byte_count > PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- *digest_text= '\0';
- return;
- }
-
- /* Convert text to utf8 */
- const CHARSET_INFO *from_cs= get_charset(digest_storage->m_charset_number, MYF(0));
- const CHARSET_INFO *to_cs= &my_charset_utf8_bin;
-
- if (from_cs == NULL)
- {
- /*
- Can happen, as we do dirty reads on digest_storage,
- which can be written to in another thread.
- */
- *digest_text= '\0';
- return;
- }
-
- /*
- Max converted size is number of characters * max multibyte length of the
- target charset, which is 4 for UTF8.
- */
- const uint max_converted_size= PSI_MAX_DIGEST_STORAGE_SIZE * 4;
- char id_buffer[max_converted_size];
- char *id_string;
- int id_length;
- bool convert_text= !my_charset_same(from_cs, to_cs);
-
- DBUG_ASSERT(byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- while ((current_byte < byte_count) &&
- (bytes_available > 0) &&
- !truncated)
- {
- current_byte= read_token(digest_storage, current_byte, &tok);
-
- if (tok <= 0 || tok >= array_elements(lex_token_array))
- {
- *digest_text='\0';
- return;
- }
-
- tok_data= &lex_token_array[tok];
-
- switch (tok)
- {
- /* All identifiers are printed with their name. */
- case IDENT:
- case IDENT_QUOTED:
- {
- char *id_ptr;
- int id_len;
- uint err_cs= 0;
-
- /* Get the next identifier from the storage buffer. */
- current_byte= read_identifier(digest_storage, current_byte,
- &id_ptr, &id_len);
- if (convert_text)
- {
- /* Verify that the converted text will fit. */
- if (to_cs->mbmaxlen*id_len > max_converted_size)
- {
- truncated= true;
- break;
- }
- /* Convert identifier string into the storage character set. */
- id_length= my_convert(id_buffer, max_converted_size, to_cs,
- id_ptr, id_len, from_cs, &err_cs);
- id_string= id_buffer;
- }
- else
- {
- id_string= id_ptr;
- id_length= id_len;
- }
-
- if (id_length == 0 || err_cs != 0)
- {
- truncated= true;
- break;
- }
- /* Copy the converted identifier into the digest string. */
- bytes_needed= id_length + (tok == IDENT ? 1 : 3);
- if (bytes_needed <= bytes_available)
- {
- if (tok == IDENT_QUOTED)
- *digest_output++= '`';
- if (id_length > 0)
- {
- memcpy(digest_output, id_string, id_length);
- digest_output+= id_length;
- }
- if (tok == IDENT_QUOTED)
- *digest_output++= '`';
- *digest_output++= ' ';
- bytes_available-= bytes_needed;
- }
- else
- {
- truncated= true;
- }
- }
- break;
-
- /* Everything else is printed as is. */
- default:
- /*
- Make sure not to overflow digest_text buffer.
- +1 is to make sure extra space for ' '.
- */
- int tok_length= tok_data->m_token_length;
- bytes_needed= tok_length + 1;
-
- if (bytes_needed <= bytes_available)
- {
- strncpy(digest_output, tok_data->m_token_string, tok_length);
- digest_output+= tok_length;
- *digest_output++= ' ';
- bytes_available-= bytes_needed;
- }
- else
- {
- truncated= true;
- }
- break;
- }
- }
-
- /* Truncate digest text in case of long queries. */
- if (digest_storage->m_full || truncated)
- {
- strcpy(digest_output, "...");
- digest_output+= 3;
- }
-
- *digest_output= '\0';
-}
-
-static inline uint peek_token(const PSI_digest_storage *digest, int index)
-{
- uint token;
- DBUG_ASSERT(index >= 0);
- DBUG_ASSERT(index + PFS_SIZE_OF_A_TOKEN <= digest->m_byte_count);
- DBUG_ASSERT(digest->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- token= ((digest->m_token_array[index + 1])<<8) | digest->m_token_array[index];
- return token;
-}
-
-/**
- Function to read last two tokens from token array. If an identifier
- is found, do not look for token before that.
-*/
-static inline void peek_last_two_tokens(const PSI_digest_storage* digest_storage,
- int last_id_index, uint *t1, uint *t2)
-{
- int byte_count= digest_storage->m_byte_count;
- int peek_index= byte_count - PFS_SIZE_OF_A_TOKEN;
-
- if (last_id_index <= peek_index)
- {
- /* Take last token. */
- *t1= peek_token(digest_storage, peek_index);
-
- peek_index-= PFS_SIZE_OF_A_TOKEN;
- if (last_id_index <= peek_index)
- {
- /* Take 2nd token from last. */
- *t2= peek_token(digest_storage, peek_index);
- }
- else
- {
- *t2= TOK_PFS_UNUSED;
- }
- }
- else
- {
- *t1= TOK_PFS_UNUSED;
- *t2= TOK_PFS_UNUSED;
- }
-}
-
-struct PSI_digest_locker* pfs_digest_start_v1(PSI_statement_locker *locker)
-{
- PSI_statement_locker_state *statement_state;
- statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
- DBUG_ASSERT(statement_state != NULL);
-
- if (statement_state->m_discarded)
- return NULL;
-
- if (statement_state->m_flags & STATE_FLAG_DIGEST)
- {
- PSI_digest_locker_state *digest_state;
- digest_state= &statement_state->m_digest_state;
- return reinterpret_cast<PSI_digest_locker*> (digest_state);
- }
-
- return NULL;
-}
-
-PSI_digest_locker* pfs_digest_add_token_v1(PSI_digest_locker *locker,
- uint token,
- OPAQUE_LEX_YYSTYPE *yylval)
-{
- PSI_digest_locker_state *state= NULL;
- PSI_digest_storage *digest_storage= NULL;
-
- state= reinterpret_cast<PSI_digest_locker_state*> (locker);
- DBUG_ASSERT(state != NULL);
-
- digest_storage= &state->m_digest_storage;
-
- /*
- Stop collecting further tokens if digest storage is full or
- if END token is received.
- */
- if (digest_storage->m_full || token == END_OF_INPUT)
- return NULL;
-
- /*
- Take last_token 2 tokens collected till now. These tokens will be used
- in reduce for normalisation. Make sure not to consider ID tokens in reduce.
- */
- uint last_token;
- uint last_token2;
-
- switch (token)
- {
- case NUM:
- case LONG_NUM:
- case ULONGLONG_NUM:
- case DECIMAL_NUM:
- case FLOAT_NUM:
- case BIN_NUM:
- case HEX_NUM:
- {
- bool found_unary;
- do
- {
- found_unary= false;
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token == '-') || (last_token == '+'))
- {
- /*
- We need to differentiate:
- - a <unary minus> operator
- - a <unary plus> operator
- from
- - a <binary minus> operator
- - a <binary plus> operator
- to only reduce "a = -1" to "a = ?", and not change "b - 1" to "b ?"
-
- Binary operators are found inside an expression,
- while unary operators are found at the beginning of an expression, or after operators.
-
- To achieve this, every token that is followed by an <expr> expression
- in the SQL grammar is flagged.
- See sql/sql_yacc.yy
- See sql/gen_lex_token.cc
-
- For example,
- "(-1)" is parsed as "(", "-", NUM, ")", and lex_token_array["("].m_start_expr is true,
- so reduction of the "-" NUM is done, the result is "(?)".
- "(a-1)" is parsed as "(", ID, "-", NUM, ")", and lex_token_array[ID].m_start_expr is false,
- so the operator is binary, no reduction is done, and the result is "(a-?)".
- */
- if (lex_token_array[last_token2].m_start_expr)
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) (NUM | LOG_NUM | ... | FLOAT_NUM)
-
- REDUCE:
- TOK_PFS_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) TOK_PFS_GENERIC_VALUE
- */
- token= TOK_PFS_GENERIC_VALUE;
- digest_storage->m_byte_count-= PFS_SIZE_OF_A_TOKEN;
- found_unary= true;
- }
- }
- } while (found_unary);
- }
- /* fall through, for case NULL_SYM below */
- case LEX_HOSTNAME:
- case TEXT_STRING:
- case NCHAR_STRING:
- case PARAM_MARKER:
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE := BIN_NUM | DECIMAL_NUM | ... | ULONGLONG_NUM
- */
- token= TOK_PFS_GENERIC_VALUE;
- }
- /* fall through */
- case NULL_SYM:
- {
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_GENERIC_VALUE ||
- last_token2 == TOK_PFS_GENERIC_VALUE_LIST ||
- last_token2 == NULL_SYM) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE_LIST :=
- (TOK_PFS_GENERIC_VALUE|NULL_SYM) ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
-
- REDUCE:
- TOK_PFS_GENERIC_VALUE_LIST :=
- TOK_PFS_GENERIC_VALUE_LIST ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_GENERIC_VALUE_LIST;
- }
- /*
- Add this token or the resulting reduce to digest storage.
- */
- store_token(digest_storage, token);
- break;
- }
- case ')':
- {
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if (last_token == TOK_PFS_GENERIC_VALUE &&
- last_token2 == '(')
- {
- /*
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE :=
- '(' TOK_PFS_GENERIC_VALUE ')'
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_SINGLE_VALUE;
-
- /* Read last two tokens again */
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_ROW_SINGLE_VALUE ||
- last_token2 == TOK_PFS_ROW_SINGLE_VALUE_LIST) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE_LIST :=
- TOK_PFS_ROW_SINGLE_VALUE ',' TOK_PFS_ROW_SINGLE_VALUE
-
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE_LIST :=
- TOK_PFS_ROW_SINGLE_VALUE_LIST ',' TOK_PFS_ROW_SINGLE_VALUE
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_SINGLE_VALUE_LIST;
- }
- }
- else if (last_token == TOK_PFS_GENERIC_VALUE_LIST &&
- last_token2 == '(')
- {
- /*
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE :=
- '(' TOK_PFS_GENERIC_VALUE_LIST ')'
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_MULTIPLE_VALUE;
-
- /* Read last two tokens again */
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_ROW_MULTIPLE_VALUE ||
- last_token2 == TOK_PFS_ROW_MULTIPLE_VALUE_LIST) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST :=
- TOK_PFS_ROW_MULTIPLE_VALUE ',' TOK_PFS_ROW_MULTIPLE_VALUE
-
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST :=
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST ',' TOK_PFS_ROW_MULTIPLE_VALUE
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_MULTIPLE_VALUE_LIST;
- }
- }
- /*
- Add this token or the resulting reduce to digest storage.
- */
- store_token(digest_storage, token);
- break;
- }
- case IDENT:
- case IDENT_QUOTED:
- {
- LEX_YYSTYPE *lex_token= (LEX_YYSTYPE*) yylval;
- char *yytext= lex_token->lex_str.str;
- int yylen= lex_token->lex_str.length;
-
- /* Add this token and identifier string to digest storage. */
- store_token_identifier(digest_storage, token, yylen, yytext);
-
- /* Update the index of last identifier found. */
- state->m_last_id_index= digest_storage->m_byte_count;
- break;
- }
- default:
- {
- /* Add this token to digest storage. */
- store_token(digest_storage, token);
- break;
- }
- }
-
- return locker;
-}
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
index 03f534b3d7e..9d021737c44 100644
--- a/storage/perfschema/pfs_digest.h
+++ b/storage/perfschema/pfs_digest.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -24,23 +24,19 @@
#include "pfs_column_types.h"
#include "lf.h"
#include "pfs_stat.h"
-
-#define PFS_SIZE_OF_A_TOKEN 2
+#include "sql_digest.h"
extern bool flag_statements_digest;
extern ulong digest_max;
extern ulong digest_lost;
struct PFS_thread;
-/* Fixed, per MD5 hash. */
-#define PFS_MD5_SIZE 16
-
/**
Structure to store a MD5 hash value (digest) for a statement.
*/
struct PFS_digest_key
{
- unsigned char m_md5[PFS_MD5_SIZE];
+ unsigned char m_md5[MD5_HASH_SIZE];
char m_schema_name[NAME_LEN];
uint m_schema_name_length;
};
@@ -52,7 +48,7 @@ struct PFS_ALIGNED PFS_statements_digest_stat
PFS_digest_key m_digest_key;
/** Digest Storage. */
- PSI_digest_storage m_digest_storage;
+ sql_digest_storage m_digest_storage;
/** Statement stat. */
PFS_statement_stat m_stat;
@@ -62,7 +58,7 @@ struct PFS_ALIGNED PFS_statements_digest_stat
ulonglong m_last_seen;
/** Reset data for this record. */
- void reset_data();
+ void reset_data(unsigned char* token_array, uint length);
/** Reset data and remove index for this record. */
void reset_index(PFS_thread *thread);
};
@@ -73,147 +69,15 @@ void cleanup_digest();
int init_digest_hash(void);
void cleanup_digest_hash(void);
PFS_statement_stat* find_or_create_digest(PFS_thread *thread,
- PSI_digest_storage *digest_storage,
+ const sql_digest_storage *digest_storage,
const char *schema_name,
uint schema_name_length);
-void get_digest_text(char *digest_text, PSI_digest_storage *digest_storage);
-
void reset_esms_by_digest();
/* Exposing the data directly, for iterators. */
extern PFS_statements_digest_stat *statements_digest_stat_array;
-/* Instrumentation callbacks for pfs.cc */
-
-struct PSI_digest_locker *pfs_digest_start_v1(PSI_statement_locker *locker);
-PSI_digest_locker *pfs_digest_add_token_v1(PSI_digest_locker *locker,
- uint token,
- OPAQUE_LEX_YYSTYPE *yylval);
-
-static inline void digest_reset(PSI_digest_storage *digest)
-{
- digest->m_full= false;
- digest->m_byte_count= 0;
- digest->m_charset_number= 0;
-}
-
-static inline void digest_copy(PSI_digest_storage *to, const PSI_digest_storage *from)
-{
- if (from->m_byte_count > 0)
- {
- to->m_full= from->m_full;
- to->m_byte_count= from->m_byte_count;
- to->m_charset_number= from->m_charset_number;
- DBUG_ASSERT(to->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
- memcpy(to->m_token_array, from->m_token_array, to->m_byte_count);
- }
- else
- {
- DBUG_ASSERT(from->m_byte_count == 0);
- to->m_full= false;
- to->m_byte_count= 0;
- to->m_charset_number= 0;
- }
-}
-
-/**
- Read a single token from token array.
-*/
-inline int read_token(PSI_digest_storage *digest_storage,
- int index, uint *tok)
-{
- int safe_byte_count= digest_storage->m_byte_count;
-
- if (index + PFS_SIZE_OF_A_TOKEN <= safe_byte_count &&
- safe_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char *src= & digest_storage->m_token_array[index];
- *tok= src[0] | (src[1] << 8);
- return index + PFS_SIZE_OF_A_TOKEN;
- }
-
- /* The input byte stream is exhausted. */
- *tok= 0;
- return PSI_MAX_DIGEST_STORAGE_SIZE + 1;
-}
-
-/**
- Store a single token in token array.
-*/
-inline void store_token(PSI_digest_storage* digest_storage, uint token)
-{
- DBUG_ASSERT(digest_storage->m_byte_count >= 0);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- if (digest_storage->m_byte_count + PFS_SIZE_OF_A_TOKEN <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
- dest[0]= token & 0xff;
- dest[1]= (token >> 8) & 0xff;
- digest_storage->m_byte_count+= PFS_SIZE_OF_A_TOKEN;
- }
- else
- {
- digest_storage->m_full= true;
- }
-}
-
-/**
- Read an identifier from token array.
-*/
-inline int read_identifier(PSI_digest_storage* digest_storage,
- int index, char ** id_string, int *id_length)
-{
- int new_index;
- DBUG_ASSERT(index <= digest_storage->m_byte_count);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- /*
- token + length + string are written in an atomic way,
- so we do always expect a length + string here
- */
- unsigned char *src= & digest_storage->m_token_array[index];
- uint length= src[0] | (src[1] << 8);
- *id_string= (char *) (src + 2);
- *id_length= length;
-
- new_index= index + PFS_SIZE_OF_A_TOKEN + length;
- DBUG_ASSERT(new_index <= digest_storage->m_byte_count);
- return new_index;
-}
-
-/**
- Store an identifier in token array.
-*/
-inline void store_token_identifier(PSI_digest_storage* digest_storage,
- uint token,
- uint id_length, const char *id_name)
-{
- DBUG_ASSERT(digest_storage->m_byte_count >= 0);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- uint bytes_needed= 2 * PFS_SIZE_OF_A_TOKEN + id_length;
- if (digest_storage->m_byte_count + bytes_needed <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
- /* Write the token */
- dest[0]= token & 0xff;
- dest[1]= (token >> 8) & 0xff;
- /* Write the string length */
- dest[2]= id_length & 0xff;
- dest[3]= (id_length >> 8) & 0xff;
- /* Write the string data */
- if (id_length > 0)
- memcpy((char *)(dest + 4), id_name, id_length);
- digest_storage->m_byte_count+= bytes_needed;
- }
- else
- {
- digest_storage->m_full= true;
- }
-}
-
extern LF_HASH digest_hash;
#endif
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 958a2bdd7bd..5484f0b4e4c 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -1412,12 +1412,64 @@ bool pfs_show_status(handlerton *hton, THD *thd,
name= "host_cache.size";
size= sizeof(Host_entry);
break;
+ case 154:
+ name= "(history_long_statements_digest_token_array).row_count";
+ size= events_statements_history_long_size;
+ break;
+ case 155:
+ name= "(history_long_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 156:
+ name= "(history_long_statements_digest_token_array).memory";
+ size= events_statements_history_long_size * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 157:
+ name= "(history_statements_digest_token_array).row_count";
+ size= thread_max * events_statements_history_per_thread;
+ break;
+ case 158:
+ name= "(history_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 159:
+ name= "(history_statements_digest_token_array).memory";
+ size= thread_max * events_statements_history_per_thread * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 160:
+ name= "(current_statements_digest_token_array).row_count";
+ size= thread_max * statement_stack_max;
+ break;
+ case 161:
+ name= "(current_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 162:
+ name= "(current_statements_digest_token_array).memory";
+ size= thread_max * statement_stack_max * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 163:
+ name= "(statements_digest_token_array).row_count";
+ size= digest_max;
+ break;
+ case 164:
+ name= "(statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 165:
+ name= "(statements_digest_token_array).memory";
+ size= digest_max * pfs_max_digest_length;
+ total_memory+= size;
+ break;
/*
This case must be last,
for aggregation in total_memory.
*/
- case 154:
+ case 166:
name= "performance_schema.memory";
size= total_memory;
/* This will fail if something is not advertised here */
diff --git a/storage/perfschema/pfs_events_statements.cc b/storage/perfschema/pfs_events_statements.cc
index 07810d26dc4..dc34755d747 100644
--- a/storage/perfschema/pfs_events_statements.cc
+++ b/storage/perfschema/pfs_events_statements.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -44,6 +44,7 @@ bool events_statements_history_long_full= false;
volatile uint32 events_statements_history_long_index= 0;
/** EVENTS_STATEMENTS_HISTORY_LONG circular buffer. */
PFS_events_statements *events_statements_history_long_array= NULL;
+static unsigned char *h_long_stmts_digest_token_array= NULL;
/**
Initialize table EVENTS_STATEMENTS_HISTORY_LONG.
@@ -51,6 +52,7 @@ PFS_events_statements *events_statements_history_long_array= NULL;
*/
int init_events_statements_history_long(uint events_statements_history_long_sizing)
{
+ uint index;
events_statements_history_long_size= events_statements_history_long_sizing;
events_statements_history_long_full= false;
PFS_atomic::store_u32(&events_statements_history_long_index, 0);
@@ -62,20 +64,50 @@ int init_events_statements_history_long(uint events_statements_history_long_sizi
PFS_MALLOC_ARRAY(events_statements_history_long_size, PFS_events_statements,
MYF(MY_ZEROFILL));
- return (events_statements_history_long_array ? 0 : 1);
+ if (events_statements_history_long_array == NULL)
+ {
+ cleanup_events_statements_history_long();
+ return 1;
+ }
+
+ if (pfs_max_digest_length > 0)
+ {
+ h_long_stmts_digest_token_array=
+ PFS_MALLOC_ARRAY(events_statements_history_long_size * pfs_max_digest_length,
+ unsigned char, MYF(MY_ZEROFILL));
+ if (h_long_stmts_digest_token_array == NULL)
+ {
+ cleanup_events_statements_history_long();
+ return 1;
+ }
+ }
+
+ for (index= 0; index < events_statements_history_long_size; index++)
+ {
+ events_statements_history_long_array[index].m_digest_storage.reset(h_long_stmts_digest_token_array
+ + index * pfs_max_digest_length, pfs_max_digest_length);
+ }
+
+ return 0;
}
/** Cleanup table EVENTS_STATEMENTS_HISTORY_LONG. */
void cleanup_events_statements_history_long(void)
{
pfs_free(events_statements_history_long_array);
+ pfs_free(h_long_stmts_digest_token_array);
events_statements_history_long_array= NULL;
+ h_long_stmts_digest_token_array= NULL;
}
static inline void copy_events_statements(PFS_events_statements *dest,
const PFS_events_statements *source)
{
- memcpy(dest, source, sizeof(PFS_events_statements));
+ /* Copy all attributes except DIGEST */
+ memcpy(dest, source, my_offsetof(PFS_events_statements, m_digest_storage));
+
+ /* Copy DIGEST */
+ dest->m_digest_storage.copy(& source->m_digest_storage);
}
/**
diff --git a/storage/perfschema/pfs_events_statements.h b/storage/perfschema/pfs_events_statements.h
index 5d90250c618..3637e4ca764 100644
--- a/storage/perfschema/pfs_events_statements.h
+++ b/storage/perfschema/pfs_events_statements.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -88,8 +88,12 @@ struct PFS_events_statements : public PFS_events
ulonglong m_no_index_used;
/** Optimizer metric, number of 'no good index used'. */
ulonglong m_no_good_index_used;
- /** Statement digest. */
- PSI_digest_storage m_digest_storage;
+ /**
+ Statement digest.
+ This underlying token array storage pointer is immutable,
+ and always point to pre allocated memory.
+ */
+ sql_digest_storage m_digest_storage;
};
void insert_events_statements_history(PFS_thread *thread, PFS_events_statements *statement);
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 08f49f091a8..80f3900275d 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index cfae076536c..5e75df4a16f 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -94,6 +94,7 @@ ulong events_stages_history_per_thread;
/** Number of EVENTS_STATEMENTS_HISTORY records per thread. */
ulong events_statements_history_per_thread;
uint statement_stack_max;
+uint pfs_max_digest_length= 0;
/** Number of locker lost. @sa LOCKER_STACK_SIZE. */
ulong locker_lost= 0;
/** Number of statement lost. @sa STATEMENT_STACK_SIZE. */
@@ -176,6 +177,8 @@ static PFS_events_waits *thread_waits_history_array= NULL;
static PFS_events_stages *thread_stages_history_array= NULL;
static PFS_events_statements *thread_statements_history_array= NULL;
static PFS_events_statements *thread_statements_stack_array= NULL;
+static unsigned char *current_stmts_digest_token_array= NULL;
+static unsigned char *history_stmts_digest_token_array= NULL;
static char *thread_session_connect_attrs_array= NULL;
/** Hash table for instrumented files. */
@@ -190,6 +193,9 @@ static bool filename_hash_inited= false;
*/
int init_instruments(const PFS_global_param *param)
{
+ PFS_events_statements *pfs_stmt;
+ unsigned char *pfs_tokens;
+
uint thread_waits_history_sizing;
uint thread_stages_history_sizing;
uint thread_statements_history_sizing;
@@ -215,6 +221,9 @@ int init_instruments(const PFS_global_param *param)
file_handle_max= param->m_file_handle_sizing;
file_handle_full= false;
file_handle_lost= 0;
+
+ pfs_max_digest_length= param->m_max_digest_length;
+
table_max= param->m_table_sizing;
table_full= false;
table_lost= 0;
@@ -254,6 +263,9 @@ int init_instruments(const PFS_global_param *param)
* session_connect_attrs_size_per_thread;
session_connect_attrs_lost= 0;
+ size_t current_digest_tokens_sizing= param->m_thread_sizing * pfs_max_digest_length * statement_stack_max;
+ size_t history_digest_tokens_sizing= param->m_thread_sizing * pfs_max_digest_length * events_statements_history_per_thread;
+
mutex_array= NULL;
rwlock_array= NULL;
cond_array= NULL;
@@ -266,6 +278,8 @@ int init_instruments(const PFS_global_param *param)
thread_stages_history_array= NULL;
thread_statements_history_array= NULL;
thread_statements_stack_array= NULL;
+ current_stmts_digest_token_array= NULL;
+ history_stmts_digest_token_array= NULL;
thread_instr_class_waits_array= NULL;
thread_instr_class_stages_array= NULL;
thread_instr_class_statements_array= NULL;
@@ -407,6 +421,22 @@ int init_instruments(const PFS_global_param *param)
return 1;
}
+ if (current_digest_tokens_sizing > 0)
+ {
+ current_stmts_digest_token_array=
+ (unsigned char *)pfs_malloc(current_digest_tokens_sizing, MYF(MY_ZEROFILL));
+ if (unlikely(current_stmts_digest_token_array == NULL))
+ return 1;
+ }
+
+ if (history_digest_tokens_sizing > 0)
+ {
+ history_stmts_digest_token_array=
+ (unsigned char *)pfs_malloc(history_digest_tokens_sizing, MYF(MY_ZEROFILL));
+ if (unlikely(history_stmts_digest_token_array == NULL))
+ return 1;
+ }
+
for (index= 0; index < thread_max; index++)
{
thread_array[index].m_waits_history=
@@ -427,6 +457,22 @@ int init_instruments(const PFS_global_param *param)
&thread_session_connect_attrs_array[index * session_connect_attrs_size_per_thread];
}
+ for (index= 0; index < thread_statements_stack_sizing; index++)
+ {
+ pfs_stmt= & thread_statements_stack_array[index];
+
+ pfs_tokens= & current_stmts_digest_token_array[index * pfs_max_digest_length];
+ pfs_stmt->m_digest_storage.reset(pfs_tokens, pfs_max_digest_length);
+ }
+
+ for (index= 0; index < thread_statements_history_sizing; index++)
+ {
+ pfs_stmt= & thread_statements_history_array[index];
+
+ pfs_tokens= & history_stmts_digest_token_array[index * pfs_max_digest_length];
+ pfs_stmt->m_digest_storage.reset(pfs_tokens, pfs_max_digest_length);
+ }
+
if (stage_class_max > 0)
{
global_instr_class_stages_array=
@@ -501,6 +547,10 @@ void cleanup_instruments(void)
thread_instr_class_stages_array= NULL;
pfs_free(thread_session_connect_attrs_array);
thread_session_connect_attrs_array=NULL;
+ pfs_free(current_stmts_digest_token_array);
+ current_stmts_digest_token_array= NULL;
+ pfs_free(history_stmts_digest_token_array);
+ history_stmts_digest_token_array= NULL;
}
C_MODE_START
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index bd2fe0e4afd..a639f94fada 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -298,6 +298,8 @@ struct PFS_ALIGNED PFS_socket : public PFS_instr
/** Max size of the statements stack. */
extern uint statement_stack_max;
+/** Max size of the digests token array. */
+extern uint pfs_max_digest_length;
/**
@def PFS_MAX_ALLOC_RETRY
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index 383a46785fb..1cf60766cf7 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index 606a814c168..6f07e5b3feb 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -200,6 +200,8 @@ struct PFS_global_param
/** Maximum number of session attribute strings per thread */
long m_session_connect_attrs_sizing;
+ uint m_max_digest_length;
+
/** Sizing hints, for auto tuning. */
PFS_sizing_hints m_hints;
};
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index 905c0b2ee4e..a009e5d65ef 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index a3f2680c3e7..7d7539b7790 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -302,7 +302,7 @@ table_events_statements_common::table_events_statements_common
@param statement the statement the cursor is reading
*/
void table_events_statements_common::make_row_part_1(PFS_events_statements *statement,
- PSI_digest_storage *digest)
+ sql_digest_storage *digest)
{
const char *base;
const char *safe_source_file;
@@ -367,46 +367,40 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
m_row.m_sort_scan= statement->m_sort_scan;
m_row.m_no_index_used= statement->m_no_index_used;
m_row.m_no_good_index_used= statement->m_no_good_index_used;
- /*
+ /*
Making a copy of digest storage.
*/
- digest_copy(digest, & statement->m_digest_storage);
+ digest->copy(& statement->m_digest_storage);
m_row_exists= true;
return;
}
-void table_events_statements_common::make_row_part_2(PSI_digest_storage *digest)
+void table_events_statements_common::make_row_part_2(const sql_digest_storage *digest)
{
/*
Filling up statement digest information.
*/
- int safe_byte_count= digest->m_byte_count;
+ uint safe_byte_count= digest->m_byte_count;
if (safe_byte_count > 0 &&
- safe_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE)
+ safe_byte_count <= pfs_max_digest_length)
{
- PFS_digest_key md5;
- compute_md5_hash((char *) md5.m_md5,
- (char *) digest->m_token_array,
- safe_byte_count);
-
/* Generate the DIGEST string from the MD5 digest */
- MD5_HASH_TO_STRING(md5.m_md5,
+ MD5_HASH_TO_STRING(digest->m_md5,
m_row.m_digest.m_digest);
m_row.m_digest.m_digest_length= MD5_HASH_TO_STRING_LENGTH;
/* Generate the DIGEST_TEXT string from the token array */
- get_digest_text(m_row.m_digest.m_digest_text, digest);
- m_row.m_digest.m_digest_text_length= strlen(m_row.m_digest.m_digest_text);
+ compute_digest_text(digest, &m_row.m_digest.m_digest_text);
- if (m_row.m_digest.m_digest_text_length == 0)
+ if (m_row.m_digest.m_digest_text.length() == 0)
m_row.m_digest.m_digest_length= 0;
}
else
{
m_row.m_digest.m_digest_length= 0;
- m_row.m_digest.m_digest_text_length= 0;
+ m_row.m_digest.m_digest_text.length(0);
}
return;
@@ -491,9 +485,9 @@ int table_events_statements_common::read_row_values(TABLE *table,
f->set_null();
break;
case 11: /* DIGEST_TEXT */
- if (m_row.m_digest.m_digest_text_length > 0)
- set_field_longtext_utf8(f, m_row.m_digest.m_digest_text,
- m_row.m_digest.m_digest_text_length);
+ if (m_row.m_digest.m_digest_text.length() > 0)
+ set_field_longtext_utf8(f, m_row.m_digest.m_digest_text.ptr(),
+ m_row.m_digest.m_digest_text.length());
else
f->set_null();
break;
@@ -710,11 +704,11 @@ int table_events_statements_current::rnd_pos(const void *pos)
void table_events_statements_current::make_row(PFS_thread *pfs_thread,
PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
pfs_lock lock;
pfs_lock stmt_lock;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
/* Protect this reader against thread termination. */
pfs_thread->m_lock.begin_optimistic_lock(&lock);
/* Protect this reader against writing on statement information. */
@@ -838,10 +832,10 @@ int table_events_statements_history::rnd_pos(const void *pos)
void table_events_statements_history::make_row(PFS_thread *pfs_thread,
PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
pfs_lock lock;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
/* Protect this reader against thread termination. */
pfs_thread->m_lock.begin_optimistic_lock(&lock);
@@ -942,9 +936,9 @@ int table_events_statements_history_long::rnd_pos(const void *pos)
void table_events_statements_history_long::make_row(PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
table_events_statements_common::make_row_part_1(statement, &digest);
table_events_statements_common::make_row_part_2(&digest);
diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h
index e33c6b505bd..a42bbcb2e5a 100644
--- a/storage/perfschema/table_events_statements.h
+++ b/storage/perfschema/table_events_statements.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -175,14 +175,15 @@ protected:
{}
void make_row_part_1(PFS_events_statements *statement,
- PSI_digest_storage *digest);
+ sql_digest_storage *digest);
- void make_row_part_2(PSI_digest_storage *digest);
+ void make_row_part_2(const sql_digest_storage *digest);
/** Current row. */
row_events_statements m_row;
/** True if the current row exists. */
bool m_row_exists;
+ unsigned char m_token_array[MAX_DIGEST_STORAGE_SIZE];
};
/** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_CURRENT. */
diff --git a/storage/perfschema/table_helper.cc b/storage/perfschema/table_helper.cc
index 9c10a3ecc88..c9def1bfc74 100644
--- a/storage/perfschema/table_helper.cc
+++ b/storage/perfschema/table_helper.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -25,6 +25,7 @@
#include "pfs_host.h"
#include "pfs_user.h"
#include "pfs_account.h"
+#include "pfs_instr.h"
int PFS_host_row::make_row(PFS_host *pfs)
{
@@ -109,8 +110,8 @@ int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
if (m_schema_name_length > 0)
memcpy(m_schema_name, pfs->m_digest_key.m_schema_name, m_schema_name_length);
- int safe_byte_count= pfs->m_digest_storage.m_byte_count;
- if (safe_byte_count > PSI_MAX_DIGEST_STORAGE_SIZE)
+ uint safe_byte_count= pfs->m_digest_storage.m_byte_count;
+ if (safe_byte_count > pfs_max_digest_length)
safe_byte_count= 0;
/*
@@ -124,23 +125,22 @@ int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
Calculate digest from MD5 HASH collected to be shown as
DIGEST in this row.
*/
- MD5_HASH_TO_STRING(pfs->m_digest_key.m_md5, m_digest);
+ MD5_HASH_TO_STRING(pfs->m_digest_storage.m_md5, m_digest);
m_digest_length= MD5_HASH_TO_STRING_LENGTH;
/*
Calculate digest_text information from the token array collected
to be shown as DIGEST_TEXT column.
*/
- get_digest_text(m_digest_text, &pfs->m_digest_storage);
- m_digest_text_length= strlen(m_digest_text);
+ compute_digest_text(&pfs->m_digest_storage, &m_digest_text);
- if (m_digest_text_length == 0)
+ if (m_digest_text.length() == 0)
m_digest_length= 0;
}
else
{
m_digest_length= 0;
- m_digest_text_length= 0;
+ m_digest_text.length(0);
}
return 0;
@@ -165,9 +165,9 @@ void PFS_digest_row::set_field(uint index, Field *f)
f->set_null();
break;
case 2: /* DIGEST_TEXT */
- if (m_digest_text_length > 0)
- PFS_engine_table::set_field_longtext_utf8(f, m_digest_text,
- m_digest_text_length);
+ if (m_digest_text.length() > 0)
+ PFS_engine_table::set_field_longtext_utf8(f, m_digest_text.ptr(),
+ m_digest_text.length());
else
f->set_null();
break;
diff --git a/storage/perfschema/table_helper.h b/storage/perfschema/table_helper.h
index 76bb289c73b..b1377eb9748 100644
--- a/storage/perfschema/table_helper.h
+++ b/storage/perfschema/table_helper.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -136,9 +136,7 @@ struct PFS_digest_row
/** Length in bytes of @c m_digest. */
uint m_digest_length;
/** Column DIGEST_TEXT. */
- char m_digest_text[COL_DIGEST_TEXT_SIZE];
- /** Length in bytes of @c m_digest_text. */
- uint m_digest_text_length;
+ String m_digest_text;
/** Build a row from a memory buffer. */
int make_row(PFS_statements_digest_stat*);
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index 6add43de7f9..e8b11e807bf 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -23,5 +23,10 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_DEFINITIONS(-DMYSQL_SERVER ${SSL_DEFINES})
-MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs
- EXT "cc" LINK_LIBRARIES perfschema mysys)
+ADD_CONVENIENCE_LIBRARY(pfs_server_stubs pfs_server_stubs.cc)
+
+ADD_DEPENDENCIES(pfs_server_stubs GenError)
+
+MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
+ pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs
+ EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index 9211443bcca..6121fac098f 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -26,7 +26,6 @@
#include "stub_print_error.h"
#include "stub_pfs_defaults.h"
-#include "stub_server_misc.h"
/* test helpers, to simulate the setup */
@@ -112,6 +111,7 @@ void test_bootstrap()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
boot= initialize_performance_schema(& param);
ok(boot != NULL, "boot");
@@ -170,6 +170,7 @@ PSI * load_perfschema()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
/* test_bootstrap() covered this, assuming it just works */
boot= initialize_performance_schema(& param);
@@ -1514,6 +1515,7 @@ void test_event_name_index()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
param.m_mutex_sizing= 0;
param.m_rwlock_sizing= 0;
diff --git a/storage/perfschema/unittest/pfs_account-oom-t.cc b/storage/perfschema/unittest/pfs_account-oom-t.cc
index 2343e8378ad..f715325401d 100644
--- a/storage/perfschema/unittest/pfs_account-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_account-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_host-oom-t.cc b/storage/perfschema/unittest/pfs_host-oom-t.cc
index 5b823ce4eac..56597bdda74 100644
--- a/storage/perfschema/unittest/pfs_host-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_host-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index 18c0029776d..25caaa6241f 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index fab22b203d3..81df38340df 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -23,8 +23,6 @@
#include <memory.h>
-#include "stub_server_misc.h"
-
void test_no_instruments()
{
int rc;
@@ -62,6 +60,7 @@ void test_no_instruments()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
@@ -121,6 +120,7 @@ void test_no_instances()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
@@ -261,6 +261,7 @@ void test_with_instances()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index 264d6126336..1b098ee356e 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -20,7 +20,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
void test_oom()
{
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index 706c5724a80..06e3200a8d2 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -21,8 +21,6 @@
#include <pfs_global.h>
#include <tap.h>
-#include "stub_server_misc.h"
-
void test_no_registration()
{
int rc;
diff --git a/storage/perfschema/unittest/stub_server_misc.h b/storage/perfschema/unittest/pfs_server_stubs.cc
index 946da533727..a8f417e390b 100644
--- a/storage/perfschema/unittest/stub_server_misc.h
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -17,12 +17,19 @@
Minimal code to be able to link a unit test.
*/
+#include "my_global.h"
+#include "m_ctype.h"
+#include "sql_class.h"
+#include "sql_show.h"
+
+struct sql_digest_storage;
+
volatile bool ready_to_exit= false;
uint lower_case_table_names= 0;
CHARSET_INFO *files_charset_info= NULL;
-extern "C" void compute_md5_hash(char *, const char *, int)
+void compute_digest_md5(const sql_digest_storage *, unsigned char *)
{
}
diff --git a/storage/perfschema/unittest/pfs_user-oom-t.cc b/storage/perfschema/unittest/pfs_user-oom-t.cc
index 3cb80e1b7f9..6c936ba8ffb 100644
--- a/storage/perfschema/unittest/pfs_user-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_user-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */