summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/CMakeLists.txt5
-rw-r--r--storage/perfschema/ha_perfschema.cc33
-rw-r--r--storage/perfschema/ha_perfschema.h4
-rw-r--r--storage/perfschema/pfs.cc2
-rw-r--r--storage/perfschema/pfs_account.cc6
-rw-r--r--storage/perfschema/pfs_atomic.cc5
-rw-r--r--storage/perfschema/pfs_check.cc2
-rw-r--r--storage/perfschema/pfs_digest.cc4
-rw-r--r--storage/perfschema/pfs_engine_table.cc9
-rw-r--r--storage/perfschema/pfs_global.cc15
-rw-r--r--storage/perfschema/pfs_global.h1
-rw-r--r--storage/perfschema/pfs_host.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc6
-rw-r--r--storage/perfschema/pfs_instr_class.cc2
-rw-r--r--storage/perfschema/pfs_instr_class.h4
-rw-r--r--storage/perfschema/pfs_lock.h13
-rw-r--r--storage/perfschema/pfs_server.cc11
-rw-r--r--storage/perfschema/pfs_server.h3
-rw-r--r--storage/perfschema/pfs_setup_actor.cc2
-rw-r--r--storage/perfschema/pfs_setup_object.cc4
-rw-r--r--storage/perfschema/pfs_user.cc2
-rw-r--r--storage/perfschema/table_accounts.cc2
-rw-r--r--storage/perfschema/table_esgs_by_account_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esgs_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esgs_by_thread_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esgs_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esgs_global_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_account_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_digest.cc2
-rw-r--r--storage/perfschema/table_esms_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_thread_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_global_by_event_name.cc2
-rw-r--r--storage/perfschema/table_events_stages.cc2
-rw-r--r--storage/perfschema/table_events_statements.cc2
-rw-r--r--storage/perfschema/table_events_waits.cc16
-rw-r--r--storage/perfschema/table_events_waits_summary.cc2
-rw-r--r--storage/perfschema/table_ews_by_account_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_by_thread_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.cc2
-rw-r--r--storage/perfschema/table_file_instances.cc2
-rw-r--r--storage/perfschema/table_file_summary.cc372
-rw-r--r--storage/perfschema/table_file_summary.h151
-rw-r--r--storage/perfschema/table_file_summary_by_event_name.cc2
-rw-r--r--storage/perfschema/table_file_summary_by_instance.cc2
-rw-r--r--storage/perfschema/table_host_cache.cc2
-rw-r--r--storage/perfschema/table_hosts.cc2
-rw-r--r--storage/perfschema/table_os_global_by_type.cc2
-rw-r--r--storage/perfschema/table_performance_timers.cc2
-rw-r--r--storage/perfschema/table_session_connect.cc2
-rw-r--r--storage/perfschema/table_setup_actors.cc2
-rw-r--r--storage/perfschema/table_setup_consumers.cc2
-rw-r--r--storage/perfschema/table_setup_instruments.cc2
-rw-r--r--storage/perfschema/table_setup_objects.cc2
-rw-r--r--storage/perfschema/table_setup_timers.cc2
-rw-r--r--storage/perfschema/table_socket_instances.cc2
-rw-r--r--storage/perfschema/table_socket_summary_by_event_name.cc2
-rw-r--r--storage/perfschema/table_socket_summary_by_instance.cc4
-rw-r--r--storage/perfschema/table_sync_instances.cc6
-rw-r--r--storage/perfschema/table_threads.cc2
-rw-r--r--storage/perfschema/table_tiws_by_index_usage.cc2
-rw-r--r--storage/perfschema/table_tiws_by_table.cc2
-rw-r--r--storage/perfschema/table_tlws_by_table.cc2
-rw-r--r--storage/perfschema/table_users.cc2
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt51
-rw-r--r--storage/perfschema/unittest/conf.txt2
-rw-r--r--storage/perfschema/unittest/pfs-t.cc8
-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.cc7
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc7
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc7
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc8
-rw-r--r--storage/perfschema/unittest/pfs_misc-t.cc1
-rw-r--r--storage/perfschema/unittest/pfs_timer-t.cc4
-rw-r--r--storage/perfschema/unittest/pfs_user-oom-t.cc3
78 files changed, 688 insertions, 180 deletions
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 8071476e1f6..fe3b5ec985a 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -16,8 +16,8 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
- ${CMAKE_SOURCE_DIR}/regex
- ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+ ${PCRE_INCLUDES}
+ ${SSL_INCLUDE_DIRS})
ADD_DEFINITIONS(-DMYSQL_SERVER)
@@ -184,6 +184,5 @@ table_session_account_connect_attrs.cc
MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY)
IF(WITH_PERFSCHEMA_STORAGE_ENGINE AND WITH_UNIT_TESTS)
- ENABLE_TESTING()
ADD_SUBDIRECTORY(unittest)
ENDIF()
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 285768be49d..444de87ba8b 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -18,11 +18,9 @@
Performance schema storage engine (implementation).
*/
-#include "my_global.h"
+#include "sql_plugin.h"
#include "my_pthread.h"
#include "my_atomic.h"
-#include "sql_plugin.h"
-#include "mysql/plugin.h"
#include "ha_perfschema.h"
#include "pfs_engine_table.h"
#include "pfs_column_values.h"
@@ -194,6 +192,24 @@ mysql_declare_plugin(perfschema)
}
mysql_declare_plugin_end;
+maria_declare_plugin(perfschema)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &pfs_storage_engine,
+ pfs_engine_name,
+ "Marc Alff, Oracle",
+ "Performance Schema",
+ PLUGIN_LICENSE_GPL,
+ pfs_init_func,
+ pfs_done_func,
+ 0x0001,
+ pfs_status_vars,
+ NULL,
+ "5.6.32",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
+
ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share)
: handler(hton, share), m_table_share(NULL), m_table(NULL)
{}
@@ -201,15 +217,6 @@ ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share)
ha_perfschema::~ha_perfschema()
{}
-static const char *ha_pfs_exts[]= {
- NullS
-};
-
-const char **ha_perfschema::bas_ext() const
-{
- return ha_pfs_exts;
-}
-
int ha_perfschema::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_perfschema::open");
@@ -448,6 +455,8 @@ int ha_perfschema::create(const char *name, TABLE *table_arg,
This is not a general purpose engine.
Failure to CREATE TABLE is the expected result.
*/
+ DBUG_PRINT("error", ("unknown table: %s.%s", table_arg->s->db.str,
+ table_arg->s->table_name.str));
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h
index 481d663f8e4..ff87b1fd665 100644
--- a/storage/perfschema/ha_perfschema.h
+++ b/storage/perfschema/ha_perfschema.h
@@ -46,12 +46,8 @@ public:
~ha_perfschema();
- const char *table_type(void) const { return pfs_engine_name; }
-
const char *index_type(uint) { return ""; }
- const char **bas_ext(void) const;
-
/** Capabilities of the performance schema tables. */
ulonglong table_flags(void) const
{
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index cf0fa82ba3f..dd61df5f861 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -130,7 +130,7 @@
mode when a server is installed.
The implementation of the database creation script is located in
- @verbatim ./scripts/mysql_system_tables.sql @endverbatim
+ @verbatim ./scripts/mysql_performance_tables.sql @endverbatim
@subsection INT_CONFIG Runtime configuration interface
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 8650a9340b1..4e3a6d8d1d3 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -119,6 +119,10 @@ void cleanup_account(void)
account_array= NULL;
pfs_free(account_instr_class_waits_array);
account_instr_class_waits_array= NULL;
+ pfs_free(account_instr_class_stages_array);
+ account_instr_class_stages_array= 0;
+ pfs_free(account_instr_class_statements_array);
+ account_instr_class_statements_array=0;
account_max= 0;
}
@@ -149,7 +153,7 @@ int init_account_hash(void)
{
lf_hash_init(&account_hash, sizeof(PFS_account*), LF_HASH_UNIQUE,
0, 0, account_hash_get_key, &my_charset_bin);
- account_hash.size= account_max;
+ /* account_hash.size= account_max; */
account_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc
index 06090accdc6..601bd94cabd 100644
--- a/storage/perfschema/pfs_atomic.cc
+++ b/storage/perfschema/pfs_atomic.cc
@@ -59,6 +59,7 @@
operation.
*/
my_atomic_rwlock_t PFS_atomic::m_rwlock_array[256];
+static int init_done;
void PFS_atomic::init(void)
{
@@ -66,12 +67,14 @@ void PFS_atomic::init(void)
for (i=0; i< array_elements(m_rwlock_array); i++)
my_atomic_rwlock_init(&m_rwlock_array[i]);
+ init_done= 1;
}
void PFS_atomic::cleanup(void)
{
uint i;
-
+ if (!init_done)
+ return;
for (i=0; i< array_elements(m_rwlock_array); i++)
my_atomic_rwlock_destroy(&m_rwlock_array[i]);
}
diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc
index 97b23c38065..c8800e7ec96 100644
--- a/storage/perfschema/pfs_check.cc
+++ b/storage/perfschema/pfs_check.cc
@@ -55,7 +55,7 @@ void check_performance_schema()
PFS_engine_table_share::check_all_tables(thd);
- thd->restore_globals();
+ thd->reset_globals();
delete thd;
DBUG_VOID_RETURN;
}
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index 1053bd59571..bf42ada8e67 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -147,7 +147,7 @@ int init_digest_hash(void)
lf_hash_init(&digest_hash, sizeof(PFS_statements_digest_stat*),
LF_HASH_UNIQUE, 0, 0, digest_hash_get_key,
&my_charset_bin);
- digest_hash.size= (int32)digest_max;
+ /* digest_hash.size= digest_max; */
digest_hash_inited= true;
}
return 0;
@@ -213,7 +213,7 @@ find_or_create_digest(PFS_thread *thread,
PFS_statements_digest_stat **entry;
PFS_statements_digest_stat *pfs= NULL;
- ulonglong now= my_micro_time();
+ ulonglong now= my_hrtime().val;
search:
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index d114c2286d4..5484f0b4e4c 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -517,12 +517,9 @@ void PFS_engine_table::set_field_enum(Field *f, ulonglong value)
void PFS_engine_table::set_field_timestamp(Field *f, ulonglong value)
{
- struct timeval tm;
- tm.tv_sec= (long)(value / 1000000);
- tm.tv_usec= (long)(value % 1000000);
- DBUG_ASSERT(f->real_type() == MYSQL_TYPE_TIMESTAMP2);
- Field_timestampf *f2= (Field_timestampf*) f;
- f2->store_timestamp(& tm);
+ DBUG_ASSERT(is_timestamp_type(f->real_type()));
+ Field_timestamp *f2= (Field_timestamp*) f;
+ f2->store_TIME((long)(value / 1000000), (value % 1000000));
}
ulonglong PFS_engine_table::get_field_enum(Field *f)
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index 1e2070129e0..bd346f2b235 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -18,18 +18,21 @@
Miscellaneous global dependencies (implementation).
*/
-#include "my_global.h"
-#include "my_sys.h"
#include "pfs_global.h"
-#include "my_net.h"
-
-#include <stdlib.h>
-#include <string.h>
+#include <my_sys.h>
+#include <my_net.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h> /* memalign() may be here */
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#ifdef __WIN__
#include <winsock2.h>
#else
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index e69b304f4c4..f3326c5589f 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -26,6 +26,7 @@
/** True when the performance schema is initialized. */
extern bool pfs_initialized;
+
/** Total memory allocated by the performance schema, in bytes. */
extern size_t pfs_allocated_memory;
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 99e6820cdff..7da34a6d5f6 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -150,7 +150,7 @@ int init_host_hash(void)
{
lf_hash_init(&host_hash, sizeof(PFS_host*), LF_HASH_UNIQUE,
0, 0, host_hash_get_key, &my_charset_bin);
- host_hash.size= host_max;
+ /* host_hash.size= host_max; */
host_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index e842aa7fa6e..a9ea6faf212 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -541,6 +541,10 @@ void cleanup_instruments(void)
global_instr_class_stages_array= NULL;
pfs_free(global_instr_class_statements_array);
global_instr_class_statements_array= NULL;
+ pfs_free(thread_instr_class_statements_array);
+ thread_instr_class_statements_array= NULL;
+ pfs_free(thread_instr_class_stages_array);
+ 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);
@@ -577,7 +581,7 @@ int init_file_hash(void)
{
lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE,
0, 0, filename_hash_get_key, &my_charset_bin);
- filename_hash.size= file_max;
+ /* filename_hash.size= file_max; */
filename_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index 61d9b4d1484..c67c120283d 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -385,7 +385,7 @@ int init_table_share_hash(void)
{
lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE,
0, 0, table_share_hash_get_key, &my_charset_bin);
- table_share_hash.size= table_share_max;
+ /* table_share_hash.size= table_share_max; */
table_share_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h
index e50e824aee9..a51af2eca12 100644
--- a/storage/perfschema/pfs_instr_class.h
+++ b/storage/perfschema/pfs_instr_class.h
@@ -220,6 +220,8 @@ struct PFS_ALIGNED PFS_thread_class
uint m_name_length;
};
+#define PFS_TABLESHARE_HASHKEY_SIZE (NAME_LEN + 1 + NAME_LEN + 1)
+
/** Key identifying a table share. */
struct PFS_table_share_key
{
@@ -229,7 +231,7 @@ struct PFS_table_share_key
the format is "<enum_object_type><schema_name><0x00><object_name><0x00>"
@see create_table_def_key
*/
- char m_hash_key[1 + NAME_LEN + 1 + NAME_LEN + 1];
+ char m_hash_key[PFS_TABLESHARE_HASHKEY_SIZE];
/** Length in bytes of @c m_hash_key. */
uint m_key_length;
};
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index c429d934702..09efecd1c5f 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -175,27 +175,16 @@ struct pfs_lock
*/
void allocated_to_free(void)
{
-#ifndef DBUG_OFF
- extern volatile bool ready_to_exit;
-#endif
-
/*
If this record is not in the ALLOCATED state and the caller is trying
to free it, this is a bug: the caller is confused,
and potentially damaging data owned by another thread or object.
The correct assert to use here to guarantee data integrity is simply:
DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
- Now, because of Bug#56666 (Race condition between the server main thread
- and the kill server thread), this assert actually fails during shutdown,
- and the failure is legitimate, on concurrent calls to mysql_*_destroy(),
- when destroying the instrumentation of an object ... twice.
- During shutdown this has no consequences for the performance schema,
- so the assert is relaxed with the "|| ready_to_exit" condition as a work
- around until Bug#56666 is fixed.
*/
uint32 copy= PFS_atomic::load_u32(&m_version_state);
/* Make sure the record was ALLOCATED. */
- DBUG_ASSERT(((copy & STATE_MASK) == PFS_LOCK_ALLOCATED) || ready_to_exit);
+ DBUG_ASSERT(((copy & STATE_MASK) == PFS_LOCK_ALLOCATED));
/* Keep the same version, set the FREE state */
uint32 new_val= (copy & VERSION_MASK) + PFS_LOCK_FREE;
PFS_atomic::store_u32(&m_version_state, new_val);
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index cc5e52f379d..1cf60766cf7 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -162,7 +162,6 @@ static void destroy_pfs_thread(void *key)
static void cleanup_performance_schema(void)
{
cleanup_instrument_config();
-/* Disabled: Bug#5666
cleanup_instruments();
cleanup_sync_class();
cleanup_thread_class();
@@ -187,8 +186,8 @@ static void cleanup_performance_schema(void)
cleanup_account();
cleanup_account_hash();
cleanup_digest();
+ cleanup_digest_hash();
PFS_atomic::cleanup();
-*/
}
void shutdown_performance_schema(void)
@@ -215,7 +214,8 @@ void shutdown_performance_schema(void)
*/
void init_pfs_instrument_array()
{
- my_init_dynamic_array(&pfs_instr_config_array, sizeof(PFS_instr_config*), 10, 10);
+ my_init_dynamic_array(&pfs_instr_config_array, sizeof(PFS_instr_config*),
+ 10, 10, MYF(0));
pfs_instr_config_state= PFS_INSTR_CONFIG_ALLOCATED;
}
@@ -229,7 +229,12 @@ void cleanup_instrument_config()
/* Ignore if another thread has already deallocated the array */
if (my_atomic_cas32(&pfs_instr_config_state, &desired_state, PFS_INSTR_CONFIG_DEALLOCATED))
+ {
+ PFS_instr_config **array=dynamic_element(&pfs_instr_config_array, 0, PFS_instr_config**);
+ for (uint i=0; i < pfs_instr_config_array.elements; i++)
+ my_free(array[i]);
delete_dynamic(&pfs_instr_config_array);
+ }
}
/**
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index c816628a5f0..b7aa97498e3 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -54,6 +54,9 @@
#ifndef PFS_STATEMENTS_STACK_SIZE
#define PFS_STATEMENTS_STACK_SIZE 10
#endif
+#ifndef PFS_CONNECT_ATTRS_SIZE
+ #define PFS_SESSION_CONNECT_ATTRS_SIZE 2048
+#endif
struct PFS_sizing_hints
{
diff --git a/storage/perfschema/pfs_setup_actor.cc b/storage/perfschema/pfs_setup_actor.cc
index c18ab72e453..f12d70840c1 100644
--- a/storage/perfschema/pfs_setup_actor.cc
+++ b/storage/perfschema/pfs_setup_actor.cc
@@ -104,7 +104,7 @@ int init_setup_actor_hash(void)
{
lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE,
0, 0, setup_actor_hash_get_key, &my_charset_bin);
- setup_actor_hash.size= setup_actor_max;
+ /* setup_actor_hash.size= setup_actor_max; */
setup_actor_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc
index 3ad1186a8a1..809fe8edd24 100644
--- a/storage/perfschema/pfs_setup_object.cc
+++ b/storage/perfschema/pfs_setup_object.cc
@@ -99,7 +99,7 @@ int init_setup_object_hash(void)
{
lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE,
0, 0, setup_object_hash_get_key, &my_charset_bin);
- setup_object_hash.size= setup_object_max;
+ /* setup_object_hash.size= setup_object_max; */
setup_object_hash_inited= true;
}
return 0;
@@ -110,8 +110,8 @@ void cleanup_setup_object_hash(void)
{
if (setup_object_hash_inited)
{
- lf_hash_destroy(&setup_object_hash);
setup_object_hash_inited= false;
+ lf_hash_destroy(&setup_object_hash);
}
}
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index 671afab0d16..528457fe017 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -150,7 +150,7 @@ int init_user_hash(void)
{
lf_hash_init(&user_hash, sizeof(PFS_user*), LF_HASH_UNIQUE,
0, 0, user_hash_get_key, &my_charset_bin);
- user_hash.size= user_max;
+ /* user_hash.size= user_max; */
user_hash_inited= true;
}
return 0;
diff --git a/storage/perfschema/table_accounts.cc b/storage/perfschema/table_accounts.cc
index 92a5d264a44..eb14a0fe481 100644
--- a/storage/perfschema/table_accounts.cc
+++ b/storage/perfschema/table_accounts.cc
@@ -49,7 +49,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_accounts::m_field_def=
-{ 4, field_types };
+{ 4, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_accounts::m_share=
diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.cc b/storage/perfschema/table_esgs_by_account_by_event_name.cc
index 87b414c7c40..4f0fc6858f9 100644
--- a/storage/perfschema/table_esgs_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_account_by_event_name.cc
@@ -75,7 +75,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esgs_by_account_by_event_name::m_field_def=
-{ 8, field_types };
+{ 8, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esgs_by_account_by_event_name::m_share=
diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.cc b/storage/perfschema/table_esgs_by_host_by_event_name.cc
index 4087b22f98e..904f0e21b3c 100644
--- a/storage/perfschema/table_esgs_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_host_by_event_name.cc
@@ -71,7 +71,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esgs_by_host_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esgs_by_host_by_event_name::m_share=
diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.cc b/storage/perfschema/table_esgs_by_thread_by_event_name.cc
index eeef6c3fbb2..8a4d67695fa 100644
--- a/storage/perfschema/table_esgs_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_thread_by_event_name.cc
@@ -70,7 +70,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esgs_by_thread_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esgs_by_thread_by_event_name::m_share=
diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.cc b/storage/perfschema/table_esgs_by_user_by_event_name.cc
index cbaec6e16e9..736559dd5e2 100644
--- a/storage/perfschema/table_esgs_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_user_by_event_name.cc
@@ -71,7 +71,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esgs_by_user_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esgs_by_user_by_event_name::m_share=
diff --git a/storage/perfschema/table_esgs_global_by_event_name.cc b/storage/perfschema/table_esgs_global_by_event_name.cc
index 276ac8d7704..1dea1f8aceb 100644
--- a/storage/perfschema/table_esgs_global_by_event_name.cc
+++ b/storage/perfschema/table_esgs_global_by_event_name.cc
@@ -67,7 +67,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esgs_global_by_event_name::m_field_def=
-{ 6, field_types };
+{ 6, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esgs_global_by_event_name::m_share=
diff --git a/storage/perfschema/table_esms_by_account_by_event_name.cc b/storage/perfschema/table_esms_by_account_by_event_name.cc
index 941429ad307..436056ef30b 100644
--- a/storage/perfschema/table_esms_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_account_by_event_name.cc
@@ -170,7 +170,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_by_account_by_event_name::m_field_def=
-{ 27, field_types };
+{ 27, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_by_account_by_event_name::m_share=
diff --git a/storage/perfschema/table_esms_by_digest.cc b/storage/perfschema/table_esms_by_digest.cc
index 99e24316cbb..80fa4077281 100644
--- a/storage/perfschema/table_esms_by_digest.cc
+++ b/storage/perfschema/table_esms_by_digest.cc
@@ -184,7 +184,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_by_digest::m_field_def=
-{ 29, field_types };
+{ 29, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_by_digest::m_share=
diff --git a/storage/perfschema/table_esms_by_host_by_event_name.cc b/storage/perfschema/table_esms_by_host_by_event_name.cc
index d48808fd5c7..2cbe70d5ae4 100644
--- a/storage/perfschema/table_esms_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_host_by_event_name.cc
@@ -166,7 +166,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_by_host_by_event_name::m_field_def=
-{ 26, field_types };
+{ 26, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_by_host_by_event_name::m_share=
diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.cc b/storage/perfschema/table_esms_by_thread_by_event_name.cc
index 3f3117d6dc1..9ab2a814443 100644
--- a/storage/perfschema/table_esms_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_thread_by_event_name.cc
@@ -165,7 +165,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_by_thread_by_event_name::m_field_def=
-{ 26, field_types };
+{ 26, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_by_thread_by_event_name::m_share=
diff --git a/storage/perfschema/table_esms_by_user_by_event_name.cc b/storage/perfschema/table_esms_by_user_by_event_name.cc
index 1434966204f..6b55fb82814 100644
--- a/storage/perfschema/table_esms_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_user_by_event_name.cc
@@ -166,7 +166,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_by_user_by_event_name::m_field_def=
-{ 26, field_types };
+{ 26, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_by_user_by_event_name::m_share=
diff --git a/storage/perfschema/table_esms_global_by_event_name.cc b/storage/perfschema/table_esms_global_by_event_name.cc
index a335c8e6c5d..e1b65559642 100644
--- a/storage/perfschema/table_esms_global_by_event_name.cc
+++ b/storage/perfschema/table_esms_global_by_event_name.cc
@@ -162,7 +162,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_esms_global_by_event_name::m_field_def=
-{ 25, field_types };
+{ 25, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_esms_global_by_event_name::m_share=
diff --git a/storage/perfschema/table_events_stages.cc b/storage/perfschema/table_events_stages.cc
index ad0c7eb6d91..a42fc1e8075 100644
--- a/storage/perfschema/table_events_stages.cc
+++ b/storage/perfschema/table_events_stages.cc
@@ -84,7 +84,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_events_stages_current::m_field_def=
-{10 , field_types };
+{10 , field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_events_stages_current::m_share=
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index 233994dc9c1..36ff10c400a 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -237,7 +237,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_events_statements_current::m_field_def=
-{40 , field_types };
+{40 , field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_events_statements_current::m_share=
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index 0966c9ee9ae..88c4de0b1b3 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -131,7 +131,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_events_waits_current::m_field_def=
-{ 19, field_types };
+{ 19, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_events_waits_current::m_share=
@@ -315,11 +315,15 @@ int table_events_waits_common::make_socket_object_columns(volatile PFS_events_wa
uint port;
char port_str[128];
char ip_str[INET6_ADDRSTRLEN+1];
- uint ip_len= 0;
+ /*
+ "ip_length" was "ip_len" originally.
+ but it conflicted with some macro on AIX. Renamed.
+ */
+ uint ip_length= 0;
port_str[0]= ':';
/* Get the IP address and port number */
- ip_len= pfs_get_socket_address(ip_str, sizeof(ip_str), &port,
+ ip_length= pfs_get_socket_address(ip_str, sizeof(ip_str), &port,
&safe_socket->m_sock_addr,
safe_socket->m_addr_len);
@@ -327,15 +331,15 @@ int table_events_waits_common::make_socket_object_columns(volatile PFS_events_wa
int port_len= int10_to_str(port, (port_str+1), 10) - port_str + 1;
/* OBJECT NAME */
- m_row.m_object_name_length= ip_len + port_len;
+ m_row.m_object_name_length= ip_length + port_len;
if (unlikely((m_row.m_object_name_length == 0) ||
(m_row.m_object_name_length > sizeof(m_row.m_object_name))))
return 1;
char *name= m_row.m_object_name;
- memcpy(name, ip_str, ip_len);
- memcpy(name + ip_len, port_str, port_len);
+ memcpy(name, ip_str, ip_length);
+ memcpy(name + ip_length, port_str, port_len);
}
else
{
diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc
index f437e83f3ff..a7130c14a29 100644
--- a/storage/perfschema/table_events_waits_summary.cc
+++ b/storage/perfschema/table_events_waits_summary.cc
@@ -69,7 +69,7 @@ static const TABLE_FIELD_TYPE ews_by_instance_field_types[]=
TABLE_FIELD_DEF
table_events_waits_summary_by_instance::m_field_def=
-{ 7, ews_by_instance_field_types };
+{ 7, ews_by_instance_field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_events_waits_summary_by_instance::m_share=
diff --git a/storage/perfschema/table_ews_by_account_by_event_name.cc b/storage/perfschema/table_ews_by_account_by_event_name.cc
index a4b44458027..251fbc74536 100644
--- a/storage/perfschema/table_ews_by_account_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_account_by_event_name.cc
@@ -75,7 +75,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_ews_by_account_by_event_name::m_field_def=
-{ 8, field_types };
+{ 8, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_ews_by_account_by_event_name::m_share=
diff --git a/storage/perfschema/table_ews_by_host_by_event_name.cc b/storage/perfschema/table_ews_by_host_by_event_name.cc
index 5a02235bcb2..38f94ebc11b 100644
--- a/storage/perfschema/table_ews_by_host_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_host_by_event_name.cc
@@ -71,7 +71,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_ews_by_host_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_ews_by_host_by_event_name::m_share=
diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.cc b/storage/perfschema/table_ews_by_thread_by_event_name.cc
index 4db97b1c98c..3f21b0625d3 100644
--- a/storage/perfschema/table_ews_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.cc
@@ -70,7 +70,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_ews_by_thread_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_ews_by_thread_by_event_name::m_share=
diff --git a/storage/perfschema/table_ews_by_user_by_event_name.cc b/storage/perfschema/table_ews_by_user_by_event_name.cc
index 46f2ba568fb..b8365064a26 100644
--- a/storage/perfschema/table_ews_by_user_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_user_by_event_name.cc
@@ -71,7 +71,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_ews_by_user_by_event_name::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_ews_by_user_by_event_name::m_share=
diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc
index 1e165c36bc5..bc5c3780ecf 100644
--- a/storage/perfschema/table_ews_global_by_event_name.cc
+++ b/storage/perfschema/table_ews_global_by_event_name.cc
@@ -67,7 +67,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_ews_global_by_event_name::m_field_def=
-{ 6, field_types };
+{ 6, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_ews_global_by_event_name::m_share=
diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc
index a3d2fc454bb..5b13210c004 100644
--- a/storage/perfschema/table_file_instances.cc
+++ b/storage/perfschema/table_file_instances.cc
@@ -49,7 +49,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_file_instances::m_field_def=
-{ 3, field_types };
+{ 3, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_file_instances::m_share=
diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc
new file mode 100644
index 00000000000..104fa0fbd36
--- /dev/null
+++ b/storage/perfschema/table_file_summary.cc
@@ -0,0 +1,372 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+ @file storage/perfschema/table_file_summary.cc
+ Table FILE_SUMMARY_BY_xxx (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_file_summary.h"
+#include "pfs_global.h"
+
+THR_LOCK table_file_summary_by_event_name::m_table_lock;
+
+static const TABLE_FIELD_TYPE fs_by_event_name_field_types[]=
+{
+ {
+ { C_STRING_WITH_LEN("EVENT_NAME") },
+ { C_STRING_WITH_LEN("varchar(128)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("COUNT_READ") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("COUNT_WRITE") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ }
+};
+
+TABLE_FIELD_DEF
+table_file_summary_by_event_name::m_field_def=
+{ 5, fs_by_event_name_field_types, 0, (uint*) 0 };
+
+PFS_engine_table_share
+table_file_summary_by_event_name::m_share=
+{
+ { C_STRING_WITH_LEN("file_summary_by_event_name") },
+ &pfs_truncatable_acl,
+ &table_file_summary_by_event_name::create,
+ NULL, /* write_row */
+ table_file_summary_by_event_name::delete_all_rows,
+ 1000, /* records */
+ sizeof(PFS_simple_index),
+ &m_table_lock,
+ &m_field_def,
+ false /* checked */
+};
+
+PFS_engine_table* table_file_summary_by_event_name::create(void)
+{
+ return new table_file_summary_by_event_name();
+}
+
+int table_file_summary_by_event_name::delete_all_rows(void)
+{
+ reset_file_class_io();
+ return 0;
+}
+
+table_file_summary_by_event_name::table_file_summary_by_event_name()
+ : PFS_engine_table(&m_share, &m_pos),
+ m_pos(1), m_next_pos(1)
+{}
+
+void table_file_summary_by_event_name::reset_position(void)
+{
+ m_pos.m_index= 1;
+ m_next_pos.m_index= 1;
+}
+
+int table_file_summary_by_event_name::rnd_next(void)
+{
+ PFS_file_class *file_class;
+
+ m_pos.set_at(&m_next_pos);
+
+ file_class= find_file_class(m_pos.m_index);
+ if (file_class)
+ {
+ make_row(file_class);
+ m_next_pos.set_after(&m_pos);
+ return 0;
+ }
+
+ return HA_ERR_END_OF_FILE;
+}
+
+int table_file_summary_by_event_name::rnd_pos(const void *pos)
+{
+ PFS_file_class *file_class;
+
+ set_position(pos);
+
+ file_class= find_file_class(m_pos.m_index);
+ if (file_class)
+ {
+ make_row(file_class);
+ return 0;
+ }
+
+ return HA_ERR_RECORD_DELETED;
+}
+
+/**
+ Build a row.
+ @param klass the file class the cursor is reading
+*/
+void table_file_summary_by_event_name::make_row(PFS_file_class *klass)
+{
+ m_row.m_name= &klass->m_name[0];
+ m_row.m_name_length= klass->m_name_length;
+ m_row.m_file_stat= klass->m_file_stat;
+}
+
+int table_file_summary_by_event_name::read_row_values(TABLE *table,
+ unsigned char *,
+ Field **fields,
+ bool read_all)
+{
+ Field *f;
+
+ /* Set the null bits */
+ DBUG_ASSERT(table->s->null_bytes == 0);
+
+ /* The row always exists for classes */
+
+ for (; (f= *fields) ; fields++)
+ {
+ if (read_all || bitmap_is_set(table->read_set, f->field_index))
+ {
+ switch(f->field_index)
+ {
+ case 0: /* NAME */
+ set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+ break;
+ case 1: /* COUNT_READ */
+ set_field_ulonglong(f, m_row.m_file_stat.m_count_read);
+ break;
+ case 2: /* COUNT_WRITE */
+ set_field_ulonglong(f, m_row.m_file_stat.m_count_write);
+ break;
+ case 3: /* READ_BYTES */
+ set_field_ulonglong(f, m_row.m_file_stat.m_read_bytes);
+ break;
+ case 4: /* WRITE_BYTES */
+ set_field_ulonglong(f, m_row.m_file_stat.m_write_bytes);
+ break;
+ default:
+ DBUG_ASSERT(false);
+ }
+ }
+ }
+
+ return 0;
+}
+
+THR_LOCK table_file_summary_by_instance::m_table_lock;
+
+static const TABLE_FIELD_TYPE fs_by_instance_field_types[]=
+{
+ {
+ { C_STRING_WITH_LEN("FILE_NAME") },
+ { C_STRING_WITH_LEN("varchar(512)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("EVENT_NAME") },
+ { C_STRING_WITH_LEN("varchar(128)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("COUNT_READ") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("COUNT_WRITE") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ }
+};
+
+TABLE_FIELD_DEF
+table_file_summary_by_instance::m_field_def=
+{ 6, fs_by_instance_field_types, 0, (uint*) 0 };
+
+PFS_engine_table_share
+table_file_summary_by_instance::m_share=
+{
+ { C_STRING_WITH_LEN("file_summary_by_instance") },
+ &pfs_truncatable_acl,
+ &table_file_summary_by_instance::create,
+ NULL, /* write_row */
+ table_file_summary_by_instance::delete_all_rows,
+ 1000, /* records */
+ sizeof(PFS_simple_index),
+ &m_table_lock,
+ &m_field_def,
+ false /* checked */
+};
+
+PFS_engine_table* table_file_summary_by_instance::create(void)
+{
+ return new table_file_summary_by_instance();
+}
+
+int table_file_summary_by_instance::delete_all_rows(void)
+{
+ reset_file_instance_io();
+ return 0;
+}
+
+table_file_summary_by_instance::table_file_summary_by_instance()
+ : PFS_engine_table(&m_share, &m_pos),
+ m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_file_summary_by_instance::reset_position(void)
+{
+ m_pos.m_index= 0;
+ m_next_pos.m_index= 0;
+}
+
+int table_file_summary_by_instance::rnd_next(void)
+{
+ PFS_file *pfs;
+
+ for (m_pos.set_at(&m_next_pos);
+ m_pos.m_index < file_max;
+ m_pos.next())
+ {
+ pfs= &file_array[m_pos.m_index];
+ if (pfs->m_lock.is_populated())
+ {
+ make_row(pfs);
+ m_next_pos.set_after(&m_pos);
+ return 0;
+ }
+ }
+
+ return HA_ERR_END_OF_FILE;
+}
+
+int table_file_summary_by_instance::rnd_pos(const void *pos)
+{
+ PFS_file *pfs;
+
+ set_position(pos);
+ DBUG_ASSERT(m_pos.m_index < file_max);
+ pfs= &file_array[m_pos.m_index];
+
+ if (! pfs->m_lock.is_populated())
+ return HA_ERR_RECORD_DELETED;
+
+ make_row(pfs);
+ return 0;
+}
+
+/**
+ Build a row.
+ @param pfs the file the cursor is reading
+*/
+void table_file_summary_by_instance::make_row(PFS_file *pfs)
+{
+ pfs_lock lock;
+ PFS_file_class *safe_class;
+
+ m_row_exists= false;
+
+ /* Protect this reader against a file delete */
+ pfs->m_lock.begin_optimistic_lock(&lock);
+
+ safe_class= sanitize_file_class(pfs->m_class);
+ if (unlikely(safe_class == NULL))
+ return;
+
+ m_row.m_filename= pfs->m_filename;
+ m_row.m_filename_length= pfs->m_filename_length;
+ m_row.m_name= safe_class->m_name;
+ m_row.m_name_length= safe_class->m_name_length;
+ m_row.m_file_stat= pfs->m_file_stat;
+
+ if (pfs->m_lock.end_optimistic_lock(&lock))
+ m_row_exists= true;
+}
+
+int table_file_summary_by_instance::read_row_values(TABLE *table,
+ unsigned char *,
+ Field **fields,
+ bool read_all)
+{
+ Field *f;
+
+ if (unlikely(! m_row_exists))
+ return HA_ERR_RECORD_DELETED;
+
+ /* Set the null bits */
+ DBUG_ASSERT(table->s->null_bytes == 0);
+
+ for (; (f= *fields) ; fields++)
+ {
+ if (read_all || bitmap_is_set(table->read_set, f->field_index))
+ {
+ switch(f->field_index)
+ {
+ case 0: /* FILENAME */
+ set_field_varchar_utf8(f, m_row.m_filename, m_row.m_filename_length);
+ break;
+ case 1: /* NAME */
+ set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+ break;
+ case 2: /* COUNT_READ */
+ set_field_ulonglong(f, m_row.m_file_stat.m_count_read);
+ break;
+ case 3: /* COUNT_WRITE */
+ set_field_ulonglong(f, m_row.m_file_stat.m_count_write);
+ break;
+ case 4: /* READ_BYTES */
+ set_field_ulonglong(f, m_row.m_file_stat.m_read_bytes);
+ break;
+ case 5: /* WRITE_BYTES */
+ set_field_ulonglong(f, m_row.m_file_stat.m_write_bytes);
+ break;
+ default:
+ DBUG_ASSERT(false);
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h
new file mode 100644
index 00000000000..92837189f1f
--- /dev/null
+++ b/storage/perfschema/table_file_summary.h
@@ -0,0 +1,151 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_FILE_SUMMARY_H
+#define TABLE_FILE_SUMMARY_H
+
+/**
+ @file storage/perfschema/table_file_summary.h
+ Table FILE_SUMMARY_BY_xxx (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+
+/**
+ @addtogroup Performance_schema_tables
+ @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
+struct row_file_summary_by_event_name
+{
+ /** Column EVENT_NAME. */
+ const char *m_name;
+ /** Length in bytes of @c m_name. */
+ uint m_name_length;
+ /**
+ Columns COUNT_READ, COUNT_WRITE,
+ SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE.
+ */
+ PFS_file_stat m_file_stat;
+};
+
+/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
+class table_file_summary_by_event_name : public PFS_engine_table
+{
+public:
+ /** Table share */
+ static PFS_engine_table_share m_share;
+ static PFS_engine_table* create();
+ static int delete_all_rows();
+
+ virtual int rnd_next();
+ virtual int rnd_pos(const void *pos);
+ virtual void reset_position(void);
+
+protected:
+ void make_row(PFS_file_class *klass);
+
+ virtual int read_row_values(TABLE *table,
+ unsigned char *buf,
+ Field **fields,
+ bool read_all);
+
+ table_file_summary_by_event_name();
+
+public:
+ ~table_file_summary_by_event_name()
+ {}
+
+private:
+ /** Table share lock. */
+ static THR_LOCK m_table_lock;
+ /** Fields definition. */
+ static TABLE_FIELD_DEF m_field_def;
+
+ /** Current row. */
+ row_file_summary_by_event_name m_row;
+ /** Current position. */
+ PFS_simple_index m_pos;
+ /** Next position. */
+ PFS_simple_index m_next_pos;
+};
+
+/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
+struct row_file_summary_by_instance
+{
+ /** Column FILE_NAME. */
+ const char *m_filename;
+ /** Length in bytes of @c m_filename. */
+ uint m_filename_length;
+ /** Column EVENT_NAME. */
+ const char *m_name;
+ /** Length in bytes of @c m_name. */
+ uint m_name_length;
+ /**
+ Columns COUNT_READ, COUNT_WRITE,
+ SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE.
+ */
+ PFS_file_stat m_file_stat;
+};
+
+/** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */
+class table_file_summary_by_instance : public PFS_engine_table
+{
+public:
+ /** Table share */
+ static PFS_engine_table_share m_share;
+ static PFS_engine_table* create();
+ static int delete_all_rows();
+
+ virtual int rnd_next();
+ virtual int rnd_pos(const void *pos);
+ virtual void reset_position(void);
+
+protected:
+ void make_row(PFS_file *pfs);
+
+ virtual int read_row_values(TABLE *table,
+ unsigned char *buf,
+ Field **fields,
+ bool read_all);
+
+ table_file_summary_by_instance();
+
+public:
+ ~table_file_summary_by_instance()
+ {}
+
+private:
+ /** Table share lock. */
+ static THR_LOCK m_table_lock;
+ /** Fields definition. */
+ static TABLE_FIELD_DEF m_field_def;
+
+ /** Current row. */
+ row_file_summary_by_instance m_row;
+ /** True is the current row exists. */
+ bool m_row_exists;
+ /** Current position. */
+ PFS_simple_index m_pos;
+ /** Next position. */
+ PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif
diff --git a/storage/perfschema/table_file_summary_by_event_name.cc b/storage/perfschema/table_file_summary_by_event_name.cc
index 7e72f4d4158..33bee172806 100644
--- a/storage/perfschema/table_file_summary_by_event_name.cc
+++ b/storage/perfschema/table_file_summary_by_event_name.cc
@@ -156,7 +156,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_file_summary_by_event_name::m_field_def=
-{ 23, field_types };
+{ 23, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_file_summary_by_event_name::m_share=
diff --git a/storage/perfschema/table_file_summary_by_instance.cc b/storage/perfschema/table_file_summary_by_instance.cc
index 40478647f5b..c0bf1c29307 100644
--- a/storage/perfschema/table_file_summary_by_instance.cc
+++ b/storage/perfschema/table_file_summary_by_instance.cc
@@ -165,7 +165,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_file_summary_by_instance::m_field_def=
-{ 25, field_types };
+{ 25, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_file_summary_by_instance::m_share=
diff --git a/storage/perfschema/table_host_cache.cc b/storage/perfschema/table_host_cache.cc
index 57f1ea42a02..70efcd46bbf 100644
--- a/storage/perfschema/table_host_cache.cc
+++ b/storage/perfschema/table_host_cache.cc
@@ -176,7 +176,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_host_cache::m_field_def=
-{ 29, field_types };
+{ 29, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_host_cache::m_share=
diff --git a/storage/perfschema/table_hosts.cc b/storage/perfschema/table_hosts.cc
index 8e919ec0724..c91193ea83e 100644
--- a/storage/perfschema/table_hosts.cc
+++ b/storage/perfschema/table_hosts.cc
@@ -45,7 +45,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_hosts::m_field_def=
-{ 3, field_types };
+{ 3, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_hosts::m_share=
diff --git a/storage/perfschema/table_os_global_by_type.cc b/storage/perfschema/table_os_global_by_type.cc
index 954128a7647..f6c9a85a95d 100644
--- a/storage/perfschema/table_os_global_by_type.cc
+++ b/storage/perfschema/table_os_global_by_type.cc
@@ -74,7 +74,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_os_global_by_type::m_field_def=
-{ 8, field_types };
+{ 8, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_os_global_by_type::m_share=
diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc
index a891d2f04cd..473ea8b82cf 100644
--- a/storage/perfschema/table_performance_timers.cc
+++ b/storage/perfschema/table_performance_timers.cc
@@ -53,7 +53,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_performance_timers::m_field_def=
-{ 4, field_types };
+{ 4, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_performance_timers::m_share=
diff --git a/storage/perfschema/table_session_connect.cc b/storage/perfschema/table_session_connect.cc
index 70e89c0b195..a8cf199b651 100644
--- a/storage/perfschema/table_session_connect.cc
+++ b/storage/perfschema/table_session_connect.cc
@@ -40,7 +40,7 @@ static const TABLE_FIELD_TYPE field_types[]=
};
TABLE_FIELD_DEF table_session_connect::m_field_def=
-{ 4, field_types };
+{ 4, field_types, 0, (uint*) 0 };
table_session_connect::table_session_connect(const PFS_engine_table_share *share)
: cursor_by_thread_connect_attr(share)
diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc
index 00699a9c2e5..a73ec452980 100644
--- a/storage/perfschema/table_setup_actors.cc
+++ b/storage/perfschema/table_setup_actors.cc
@@ -50,7 +50,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_setup_actors::m_field_def=
-{ 3, field_types };
+{ 3, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_setup_actors::m_share=
diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc
index 7b5441b684a..563307f97ad 100644
--- a/storage/perfschema/table_setup_consumers.cc
+++ b/storage/perfschema/table_setup_consumers.cc
@@ -108,7 +108,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_setup_consumers::m_field_def=
-{ 2, field_types };
+{ 2, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_setup_consumers::m_share=
diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc
index 31e2adb0f62..060857c3a38 100644
--- a/storage/perfschema/table_setup_instruments.cc
+++ b/storage/perfschema/table_setup_instruments.cc
@@ -51,7 +51,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_setup_instruments::m_field_def=
-{ 3, field_types };
+{ 3, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_setup_instruments::m_share=
diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc
index 11fab913ac4..4753285d277 100644
--- a/storage/perfschema/table_setup_objects.cc
+++ b/storage/perfschema/table_setup_objects.cc
@@ -61,7 +61,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_setup_objects::m_field_def=
-{ 5, field_types };
+{ 5, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_setup_objects::m_share=
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index a6a8a52b7e5..1176f1f34b1 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -65,7 +65,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_setup_timers::m_field_def=
-{ 2, field_types };
+{ 2, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_setup_timers::m_share=
diff --git a/storage/perfschema/table_socket_instances.cc b/storage/perfschema/table_socket_instances.cc
index 0fa1d2b1a3a..6dfea0bf8be 100644
--- a/storage/perfschema/table_socket_instances.cc
+++ b/storage/perfschema/table_socket_instances.cc
@@ -69,7 +69,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_socket_instances::m_field_def=
-{ 7, field_types };
+{ 7, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_socket_instances::m_share=
diff --git a/storage/perfschema/table_socket_summary_by_event_name.cc b/storage/perfschema/table_socket_summary_by_event_name.cc
index 0262178e5b5..07bc9c9389a 100644
--- a/storage/perfschema/table_socket_summary_by_event_name.cc
+++ b/storage/perfschema/table_socket_summary_by_event_name.cc
@@ -156,7 +156,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_socket_summary_by_event_name::m_field_def=
-{ 23, field_types };
+{ 23, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_socket_summary_by_event_name::m_share=
diff --git a/storage/perfschema/table_socket_summary_by_instance.cc b/storage/perfschema/table_socket_summary_by_instance.cc
index 5b177cb3dce..3d092b9b1d0 100644
--- a/storage/perfschema/table_socket_summary_by_instance.cc
+++ b/storage/perfschema/table_socket_summary_by_instance.cc
@@ -160,7 +160,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_socket_summary_by_instance::m_field_def=
-{ 24, field_types };
+{ 24, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_socket_summary_by_instance::m_share=
@@ -286,7 +286,7 @@ int table_socket_summary_by_instance::read_row_values(TABLE *table,
m_row.m_event_name.set_field(f);
break;
case 1: /* OBJECT_INSTANCE */
- set_field_ulonglong(f, (ulonglong)m_row.m_identity);
+ set_field_ulonglong(f, (intptr)m_row.m_identity);
break;
case 2:/* COUNT_STAR */
diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc
index 4d7c48efdc1..9b53eb3ce57 100644
--- a/storage/perfschema/table_sync_instances.cc
+++ b/storage/perfschema/table_sync_instances.cc
@@ -50,7 +50,7 @@ static const TABLE_FIELD_TYPE mutex_field_types[]=
TABLE_FIELD_DEF
table_mutex_instances::m_field_def=
-{ 3, mutex_field_types };
+{ 3, mutex_field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_mutex_instances::m_share=
@@ -219,7 +219,7 @@ static const TABLE_FIELD_TYPE rwlock_field_types[]=
TABLE_FIELD_DEF
table_rwlock_instances::m_field_def=
-{ 4, rwlock_field_types };
+{ 4, rwlock_field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_rwlock_instances::m_share=
@@ -385,7 +385,7 @@ static const TABLE_FIELD_TYPE cond_field_types[]=
TABLE_FIELD_DEF
table_cond_instances::m_field_def=
-{ 2, cond_field_types };
+{ 2, cond_field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_cond_instances::m_share=
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index 0774858ca92..1fd2486589c 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -98,7 +98,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_threads::m_field_def=
-{ 14, field_types };
+{ 14, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_threads::m_share=
diff --git a/storage/perfschema/table_tiws_by_index_usage.cc b/storage/perfschema/table_tiws_by_index_usage.cc
index 71455793516..5f6d0cd2b5a 100644
--- a/storage/perfschema/table_tiws_by_index_usage.cc
+++ b/storage/perfschema/table_tiws_by_index_usage.cc
@@ -230,7 +230,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_tiws_by_index_usage::m_field_def=
-{ 39, field_types };
+{ 39, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_tiws_by_index_usage::m_share=
diff --git a/storage/perfschema/table_tiws_by_table.cc b/storage/perfschema/table_tiws_by_table.cc
index ab6ad3f5e3f..7eeebccb8a9 100644
--- a/storage/perfschema/table_tiws_by_table.cc
+++ b/storage/perfschema/table_tiws_by_table.cc
@@ -225,7 +225,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_tiws_by_table::m_field_def=
-{ 38, field_types };
+{ 38, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_tiws_by_table::m_share=
diff --git a/storage/perfschema/table_tlws_by_table.cc b/storage/perfschema/table_tlws_by_table.cc
index 7d33b42648e..6537e709549 100644
--- a/storage/perfschema/table_tlws_by_table.cc
+++ b/storage/perfschema/table_tlws_by_table.cc
@@ -400,7 +400,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_tlws_by_table::m_field_def=
-{ 73, field_types };
+{ 73, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_tlws_by_table::m_share=
diff --git a/storage/perfschema/table_users.cc b/storage/perfschema/table_users.cc
index c0d85017ebc..1f6b861342d 100644
--- a/storage/perfschema/table_users.cc
+++ b/storage/perfschema/table_users.cc
@@ -45,7 +45,7 @@ static const TABLE_FIELD_TYPE field_types[]=
TABLE_FIELD_DEF
table_users::m_field_def=
-{ 3, field_types };
+{ 3, field_types, 0, (uint*) 0 };
PFS_engine_table_share
table_users::m_share=
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index 22e4aad3f36..4c6b0b91021 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -15,7 +15,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mysql
- ${CMAKE_SOURCE_DIR}/regex
+ ${PCRE_INCLUDES}
${CMAKE_SOURCE_DIR}/sql
${SSL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/unittest/mytap
@@ -27,49 +27,6 @@ ADD_CONVENIENCE_LIBRARY(pfs_server_stubs pfs_server_stubs.cc)
ADD_DEPENDENCIES(pfs_server_stubs GenError)
-MACRO (PFS_ADD_TEST name)
- ADD_EXECUTABLE(${name}-t ${name}-t.cc)
- TARGET_LINK_LIBRARIES(${name}-t mytap perfschema mysys pfs_server_stubs)
- ADD_TEST(${name} ${name}-t)
-ENDMACRO()
-
-SET(tests
- pfs_instr_class
- pfs_instr_class-oom
- pfs_instr
- pfs_instr-oom
- pfs_account-oom
- pfs_host-oom
- pfs_user-oom
- pfs
- pfs_misc
-)
-FOREACH(testname ${tests})
- PFS_ADD_TEST(${testname})
-ENDFOREACH()
-
-IF(WIN32)
- SET(MYSQLD_EXTRA_SOURCES ${CMAKE_SOURCE_DIR}/sql/nt_servc.cc)
-ENDIF()
-
-# We need the server libs to test the blob parser.
-# Add sql_builtin.cc here, to force linkage of plugins below.
-# Also add mysys/string.c (see Bug#45488)
-ADD_EXECUTABLE(pfs_connect_attr-t
- pfs_connect_attr-t.cc
- ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
- ${CMAKE_SOURCE_DIR}/mysys/string.c
- ${MYSQLD_EXTRA_SOURCES}
-)
-ADD_DEPENDENCIES(pfs_connect_attr-t GenServerSource)
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t mytap perfschema)
-# We need to explicitly link in everything referenced in sql/sql_builtin.cc
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t ${MYSQLD_STATIC_PLUGIN_LIBS})
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t sql binlog rpl master slave sql)
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t mysys mysys_ssl)
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t vio ${SSL_LIBRARIES})
-TARGET_LINK_LIBRARIES(pfs_connect_attr-t strings dbug regex mysys ${ZLIB_LIBRARY})
-ADD_TEST(pfs_connect_attr pfs_connect_attr-t)
-
-# On windows, pfs_connect_attr-t may depend on openssl dlls.
-COPY_OPENSSL_DLLS(copy_openssl_pfs_unittest)
+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 pfs_misc
+ EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt
index 8afd0b4dca7..6eaa044c02c 100644
--- a/storage/perfschema/unittest/conf.txt
+++ b/storage/perfschema/unittest/conf.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates.
#
# 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/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index 8b24cee9eaf..6121fac098f 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1637,11 +1637,11 @@ void do_all_tests()
test_event_name_index();
}
-int main(int, char **)
+int main(int argc, char **argv)
{
plan(216);
- MY_INIT("pfs-t");
+ MY_INIT(argv[0]);
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
-
diff --git a/storage/perfschema/unittest/pfs_account-oom-t.cc b/storage/perfschema/unittest/pfs_account-oom-t.cc
index ef8a7c195e0..f715325401d 100644
--- a/storage/perfschema/unittest/pfs_account-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_account-oom-t.cc
@@ -111,6 +111,7 @@ int main(int, char **)
plan(6);
MY_INIT("pfs_account-oom-t");
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_host-oom-t.cc b/storage/perfschema/unittest/pfs_host-oom-t.cc
index 6627dd48df2..56597bdda74 100644
--- a/storage/perfschema/unittest/pfs_host-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_host-oom-t.cc
@@ -111,6 +111,7 @@ int main(int, char **)
plan(6);
MY_INIT("pfs_host-oom-t");
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index 161060aa6bf..25caaa6241f 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -660,11 +660,12 @@ void do_all_tests()
PFS_atomic::cleanup();
}
-int main(int, char **)
+int main(int argc, char **argv)
{
plan(20);
- MY_INIT("pfs_instr-oom-t");
+ MY_INIT(argv[0]);
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index 3cc4c48388d..81df38340df 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -412,11 +412,12 @@ void do_all_tests()
PFS_atomic::cleanup();
}
-int main(int, char **)
+int main(int argc, char **argv)
{
plan(103);
- MY_INIT("pfs_instr-t");
+ MY_INIT(argv[0]);
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index e98250d8567..1b098ee356e 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -62,11 +62,12 @@ void do_all_tests()
PFS_atomic::cleanup();
}
-int main(int, char **)
+int main(int argc, char **argv)
{
plan(9);
- MY_INIT("pfs_instr_info-oom-t");
+ MY_INIT(argv[0]);
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index ee483312e3c..06e3200a8d2 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -668,11 +668,11 @@ void do_all_tests()
PFS_atomic::cleanup();
}
-int main(int, char **)
+int main(int argc, char **argv)
{
plan(181);
- MY_INIT("pfs_instr_info-t");
+ MY_INIT(argv[0]);
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
-
diff --git a/storage/perfschema/unittest/pfs_misc-t.cc b/storage/perfschema/unittest/pfs_misc-t.cc
index a0fff2f593c..a4b11b9a727 100644
--- a/storage/perfschema/unittest/pfs_misc-t.cc
+++ b/storage/perfschema/unittest/pfs_misc-t.cc
@@ -66,6 +66,7 @@ int main(int, char **)
plan(2);
MY_INIT("pfs_misc-t");
do_all_tests();
+ my_end(0);
return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc
index 9c9ae0f75f1..0a2cc63f30e 100644
--- a/storage/perfschema/unittest/pfs_timer-t.cc
+++ b/storage/perfschema/unittest/pfs_timer-t.cc
@@ -15,6 +15,7 @@
#include <my_global.h>
#include <my_pthread.h>
+#include <pfs_atomic.h>
#include <pfs_timer.h>
#include "my_sys.h"
#include <tap.h>
@@ -117,6 +118,7 @@ int main(int, char **)
plan(5);
MY_INIT("pfs_timer-t");
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}
diff --git a/storage/perfschema/unittest/pfs_user-oom-t.cc b/storage/perfschema/unittest/pfs_user-oom-t.cc
index 0e4c5eb3411..6c936ba8ffb 100644
--- a/storage/perfschema/unittest/pfs_user-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_user-oom-t.cc
@@ -110,6 +110,7 @@ int main(int, char **)
plan(6);
MY_INIT("pfs_user-oom-t");
do_all_tests();
- return 0;
+ my_end(0);
+ return exit_status();
}