1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fixed bug LP:973039 - Assertion `share->in_trans == 0' failed in maria_close on DROP TABLE under LOCK

- 5.5 was missing calls to ha_extra(HA_PREPARE_FOR_DROP | HA_PREPARE_FOR_RENAME);  Lost in merge 5.3 -> 5.5


sql/sql_admin.cc:
  Updated arguments for close_all_tables_for_name
sql/sql_base.h:
  Updated arguments for close_all_tables_for_name
sql/sql_partition.cc:
  Updated arguments for close_all_tables_for_name
sql/sql_table.cc:
  Updated arguments for close_all_tables_for_name
  Removed test of kill, as we have already called 'ha_extra(HA_PREPARE_FOR_DROP)' and the table may be inconsistent.
sql/sql_trigger.cc:
  Updated arguments for close_all_tables_for_name
sql/sql_truncate.cc:
  For truncate that is done with drop + recreate, signal that the table will be dropped.
This commit is contained in:
Michael Widenius
2012-05-16 18:44:17 +03:00
parent c17bace4f0
commit 6d8e329c9a
9 changed files with 51 additions and 23 deletions

View File

@@ -2126,7 +2126,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
error= -1;
goto err;
}
close_all_tables_for_name(thd, table->table->s, TRUE);
close_all_tables_for_name(thd, table->table->s,
HA_EXTRA_PREPARE_FOR_DROP);
table->table= 0;
}
@@ -2134,11 +2135,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
MDL_EXCLUSIVE));
if (thd->killed)
{
error= -1;
goto err;
}
alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove .frm file and engine files */
path_length= build_table_filename(path, sizeof(path) - 1, db, alias,
@@ -6188,7 +6185,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
*/
if (wait_while_table_is_used(thd, table, extra_func))
goto err;
close_all_tables_for_name(thd, table->s, TRUE);
close_all_tables_for_name(thd, table->s, HA_EXTRA_PREPARE_FOR_RENAME);
/*
Then, we want check once again that target table does not exist.
Actually the order of these two steps does not matter since
@@ -6895,7 +6892,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
close_all_tables_for_name(thd, table->s,
new_name != table_name || new_db != db);
new_name != table_name || new_db != db ?
HA_EXTRA_PREPARE_FOR_RENAME :
HA_EXTRA_NORMAL);
error=0;
table_list->table= table= 0; /* Safety */