Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-11 23:51:14+04:00, petr@stripped +12 -0
Fix for Bug #21966 "Strange warnings on create like/repair of the log tables"
The fix solves two problems:
1) Makes REPAIR of the log table exclusive operation (as it should be), thus
eliminating lock-related warnings. and
2) Updates CREATE LIKE TABLE to use usual read lock on the source table rather
then name lock, which is too restrictive. This way we get rid of another
log table-related warning, which occured because of the above fact
(as a side-effect, name lock resulted in a warning).
mysql-test/r/log_tables.result@stripped, 2006-09-11 23:51:00+04:00, petr@stripped +17 -3
Update result file
mysql-test/t/log_tables.test@stripped, 2006-09-11 23:51:00+04:00, petr@stripped +14 -0
Add a test for the bug
sql/ha_myisam.cc@stripped, 2006-09-11 23:51:00+04:00, petr@stripped +4 -4
update function to reflect changes in log tables
locking logic.
sql/handler.cc@stripped, 2006-09-11 23:51:00+04:00, petr@stripped +3 -2
update comment
sql/handler.h@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +5 -1
update function to reflect changes in log tables
locking logic.
sql/lock.cc@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +2 -1
Now we allow locking of the log tables for "privileged" threads
Privileged thread must explicitly close and lock log tables. This
is required for admin operations such as REPAIR.
sql/log.cc@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +35 -8
Add a function to check if a given table is a log table.
Add support for "privileged" thread, merge
is_[general/slow]_log_table_enabled() into one function.
sql/log.h@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +40 -8
add a prototype for the function to check if a given
table is a log table; add privileged table flag to
table logger merge is_[general/slow]_log_table_enabled()
into one function.
sql/mysql_priv.h@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +0 -4
move log table defines to log.h
sql/sql_rename.cc@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +3 -22
move check_if_opened_log_table() to log.cc,
update code to take into account
is_[general/slow]_log_table_enabled() ->
is_log_table_enabled() refactoring
sql/sql_table.cc@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +72 -23
(1) mysql_admin_table() should disable logs if it performs
exclusive admin operation on a log table. This way we
also eliminate warning on REPAIR of the log table.
(2) mysql_create_like_table should read-lock the sourse table
instead getting name lock on it. Name lock is too restrictive
in this case.
storage/csv/ha_tina.cc@stripped, 2006-09-11 23:51:01+04:00, petr@stripped +2 -2
update function to reflect changes in log tables
locking logic.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: petr
# Host: owlet.local
# Root: /home/cps/mysql/devel/5.1-rename-bug
--- 1.187/sql/ha_myisam.cc 2006-09-11 23:51:23 +04:00
+++ 1.188/sql/ha_myisam.cc 2006-09-11 23:51:23 +04:00
@@ -259,7 +259,7 @@ err:
bool ha_myisam::check_if_locking_is_allowed(uint sql_command,
ulong type, TABLE *table,
uint count,
- bool called_by_logger_thread)
+ bool called_by_privileged_thread)
{
/*
To be able to open and lock for reading system tables like 'mysql.proc',
@@ -277,10 +277,10 @@ bool ha_myisam::check_if_locking_is_allo
/*
Deny locking of the log tables, which is incompatible with
- concurrent insert. Unless called from a logger THD:
- general_log_thd or slow_log_thd.
+ concurrent insert. Unless called from a logger THD (general_log_thd
+ or slow_log_thd) or by a privileged thread.
*/
- if (!called_by_logger_thread)
+ if (!called_by_privileged_thread)
return check_if_log_table_locking_is_allowed(sql_command, type, table);
return TRUE;
--- 1.256/sql/handler.cc 2006-09-11 23:51:23 +04:00
+++ 1.257/sql/handler.cc 2006-09-11 23:51:23 +04:00
@@ -1428,8 +1428,9 @@ bool handler::check_if_log_table_locking
{
/*
Deny locking of the log tables, which is incompatible with
- concurrent insert. Unless called from a logger THD:
- general_log_thd or slow_log_thd.
+ concurrent insert. The routine is not called if the table is
+ being locked from a logger THD (general_log_thd or slow_log_thd)
+ or from a privileged thread (see log.cc for details)
*/
if (table->s->log_table &&
sql_command != SQLCOM_TRUNCATE &&
--- 1.232/sql/handler.h 2006-09-11 23:51:23 +04:00
+++ 1.233/sql/handler.h 2006-09-11 23:51:23 +04:00
@@ -955,6 +955,10 @@ public:
thd Handler of the thread, trying to lock the table
table Table handler to check
count Number of locks already granted to the table
+ called_by_privileged_thread TRUE if called from a logger THD
+ (general_log_thd or slow_log_thd)
+ or by a privileged thread, which
+ has the right to lock log tables.
DESCRIPTION
Check whether a handler allows to lock the table. For instance,
@@ -970,7 +974,7 @@ public:
virtual bool check_if_locking_is_allowed(uint sql_command,
ulong type, TABLE *table,
uint count,
- bool called_by_logger_thread)
+ bool called_by_privileged_thread)
{
return TRUE;
}
--- 1.97/sql/lock.cc 2006-09-11 23:51:23 +04:00
+++ 1.98/sql/lock.cc 2006-09-11 23:51:23 +04:00
@@ -691,7 +691,8 @@ static MYSQL_LOCK *get_lock_data(THD *th
check_if_locking_is_allowed(thd->lex->sql_command, thd->lex->type,
table_ptr[i], count,
(thd == logger.get_general_log_thd()) ||
- (thd == logger.get_slow_log_thd())))
+ (thd == logger.get_slow_log_thd()) ||
+ (thd == logger.get_privileged_thread())))
DBUG_RETURN(0);
}
--- 1.224/sql/log.cc 2006-09-11 23:51:23 +04:00
+++ 1.225/sql/log.cc 2006-09-11 23:51:23 +04:00
@@ -92,6 +92,24 @@ struct binlog_trx_data {
handlerton binlog_hton;
+/* Check if a given table is opened log table */
+int check_if_opened_log_table(uint db_len, const char *db,
+ const char *table_name)
+{
+ if (db_len == 5 &&
+ !my_strcasecmp(system_charset_info, db, "mysql"))
+ {
+ if (!my_strcasecmp(system_charset_info, table_name, "general_log") &&
+ logger.is_log_table_enabled(QUERY_LOG_GENERAL))
+ return QUERY_LOG_GENERAL;
+ else
+ if (!my_strcasecmp(system_charset_info, table_name, "slow_log") &&
+ logger.is_log_table_enabled(QUERY_LOG_SLOW))
+ return QUERY_LOG_SLOW;
+ }
+ return 0;
+}
+
/*
Open log table of a given type (general or slow log)
@@ -192,6 +210,12 @@ bool Log_to_csv_event_handler::open_log_
my_pthread_setspecific_ptr(THR_MALLOC, 0);
}
+ /*
+ After a log table was opened, we should clear privileged thread
+ flag (which allows locking of a log table be a special thread, usually
+ the one who closed log tables temporarily).
+ */
+ privileged_thread= 0;
DBUG_RETURN(error);
}
@@ -208,6 +232,8 @@ Log_to_csv_event_handler::Log_to_csv_eve
/* logger thread always works with mysql database */
slow_log_thd->db= my_strdup("mysql", MYF(0));;
slow_log_thd->db_length= 5;
+ /* no privileged thread exists at the moment */
+ privileged_thread= 0;
}
@@ -685,9 +711,9 @@ bool LOGGER::reopen_log_table(uint log_t
return table_log_handler->reopen_log_table(log_table_type);
}
-void LOGGER::close_n_lock_tables()
+void LOGGER::close_n_lock_tables(THD *thd)
{
- table_log_handler->close_n_lock_tables();
+ table_log_handler->close_n_lock_tables(thd);
}
bool LOGGER::flush_logs(THD *thd)
@@ -703,7 +729,7 @@ bool LOGGER::flush_logs(THD *thd)
are allowed.
*/
if (logger.is_log_tables_initialized)
- table_log_handler->close_n_lock_tables(); // the locking happens here
+ table_log_handler->close_n_lock_tables(thd); // the locking happens here
else
logger.lock();
@@ -1031,7 +1057,7 @@ void LOGGER::deactivate_log_handler(THD
}
-void Log_to_csv_event_handler::close_n_lock_tables()
+void Log_to_csv_event_handler::close_n_lock_tables(THD *thd)
{
TABLE_LIST close_slow_log, close_general_log;
@@ -1064,6 +1090,8 @@ void Log_to_csv_event_handler::close_n_l
if (opt_log)
lock_and_wait_for_table_name(general_log_thd, &close_general_log);
+ privileged_thread= thd;
+
/*
Now we lock logger, as nobody should be able to use logging routines while
log tables are closed
@@ -1151,16 +1179,15 @@ void Log_to_csv_event_handler::
THD *log_thd, *curr= current_thd;
TABLE_LIST *table;
+ if (!logger.is_log_table_enabled(log_table_type))
+ return; /* do nothing */
+
switch (log_table_type) {
case QUERY_LOG_GENERAL:
- if (!logger.is_general_log_table_enabled())
- return; /* do nothing */
log_thd= general_log_thd;
table= &general_log;
break;
case QUERY_LOG_SLOW:
- if (!logger.is_slow_log_table_enabled())
- return; /* do nothing */
log_thd= slow_log_thd;
table= &slow_log;
break;
--- 1.431/sql/mysql_priv.h 2006-09-11 23:51:23 +04:00
+++ 1.432/sql/mysql_priv.h 2006-09-11 23:51:23 +04:00
@@ -1417,10 +1417,6 @@ void sql_print_information(const char *f
typedef void (*sql_print_message_func)(const char *format, ...);
extern sql_print_message_func sql_print_message_handlers[];
-/* type of the log table */
-#define QUERY_LOG_SLOW 1
-#define QUERY_LOG_GENERAL 2
-
int error_log_print(enum loglevel level, const char *format,
va_list args);
--- 1.366/sql/sql_table.cc 2006-09-11 23:51:23 +04:00
+++ 1.367/sql/sql_table.cc 2006-09-11 23:51:23 +04:00
@@ -1624,9 +1624,9 @@ int mysql_rm_table_part2(THD *thd, TABLE
if (share && share->log_table &&
((!my_strcasecmp(system_charset_info, table->table_name,
"general_log") && opt_log &&
- logger.is_general_log_table_enabled()) ||
+ logger.is_log_table_enabled(QUERY_LOG_GENERAL)) ||
(!my_strcasecmp(system_charset_info, table->table_name, "slow_log")
- && opt_slow_log && logger.is_slow_log_table_enabled())))
+ && opt_slow_log &&
logger.is_log_table_enabled(QUERY_LOG_SLOW))))
{
my_error(ER_CANT_DROP_LOG_TABLE, MYF(0));
DBUG_RETURN(1);
@@ -3993,7 +3993,6 @@ end:
}
-
/*
RETURN VALUES
FALSE Message sent to net (admin operation went ok)
@@ -4019,7 +4018,7 @@ static bool mysql_admin_table(THD* thd,
Item *item;
Protocol *protocol= thd->protocol;
LEX *lex= thd->lex;
- int result_code;
+ int result_code, disable_logs= 0;
DBUG_ENTER("mysql_admin_table");
if (end_active_trans(thd))
@@ -4064,6 +4063,21 @@ static bool mysql_admin_table(THD* thd,
thd->no_warnings_for_error= no_warnings_for_error;
if (view_operator_func == NULL)
table->required_type=FRMTYPE_TABLE;
+
+ /*
+ If we want to perform an admin operation on the log table
+ (E.g. rename) and lock_type >= TL_READ_NO_INSERT disable
+ log tables
+ */
+
+ if (check_if_opened_log_table(table->db_length, table->db,
+ table->table_name) &&
+ lock_type >= TL_READ_NO_INSERT)
+ {
+ disable_logs= 1;
+ logger.close_n_lock_tables(thd);
+ }
+
open_and_lock_tables(thd, table);
thd->no_warnings_for_error= 0;
table->next_global= save_next_global;
@@ -4380,11 +4394,27 @@ send_result_message:
}
send_eof(thd);
+ /* enable logging back if needed */
+ if (disable_logs)
+ {
+ if ((opt_slow_log && logger.reopen_log_table(QUERY_LOG_SLOW)) |
+ (opt_log && logger.reopen_log_table(QUERY_LOG_GENERAL)))
+ my_error(ER_CANT_ACTIVATE_LOG, MYF(0));
+ logger.unlock();
+ }
DBUG_RETURN(FALSE);
err:
ha_autocommit_or_rollback(thd, 1);
close_thread_tables(thd); // Shouldn't be needed
+ /* enable logging back if needed */
+ if (disable_logs)
+ {
+ if ((opt_slow_log && logger.reopen_log_table(QUERY_LOG_SLOW)) |
+ (opt_log && logger.reopen_log_table(QUERY_LOG_GENERAL)))
+ my_error(ER_CANT_ACTIVATE_LOG, MYF(0));
+ logger.unlock();
+ }
if (table)
table->table=0;
DBUG_RETURN(TRUE);
@@ -4549,6 +4579,7 @@ bool mysql_create_like_table(THD* thd, T
{
TABLE *tmp_table;
char src_path[FN_REFLEN], dst_path[FN_REFLEN], tmp_path[FN_REFLEN];
+ char src_table_name_buff[FN_REFLEN], src_db_name_buff[FN_REFLEN];
uint dst_path_length;
char *db= table->db;
char *table_name= table->table_name;
@@ -4585,13 +4616,6 @@ bool mysql_create_like_table(THD* thd, T
DBUG_RETURN(-1);
}
- bzero((gptr)&src_tables_list, sizeof(src_tables_list));
- src_tables_list.db= src_db;
- src_tables_list.table_name= src_table;
-
- if (lock_and_wait_for_table_name(thd, &src_tables_list))
- goto err;
-
if ((tmp_table= find_temporary_table(thd, src_db, src_table)))
strxmov(src_path, tmp_table->s->path.str, reg_ext, NullS);
else
@@ -4618,6 +4642,34 @@ bool mysql_create_like_table(THD* thd, T
goto err;
}
+ if (lower_case_table_names)
+ {
+ if (src_db)
+ {
+ strmake(src_db_name_buff, src_db,
+ min(sizeof(src_db_name_buff) - 1, table_ident->db.length));
+ my_casedn_str(files_charset_info, src_db_name_buff);
+ src_db= src_db_name_buff;
+ }
+ if (src_table)
+ {
+ strmake(src_table_name_buff, src_table,
+ min(sizeof(src_table_name_buff) - 1, table_ident->table.length));
+ my_casedn_str(files_charset_info, src_table_name_buff);
+ src_table= src_table_name_buff;
+ }
+ }
+
+ bzero((gptr)&src_tables_list, sizeof(src_tables_list));
+ src_tables_list.db= src_db;
+ src_tables_list.db_length= table_ident->db.length;
+ src_tables_list.lock_type= TL_READ;
+ src_tables_list.table_name= src_table;
+ src_tables_list.alias= src_table;
+
+ if (simple_open_n_lock_tables(thd, &src_tables_list))
+ DBUG_RETURN(TRUE);
+
/*
Validate the destination table
@@ -4764,9 +4816,7 @@ table_exists:
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
err:
- pthread_mutex_lock(&LOCK_open);
- unlock_table_name(thd, &src_tables_list);
- pthread_mutex_unlock(&LOCK_open);
+ close_thread_tables(thd);
DBUG_RETURN(res);
}
@@ -5157,29 +5207,28 @@ bool mysql_alter_table(THD *thd,char *ne
!my_strcasecmp(system_charset_info, table_list->db, "mysql") &&
table_list->table_name)
{
- enum enum_table_kind { NOT_LOG_TABLE= 1, GENERAL_LOG, SLOW_LOG }
- table_kind= NOT_LOG_TABLE;
+ int table_kind= 0;
if (!my_strcasecmp(system_charset_info, table_list->table_name,
"general_log"))
- table_kind= GENERAL_LOG;
+ table_kind= QUERY_LOG_GENERAL;
else
if (!my_strcasecmp(system_charset_info, table_list->table_name,
"slow_log"))
- table_kind= SLOW_LOG;
+ table_kind= QUERY_LOG_SLOW;
/* Disable alter of enabled log tables */
- if ((table_kind == GENERAL_LOG && opt_log &&
- logger.is_general_log_table_enabled()) ||
- (table_kind == SLOW_LOG && opt_slow_log &&
- logger.is_slow_log_table_enabled()))
+ if ((table_kind == QUERY_LOG_GENERAL && opt_log &&
+ logger.is_log_table_enabled(table_kind)) ||
+ (table_kind == QUERY_LOG_SLOW && opt_slow_log &&
+ logger.is_log_table_enabled(table_kind)))
{
my_error(ER_CANT_ALTER_LOG_TABLE, MYF(0));
DBUG_RETURN(TRUE);
}
/* Disable alter of log tables to unsupported engine */
- if ((table_kind == GENERAL_LOG || table_kind == SLOW_LOG) &&
+ if ((table_kind == QUERY_LOG_GENERAL || table_kind == QUERY_LOG_SLOW) &&
(lex_create_info->used_fields & HA_CREATE_USED_ENGINE) &&
(!lex_create_info->db_type || /* unknown engine */
!(lex_create_info->db_type->db_type == DB_TYPE_MYISAM ||
--- 1.57/storage/csv/ha_tina.cc 2006-09-11 23:51:23 +04:00
+++ 1.58/storage/csv/ha_tina.cc 2006-09-11 23:51:23 +04:00
@@ -816,9 +816,9 @@ void ha_tina::update_status()
bool ha_tina::check_if_locking_is_allowed(uint sql_command,
ulong type, TABLE *table,
uint count,
- bool called_by_logger_thread)
+ bool called_by_privileged_thread)
{
- if (!called_by_logger_thread)
+ if (!called_by_privileged_thread)
return check_if_log_table_locking_is_allowed(sql_command, type, table);
return TRUE;
--- 1.9/mysql-test/r/log_tables.result 2006-09-11 23:51:23 +04:00
+++ 1.10/mysql-test/r/log_tables.result 2006-09-11 23:51:23 +04:00
@@ -226,8 +226,6 @@ select * from general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
create table general_log_new like general_log;
-Warnings:
-Error 1542 You can't write-lock a log table. Only read access is possible
rename table general_log TO renamed_general_log, general_log_new TO general_log;
rename table general_log TO general_log_new, renamed_general_log TO general_log, slow_log
to renamed_slow_log;
ERROR HY000: Cannot rename a log table. Rename of the log table is allowed only for log
rotate and in this case you should also specify a table with appropriate schema to be
renamed back to the log table
@@ -239,7 +237,6 @@ select * from renamed_general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log
-TIMESTAMP USER_HOST THREAD_ID 1 Query SHOW WARNINGS
TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log,
general_log_new TO general_log
set global general_log='OFF';
RENAME TABLE general_log TO general_log2;
@@ -250,4 +247,21 @@ set global general_log='ON';
flush logs;
flush logs;
drop table renamed_general_log;
+use test;
+use mysql;
+repair table general_log;
+Table Op Msg_type Msg_text
+mysql.general_log repair status OK
+repair table slow_log;
+Table Op Msg_type Msg_text
+mysql.slow_log repair status OK
+create table general_log_new like general_log;
+create table slow_log_new like slow_log;
+show tables like "%log%";
+Tables_in_mysql (%log%)
+general_log
+general_log_new
+slow_log
+slow_log_new
+drop table slow_log_new, general_log_new;
use test;
--- 1.13/mysql-test/t/log_tables.test 2006-09-11 23:51:23 +04:00
+++ 1.14/mysql-test/t/log_tables.test 2006-09-11 23:51:23 +04:00
@@ -357,6 +357,20 @@ flush logs;
drop table renamed_general_log;
use test;
+#
+# Bug #21966 Strange warnings on repair of the log tables
+#
+
+use mysql;
+# check that no warning occurs on repair of the log tables
+repair table general_log;
+repair table slow_log;
+# check that no warning occurs on "create like" for the log tables
+create table general_log_new like general_log;
+create table slow_log_new like slow_log;
+show tables like "%log%";
+drop table slow_log_new, general_log_new;
+use test;
# kill all connections
disconnect con1;
--- 1.14/sql/log.h 2006-09-11 23:51:23 +04:00
+++ 1.15/sql/log.h 2006-09-11 23:51:23 +04:00
@@ -403,6 +403,9 @@ public:
};
+int check_if_opened_log_table(uint db_len, const char *db,
+ const char *table_name);
+
class Log_to_csv_event_handler: public Log_event_handler
{
/*
@@ -411,6 +414,16 @@ class Log_to_csv_event_handler: public L
THD's of the query. The reason is the locking order and duration.
*/
THD *general_log_thd, *slow_log_thd;
+ /*
+ This is for the thread, which called close_n_lock_tables. The thread
+ will be allowed to write-lock the log tables (as it explicitly disabled
+ logging). This is used for such operations as REPAIR, which require
+ exclusive lock on the log tables.
+ NOTE: there can be only one priviliged thread, as close_n_lock_tables
+ lockes logger exclusively, so no other thread could get privileged
+ status.
+ */
+ THD *privileged_thread;
friend class LOGGER;
TABLE_LIST general_log, slow_log;
@@ -435,12 +448,20 @@ public:
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs);
- void close_n_lock_tables();
+ void close_n_lock_tables(THD *thd);
void close_log_table(uint log_type, bool lock_in_use);
bool reopen_log_table(uint log_type);
+ THD* get_privileged_thread()
+ {
+ return privileged_thread;
+ }
};
+/* type of the log table */
+#define QUERY_LOG_SLOW 1
+#define QUERY_LOG_GENERAL 2
+
class Log_to_file_event_handler: public Log_event_handler
{
MYSQL_QUERY_LOG mysql_log;
@@ -496,14 +517,18 @@ public:
{}
void lock() { (void) pthread_mutex_lock(&LOCK_logger); }
void unlock() { (void) pthread_mutex_unlock(&LOCK_logger); }
- void close_n_lock_tables();
- bool is_general_log_table_enabled()
- {
- return table_log_handler && table_log_handler->general_log.table != 0;
- }
- bool is_slow_log_table_enabled()
+ void close_n_lock_tables(THD *thd);
+ bool is_log_table_enabled(uint log_table_type)
{
- return table_log_handler && table_log_handler->slow_log.table != 0;
+ switch (log_table_type) {
+ case QUERY_LOG_SLOW:
+ return table_log_handler && table_log_handler->slow_log.table != 0;
+ case QUERY_LOG_GENERAL:
+ return table_log_handler && table_log_handler->general_log.table != 0;
+ default:
+ DBUG_ASSERT(0);
+ return FALSE; /* make compiler happy */
+ }
}
/*
We want to initialize all log mutexes as soon as possible,
@@ -562,6 +587,13 @@ public:
if (file_log_handler)
return file_log_handler->get_mysql_log();
return NULL;
+ }
+ THD* get_privileged_thread()
+ {
+ if (table_log_handler)
+ return table_log_handler->get_privileged_thread();
+ else
+ return NULL;
}
};
--- 1.38/sql/sql_rename.cc 2006-09-11 23:51:23 +04:00
+++ 1.39/sql/sql_rename.cc 2006-09-11 23:51:23 +04:00
@@ -28,25 +28,6 @@ static TABLE_LIST *rename_tables(THD *th
static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list);
-/* Check if a given table is opened log table */
-int check_if_opened_log_table(uint db_len, const char *db,
- const char *table_name)
-{
- if (db_len == 5 &&
- !my_strcasecmp(system_charset_info, db, "mysql"))
- {
- if (!my_strcasecmp(system_charset_info, table_name, "general_log") &&
- logger.is_general_log_table_enabled())
- return QUERY_LOG_GENERAL;
- else
- if (!my_strcasecmp(system_charset_info, table_name, "slow_log") &&
- logger.is_slow_log_table_enabled())
- return QUERY_LOG_SLOW;
- }
- return 0;
-}
-
-
/*
Every second entry in the table_list is the original name and every
second entry is the new name.
@@ -74,8 +55,8 @@ bool mysql_rename_tables(THD *thd, TABLE
if (wait_if_global_read_lock(thd,0,1))
DBUG_RETURN(1);
- if (logger.is_general_log_table_enabled() ||
- logger.is_slow_log_table_enabled())
+ if (logger.is_log_table_enabled(QUERY_LOG_GENERAL) ||
+ logger.is_log_table_enabled(QUERY_LOG_SLOW))
{
/*
@@ -132,7 +113,7 @@ bool mysql_rename_tables(THD *thd, TABLE
/* The function will close log tables and call logger.lock() */
if (disable_logs)
- logger.close_n_lock_tables();
+ logger.close_n_lock_tables(thd);
}
VOID(pthread_mutex_lock(&LOCK_open));
| Thread |
|---|
| • bk commit into 5.1 tree (petr:1.2286) BUG#21966 | Petr Chardin | 11 Sep |