diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 7331d5ee67368..2389b6499697b 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -45,6 +45,8 @@ #include "proxy_protocol.h" #include +#include "../storage/perfschema/pfs_server.h" + HASH global_user_stats, global_client_stats, global_table_stats; HASH global_index_stats; /* Protects the above global stats */ @@ -1570,6 +1572,8 @@ THD *CONNECT::create_thd(THD *thd) /* Attach PSI instrumentation to the new THD */ PSI_thread *psi= PSI_CALL_get_thread(); + extern my_bool pfs_enabled; + DBUG_ASSERT(psi || !pfs_enabled || !pfs_param.m_thread_sizing || !pfs_param.m_thread_class_sizing); PSI_CALL_set_thread_os_id(psi); PSI_CALL_set_thread_THD(psi, thd); PSI_CALL_set_thread_id(psi, thd->thread_id); diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 5d5ddb31353c8..130e1162e234e 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1935,6 +1935,12 @@ pfs_drop_table_share_v1(my_bool temporary, /* Ignore temporary tables. */ if (temporary) return; + { + THD *thd= current_thd; + if (thd) + fprintf(stderr, "PFS: %.*s\n", (int)thd->query_string.length(), + thd->query_string.str()); + } PFS_thread *pfs_thread= my_thread_get_THR_PFS(); if (unlikely(pfs_thread == NULL)) { @@ -1942,12 +1948,6 @@ pfs_drop_table_share_v1(my_bool temporary, table_name_length, table_name); return; } - { - THD *thd= current_thd; - if (thd) - fprintf(stderr, "PFS: %.*s\n", (int)thd->query_string.length(), - thd->query_string.str()); - } /* TODO: temporary tables */ drop_table_share(pfs_thread, temporary, schema_name, schema_name_length, table_name, table_name_length);