Commit 7c61679c authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4685 Compile error on LFS

fix the code to compile w/o perfomance schema
parent 7cc77106
......@@ -38,6 +38,7 @@ mysql_cond_t sleep_condition;
volatile bool shutdown_plugin;
static pthread_t sender_thread;
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_sleep_mutex;
static PSI_mutex_info mutex_list[]=
{{ &key_sleep_mutex, "sleep_mutex", PSI_FLAG_GLOBAL}};
......@@ -49,6 +50,7 @@ static PSI_cond_info cond_list[]=
static PSI_thread_key key_sender_thread;
static PSI_thread_info thread_list[] =
{{&key_sender_thread, "sender_thread", 0}};
#endif
Url **urls; ///< list of urls to send the report to
uint url_count;
......@@ -231,8 +233,12 @@ static int init(void *p)
i_s_feedback->fill_table= fill_feedback; ///< how to fill the I_S table
i_s_feedback->idx_field1 = 0; ///< virtual index on the 1st col
#ifdef HAVE_PSI_INTERFACE
#define PSI_register(X) \
if(PSI_server) PSI_server->register_ ## X("feedback", X ## _list, array_elements(X ## _list))
#else
#define PSI_register(X) /* no-op */
#endif
PSI_register(mutex);
PSI_register(cond);
......
......@@ -21,10 +21,12 @@
extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
#ifdef HAVE_PSI_INTERFACE
/* These belong to the service initialization */
static PSI_mutex_key key_LOCK_logger_service;
static PSI_mutex_info mutex_list[]=
{{ &key_LOCK_logger_service, "logger_service_file_st::lock", PSI_FLAG_GLOBAL}};
#endif
typedef struct logger_handle_st {
File file;
......@@ -188,7 +190,9 @@ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...)
void init_logger_mutexes()
{
#ifdef HAVE_PSI_INTERFACE
if (PSI_server)
PSI_server->register_mutex("sql_logger", mutex_list, 1);
#endif
}
......@@ -1766,7 +1766,9 @@ static void mysqld_exit(int exit_code)
clean_up_mutexes();
clean_up_error_log_mutex();
my_end((opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0));
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
shutdown_performance_schema(); // we do it as late as possible
#endif
exit(exit_code); /* purecov: inspected */
}
......
......@@ -72,14 +72,18 @@ struct Worker_thread_context
void save()
{
#ifdef HAVE_PSI_INTERFACE
psi_thread= PSI_server?PSI_server->get_thread():0;
#endif
mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
}
void restore()
{
#ifdef HAVE_PSI_INTERFACE
if (PSI_server)
PSI_server->set_thread(psi_thread);
#endif
pthread_setspecific(THR_KEY_mysys,mysys_var);
pthread_setspecific(THR_THD, 0);
pthread_setspecific(THR_MALLOC, 0);
......@@ -95,8 +99,10 @@ static bool thread_attach(THD* thd)
pthread_setspecific(THR_KEY_mysys,thd->mysys_var);
thd->thread_stack=(char*)&thd;
thd->store_globals();
#ifdef HAVE_PSI_INTERFACE
if (PSI_server)
PSI_server->set_thread(thd->event_scheduler.m_psi);
#endif
return 0;
}
......@@ -123,11 +129,13 @@ int threadpool_add_connection(THD *thd)
}
/* Create new PSI thread for use with the THD. */
#ifdef HAVE_PSI_INTERFACE
if (PSI_server)
{
thd->event_scheduler.m_psi =
PSI_server->new_thread(key_thread_one_connection, thd, thd->thread_id);
}
#endif
/* Login. */
......
......@@ -52,6 +52,7 @@ static bool threadpool_started= false;
*/
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_group_mutex;
static PSI_mutex_key key_timer_mutex;
static PSI_mutex_info mutex_list[]=
......@@ -79,6 +80,9 @@ static PSI_thread_info thread_list[] =
/* Macro to simplify performance schema registration */
#define PSI_register(X) \
if(PSI_server) PSI_server->register_ ## X("threadpool", X ## _list, array_elements(X ## _list))
#else
#define PSI_register(X) /* no-op */
#endif
struct thread_group_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment