summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-02-15 18:25:57 +0100
committerSergei Golubchik <serg@mariadb.org>2020-03-10 19:24:23 +0100
commit7af733a5a2cb7f79ffb5ff0129cad6db6f3cc359 (patch)
treef8f9cab2cd92e43b5fd20c9ac77f9487ece4e5a7 /storage/perfschema
parent81cffda2e68ea5a155b74f24ae4345388afa963c (diff)
downloadmariadb-git-7af733a5a2cb7f79ffb5ff0129cad6db6f3cc359.tar.gz
perfschema compilation, test and misc fixes
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/CMakeLists.txt59
-rw-r--r--storage/perfschema/my_thread.h71
-rw-r--r--storage/perfschema/mysqld_thd_manager.cc39
-rw-r--r--storage/perfschema/mysqld_thd_manager.h29
-rw-r--r--storage/perfschema/pfs.cc13
-rw-r--r--storage/perfschema/pfs_account.cc4
-rw-r--r--storage/perfschema/pfs_buffer_container.h9
-rw-r--r--storage/perfschema/pfs_builtin_memory.cc2
-rw-r--r--storage/perfschema/pfs_column_types.h62
-rw-r--r--storage/perfschema/pfs_config.h.cmake4
-rw-r--r--storage/perfschema/pfs_engine_table.cc22
-rw-r--r--storage/perfschema/pfs_engine_table.h4
-rw-r--r--storage/perfschema/pfs_events.h2
-rw-r--r--storage/perfschema/pfs_events_waits.h4
-rw-r--r--storage/perfschema/pfs_instr.cc2
-rw-r--r--storage/perfschema/pfs_instr_class.cc14
-rw-r--r--storage/perfschema/pfs_lock.h14
-rw-r--r--storage/perfschema/pfs_program.cc2
-rw-r--r--storage/perfschema/pfs_stat.h11
-rw-r--r--storage/perfschema/pfs_status.cc4
-rw-r--r--storage/perfschema/pfs_status.h2
-rw-r--r--storage/perfschema/pfs_variable.cc100
-rw-r--r--storage/perfschema/pfs_variable.h16
-rw-r--r--storage/perfschema/pfs_visitor.cc6
-rw-r--r--storage/perfschema/rpl_gtid.h17
-rw-r--r--storage/perfschema/table_events_statements.cc12
-rw-r--r--storage/perfschema/table_events_transactions.cc4
-rw-r--r--storage/perfschema/table_events_waits.cc36
-rw-r--r--storage/perfschema/table_global_variables.cc4
-rw-r--r--storage/perfschema/table_helper.cc177
-rw-r--r--storage/perfschema/table_helper.h5
-rw-r--r--storage/perfschema/table_md_locks.cc2
-rw-r--r--storage/perfschema/table_replication_applier_configuration.cc8
-rw-r--r--storage/perfschema/table_replication_applier_status.cc7
-rw-r--r--storage/perfschema/table_replication_applier_status_by_coordinator.cc11
-rw-r--r--storage/perfschema/table_replication_applier_status_by_worker.cc2
-rw-r--r--storage/perfschema/table_replication_connection_configuration.cc30
-rw-r--r--storage/perfschema/table_replication_connection_status.cc2
-rw-r--r--storage/perfschema/table_replication_group_member_stats.cc2
-rw-r--r--storage/perfschema/table_replication_group_members.cc2
-rw-r--r--storage/perfschema/table_session_variables.cc4
-rw-r--r--storage/perfschema/table_setup_actors.cc4
-rw-r--r--storage/perfschema/table_setup_objects.cc3
-rw-r--r--storage/perfschema/table_setup_timers.cc2
-rw-r--r--storage/perfschema/table_threads.cc32
-rw-r--r--storage/perfschema/table_tlws_by_table.cc51
-rw-r--r--storage/perfschema/table_uvar_by_thread.cc8
-rw-r--r--storage/perfschema/table_uvar_by_thread.h2
-rw-r--r--storage/perfschema/table_variables_by_thread.cc6
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc1
-rw-r--r--storage/perfschema/unittest/stub_global_status_var.h2
51 files changed, 540 insertions, 391 deletions
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 667d2d99b5d..c871677d0a9 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
${CMAKE_BINARY_DIR}/sql
+ ${CMAKE_CURRENT_BINARY_DIR}
${PCRE_INCLUDES}
${SSL_INCLUDE_DIRS})
@@ -161,6 +162,7 @@ cursor_by_host.cc
cursor_by_thread.cc
cursor_by_user.cc
ha_perfschema.cc
+mysqld_thd_manager.cc
pfs.cc
pfs_account.cc
pfs_autosize.cc
@@ -249,9 +251,9 @@ table_status_by_thread.cc
table_status_by_user.cc
table_global_status.cc
table_session_status.cc
-table_variables_by_thread.cc
-table_global_variables.cc
-table_session_variables.cc
+#table_variables_by_thread.cc
+#table_global_variables.cc
+#table_session_variables.cc
table_table_handles.cc
table_threads.cc
table_tiws_by_index_usage.cc
@@ -273,7 +275,56 @@ table_replication_applier_status_by_coordinator.cc
#table_replication_group_member_stats.cc
)
-MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY)
+# Check for pthread_threadid_np()
+CHECK_C_SOURCE_COMPILES("
+#include <pthread.h>
+int main(int ac, char **av)
+{
+ unsigned long long tid64;
+ pthread_threadid_np(NULL, &tid64);
+ return (tid64 != 0 ? 0 : 1);
+}"
+HAVE_PTHREAD_THREADID_NP)
+
+# Check for gettid() system call
+CHECK_C_SOURCE_COMPILES("
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+int main(int ac, char **av)
+{
+ unsigned long long tid = syscall(SYS_gettid);
+ return (tid != 0 ? 0 : 1);
+}"
+HAVE_SYS_GETTID)
+
+# Check for pthread_getthreadid_np()
+CHECK_C_SOURCE_COMPILES("
+#include <pthread_np.h>
+int main(int ac, char **av)
+{
+ unsigned long long tid = pthread_getthreadid_np();
+ return (tid != 0 ? 0 : 1);
+}"
+HAVE_PTHREAD_GETTHREADID_NP)
+
+# Check for pthread_self() returning an integer type
+CHECK_C_SOURCE_COMPILES("
+#include <sys/types.h>
+#include <pthread.h>
+int main(int ac, char **av)
+{
+ unsigned long long tid = pthread_self();
+ return (tid != 0 ? 0 : 1);
+}"
+HAVE_INTEGER_PTHREAD_SELF
+FAIL_REGEX "warning: incompatible pointer to integer conversion"
+)
+
+CONFIGURE_FILE(pfs_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/pfs_config.h)
+
+MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT
+ STATIC_ONLY RECOMPILE_FOR_EMBEDDED)
IF (TARGET perfschema)
ADD_DEPENDENCIES(perfschema GenServerSource)
IF(WITH_UNIT_TESTS)
diff --git a/storage/perfschema/my_thread.h b/storage/perfschema/my_thread.h
index 28f8ae07ab8..542035bda0f 100644
--- a/storage/perfschema/my_thread.h
+++ b/storage/perfschema/my_thread.h
@@ -3,13 +3,20 @@
#include <my_pthread.h>
#include <m_string.h>
-#include "rpl_gtid.h"
+#include "pfs_config.h"
+
+#ifdef HAVE_SYS_GETTID
+#include <sys/types.h>
+#include <sys/syscall.h>
+#endif
typedef pthread_key_t thread_local_key_t;
typedef pthread_t my_thread_handle;
typedef pthread_attr_t my_thread_attr_t;
typedef uint32 my_thread_os_id_t;
+#define LOCK_plugin_delete LOCK_plugin
+
static inline int my_create_thread_local_key(thread_local_key_t *key, void (*destructor)(void*))
{ return pthread_key_create(key, destructor); }
@@ -28,21 +35,47 @@ static inline int my_thread_create(my_thread_handle *thread,
static inline my_thread_os_id_t my_thread_os_id()
{
-#ifdef __NR_gettid
- return (uint32)syscall(__NR_gettid);
+#ifdef HAVE_PTHREAD_THREADID_NP
+ /*
+ macOS.
+
+ Be careful to use this version first, and to not use SYS_gettid on macOS,
+ as SYS_gettid has a different meaning compared to linux gettid().
+ */
+ uint64_t tid64;
+ pthread_threadid_np(nullptr, &tid64);
+ return (pid_t)tid64;
+#else
+#ifdef HAVE_SYS_GETTID
+ /*
+ Linux.
+ See man gettid
+ See GLIBC Bug 6399 - gettid() should have a wrapper
+ https://sourceware.org/bugzilla/show_bug.cgi?id=6399
+ */
+ return syscall(SYS_gettid);
#else
+#ifdef _WIN32
+ /* Windows */
+ return GetCurrentThreadId();
+#else
+#ifdef HAVE_PTHREAD_GETTHREADID_NP
+ /* FreeBSD 10.2 */
+ return pthread_getthreadid_np();
+#else
+#ifdef HAVE_INTEGER_PTHREAD_SELF
+ /* Unknown platform, fallback. */
+ return pthread_self();
+#else
+ /* Feature not available. */
return 0;
-#endif
+#endif /* HAVE_INTEGER_PTHREAD_SELF */
+#endif /* HAVE_PTHREAD_GETTHREADID_NP */
+#endif /* _WIN32 */
+#endif /* HAVE_SYS_GETTID */
+#endif /* HAVE_SYS_THREAD_SELFID */
}
-enum enum_sp_type
-{
- SP_TYPE_FUNCTION= 1,
- SP_TYPE_PROCEDURE,
- SP_TYPE_TRIGGER,
- SP_TYPE_EVENT
-};
-
#define CHANNEL_NAME_LENGTH MAX_CONNECTION_NAME
enum enum_mysql_show_scope
@@ -59,16 +92,6 @@ typedef enum enum_mysql_show_scope SHOW_SCOPE;
static inline char *my_stpnmov(char *dst, const char *src, size_t n)
{ return strnmov(dst, src, n); }
-class Gtid_specification: public rpl_gtid
-{
-public:
- size_t to_string(char *buf)
- {
- return my_snprintf(buf, GTID_MAX_STR_LENGTH, "%u-%u-%llu",
- domain_id, server_id, seq_no);
- }
-};
-
static inline size_t bin_to_hex_str(char *to, size_t to_len,
const char *from, size_t from_len)
{
@@ -83,8 +106,6 @@ static inline size_t bin_to_hex_str(char *to, size_t to_len,
return from_len * 2 + 1;
}
-enum enum_psi_status { PENDING = 0, GRANTED,
- PRE_ACQUIRE_NOTIFY, POST_RELEASE_NOTIFY };
+#define thd_get_psi(X) ((X)->get_psi())
-PSI_thread* thd_get_psi(THD *thd);
#endif
diff --git a/storage/perfschema/mysqld_thd_manager.cc b/storage/perfschema/mysqld_thd_manager.cc
new file mode 100644
index 00000000000..61282b7e024
--- /dev/null
+++ b/storage/perfschema/mysqld_thd_manager.cc
@@ -0,0 +1,39 @@
+#include "mysqld_thd_manager.h"
+#include "sql_class.h"
+
+static Global_THD_manager manager;
+Global_THD_manager* Global_THD_manager::get_instance()
+{
+ return &manager;
+}
+
+struct find_thd_arg
+{
+ Find_THD_Impl *func;
+ THD *cur;
+};
+
+static my_bool find_thd_cb(THD *tmp, find_thd_arg *arg)
+{
+ arg->cur= tmp;
+ return (*arg->func)(tmp);
+}
+
+THD* Global_THD_manager::find_thd(Find_THD_Impl *func)
+{
+ find_thd_arg arg= {func, NULL};
+ if (THD_list_iterator::iterator()->iterate(find_thd_cb, &arg))
+ return arg.cur;
+ return NULL;
+}
+
+static my_bool do_for_all_cb(THD *tmp, Do_THD_Impl *arg)
+{
+ (*arg)(tmp);
+ return 0;
+}
+
+void Global_THD_manager::do_for_all_thd(Do_THD_Impl *arg)
+{
+ THD_list_iterator::iterator()->iterate(do_for_all_cb, arg);
+}
diff --git a/storage/perfschema/mysqld_thd_manager.h b/storage/perfschema/mysqld_thd_manager.h
new file mode 100644
index 00000000000..fbb6f86a8c4
--- /dev/null
+++ b/storage/perfschema/mysqld_thd_manager.h
@@ -0,0 +1,29 @@
+#ifndef STORAGE_PERFSCHEMA_MYSQL_THD_MANAGER_INCLUDED
+#define STORAGE_PERFSCHEMA_MYSQL_THD_MANAGER_INCLUDED
+#include "my_global.h"
+#include "my_thread.h"
+
+class Find_THD_Impl
+{
+ public:
+ virtual ~Find_THD_Impl() {}
+ virtual bool operator()(THD *thd) = 0;
+};
+
+class Do_THD_Impl
+{
+ public:
+ virtual ~Do_THD_Impl() {}
+ virtual void operator()(THD*) = 0;
+};
+
+class Global_THD_manager
+{
+ public:
+ static Global_THD_manager* get_instance();
+ THD* find_thd(Find_THD_Impl *func);
+ void do_for_all_thd(Do_THD_Impl *arg);
+};
+
+ulong get_system_variable_hash_records(void);
+#endif
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index cc922d69d2c..c9d3c678d1a 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1468,6 +1468,7 @@ static enum_operation_type table_lock_operation_map[]=
OPERATION_TYPE_TL_READ_NO_INSERTS, /* PFS_TL_READ_NO_INSERT */
OPERATION_TYPE_TL_WRITE_ALLOW_WRITE, /* PFS_TL_WRITE_ALLOW_WRITE */
OPERATION_TYPE_TL_WRITE_CONCURRENT_INSERT, /* PFS_TL_WRITE_CONCURRENT_INSERT */
+ OPERATION_TYPE_TL_WRITE_DELAYED, /* PFS_TL_WRITE_DELAYED */
OPERATION_TYPE_TL_WRITE_LOW_PRIORITY, /* PFS_TL_WRITE_LOW_PRIORITY */
OPERATION_TYPE_TL_WRITE_NORMAL, /* PFS_TL_WRITE */
OPERATION_TYPE_TL_READ_EXTERNAL, /* PFS_TL_READ_EXTERNAL */
@@ -2963,6 +2964,8 @@ static inline PFS_TL_LOCK_TYPE lock_flags_to_lock_type(uint flags)
return PFS_TL_WRITE_ALLOW_WRITE;
case TL_WRITE_CONCURRENT_INSERT:
return PFS_TL_WRITE_CONCURRENT_INSERT;
+ case TL_WRITE_DELAYED:
+ return PFS_TL_WRITE_DELAYED;
case TL_WRITE_LOW_PRIORITY:
return PFS_TL_WRITE_LOW_PRIORITY;
case TL_WRITE:
@@ -4884,7 +4887,7 @@ pfs_start_stage_v1(PSI_stage_key key, const char *src_file, int src_line)
}
PSI_stage_progress*
-pfs_get_current_stage_progress_v1()
+pfs_get_current_stage_progress_v1(void)
{
PFS_thread *pfs_thread= my_thread_get_THR_PFS();
if (unlikely(pfs_thread == NULL))
@@ -5762,6 +5765,10 @@ static inline enum_object_type sp_type_to_object_type(uint sp_type)
return OBJECT_TYPE_FUNCTION;
case SP_TYPE_PROCEDURE:
return OBJECT_TYPE_PROCEDURE;
+ case SP_TYPE_PACKAGE:
+ return OBJECT_TYPE_PACKAGE;
+ case SP_TYPE_PACKAGE_BODY:
+ return OBJECT_TYPE_PACKAGE_BODY;
case SP_TYPE_TRIGGER:
return OBJECT_TYPE_TRIGGER;
case SP_TYPE_EVENT:
@@ -6389,8 +6396,8 @@ pfs_create_prepared_stmt_v1(void *identity, uint stmt_id,
PFS_prepared_stmt *pfs= create_prepared_stmt(identity,
pfs_thread, pfs_program,
pfs_stmt, stmt_id,
- stmt_name, stmt_name_length,
- sql_text, sql_text_length);
+ stmt_name, static_cast<uint>(stmt_name_length),
+ sql_text, static_cast<uint>(sql_text_length));
state->m_parent_prepared_stmt= reinterpret_cast<PSI_prepared_stmt*>(pfs);
state->m_in_prepare= true;
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 9d7a0afb783..b6090d064c9 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -548,7 +548,7 @@ void PFS_account::aggregate_status(PFS_user *safe_user, PFS_host *safe_host)
- GLOBAL_STATUS
*/
safe_user->m_status_stats.aggregate(& m_status_stats);
- m_status_stats.aggregate_to(& global_status_var);
+ //m_status_stats.aggregate_to(& global_status_var);
m_status_stats.reset();
return;
}
@@ -568,7 +568,7 @@ void PFS_account::aggregate_status(PFS_user *safe_user, PFS_host *safe_host)
Aggregate STATUS_BY_ACCOUNT to:
- GLOBAL_STATUS
*/
- m_status_stats.aggregate_to(& global_status_var);
+ //m_status_stats.aggregate_to(& global_status_var);
m_status_stats.reset();
return;
}
diff --git a/storage/perfschema/pfs_buffer_container.h b/storage/perfschema/pfs_buffer_container.h
index 911e030209a..141cbdf2999 100644
--- a/storage/perfschema/pfs_buffer_container.h
+++ b/storage/perfschema/pfs_buffer_container.h
@@ -88,7 +88,7 @@ public:
return NULL;
monotonic= PFS_atomic::add_u32(& m_monotonic.m_u32, 1);
- monotonic_max= monotonic + m_max;
+ monotonic_max= monotonic + static_cast<uint>(m_max);
while (monotonic < monotonic_max)
{
@@ -428,6 +428,7 @@ public:
{
m_allocator= allocator;
m_initialized= false;
+ m_lost= 0;
}
int init(long max_size)
@@ -979,7 +980,7 @@ private:
if (page == NULL)
{
- index= m_max;
+ index= static_cast<uint>(m_max);
return NULL;
}
@@ -991,7 +992,7 @@ private:
{
if (pfs->m_lock.is_populated())
{
- uint found= index_1 * PFS_PAGE_SIZE + (pfs - pfs_first);
+ uint found= index_1 * PFS_PAGE_SIZE + static_cast<uint>(pfs - pfs_first);
*found_index= found;
index= found + 1;
return pfs;
@@ -1003,7 +1004,7 @@ private:
index_2= 0;
}
- index= m_max;
+ index= static_cast<uint>(m_max);
return NULL;
}
diff --git a/storage/perfschema/pfs_builtin_memory.cc b/storage/perfschema/pfs_builtin_memory.cc
index 6955f1a8ec3..676a9094976 100644
--- a/storage/perfschema/pfs_builtin_memory.cc
+++ b/storage/perfschema/pfs_builtin_memory.cc
@@ -118,7 +118,7 @@ static void init_builtin_memory_class(PFS_builtin_memory_class *klass, const cha
klass->m_class.m_event_name_index= 0;
my_snprintf(klass->m_class.m_name, sizeof(klass->m_class.m_name), "%.*s",
PFS_MAX_INFO_NAME_LENGTH - 1, name);
- klass->m_class.m_name_length= strlen(name);
+ klass->m_class.m_name_length= static_cast<uint>(strlen(name));
DBUG_ASSERT(klass->m_class.m_name_length < sizeof(klass->m_class.m_name));
klass->m_class.m_timer= NULL;
diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h
index b47f9ab938f..e4577fdb22e 100644
--- a/storage/perfschema/pfs_column_types.h
+++ b/storage/perfschema/pfs_column_types.h
@@ -161,33 +161,34 @@ enum enum_operation_type
OPERATION_TYPE_TL_READ_NO_INSERTS= 39,
OPERATION_TYPE_TL_WRITE_ALLOW_WRITE= 40,
OPERATION_TYPE_TL_WRITE_CONCURRENT_INSERT= 41,
- OPERATION_TYPE_TL_WRITE_LOW_PRIORITY= 42,
- OPERATION_TYPE_TL_WRITE_NORMAL= 43,
- OPERATION_TYPE_TL_READ_EXTERNAL= 44,
- OPERATION_TYPE_TL_WRITE_EXTERNAL= 45,
+ OPERATION_TYPE_TL_WRITE_DELAYED= 42,
+ OPERATION_TYPE_TL_WRITE_LOW_PRIORITY= 43,
+ OPERATION_TYPE_TL_WRITE_NORMAL= 44,
+ OPERATION_TYPE_TL_READ_EXTERNAL= 45,
+ OPERATION_TYPE_TL_WRITE_EXTERNAL= 46,
/* Socket operations */
- OPERATION_TYPE_SOCKETCREATE = 46,
- OPERATION_TYPE_SOCKETCONNECT = 47,
- OPERATION_TYPE_SOCKETBIND = 48,
- OPERATION_TYPE_SOCKETCLOSE = 49,
- OPERATION_TYPE_SOCKETSEND = 50,
- OPERATION_TYPE_SOCKETRECV = 51,
- OPERATION_TYPE_SOCKETSENDTO = 52,
- OPERATION_TYPE_SOCKETRECVFROM = 53,
- OPERATION_TYPE_SOCKETSENDMSG = 54,
- OPERATION_TYPE_SOCKETRECVMSG = 55,
- OPERATION_TYPE_SOCKETSEEK = 56,
- OPERATION_TYPE_SOCKETOPT = 57,
- OPERATION_TYPE_SOCKETSTAT = 58,
- OPERATION_TYPE_SOCKETSHUTDOWN = 59,
- OPERATION_TYPE_SOCKETSELECT = 60,
+ OPERATION_TYPE_SOCKETCREATE = 47,
+ OPERATION_TYPE_SOCKETCONNECT = 48,
+ OPERATION_TYPE_SOCKETBIND = 49,
+ OPERATION_TYPE_SOCKETCLOSE = 50,
+ OPERATION_TYPE_SOCKETSEND = 51,
+ OPERATION_TYPE_SOCKETRECV = 52,
+ OPERATION_TYPE_SOCKETSENDTO = 53,
+ OPERATION_TYPE_SOCKETRECVFROM = 54,
+ OPERATION_TYPE_SOCKETSENDMSG = 55,
+ OPERATION_TYPE_SOCKETRECVMSG = 56,
+ OPERATION_TYPE_SOCKETSEEK = 57,
+ OPERATION_TYPE_SOCKETOPT = 58,
+ OPERATION_TYPE_SOCKETSTAT = 59,
+ OPERATION_TYPE_SOCKETSHUTDOWN = 60,
+ OPERATION_TYPE_SOCKETSELECT = 61,
/* Idle operation */
- OPERATION_TYPE_IDLE= 61,
+ OPERATION_TYPE_IDLE= 62,
/* Metadata lock operation */
- OPERATION_TYPE_METADATA= 62
+ OPERATION_TYPE_METADATA= 63
};
/** Integer, first value of @sa enum_operation_type. */
#define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK))
@@ -203,7 +204,7 @@ enum enum_object_type
{
NO_OBJECT_TYPE= 0,
- /* Advertised in SQL ENUM */
+ /* Advertised in SQL ENUM (see table_setup_object.cc) */
OBJECT_TYPE_EVENT= 1,
OBJECT_TYPE_FUNCTION= 2,
@@ -214,17 +215,16 @@ enum enum_object_type
/* Not advertised in SQL ENUM, only displayed as VARCHAR */
OBJECT_TYPE_TEMPORARY_TABLE= 6,
- OBJECT_TYPE_GLOBAL= 7,
+ OBJECT_TYPE_BACKUP= 7,
OBJECT_TYPE_SCHEMA= 8,
- OBJECT_TYPE_COMMIT= 9,
- OBJECT_TYPE_USER_LEVEL_LOCK= 10,
- OBJECT_TYPE_TABLESPACE= 11,
- OBJECT_TYPE_LOCKING_SERVICE= 12
+ OBJECT_TYPE_PACKAGE= 9,
+ OBJECT_TYPE_PACKAGE_BODY= 10,
+ OBJECT_TYPE_USER_LEVEL_LOCK= 11,
};
/** Integer, first value of @sa enum_object_type. */
#define FIRST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_EVENT))
/** Integer, last value of @sa enum_object_type. */
-#define LAST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_LOCKING_SERVICE))
+#define LAST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_USER_LEVEL_LOCK))
/** Integer, number of values of @sa enum_object_type. */
#define COUNT_OBJECT_TYPE (LAST_OBJECT_TYPE - FIRST_OBJECT_TYPE + 1)
@@ -268,13 +268,13 @@ enum enum_transaction_state
#define COUNT_TRANS_STATE (LAST_TRANS_STATE - FIRST_TRANS_STATE + 1)
/**
- Enum values for XA transaction state columns. Enums 1-5 match those used by
+ Enum values for XA transaction state columns. Enums 0-3 match those used by
the server. See XID_STATE::enum xa_states in xa.h.
*/
enum enum_xa_transaction_state
{
- TRANS_STATE_XA_NOTR,
- TRANS_STATE_XA_ACTIVE,
+ TRANS_STATE_XA_NOTR=-1,
+ TRANS_STATE_XA_ACTIVE=0,
TRANS_STATE_XA_IDLE,
TRANS_STATE_XA_PREPARED,
TRANS_STATE_XA_ROLLBACK_ONLY,
diff --git a/storage/perfschema/pfs_config.h.cmake b/storage/perfschema/pfs_config.h.cmake
new file mode 100644
index 00000000000..0dc29da72d9
--- /dev/null
+++ b/storage/perfschema/pfs_config.h.cmake
@@ -0,0 +1,4 @@
+#cmakedefine HAVE_PTHREAD_THREADID_NP 1
+#cmakedefine HAVE_SYS_GETTID 1
+#cmakedefine HAVE_PTHREAD_GETTHREADID_NP 1
+#cmakedefine HAVE_INTEGER_PTHREAD_SELF 1
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 98028e38024..b9f79fa61d6 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -310,14 +310,16 @@ static PFS_engine_table_share *all_shares[]=
&table_table_handles::m_share,
&table_metadata_locks::m_share,
+#ifdef HAVE_REPLICATION
&table_replication_connection_configuration::m_share,
- &table_replication_group_members::m_share,
- &table_replication_connection_status::m_share,
+ //&table_replication_group_members::m_share,
+ //&table_replication_connection_status::m_share,
&table_replication_applier_configuration::m_share,
&table_replication_applier_status::m_share,
&table_replication_applier_status_by_coordinator::m_share,
- &table_replication_applier_status_by_worker::m_share,
- &table_replication_group_member_stats::m_share,
+ //&table_replication_applier_status_by_worker::m_share,
+ //&table_replication_group_member_stats::m_share,
+#endif
&table_prepared_stmt_instances::m_share,
@@ -329,9 +331,9 @@ static PFS_engine_table_share *all_shares[]=
&table_global_status::m_share,
&table_session_status::m_share,
- &table_variables_by_thread::m_share,
- &table_global_variables::m_share,
- &table_session_variables::m_share,
+ //&table_variables_by_thread::m_share,
+ //&table_global_variables::m_share,
+ //&table_session_variables::m_share,
NULL
};
@@ -597,7 +599,7 @@ void PFS_engine_table::set_field_blob(Field *f, const char* val,
{
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_BLOB);
Field_blob *f2= (Field_blob*) f;
- f2->store(val, len, &my_charset_utf8_bin);
+ f2->store(val, len, &my_charset_utf8mb3_bin);
}
void PFS_engine_table::set_field_enum(Field *f, ulonglong value)
@@ -765,7 +767,7 @@ PFS_readonly_acl::check(privilege_t want_access, privilege_t *save_priv) const
PFS_readonly_world_acl pfs_readonly_world_acl;
ACL_internal_access_result
-PFS_readonly_world_acl::check(ulong want_access, ulong *save_priv) const
+PFS_readonly_world_acl::check(privilege_t want_access, privilege_t *save_priv) const
{
ACL_internal_access_result res= PFS_readonly_acl::check(want_access, save_priv);
if (res == ACL_INTERNAL_ACCESS_CHECK_GRANT)
@@ -796,7 +798,7 @@ PFS_truncatable_acl::check(privilege_t want_access, privilege_t *save_priv) cons
PFS_truncatable_world_acl pfs_truncatable_world_acl;
ACL_internal_access_result
-PFS_truncatable_world_acl::check(ulong want_access, ulong *save_priv) const
+PFS_truncatable_world_acl::check(privilege_t want_access, privilege_t *save_priv) const
{
ACL_internal_access_result res= PFS_truncatable_acl::check(want_access, save_priv);
if (res == ACL_INTERNAL_ACCESS_CHECK_GRANT)
diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h
index b751d48a38f..89b723b08d7 100644
--- a/storage/perfschema/pfs_engine_table.h
+++ b/storage/perfschema/pfs_engine_table.h
@@ -432,7 +432,7 @@ public:
~PFS_readonly_world_acl()
{}
- virtual ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
+ virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const;
};
@@ -451,7 +451,7 @@ public:
~PFS_truncatable_world_acl()
{}
- virtual ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
+ virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const;
};
diff --git a/storage/perfschema/pfs_events.h b/storage/perfschema/pfs_events.h
index 47c4c9280e6..6d4a28936ff 100644
--- a/storage/perfschema/pfs_events.h
+++ b/storage/perfschema/pfs_events.h
@@ -41,6 +41,8 @@ struct PFS_events
ulonglong m_event_id;
/** END_EVENT_ID. */
ulonglong m_end_event_id;
+ /** (EVENT_TYPE) */
+ enum_event_type m_event_type;
/** NESTING_EVENT_ID. */
ulonglong m_nesting_event_id;
/** NESTING_EVENT_TYPE */
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index 570e1c9b71e..87e43459d00 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -88,6 +88,8 @@ struct PFS_events_waits : public PFS_events
PFS_metadata_lock *m_weak_metadata_lock;
/** For weak pointers, target object version. */
uint32 m_weak_version;
+ /** Address in memory of the object instance waited on. */
+ const void *m_object_instance_addr;
/** Operation performed. */
enum_operation_type m_operation;
/**
@@ -101,6 +103,8 @@ struct PFS_events_waits : public PFS_events
This member is populated for TABLE IO operations only.
*/
uint m_index;
+ /** Flags */
+ ulong m_flags;
};
/** TIMED bit in the state flags bitfield. */
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 728c503ec4e..335087443a5 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -95,6 +95,8 @@ LF_HASH filename_hash;
/** True if filename_hash is initialized. */
static bool filename_hash_inited= false;
+my_bool show_compatibility_56= 0;
+
/**
Initialize all the instruments instance buffers.
@param param sizing parameters
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index 1a6a8b86f03..491dd5bacea 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -779,10 +779,10 @@ create_table_share_index_stat(const TABLE_SHARE *server_share, uint server_index
else
{
KEY *key_info= server_share->key_info + server_index;
- size_t len= strlen(key_info->name);
+ size_t len= key_info->name.length;
- memcpy(pfs->m_key.m_name, key_info->name, len);
- pfs->m_key.m_name_length= len;
+ memcpy(pfs->m_key.m_name, key_info->name.str, len);
+ pfs->m_key.m_name_length= static_cast<uint>(len);
}
/* Reset the stats. */
@@ -1785,8 +1785,8 @@ search:
{
lookup_setup_object(thread,
OBJECT_TYPE_TABLE,
- schema_name, schema_name_length,
- table_name, table_name_length,
+ schema_name, static_cast<uint>(schema_name_length),
+ table_name, static_cast<uint>(table_name_length),
&enabled, &timed);
/*
Even when enabled is false, a record is added in the dictionary:
@@ -1801,9 +1801,9 @@ search:
{
pfs->m_key= key;
pfs->m_schema_name= &pfs->m_key.m_hash_key[1];
- pfs->m_schema_name_length= schema_name_length;
+ pfs->m_schema_name_length= static_cast<uint>(schema_name_length);
pfs->m_table_name= &pfs->m_key.m_hash_key[schema_name_length + 2];
- pfs->m_table_name_length= table_name_length;
+ pfs->m_table_name_length= static_cast<uint>(table_name_length);
pfs->m_enabled= enabled;
pfs->m_timed= timed;
pfs->init_refcount();
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index 836c64ec992..3730e61ced7 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -228,20 +228,6 @@ struct pfs_lock
}
/**
- Initialize a lock to dirty.
- */
- void set_dirty(pfs_dirty_state *copy_ptr)
- {
- /* Do not set the version to 0, read the previous value. */
- uint32 copy= PFS_atomic::load_u32(&m_version_state);
- /* Increment the version, set the DIRTY state */
- uint32 new_val= (copy & VERSION_MASK) + VERSION_INC + PFS_LOCK_DIRTY;
- PFS_atomic::store_u32(&m_version_state, new_val);
-
- copy_ptr->m_version_state= new_val;
- }
-
- /**
Execute a dirty to free transition.
This transition should be executed by the writer that owns the record.
*/
diff --git a/storage/perfschema/pfs_program.cc b/storage/perfschema/pfs_program.cc
index e8808b0b63a..8e6d02c761c 100644
--- a/storage/perfschema/pfs_program.cc
+++ b/storage/perfschema/pfs_program.cc
@@ -146,7 +146,7 @@ static void set_program_key(PFS_program_key *key,
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= static_cast<uint>(ptr - &key->m_hash_key[0]);
}
diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h
index 8667a5f691c..e3e06760eb6 100644
--- a/storage/perfschema/pfs_stat.h
+++ b/storage/perfschema/pfs_stat.h
@@ -620,17 +620,18 @@ enum PFS_TL_LOCK_TYPE
PFS_TL_READ_NO_INSERT= 3,
PFS_TL_WRITE_ALLOW_WRITE= 4,
PFS_TL_WRITE_CONCURRENT_INSERT= 5,
- PFS_TL_WRITE_LOW_PRIORITY= 6,
- PFS_TL_WRITE= 7,
+ PFS_TL_WRITE_DELAYED= 6,
+ PFS_TL_WRITE_LOW_PRIORITY= 7,
+ PFS_TL_WRITE= 8,
/* Locks for handler::ha_external_lock() */
- PFS_TL_READ_EXTERNAL= 8,
- PFS_TL_WRITE_EXTERNAL= 9,
+ PFS_TL_READ_EXTERNAL= 9,
+ PFS_TL_WRITE_EXTERNAL= 10,
PFS_TL_NONE= 99
};
-#define COUNT_PFS_TL_LOCK_TYPE 10
+#define COUNT_PFS_TL_LOCK_TYPE 11
/** Statistics for table locks. */
struct PFS_table_lock_stat
diff --git a/storage/perfschema/pfs_status.cc b/storage/perfschema/pfs_status.cc
index 61afcbfccd9..2007d191d13 100644
--- a/storage/perfschema/pfs_status.cc
+++ b/storage/perfschema/pfs_status.cc
@@ -64,7 +64,7 @@ void PFS_status_stats::aggregate(const PFS_status_stats *from)
void PFS_status_stats::aggregate_from(const STATUS_VAR *from)
{
- ulonglong *from_var= (ulonglong*) from;
+ ulong *from_var= (ulong*) from;
m_has_stats= true;
for (int i= 0;
@@ -79,7 +79,7 @@ void PFS_status_stats::aggregate_to(STATUS_VAR *to)
{
if (m_has_stats)
{
- ulonglong *to_var= (ulonglong*) to;
+ ulong *to_var= (ulong*) to;
for (int i= 0;
i < COUNT_GLOBAL_STATUS_VARS;
diff --git a/storage/perfschema/pfs_status.h b/storage/perfschema/pfs_status.h
index 0417976e9f2..6b35a162982 100644
--- a/storage/perfschema/pfs_status.h
+++ b/storage/perfschema/pfs_status.h
@@ -38,7 +38,7 @@ struct PFS_status_stats
void aggregate_to(STATUS_VAR *to);
bool m_has_stats;
- ulonglong m_stats[COUNT_GLOBAL_STATUS_VARS];
+ ulong m_stats[COUNT_GLOBAL_STATUS_VARS];
};
void reset_status_by_thread();
diff --git a/storage/perfschema/pfs_variable.cc b/storage/perfschema/pfs_variable.cc
index 933d6ad6ce6..3654dba2936 100644
--- a/storage/perfschema/pfs_variable.cc
+++ b/storage/perfschema/pfs_variable.cc
@@ -84,7 +84,7 @@ bool PFS_system_variable_cache::init_show_var_array(enum_var_type scope, bool st
DBUG_ASSERT(!m_initialized);
m_query_scope= scope;
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
DEBUG_SYNC(m_current_thd, "acquired_LOCK_system_variables_hash");
/* Record the system variable hash version to detect subsequent changes. */
@@ -96,7 +96,7 @@ bool PFS_system_variable_cache::init_show_var_array(enum_var_type scope, bool st
for (int i=0; vars[i].name; i++)
m_show_var_array.set(i, vars[i]);
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
/* Increase cache size if necessary. */
m_cache.reserve(m_show_var_array.elements());
@@ -152,8 +152,8 @@ bool PFS_system_variable_cache::match_scope(int scope)
*/
int PFS_system_variable_cache::do_materialize_global(void)
{
- /* Block plugins from unloading. */
- mysql_mutex_lock(&LOCK_plugin_delete);
+ /* Block system variable additions or deletions. */
+ mysql_mutex_lock(&LOCK_global_system_variables);
m_materialized= false;
@@ -213,7 +213,7 @@ int PFS_system_variable_cache::do_materialize_global(void)
}
m_materialized= true;
- mysql_mutex_unlock(&LOCK_plugin_delete);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
return 0;
}
@@ -247,38 +247,11 @@ int PFS_system_variable_cache::do_materialize_all(THD *unsafe_thd)
for (SHOW_VAR *show_var= m_show_var_array.front();
show_var->value && (show_var != m_show_var_array.end()); show_var++)
{
- const char* name= show_var->name;
sys_var *value= (sys_var *)show_var->value;
DBUG_ASSERT(value);
- bool ignore= false;
- if (value->scope() == sys_var::SESSION &&
- (!my_strcasecmp(system_charset_info, name, "gtid_executed")))
- {
- /*
- GTID_EXECUTED is:
- - declared in sys_vars.cc as both GLOBAL and SESSION in 5.7
- - can be read with @@session.gtid_executed
-
- When show_compatibility_56 = ON,
- - SHOW SESSION VARIABLES does expose a row for GTID_EXECUTED
- - INFORMATION_SCHEMA.SESSION_VARIABLES also does expose a row,
- both are for backward compatibility of existing applications,
- so that no application logic change is required.
-
- Now, with show_compatibility_56 = OFF (aka, in this code)
- - SHOW SESSION VARIABLES does -- not -- expose a row for GTID_EXECUTED
- - PERFORMANCE_SCHEMA.SESSION_VARIABLES also does -- not -- expose a row
- so that a clean interface is exposed to (upgraded and modified)
- applications.
-
- This special case needs be removed once @@SESSION.GTID_EXECUTED is
- deprecated.
- */
- ignore= true;
- }
/* Resolve value, convert to text, add to cache. */
- System_variable system_var(m_safe_thd, show_var, m_query_scope, ignore);
+ System_variable system_var(m_safe_thd, show_var, m_query_scope, false);
m_cache.push(system_var);
}
@@ -303,7 +276,7 @@ void PFS_system_variable_cache::set_mem_root(void)
init_sql_alloc(PSI_INSTRUMENT_ME, &m_mem_sysvar, SYSVAR_MEMROOT_BLOCK_SIZE, 0, 0);
m_mem_sysvar_ptr= &m_mem_sysvar;
}
- m_mem_thd= my_thread_get_THR_MALLOC(); /* pointer to current THD mem_root */
+ m_mem_thd= &current_thd->mem_root; /* pointer to current THD mem_root */
m_mem_thd_save= *m_mem_thd; /* restore later */
*m_mem_thd= &m_mem_sysvar; /* use temporary mem_root */
}
@@ -376,18 +349,8 @@ int PFS_system_variable_cache::do_materialize_session(PFS_thread *pfs_thread)
/* Match the system variable scope to the target scope. */
if (match_scope(value->scope()))
{
- const char* name= show_var->name;
- bool ignore= false;
-
- if (value->scope() == sys_var::SESSION &&
- (!my_strcasecmp(system_charset_info, name, "gtid_executed")))
- {
- /* Deprecated. See PFS_system_variable_cache::do_materialize_all. */
-#warning no @@gtid_executed in MariaDB
- ignore= true;
- }
/* Resolve value, convert to text, add to cache. */
- System_variable system_var(m_safe_thd, show_var, m_query_scope, ignore);
+ System_variable system_var(m_safe_thd, show_var, m_query_scope, false);
m_cache.push(system_var);
}
}
@@ -439,18 +402,9 @@ int PFS_system_variable_cache::do_materialize_session(PFS_thread *pfs_thread, ui
/* Match the system variable scope to the target scope. */
if (match_scope(value->scope()))
{
- const char* name= show_var->name;
- bool ignore= false;
-
- if (value->scope() == sys_var::SESSION &&
- (!my_strcasecmp(system_charset_info, name, "gtid_executed")))
- {
- /* Deprecated. See PFS_system_variable_cache::do_materialize_all. */
- ignore= true;
- }
/* Resolve value, convert to text, add to cache. */
- System_variable system_var(m_safe_thd, show_var, m_query_scope, ignore);
- m_cache.push_back(system_var);
+ System_variable system_var(m_safe_thd, show_var, m_query_scope, false);
+ m_cache.push(system_var);
}
}
@@ -499,17 +453,8 @@ int PFS_system_variable_cache::do_materialize_session(THD *unsafe_thd)
/* Match the system variable scope to the target scope. */
if (match_scope(value->scope()))
{
- const char* name= show_var->name;
- bool ignore= false;
-
- if (value->scope() == sys_var::SESSION &&
- (!my_strcasecmp(system_charset_info, name, "gtid_executed")))
- {
- /* Deprecated. See PFS_system_variable_cache::do_materialize_all. */
- ignore= true;
- }
/* Resolve value, convert to text, add to cache. */
- System_variable system_var(m_safe_thd, show_var, m_query_scope, ignore);
+ System_variable system_var(m_safe_thd, show_var, m_query_scope, false);
m_cache.push(system_var);
}
}
@@ -575,13 +520,11 @@ void System_variable::init(THD *target_thd, const SHOW_VAR *show_var,
return;
}
- THD *current_thread= current_thd;
-
/* Block remote target thread from updating this system variable. */
+ /*XXX
+ THD *current_thread= current_thd;
if (target_thd != current_thread)
- /*XXX mysql_mutex_lock(&target_thd->LOCK_thd_sysvar)*/;
- /* Block system variable additions or deletions. */
- mysql_mutex_lock(&LOCK_global_system_variables);
+ mysql_mutex_lock(&target_thd->LOCK_thd_sysvar);*/
sys_var *system_var= (sys_var *)show_var->value;
DBUG_ASSERT(system_var != NULL);
@@ -591,8 +534,9 @@ void System_variable::init(THD *target_thd, const SHOW_VAR *show_var,
/* Get the value of the system variable. */
String buf(m_value_str, sizeof(m_value_str) - 1, system_charset_info);
- system_var->val_str_nolock(&buf, target_thd,
- system_var->value_ptr(target_thd, query_scope, &null_lex_str));
+ if (!system_var->val_str_nolock(&buf, target_thd,
+ system_var->value_ptr(target_thd, query_scope, &null_clex_str)))
+ buf.length(0);
m_value_length= MY_MIN(buf.length(), SHOW_VAR_FUNC_BUFF_SIZE);
@@ -601,9 +545,9 @@ void System_variable::init(THD *target_thd, const SHOW_VAR *show_var,
memcpy(m_value_str, buf.ptr(), m_value_length);
m_value_str[m_value_length]= 0;
- mysql_mutex_unlock(&LOCK_global_system_variables);
+ /*XXX
if (target_thd != current_thread)
- /*XXX mysql_mutex_unlock(&target_thd->LOCK_thd_sysvar)*/;
+ mysql_mutex_unlock(&target_thd->LOCK_thd_sysvar);*/
m_initialized= true;
}
@@ -1283,9 +1227,11 @@ void Status_variable::init(const SHOW_VAR *show_var, STATUS_VAR *status_vars, en
m_type= show_var->type;
/* Get the value of the status variable. */
- char *value= m_value_str;
- m_value_length= get_one_variable(status_vars, m_type, show_var->value, &value);
+ const char *value;
+ value= get_one_variable(current_thd, show_var, query_scope, m_type,
+ status_vars, &m_charset, m_value_str, &m_value_length);
m_value_length= MY_MIN(m_value_length, SHOW_VAR_FUNC_BUFF_SIZE);
+ m_charset= system_charset_info;
/* Returned value may reference a string other than m_value_str. */
if (value != m_value_str)
diff --git a/storage/perfschema/pfs_variable.h b/storage/perfschema/pfs_variable.h
index eefca5612ea..bfe51c6d1b3 100644
--- a/storage/perfschema/pfs_variable.h
+++ b/storage/perfschema/pfs_variable.h
@@ -114,7 +114,7 @@
*/
/* Iteration on THD from the sql layer. */
-//#include "mysqld_thd_manager.h"
+#include "mysqld_thd_manager.h"
#define PFS_VAR
/* Class sys_var */
#include "set_var.h"
@@ -125,7 +125,6 @@
#include "pfs_user.h"
#include "pfs_host.h"
#include "pfs_account.h"
-#include "my_thread.h"
/* Global array of all server and plugin-defined status variables. */
extern DYNAMIC_ARRAY all_status_vars;
@@ -200,7 +199,7 @@ private:
/**
CLASS Find_THD_variable - Get and lock a validated THD from the thread manager.
*/
-class Find_THD_variable //: public Find_THD_Impl
+class Find_THD_variable : public Find_THD_Impl
{
public:
Find_THD_variable() : m_unsafe_thd(NULL) {}
@@ -236,12 +235,12 @@ public:
m_current_thd(current_thd),
m_pfs_thread(NULL),
m_pfs_client(NULL),
- //m_thd_finder(),
- m_cache(PSI_INSTRUMENT_MEM, 200, 50),
+ m_thd_finder(),
+ m_cache(PSI_INSTRUMENT_MEM),
m_initialized(false),
m_external_init(external_init),
m_materialized(false),
- m_show_var_array(PSI_INSTRUMENT_MEM, 200, 50),
+ m_show_var_array(PSI_INSTRUMENT_MEM),
m_version(0),
m_query_scope(OPT_DEFAULT),
m_use_mem_root(false),
@@ -413,7 +412,7 @@ protected:
PFS_client *m_pfs_client;
/* Callback for thread iterator. */
- //Find_THD_variable m_thd_finder;
+ Find_THD_variable m_thd_finder;
/* Cache of materialized variables. */
Variable_array m_cache;
@@ -447,7 +446,6 @@ protected:
};
-#if 0
/**
Required implementation for pure virtual destructor of a template class.
*/
@@ -592,7 +590,6 @@ int PFS_variable_cache<Var_type>::materialize_session(PFS_thread *pfs_thread, ui
return do_materialize_session(pfs_thread, index);
}
-#endif
/**
CLASS PFS_system_variable_cache - System variable cache.
@@ -716,3 +713,4 @@ void sum_account_status(PFS_client *pfs_account, STATUS_VAR *status_totals);
/** @} */
#endif
+
diff --git a/storage/perfschema/pfs_visitor.cc b/storage/perfschema/pfs_visitor.cc
index 713139ef935..638877d8755 100644
--- a/storage/perfschema/pfs_visitor.cc
+++ b/storage/perfschema/pfs_visitor.cc
@@ -30,6 +30,8 @@
#include "pfs_account.h"
#include "pfs_buffer_container.h"
+#include "mysqld_thd_manager.h"
+
/**
@file storage/perfschema/pfs_visitor.cc
Visitors (implementation).
@@ -1366,7 +1368,7 @@ void PFS_connection_status_visitor::visit_global()
{
/* NOTE: Requires lock on LOCK_status. */
mysql_mutex_assert_owner(&LOCK_status);
- add_to_status(m_status_vars, &global_status_var, false);
+ add_to_status(m_status_vars, &global_status_var);
}
void PFS_connection_status_visitor::visit_host(PFS_host *pfs)
@@ -1390,7 +1392,7 @@ void PFS_connection_status_visitor::visit_thread(PFS_thread *pfs)
void PFS_connection_status_visitor::visit_THD(THD *thd)
{
- add_to_status(m_status_vars, &thd->status_var, false);
+ add_to_status(m_status_vars, &thd->status_var);
}
diff --git a/storage/perfschema/rpl_gtid.h b/storage/perfschema/rpl_gtid.h
new file mode 100644
index 00000000000..6d9ecb0ea5f
--- /dev/null
+++ b/storage/perfschema/rpl_gtid.h
@@ -0,0 +1,17 @@
+#ifndef STORAGE_PERFSCHEMA_RPL_GTID_INCLUDED
+#define STORAGE_PERFSCHEMA_RPL_GTID_INCLUDED
+
+struct TABLE;
+
+#include "../../sql/rpl_gtid.h"
+
+class Gtid_specification: public rpl_gtid
+{
+public:
+ size_t to_string(char *buf)
+ {
+ return my_snprintf(buf, GTID_MAX_STR_LENGTH, "%u-%u-%llu",
+ domain_id, server_id, seq_no);
+ }
+};
+#endif
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index 24c2ff4ff74..c3667f061fd 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -91,7 +91,7 @@ table_events_statements_current::m_share=
"NO_GOOD_INDEX_USED BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
- "NESTING_EVENT_LEVEL INT unsigned)") },
+ "NESTING_EVENT_LEVEL INT)") },
false /* perpetual */
};
@@ -149,7 +149,7 @@ table_events_statements_history::m_share=
"NO_GOOD_INDEX_USED BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
- "NESTING_EVENT_LEVEL INT unsigned)") },
+ "NESTING_EVENT_LEVEL INT)") },
false /* perpetual */
};
@@ -207,7 +207,7 @@ table_events_statements_history_long::m_share=
"NO_GOOD_INDEX_USED BIGINT unsigned not null,"
"NESTING_EVENT_ID BIGINT unsigned,"
"NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
- "NESTING_EVENT_LEVEL INT unsigned)") },
+ "NESTING_EVENT_LEVEL INT)") },
false /* perpetual */
};
@@ -489,7 +489,7 @@ int table_events_statements_common::read_row_values(TABLE *table,
f->set_null();
break;
case 19: /* MESSAGE_TEXT */
- len= strlen(m_row.m_message_text);
+ len= static_cast<uint>(strlen(m_row.m_message_text));
if (len)
set_field_varchar_utf8(f, m_row.m_message_text, len);
else
@@ -868,7 +868,7 @@ int table_events_statements_history_long::rnd_next(void)
return HA_ERR_END_OF_FILE;
if (events_statements_history_long_full)
- limit= events_statements_history_long_size;
+ limit= static_cast<uint>(events_statements_history_long_size);
else
limit= events_statements_history_long_index.m_u32 % events_statements_history_long_size;
@@ -899,7 +899,7 @@ int table_events_statements_history_long::rnd_pos(const void *pos)
set_position(pos);
if (events_statements_history_long_full)
- limit= events_statements_history_long_size;
+ limit= static_cast<uint>(events_statements_history_long_size);
else
limit= events_statements_history_long_index.m_u32 % events_statements_history_long_size;
diff --git a/storage/perfschema/table_events_transactions.cc b/storage/perfschema/table_events_transactions.cc
index 31d146fa11a..1d717979a2f 100644
--- a/storage/perfschema/table_events_transactions.cc
+++ b/storage/perfschema/table_events_transactions.cc
@@ -229,7 +229,7 @@ void table_events_transactions_common::make_row(PFS_events_transactions *transac
*/
//rpl_sid *sid= &transaction->m_sid;
Gtid_specification *gtid_spec= &transaction->m_gtid_spec;
- m_row.m_gtid_length= gtid_spec->to_string(m_row.m_gtid);
+ m_row.m_gtid_length= static_cast<uint>(gtid_spec->to_string(m_row.m_gtid));
m_row.m_xid= transaction->m_xid;
m_row.m_isolation_level= transaction->m_isolation_level;
@@ -259,7 +259,7 @@ static const ulong XID_BUFFER_SIZE= XIDDATASIZE*2 + 2 + 1;
@param length number of bytes to process
@return number of bytes in hex string
*/
-static uint xid_to_hex(char *buf, size_t buf_len, PSI_xid *xid, size_t offset, size_t length)
+static size_t xid_to_hex(char *buf, size_t buf_len, PSI_xid *xid, size_t offset, size_t length)
{
DBUG_ASSERT(buf_len >= XID_BUFFER_SIZE);
DBUG_ASSERT(offset + length <= XIDDATASIZE);
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index ae2dde9b39c..aa73344fff7 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -302,7 +302,7 @@ int table_events_waits_common::make_socket_object_columns(PFS_events_waits *wait
size_t port_len= int10_to_str(port, (port_str+1), 10) - port_str + 1;
/* OBJECT NAME */
- m_row.m_object_name_length= ip_length + port_len;
+ m_row.m_object_name_length= ip_length + static_cast<uint>(port_len);
if (unlikely((m_row.m_object_name_length == 0) ||
(m_row.m_object_name_length > sizeof(m_row.m_object_name))))
@@ -333,11 +333,12 @@ int table_events_waits_common::make_metadata_lock_object_columns(PFS_events_wait
if (safe_metadata_lock->get_version() == wait->m_weak_version)
{
MDL_key *mdl= & safe_metadata_lock->m_mdl_key;
+ MDL_key user_lock_workaround;
switch(mdl->mdl_namespace())
{
- case MDL_key::GLOBAL:
- m_row.m_object_type= "GLOBAL";
+ case MDL_key::BACKUP:
+ m_row.m_object_type= "BACKUP";
m_row.m_object_type_length= 6;
m_row.m_object_schema_length= 0;
m_row.m_object_name_length= 0;
@@ -366,6 +367,12 @@ int table_events_waits_common::make_metadata_lock_object_columns(PFS_events_wait
m_row.m_object_schema_length= mdl->db_name_length();
m_row.m_object_name_length= mdl->name_length();
break;
+ case MDL_key::PACKAGE_BODY:
+ m_row.m_object_type= "PACKAGE_BODY";
+ m_row.m_object_type_length= 12;
+ m_row.m_object_schema_length= mdl->db_name_length();
+ m_row.m_object_name_length= mdl->name_length();
+ break;
case MDL_key::TRIGGER:
m_row.m_object_type= "TRIGGER";
m_row.m_object_type_length= 7;
@@ -378,32 +385,14 @@ int table_events_waits_common::make_metadata_lock_object_columns(PFS_events_wait
m_row.m_object_schema_length= mdl->db_name_length();
m_row.m_object_name_length= mdl->name_length();
break;
- case MDL_key::COMMIT:
- m_row.m_object_type= "COMMIT";
- m_row.m_object_type_length= 6;
- m_row.m_object_schema_length= 0;
- m_row.m_object_name_length= 0;
- break;
case MDL_key::USER_LOCK:
m_row.m_object_type= "USER LEVEL LOCK";
m_row.m_object_type_length= 15;
+ user_lock_workaround.mdl_key_init(MDL_key::USER_LOCK, "", mdl->db_name());
+ mdl=& user_lock_workaround;
m_row.m_object_schema_length= 0;
m_row.m_object_name_length= mdl->name_length();
break;
-#if 0
- case MDL_key::TABLESPACE:
- m_row.m_object_type= "TABLESPACE";
- m_row.m_object_type_length= 10;
- m_row.m_object_schema_length= 0;
- m_row.m_object_name_length= mdl->name_length();
- break;
- case MDL_key::LOCKING_SERVICE:
- m_row.m_object_type= "LOCKING SERVICE";
- m_row.m_object_type_length= 15;
- m_row.m_object_schema_length= mdl->db_name_length();
- m_row.m_object_name_length= mdl->name_length();
- break;
-#endif
case MDL_key::NAMESPACE_END:
default:
m_row.m_object_type_length= 0;
@@ -621,6 +610,7 @@ static const LEX_STRING operation_names_map[]=
{ C_STRING_WITH_LEN("read no inserts") },
{ C_STRING_WITH_LEN("write allow write") },
{ C_STRING_WITH_LEN("write concurrent insert") },
+ { C_STRING_WITH_LEN("write delayed") },
{ C_STRING_WITH_LEN("write low priority") },
{ C_STRING_WITH_LEN("write normal") },
{ C_STRING_WITH_LEN("read external") },
diff --git a/storage/perfschema/table_global_variables.cc b/storage/perfschema/table_global_variables.cc
index 9e8c1af2ece..117e06e36bf 100644
--- a/storage/perfschema/table_global_variables.cc
+++ b/storage/perfschema/table_global_variables.cc
@@ -61,9 +61,9 @@ table_global_variables::create(void)
ha_rows table_global_variables::get_row_count(void)
{
mysql_mutex_lock(&LOCK_plugin_delete);
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
ha_rows system_var_count= get_system_variable_hash_records();
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
mysql_mutex_unlock(&LOCK_plugin_delete);
return system_var_count;
}
diff --git a/storage/perfschema/table_helper.cc b/storage/perfschema/table_helper.cc
index 749e15a7113..55b1397143e 100644
--- a/storage/perfschema/table_helper.cc
+++ b/storage/perfschema/table_helper.cc
@@ -226,10 +226,11 @@ int PFS_object_row::make_row(PFS_program *pfs)
int PFS_object_row::make_row(const MDL_key *mdl)
{
+ MDL_key user_lock_workaround;
switch(mdl->mdl_namespace())
{
- case MDL_key::GLOBAL:
- m_object_type= OBJECT_TYPE_GLOBAL;
+ case MDL_key::BACKUP:
+ m_object_type= OBJECT_TYPE_BACKUP;
m_schema_name_length= 0;
m_object_name_length= 0;
break;
@@ -253,6 +254,11 @@ int PFS_object_row::make_row(const MDL_key *mdl)
m_schema_name_length= mdl->db_name_length();
m_object_name_length= mdl->name_length();
break;
+ case MDL_key::PACKAGE_BODY:
+ m_object_type= OBJECT_TYPE_PACKAGE_BODY;
+ m_schema_name_length= mdl->db_name_length();
+ m_object_name_length= mdl->name_length();
+ break;
case MDL_key::TRIGGER:
m_object_type= OBJECT_TYPE_TRIGGER;
m_schema_name_length= mdl->db_name_length();
@@ -263,28 +269,13 @@ int PFS_object_row::make_row(const MDL_key *mdl)
m_schema_name_length= mdl->db_name_length();
m_object_name_length= mdl->name_length();
break;
- case MDL_key::COMMIT:
- m_object_type= OBJECT_TYPE_COMMIT;
- m_schema_name_length= 0;
- m_object_name_length= 0;
- break;
case MDL_key::USER_LOCK:
m_object_type= OBJECT_TYPE_USER_LEVEL_LOCK;
+ user_lock_workaround.mdl_key_init(MDL_key::USER_LOCK, "", mdl->db_name());
+ mdl=& user_lock_workaround;
m_schema_name_length= 0;
m_object_name_length= mdl->name_length();
break;
-#if 0
- case MDL_key::TABLESPACE:
- m_object_type= OBJECT_TYPE_TABLESPACE;
- m_schema_name_length= 0;
- m_object_name_length= mdl->name_length();
- break;
- case MDL_key::LOCKING_SERVICE:
- m_object_type= OBJECT_TYPE_LOCKING_SERVICE;
- m_schema_name_length= mdl->db_name_length();
- m_object_name_length= mdl->name_length();
- break;
-#endif
case MDL_key::NAMESPACE_END:
default:
m_object_type= NO_OBJECT_TYPE;
@@ -550,24 +541,18 @@ void set_field_object_type(Field *f, enum_object_type object_type)
case OBJECT_TYPE_TRIGGER:
PFS_engine_table::set_field_varchar_utf8(f, "TRIGGER", 7);
break;
- case OBJECT_TYPE_GLOBAL:
- PFS_engine_table::set_field_varchar_utf8(f, "GLOBAL", 6);
+ case OBJECT_TYPE_BACKUP:
+ PFS_engine_table::set_field_varchar_utf8(f, "BACKUP", 6);
break;
case OBJECT_TYPE_SCHEMA:
PFS_engine_table::set_field_varchar_utf8(f, "SCHEMA", 6);
break;
- case OBJECT_TYPE_COMMIT:
- PFS_engine_table::set_field_varchar_utf8(f, "COMMIT", 6);
+ case OBJECT_TYPE_PACKAGE_BODY:
+ PFS_engine_table::set_field_varchar_utf8(f, "PACKAGE BODY", 12);
break;
case OBJECT_TYPE_USER_LEVEL_LOCK:
PFS_engine_table::set_field_varchar_utf8(f, "USER LEVEL LOCK", 15);
break;
- case OBJECT_TYPE_TABLESPACE:
- PFS_engine_table::set_field_varchar_utf8(f, "TABLESPACE", 10);
- break;
- case OBJECT_TYPE_LOCKING_SERVICE:
- PFS_engine_table::set_field_varchar_utf8(f, "LOCKING SERVICE", 15);
- break;
case NO_OBJECT_TYPE:
default:
DBUG_ASSERT(false);
@@ -618,40 +603,96 @@ void set_field_lock_type(Field *f, PFS_TL_LOCK_TYPE lock_type)
}
}
-void set_field_mdl_type(Field *f, opaque_mdl_type mdl_type)
+void set_field_mdl_type(Field *f, opaque_mdl_type mdl_type, bool backup)
{
- enum_mdl_type e= (enum_mdl_type) mdl_type;
- switch (e)
+ if (backup)
{
- case MDL_INTENTION_EXCLUSIVE:
- PFS_engine_table::set_field_varchar_utf8(f, "INTENTION_EXCLUSIVE", 19);
- break;
- case MDL_SHARED:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED", 6);
- break;
- case MDL_SHARED_HIGH_PRIO:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_HIGH_PRIO", 16);
- break;
- case MDL_SHARED_READ:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_READ", 11);
- break;
- case MDL_SHARED_WRITE:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_WRITE", 12);
- break;
- case MDL_SHARED_UPGRADABLE:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_UPGRADABLE", 17);
- break;
- case MDL_SHARED_NO_WRITE:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_NO_WRITE", 15);
- break;
- case MDL_SHARED_NO_READ_WRITE:
- PFS_engine_table::set_field_varchar_utf8(f, "SHARED_NO_READ_WRITE", 20);
- break;
- case MDL_EXCLUSIVE:
- PFS_engine_table::set_field_varchar_utf8(f, "EXCLUSIVE", 9);
- break;
- default:
- DBUG_ASSERT(false);
+ switch (mdl_type)
+ {
+ case MDL_BACKUP_START:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_START"));
+ break;
+ case MDL_BACKUP_FLUSH:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_FLUSH"));
+ break;
+ case MDL_BACKUP_WAIT_FLUSH:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_WAIT_FLUSH"));
+ break;
+ case MDL_BACKUP_WAIT_DDL:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_WAIT_DDL"));
+ break;
+ case MDL_BACKUP_WAIT_COMMIT:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_WAIT_COMMIT"));
+ break;
+ case MDL_BACKUP_FTWRL1:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_FTWRL1"));
+ break;
+ case MDL_BACKUP_FTWRL2:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_FTWRL2"));
+ break;
+ case MDL_BACKUP_DML:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_DML"));
+ break;
+ case MDL_BACKUP_TRANS_DML:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_TRANS_DML"));
+ break;
+ case MDL_BACKUP_SYS_DML:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_SYS_DML"));
+ break;
+ case MDL_BACKUP_DDL:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_DDL"));
+ break;
+ case MDL_BACKUP_BLOCK_DDL:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_BLOCK_DDL"));
+ break;
+ case MDL_BACKUP_ALTER_COPY:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_ALTER_COPY"));
+ break;
+ case MDL_BACKUP_COMMIT:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_COMMIT"));
+ break;
+ case MDL_BACKUP_END:
+ PFS_engine_table::set_field_varchar_utf8(f, STRING_WITH_LEN("BACKUP_END"));
+ break;
+ default:
+ DBUG_ASSERT(false);
+ }
+ }
+ else
+ {
+ enum_mdl_type e= (enum_mdl_type) mdl_type;
+ switch (e)
+ {
+ case MDL_INTENTION_EXCLUSIVE:
+ PFS_engine_table::set_field_varchar_utf8(f, "INTENTION_EXCLUSIVE", 19);
+ break;
+ case MDL_SHARED:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED", 6);
+ break;
+ case MDL_SHARED_HIGH_PRIO:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_HIGH_PRIO", 16);
+ break;
+ case MDL_SHARED_READ:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_READ", 11);
+ break;
+ case MDL_SHARED_WRITE:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_WRITE", 12);
+ break;
+ case MDL_SHARED_UPGRADABLE:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_UPGRADABLE", 17);
+ break;
+ case MDL_SHARED_NO_WRITE:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_NO_WRITE", 15);
+ break;
+ case MDL_SHARED_NO_READ_WRITE:
+ PFS_engine_table::set_field_varchar_utf8(f, "SHARED_NO_READ_WRITE", 20);
+ break;
+ case MDL_EXCLUSIVE:
+ PFS_engine_table::set_field_varchar_utf8(f, "EXCLUSIVE", 9);
+ break;
+ default:
+ DBUG_ASSERT(false);
+ }
}
}
@@ -677,19 +718,19 @@ void set_field_mdl_duration(Field *f, opaque_mdl_duration mdl_duration)
void set_field_mdl_status(Field *f, opaque_mdl_status mdl_status)
{
- enum_psi_status e= static_cast<enum_psi_status>(mdl_status);
+ MDL_ticket::enum_psi_status e= static_cast<MDL_ticket::enum_psi_status>(mdl_status);
switch (e)
{
- case PENDING:
+ case MDL_ticket::PENDING:
PFS_engine_table::set_field_varchar_utf8(f, "PENDING", 7);
break;
- case GRANTED:
+ case MDL_ticket::GRANTED:
PFS_engine_table::set_field_varchar_utf8(f, "GRANTED", 7);
break;
- case PRE_ACQUIRE_NOTIFY:
+ case MDL_ticket::PRE_ACQUIRE_NOTIFY:
PFS_engine_table::set_field_varchar_utf8(f, "PRE_ACQUIRE_NOTIFY", 18);
break;
- case POST_RELEASE_NOTIFY:
+ case MDL_ticket::POST_RELEASE_NOTIFY:
PFS_engine_table::set_field_varchar_utf8(f, "POST_RELEASE_NOTIFY", 19);
break;
default:
@@ -798,7 +839,7 @@ void PFS_variable_name_row::make_row(const char* str, size_t length)
DBUG_ASSERT(length <= sizeof(m_str));
DBUG_ASSERT(length <= NAME_CHAR_LEN);
- m_length= MY_MIN(length, NAME_CHAR_LEN); /* enforce max name length */
+ m_length= MY_MIN(static_cast<uint>(length), NAME_CHAR_LEN); /* enforce max name length */
if (m_length > 0)
memcpy(m_str, str, length);
m_str[m_length]= '\0';
@@ -822,7 +863,7 @@ void PFS_variable_value_row::make_row(const CHARSET_INFO *cs, const char* str, s
{
memcpy(m_str, str, length);
}
- m_length= length;
+ m_length= static_cast<uint>(length);
m_charset= cs;
}
diff --git a/storage/perfschema/table_helper.h b/storage/perfschema/table_helper.h
index bf431802900..3ce74648360 100644
--- a/storage/perfschema/table_helper.h
+++ b/storage/perfschema/table_helper.h
@@ -349,6 +349,7 @@ struct PFS_table_lock_stat_row
PFS_stat_row m_read_external;
PFS_stat_row m_write_allow_write;
PFS_stat_row m_write_concurrent_insert;
+ PFS_stat_row m_write_delayed;
PFS_stat_row m_write_low_priority;
PFS_stat_row m_write_normal;
PFS_stat_row m_write_external;
@@ -374,12 +375,14 @@ struct PFS_table_lock_stat_row
m_write_allow_write.set(normalizer, & stat->m_stat[PFS_TL_WRITE_ALLOW_WRITE]);
m_write_concurrent_insert.set(normalizer, & stat->m_stat[PFS_TL_WRITE_CONCURRENT_INSERT]);
+ m_write_delayed.set(normalizer, & stat->m_stat[PFS_TL_WRITE_DELAYED]);
m_write_low_priority.set(normalizer, & stat->m_stat[PFS_TL_WRITE_LOW_PRIORITY]);
m_write_normal.set(normalizer, & stat->m_stat[PFS_TL_WRITE]);
m_write_external.set(normalizer, & stat->m_stat[PFS_TL_WRITE_EXTERNAL]);
all_write.aggregate(& stat->m_stat[PFS_TL_WRITE_ALLOW_WRITE]);
all_write.aggregate(& stat->m_stat[PFS_TL_WRITE_CONCURRENT_INSERT]);
+ all_write.aggregate(& stat->m_stat[PFS_TL_WRITE_DELAYED]);
all_write.aggregate(& stat->m_stat[PFS_TL_WRITE_LOW_PRIORITY]);
all_write.aggregate(& stat->m_stat[PFS_TL_WRITE]);
all_write.aggregate(& stat->m_stat[PFS_TL_WRITE_EXTERNAL]);
@@ -555,7 +558,7 @@ struct PFS_connection_stat_row
void set_field_object_type(Field *f, enum_object_type object_type);
void set_field_lock_type(Field *f, PFS_TL_LOCK_TYPE lock_type);
-void set_field_mdl_type(Field *f, opaque_mdl_type mdl_type);
+void set_field_mdl_type(Field *f, opaque_mdl_type mdl_type, bool backup);
void set_field_mdl_duration(Field *f, opaque_mdl_duration mdl_duration);
void set_field_mdl_status(Field *f, opaque_mdl_status mdl_status);
void set_field_isolation_level(Field *f, enum_isolation_level iso_level);
diff --git a/storage/perfschema/table_md_locks.cc b/storage/perfschema/table_md_locks.cc
index 1f771e105d6..9f78750e89b 100644
--- a/storage/perfschema/table_md_locks.cc
+++ b/storage/perfschema/table_md_locks.cc
@@ -173,7 +173,7 @@ int table_metadata_locks::read_row_values(TABLE *table,
set_field_ulonglong(f, (intptr) m_row.m_identity);
break;
case 4: /* LOCK_TYPE */
- set_field_mdl_type(f, m_row.m_mdl_type);
+ set_field_mdl_type(f, m_row.m_mdl_type, m_row.m_object.m_object_type == OBJECT_TYPE_BACKUP);
break;
case 5: /* LOCK_DURATION */
set_field_mdl_duration(f, m_row.m_mdl_duration);
diff --git a/storage/perfschema/table_replication_applier_configuration.cc b/storage/perfschema/table_replication_applier_configuration.cc
index cb5dfd05e69..06de6c6e141 100644
--- a/storage/perfschema/table_replication_applier_configuration.cc
+++ b/storage/perfschema/table_replication_applier_configuration.cc
@@ -26,7 +26,7 @@
Table replication_applier_configuration (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_applier_configuration.h"
@@ -39,6 +39,7 @@
#include "sql_parse.h"
//#include "rpl_msr.h" /* Multisource replication */
+#ifdef HAVE_REPLICATION
THR_LOCK table_replication_applier_configuration::m_table_lock;
PFS_engine_table_share
@@ -101,7 +102,7 @@ int table_replication_applier_configuration::rnd_next(void)
{
make_row(mi);
m_next_pos.set_after(&m_pos);
- channel_map.unlock();
+ mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
}
@@ -138,7 +139,7 @@ void table_replication_applier_configuration::make_row(Master_info *mi)
mysql_mutex_lock(&mi->data_lock);
mysql_mutex_lock(&mi->rli.data_lock);
- m_row.channel_name_length= mi->connection_name.length;
+ m_row.channel_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_name_length);
m_row.desired_delay= 0; //mi->rli->get_sql_delay();
@@ -190,3 +191,4 @@ int table_replication_applier_configuration::read_row_values(TABLE *table,
}
return 0;
}
+#endif
diff --git a/storage/perfschema/table_replication_applier_status.cc b/storage/perfschema/table_replication_applier_status.cc
index b6d06ff442c..7083d3ac3b9 100644
--- a/storage/perfschema/table_replication_applier_status.cc
+++ b/storage/perfschema/table_replication_applier_status.cc
@@ -26,9 +26,11 @@
Table replication_applier_status (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
+
+#ifdef HAVE_REPLICATION
#include "table_replication_applier_status.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
@@ -138,7 +140,7 @@ void table_replication_applier_status::make_row(Master_info *mi)
DBUG_ASSERT(mi != NULL);
- m_row.channel_name_length= mi->connection_name.length;
+ m_row.channel_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_name_length);
//mysql_mutex_lock(&mi->rli->info_thd_lock);
@@ -217,3 +219,4 @@ int table_replication_applier_status::read_row_values(TABLE *table,
}
return 0;
}
+#endif
diff --git a/storage/perfschema/table_replication_applier_status_by_coordinator.cc b/storage/perfschema/table_replication_applier_status_by_coordinator.cc
index 5201bdc6de8..beb8620b240 100644
--- a/storage/perfschema/table_replication_applier_status_by_coordinator.cc
+++ b/storage/perfschema/table_replication_applier_status_by_coordinator.cc
@@ -26,9 +26,11 @@
Table replication_applier_status_by_coordinator (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
+
+#ifdef HAVE_REPLICATION
#include "table_replication_applier_status_by_coordinator.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
@@ -114,7 +116,7 @@ int table_replication_applier_status_by_coordinator::rnd_next(void)
{
make_row(mi);
m_next_pos.set_after(&m_pos);
- channel_map.unlock();
+ mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
}
@@ -150,7 +152,7 @@ void table_replication_applier_status_by_coordinator::make_row(Master_info *mi)
mysql_mutex_lock(&mi->rli.data_lock);
- m_row.channel_name_length= mi->connection_name.length;
+ m_row.channel_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_name_length);
if (mi->rli.slave_running)
@@ -183,7 +185,7 @@ void table_replication_applier_status_by_coordinator::make_row(Master_info *mi)
if (m_row.last_error_number)
{
char *temp_store= (char*) mi->rli.last_error().message;
- m_row.last_error_message_length= strlen(temp_store);
+ m_row.last_error_message_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.last_error_message, temp_store,
m_row.last_error_message_length);
@@ -244,3 +246,4 @@ int table_replication_applier_status_by_coordinator
}
return 0;
}
+#endif
diff --git a/storage/perfschema/table_replication_applier_status_by_worker.cc b/storage/perfschema/table_replication_applier_status_by_worker.cc
index 65a1e277805..4c7ca612e0b 100644
--- a/storage/perfschema/table_replication_applier_status_by_worker.cc
+++ b/storage/perfschema/table_replication_applier_status_by_worker.cc
@@ -26,7 +26,7 @@
Table replication_applier_status_by_worker (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_applier_status_by_worker.h"
diff --git a/storage/perfschema/table_replication_connection_configuration.cc b/storage/perfschema/table_replication_connection_configuration.cc
index 219d6b8259c..6d358240332 100644
--- a/storage/perfschema/table_replication_connection_configuration.cc
+++ b/storage/perfschema/table_replication_connection_configuration.cc
@@ -26,7 +26,7 @@
Table replication_connection_configuration (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_connection_configuration.h"
@@ -39,6 +39,7 @@
#include "sql_parse.h"
//#include "rpl_msr.h" /* Multisource replciation */
+#ifdef HAVE_REPLICATION
THR_LOCK table_replication_connection_configuration::m_table_lock;
PFS_engine_table_share
@@ -123,7 +124,7 @@ int table_replication_connection_configuration::rnd_next(void)
{
make_row(mi);
m_next_pos.set_after(&m_pos);
- channel_map.unlock();
+ mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
}
@@ -163,21 +164,21 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
mysql_mutex_lock(&mi->data_lock);
mysql_mutex_lock(&mi->rli.data_lock);
- m_row.channel_name_length= mi->connection_name.length;
+ m_row.channel_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_name_length);
- m_row.host_length= strlen(mi->host);
+ m_row.host_length= static_cast<uint>(strlen(mi->host));
memcpy(m_row.host, mi->host, m_row.host_length);
m_row.port= (unsigned int) mi->port;
/* can't the user be NULL? */
temp_store= (char*)mi->user;
- m_row.user_length= strlen(temp_store);
+ m_row.user_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.user, temp_store, m_row.user_length);
temp_store= const_cast<char*>(""); //(char*)mi->bind_addr;
- m_row.network_interface_length= strlen(temp_store);
+ m_row.network_interface_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.network_interface, temp_store, m_row.network_interface_length);
if (mi->using_gtid)
@@ -192,23 +193,23 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
#endif
temp_store= (char*)mi->ssl_ca;
- m_row.ssl_ca_file_length= strlen(temp_store);
+ m_row.ssl_ca_file_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_ca_file, temp_store, m_row.ssl_ca_file_length);
temp_store= (char*)mi->ssl_capath;
- m_row.ssl_ca_path_length= strlen(temp_store);
+ m_row.ssl_ca_path_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_ca_path, temp_store, m_row.ssl_ca_path_length);
temp_store= (char*)mi->ssl_cert;
- m_row.ssl_certificate_length= strlen(temp_store);
+ m_row.ssl_certificate_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_certificate, temp_store, m_row.ssl_certificate_length);
temp_store= (char*)mi->ssl_cipher;
- m_row.ssl_cipher_length= strlen(temp_store);
+ m_row.ssl_cipher_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_cipher, temp_store, m_row.ssl_cipher_length);
temp_store= (char*)mi->ssl_key;
- m_row.ssl_key_length= strlen(temp_store);
+ m_row.ssl_key_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_key, temp_store, m_row.ssl_key_length);
if (mi->ssl_verify_server_cert)
@@ -217,11 +218,11 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
m_row.ssl_verify_server_certificate= PS_RPL_NO;
temp_store= (char*)mi->ssl_crl;
- m_row.ssl_crl_file_length= strlen(temp_store);
+ m_row.ssl_crl_file_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_crl_file, temp_store, m_row.ssl_crl_file_length);
temp_store= (char*)mi->ssl_crlpath;
- m_row.ssl_crl_path_length= strlen(temp_store);
+ m_row.ssl_crl_path_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.ssl_crl_path, temp_store, m_row.ssl_crl_path_length);
m_row.connection_retry_interval= (unsigned int) mi->connect_retry;
@@ -231,7 +232,7 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
m_row.heartbeat_interval= (double)mi->heartbeat_period;
temp_store= (char*)""; //mi->tls_version;
- m_row.tls_version_length= strlen(temp_store);
+ m_row.tls_version_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.tls_version, temp_store, m_row.tls_version_length);
mysql_mutex_unlock(&mi->rli.data_lock);
@@ -329,3 +330,4 @@ int table_replication_connection_configuration::read_row_values(TABLE *table,
}
return 0;
}
+#endif
diff --git a/storage/perfschema/table_replication_connection_status.cc b/storage/perfschema/table_replication_connection_status.cc
index eb1d3c8ef71..a4230913917 100644
--- a/storage/perfschema/table_replication_connection_status.cc
+++ b/storage/perfschema/table_replication_connection_status.cc
@@ -26,7 +26,7 @@
Table replication_connection_status (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_connection_status.h"
diff --git a/storage/perfschema/table_replication_group_member_stats.cc b/storage/perfschema/table_replication_group_member_stats.cc
index 9c7f61817d1..f85a3e3f099 100644
--- a/storage/perfschema/table_replication_group_member_stats.cc
+++ b/storage/perfschema/table_replication_group_member_stats.cc
@@ -26,7 +26,7 @@
Table replication_group_member_stats (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_group_member_stats.h"
diff --git a/storage/perfschema/table_replication_group_members.cc b/storage/perfschema/table_replication_group_members.cc
index d86052d687f..5967b98c7cc 100644
--- a/storage/perfschema/table_replication_group_members.cc
+++ b/storage/perfschema/table_replication_group_members.cc
@@ -26,7 +26,7 @@
Table replication_group_members (implementation).
*/
-#define HAVE_REPLICATION
+//#define HAVE_REPLICATION
#include "my_global.h"
#include "table_replication_group_members.h"
diff --git a/storage/perfschema/table_session_variables.cc b/storage/perfschema/table_session_variables.cc
index f293af4a1cf..3ed1314535e 100644
--- a/storage/perfschema/table_session_variables.cc
+++ b/storage/perfschema/table_session_variables.cc
@@ -61,9 +61,9 @@ table_session_variables::create(void)
ha_rows table_session_variables::get_row_count(void)
{
mysql_mutex_lock(&LOCK_plugin_delete);
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
ha_rows system_var_count= get_system_variable_hash_records();
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
mysql_mutex_unlock(&LOCK_plugin_delete);
return system_var_count;
}
diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc
index 5004dbc7c16..dae9c80e6eb 100644
--- a/storage/perfschema/table_setup_actors.cc
+++ b/storage/perfschema/table_setup_actors.cc
@@ -53,8 +53,8 @@ table_setup_actors::m_share=
"HOST CHAR(60) collate utf8_bin default '%' not null,"
"USER CHAR(" USERNAME_CHAR_LENGTH_STR ") collate utf8_bin default '%' not null,"
"ROLE CHAR(16) collate utf8_bin default '%' not null,"
- "ENABLED ENUM('YES', 'NO') not null,"
- "HISTORY ENUM('YES', 'NO') not null)") },
+ "ENABLED ENUM('YES', 'NO') not null default 'YES',"
+ "HISTORY ENUM('YES', 'NO') not null default 'YES')") },
false /* perpetual */
};
diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc
index 23d4bcaab0f..cccbd64f803 100644
--- a/storage/perfschema/table_setup_objects.cc
+++ b/storage/perfschema/table_setup_objects.cc
@@ -51,8 +51,7 @@ table_setup_objects::m_share=
sizeof(PFS_simple_index),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE setup_objects("
- "OBJECT_TYPE ENUM ('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER') not null default 'EVENT',"
-
+ "OBJECT_TYPE ENUM ('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER') not null default 'TABLE',"
"OBJECT_SCHEMA VARCHAR(64) default '%',"
"OBJECT_NAME VARCHAR(64) not null default '%',"
"ENABLED ENUM ('YES', 'NO') not null default 'YES',"
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index e43a9943fc6..d5656ea261e 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -82,7 +82,7 @@ PFS_engine_table* table_setup_timers::create(void)
{
THD *thd = current_thd;
push_warning_printf(thd,
- Sql_condition::SL_WARNING,
+ Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
"performance_schema.setup_timers");
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index 0b004c17c24..37bb6fd074a 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -27,34 +27,6 @@
#include "pfs_instr_class.h"
#include "pfs_instr.h"
-static const LEX_CSTRING vio_type_names[] =
-{
- { STRING_WITH_LEN("Error") }, // cannot happen
- { STRING_WITH_LEN("TCP/IP") },
- { STRING_WITH_LEN("Socket") },
- { STRING_WITH_LEN("Named Pipe") },
- { STRING_WITH_LEN("SSL/TLS") },
- { STRING_WITH_LEN("Shared Memory") }
-};
-
-static void get_vio_type_name(enum enum_vio_type vio_type, const char **str, int *len)
-{
- int index;
-
- if ((vio_type >= FIRST_VIO_TYPE) && (vio_type <= LAST_VIO_TYPE))
- {
- index= vio_type;
- }
- else
- {
- index= 0;
- }
- *str= vio_type_names[index].str;
- *len= vio_type_names[index].length;
- return;
-}
-
-
THR_LOCK table_threads::m_table_lock;
PFS_engine_table_share
@@ -84,7 +56,7 @@ table_threads::m_share=
"ROLE VARCHAR(64),"
"INSTRUMENTED ENUM ('YES', 'NO') not null,"
"HISTORY ENUM ('YES', 'NO') not null,"
- "CONNECTION_TYPE VARCHAR(16)"
+ "CONNECTION_TYPE VARCHAR(16),"
"THREAD_OS_ID BIGINT unsigned)") },
false /* perpetual */
};
@@ -324,7 +296,7 @@ int table_threads::read_row_values(TABLE *table,
set_field_enum(f, m_row.m_history ? ENUM_YES : ENUM_NO);
break;
case 15: /* CONNECTION_TYPE */
- get_vio_type_name(m_row.m_connection_type, & str, & len);
+ str= vio_type_name(m_row.m_connection_type, & len);
if (len > 0)
set_field_varchar_utf8(f, str, (uint)len);
else
diff --git a/storage/perfschema/table_tlws_by_table.cc b/storage/perfschema/table_tlws_by_table.cc
index 0b0758469d7..8f4bc2aea84 100644
--- a/storage/perfschema/table_tlws_by_table.cc
+++ b/storage/perfschema/table_tlws_by_table.cc
@@ -103,6 +103,11 @@ table_tlws_by_table::m_share=
"MIN_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
"AVG_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
"MAX_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
+ "COUNT_WRITE_DELAYED BIGINT unsigned not null,"
+ "SUM_TIMER_WRITE_DELAYED BIGINT unsigned not null,"
+ "MIN_TIMER_WRITE_DELAYED BIGINT unsigned not null,"
+ "AVG_TIMER_WRITE_DELAYED BIGINT unsigned not null,"
+ "MAX_TIMER_WRITE_DELAYED BIGINT unsigned not null,"
"COUNT_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
"SUM_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
"MIN_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
@@ -405,51 +410,67 @@ int table_tlws_by_table::read_row_values(TABLE *table,
set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_max);
break;
- case 53: /* COUNT_WRITE_LOW_PRIORITY */
+ case 53: /* COUNT_WRITE_DELAYED */
+ set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_count);
+ break;
+ case 54: /* SUM_TIMER_WRITE_DELAYED */
+ set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_sum);
+ break;
+ case 55: /* MIN_TIMER_WRITE_DELAYED */
+ set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_min);
+ break;
+ case 56: /* AVG_TIMER_WRITE_DELAYED */
+ set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_avg);
+ break;
+ case 57: /* MAX_TIMER_WRITE_DELAYED */
+ set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_max);
+ break;
+
+ case 58: /* COUNT_WRITE_LOW_PRIORITY */
set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_count);
break;
- case 54: /* SUM_TIMER_WRITE_LOW_PRIORITY */
+ case 59: /* SUM_TIMER_WRITE_LOW_PRIORITY */
set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_sum);
break;
- case 55: /* MIN_TIMER_WRITE_LOW_PRIORITY */
+ case 60: /* MIN_TIMER_WRITE_LOW_PRIORITY */
set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_min);
break;
- case 56: /* AVG_TIMER_WRITE_LOW_PRIORITY */
+ case 61: /* AVG_TIMER_WRITE_LOW_PRIORITY */
set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_avg);
break;
- case 57: /* MAX_TIMER_WRITE_LOW_PRIORITY */
+ case 62: /* MAX_TIMER_WRITE_LOW_PRIORITY */
set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_max);
break;
- case 58: /* COUNT_WRITE_NORMAL */
+ case 63: /* COUNT_WRITE_NORMAL */
set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_count);
break;
- case 59: /* SUM_TIMER_WRITE_NORMAL */
+ case 64: /* SUM_TIMER_WRITE_NORMAL */
set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_sum);
break;
- case 60: /* MIN_TIMER_WRITE_NORMAL */
+ case 65: /* MIN_TIMER_WRITE_NORMAL */
set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_min);
break;
- case 61: /* AVG_TIMER_WRITE_NORMAL */
+ case 66: /* AVG_TIMER_WRITE_NORMAL */
set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_avg);
break;
- case 62: /* MAX_TIMER_WRITE_NORMAL */
+ case 67: /* MAX_TIMER_WRITE_NORMAL */
set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_max);
break;
- case 63: /* COUNT_WRITE_EXTERNAL */
+ case 68: /* COUNT_WRITE_EXTERNAL */
set_field_ulonglong(f, m_row.m_stat.m_write_external.m_count);
break;
- case 64: /* SUM_TIMER_WRITE_EXTERNAL */
+ case 69: /* SUM_TIMER_WRITE_EXTERNAL */
set_field_ulonglong(f, m_row.m_stat.m_write_external.m_sum);
break;
- case 65: /* MIN_TIMER_WRITE_EXTERNAL */
+ case 70: /* MIN_TIMER_WRITE_EXTERNAL */
set_field_ulonglong(f, m_row.m_stat.m_write_external.m_min);
break;
- case 66: /* AVG_TIMER_WRITE_EXTERNAL */
+ case 71: /* AVG_TIMER_WRITE_EXTERNAL */
set_field_ulonglong(f, m_row.m_stat.m_write_external.m_avg);
break;
- case 67: /* MAX_TIMER_WRITE_EXTERNAL */
+ case 72: /* MAX_TIMER_WRITE_EXTERNAL */
set_field_ulonglong(f, m_row.m_stat.m_write_external.m_max);
break;
diff --git a/storage/perfschema/table_uvar_by_thread.cc b/storage/perfschema/table_uvar_by_thread.cc
index 724fc9271d1..77764c002cc 100644
--- a/storage/perfschema/table_uvar_by_thread.cc
+++ b/storage/perfschema/table_uvar_by_thread.cc
@@ -37,9 +37,9 @@
/* Iteration on THD from the sql layer. */
#include "sql_class.h"
-//#include "mysqld_thd_manager.h"
+#include "mysqld_thd_manager.h"
-class Find_thd_user_var //: public Find_THD_Impl
+class Find_thd_user_var : public Find_THD_Impl
{
public:
Find_thd_user_var(THD *unsafe_thd)
@@ -244,7 +244,7 @@ int table_uvar_by_thread::materialize(PFS_thread *thread)
return 1;
Find_thd_user_var finder(unsafe_thd);
- THD *safe_thd= NULL;//Global_THD_manager::get_instance()->find_thd(&finder);
+ THD *safe_thd= Global_THD_manager::get_instance()->find_thd(&finder);
if (safe_thd == NULL)
return 1;
@@ -311,7 +311,7 @@ int table_uvar_by_thread
{
set_field_blob(f,
m_row.m_variable_value->get_value(),
- m_row.m_variable_value->get_value_length());
+ static_cast<uint>(m_row.m_variable_value->get_value_length()));
}
else
{
diff --git a/storage/perfschema/table_uvar_by_thread.h b/storage/perfschema/table_uvar_by_thread.h
index 8d7beace481..a7334b2bdfe 100644
--- a/storage/perfschema/table_uvar_by_thread.h
+++ b/storage/perfschema/table_uvar_by_thread.h
@@ -70,6 +70,8 @@ public:
{
m_pfs= NULL;
m_thread_internal_id= 0;
+ for (uint i=0; i < m_array.elements(); i++)
+ m_array.at(i).~User_variable();
m_array.clear();
}
diff --git a/storage/perfschema/table_variables_by_thread.cc b/storage/perfschema/table_variables_by_thread.cc
index 0e1c1021635..b43c6cd88ef 100644
--- a/storage/perfschema/table_variables_by_thread.cc
+++ b/storage/perfschema/table_variables_by_thread.cc
@@ -49,7 +49,7 @@ table_variables_by_thread::m_share=
{ C_STRING_WITH_LEN("CREATE TABLE user_variables_by_thread("
"THREAD_ID BIGINT unsigned not null,"
"VARIABLE_NAME VARCHAR(64) not null,"
- "VARIABLE_VALUE LONGBLOB)") },
+ "VARIABLE_VALUE VARCHAR(1024))") },
true /* perpetual */
};
@@ -62,9 +62,9 @@ table_variables_by_thread::create(void)
ha_rows table_variables_by_thread::get_row_count(void)
{
mysql_mutex_lock(&LOCK_plugin_delete);
- mysql_rwlock_rdlock(&LOCK_system_variables_hash);
+ mysql_prlock_rdlock(&LOCK_system_variables_hash);
ulong system_var_count= get_system_variable_hash_records();
- mysql_rwlock_unlock(&LOCK_system_variables_hash);
+ mysql_prlock_unlock(&LOCK_system_variables_hash);
mysql_mutex_unlock(&LOCK_plugin_delete);
return (global_thread_container.get_row_count() * system_var_count);
}
diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc
index 31894223e89..5a855b2c147 100644
--- a/storage/perfschema/unittest/pfs_server_stubs.cc
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -30,7 +30,6 @@
#include "sql_class.h"
#include "sql_show.h"
-my_bool show_compatibility_56= FALSE;
struct system_status_var global_status_var;
struct sql_digest_storage;
diff --git a/storage/perfschema/unittest/stub_global_status_var.h b/storage/perfschema/unittest/stub_global_status_var.h
index bfb06b4e0d5..c870b863331 100644
--- a/storage/perfschema/unittest/stub_global_status_var.h
+++ b/storage/perfschema/unittest/stub_global_status_var.h
@@ -26,6 +26,6 @@
#include <string.h>
-void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, bool reset_from_var)
+void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
{
}