mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
WL#2360 Performance schema
Part IV: sql instrumentation
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -44,21 +44,21 @@ Master_info::Master_info(bool is_slave_recovery)
|
||||
|
||||
my_init_dynamic_array(&ignore_server_ids, sizeof(::server_id), 16, 16);
|
||||
bzero((char*) &file, sizeof(file));
|
||||
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&data_cond, NULL);
|
||||
pthread_cond_init(&start_cond, NULL);
|
||||
pthread_cond_init(&stop_cond, NULL);
|
||||
mysql_mutex_init(key_master_info_run_lock, &run_lock, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_master_info_data_lock, &data_lock, MY_MUTEX_INIT_FAST);
|
||||
mysql_cond_init(key_master_info_data_cond, &data_cond, NULL);
|
||||
mysql_cond_init(key_master_info_start_cond, &start_cond, NULL);
|
||||
mysql_cond_init(key_master_info_stop_cond, &stop_cond, NULL);
|
||||
}
|
||||
|
||||
Master_info::~Master_info()
|
||||
{
|
||||
delete_dynamic(&ignore_server_ids);
|
||||
pthread_mutex_destroy(&run_lock);
|
||||
pthread_mutex_destroy(&data_lock);
|
||||
pthread_cond_destroy(&data_cond);
|
||||
pthread_cond_destroy(&start_cond);
|
||||
pthread_cond_destroy(&stop_cond);
|
||||
mysql_mutex_destroy(&run_lock);
|
||||
mysql_mutex_destroy(&data_lock);
|
||||
mysql_cond_destroy(&data_cond);
|
||||
mysql_cond_destroy(&start_cond);
|
||||
mysql_cond_destroy(&stop_cond);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,7 +175,7 @@ int init_master_info(Master_info* mi, const char* master_info_fname,
|
||||
keep other threads from reading bogus info
|
||||
*/
|
||||
|
||||
pthread_mutex_lock(&mi->data_lock);
|
||||
mysql_mutex_lock(&mi->data_lock);
|
||||
fd = mi->fd;
|
||||
|
||||
/* does master.info exist ? */
|
||||
@ -184,7 +184,7 @@ int init_master_info(Master_info* mi, const char* master_info_fname,
|
||||
{
|
||||
if (abort_if_no_master_info_file)
|
||||
{
|
||||
pthread_mutex_unlock(&mi->data_lock);
|
||||
mysql_mutex_unlock(&mi->data_lock);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/*
|
||||
@ -192,8 +192,9 @@ int init_master_info(Master_info* mi, const char* master_info_fname,
|
||||
the old descriptor and re-create the old file
|
||||
*/
|
||||
if (fd >= 0)
|
||||
my_close(fd, MYF(MY_WME));
|
||||
if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
|
||||
mysql_file_close(fd, MYF(MY_WME));
|
||||
if ((fd= mysql_file_open(key_file_master_info,
|
||||
fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
|
||||
{
|
||||
sql_print_error("Failed to create a new master info file (\
|
||||
file '%s', errno %d)", fname, my_errno);
|
||||
@ -217,7 +218,8 @@ file '%s')", fname);
|
||||
reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0);
|
||||
else
|
||||
{
|
||||
if ((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
|
||||
if ((fd= mysql_file_open(key_file_master_info,
|
||||
fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
|
||||
{
|
||||
sql_print_error("Failed to open the existing master info file (\
|
||||
file '%s', errno %d)", fname, my_errno);
|
||||
@ -369,7 +371,7 @@ file '%s')", fname);
|
||||
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
|
||||
if ((error=test(flush_master_info(mi, 1))))
|
||||
sql_print_error("Failed to flush master info file");
|
||||
pthread_mutex_unlock(&mi->data_lock);
|
||||
mysql_mutex_unlock(&mi->data_lock);
|
||||
DBUG_RETURN(error);
|
||||
|
||||
errwithmsg:
|
||||
@ -378,11 +380,11 @@ errwithmsg:
|
||||
err:
|
||||
if (fd >= 0)
|
||||
{
|
||||
my_close(fd, MYF(0));
|
||||
mysql_file_close(fd, MYF(0));
|
||||
end_io_cache(&mi->file);
|
||||
}
|
||||
mi->fd= -1;
|
||||
pthread_mutex_unlock(&mi->data_lock);
|
||||
mysql_mutex_unlock(&mi->data_lock);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@ -494,7 +496,7 @@ void end_master_info(Master_info* mi)
|
||||
if (mi->fd >= 0)
|
||||
{
|
||||
end_io_cache(&mi->file);
|
||||
(void)my_close(mi->fd, MYF(MY_WME));
|
||||
mysql_file_close(mi->fd, MYF(MY_WME));
|
||||
mi->fd = -1;
|
||||
}
|
||||
mi->inited = 0;
|
||||
|
Reference in New Issue
Block a user