summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc53
1 files changed, 10 insertions, 43 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0ed7ebe631f..9746080e9cd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1527,7 +1527,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->db_type= share->db_type();
/* Disable drop of enabled log tables */
- if (share && share->log_table &&
+ if (share && (share->table_category == TABLE_CATEGORY_PERFORMANCE) &&
check_if_log_table(table->db_length, table->db,
table->table_name_length, table->table_name, 1))
{
@@ -3980,7 +3980,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
Item *item;
Protocol *protocol= thd->protocol;
LEX *lex= thd->lex;
- int result_code, disable_logs= 0;
+ int result_code;
DBUG_ENTER("mysql_admin_table");
if (end_active_trans(thd))
@@ -4028,22 +4028,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
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_log_table(table->db_length, table->db,
- table->table_name_length,
- table->table_name, 1) &&
- lock_type >= TL_READ_NO_INSERT)
- {
- disable_logs= 1;
- logger.lock();
- logger.tmp_close_log_tables(thd);
- }
-
open_and_lock_tables(thd, table);
thd->no_warnings_for_error= 0;
table->next_global= save_next_global;
@@ -4113,8 +4097,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
/* Close all instances of the table to allow repair to rename files */
- if (lock_type == TL_WRITE && table->table->s->version &&
- !table->table->s->log_table)
+ if (lock_type == TL_WRITE && table->table->s->version)
{
pthread_mutex_lock(&LOCK_open);
const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
@@ -4273,7 +4256,7 @@ send_result_message:
close_thread_tables(thd);
if (!result_code) // recreation went ok
{
- if ((table->table= open_ltable(thd, table, lock_type)) &&
+ if ((table->table= open_ltable(thd, table, lock_type, 0)) &&
((result_code= table->table->file->analyze(thd, check_opt)) > 0))
result_code= 0; // analyze went ok
}
@@ -4339,10 +4322,9 @@ send_result_message:
}
if (table->table)
{
- /* in the below check we do not refresh the log tables */
if (fatal_error)
table->table->s->version=0; // Force close of table
- else if (open_for_modify && !table->table->s->log_table)
+ else if (open_for_modify)
{
if (table->table->s->tmp_table)
table->table->file->info(HA_STATUS_CONST);
@@ -4365,24 +4347,11 @@ send_result_message:
}
send_eof(thd);
- if (disable_logs)
- {
- if (logger.reopen_log_tables())
- 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 (logger.reopen_log_tables())
- my_error(ER_CANT_ACTIVATE_LOG, MYF(0));
- logger.unlock();
- }
if (table)
table->table=0;
DBUG_RETURN(TRUE);
@@ -4827,7 +4796,7 @@ mysql_discard_or_import_tablespace(THD *thd,
not complain when we lock the table
*/
thd->tablespace_op= TRUE;
- if (!(table=open_ltable(thd,table_list,TL_WRITE)))
+ if (!(table=open_ltable(thd, table_list, TL_WRITE, 0)))
{
thd->tablespace_op=FALSE;
DBUG_RETURN(-1);
@@ -5743,7 +5712,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (alter_info->flags & ALTER_PARTITION)
{
- my_error(ER_WRONG_USAGE, MYF(0), "PARTITION", "log table");
+ my_error(ER_WRONG_USAGE, MYF(0), "PARTITION", "log table");
DBUG_RETURN(TRUE);
}
#endif
@@ -5832,7 +5801,7 @@ view_err:
start_waiting_global_read_lock(thd);
DBUG_RETURN(error);
}
- if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ)))
+ if (!(table=open_ltable(thd, table_list, TL_WRITE_ALLOW_READ, 0)))
DBUG_RETURN(TRUE);
table->use_all_columns();
@@ -6348,11 +6317,9 @@ view_err:
{
VOID(pthread_mutex_lock(&LOCK_open));
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- table->file->ha_external_lock(thd, F_WRLCK);
+ VOID(pthread_mutex_unlock(&LOCK_open));
alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff);
- table->file->ha_external_lock(thd, F_UNLCK);
- VOID(pthread_mutex_unlock(&LOCK_open));
error= ha_commit_stmt(thd);
if (ha_commit(thd))
error= 1;
@@ -7001,7 +6968,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
strxmov(table_name, table->db ,".", table->table_name, NullS);
- t= table->table= open_ltable(thd, table, TL_READ);
+ t= table->table= open_ltable(thd, table, TL_READ, 0);
thd->clear_error(); // these errors shouldn't get client
protocol->prepare_for_resend();