1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-13721 Assertion is_lock_owner() failed in mysql_rm_table_no_locks

This happened when trying to do delete a sequence hidden by a temporary
table.
Fixed by ignoring non-sequence temporary tables when trying to drop
sequences.

Signed-off-by: Monty <monty@mariadb.org>
This commit is contained in:
Aleksey Midenkov
2017-10-22 20:14:52 +03:00
committed by Monty
parent a3b4f575b9
commit eea07f5f58
3 changed files with 112 additions and 1 deletions

View File

@ -1990,7 +1990,7 @@ int write_bin_log(THD *thd, bool clear_error,
tables List of tables to delete
if_exists If 1, don't give error if one table doesn't exists
drop_temporary 1 if DROP TEMPORARY
drop_seqeunce 1 if DROP SEQUENCE
drop_sequence 1 if DROP SEQUENCE
NOTES
Will delete all tables that can be deleted and give a compact error
@ -2038,6 +2038,25 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
if (!thd->locked_tables_mode)
{
if (drop_sequence)
{
/* We are trying to drop a sequence.
Change all temporary tables that are not sequences to
normal tables so that we can try to drop them instead.
If we don't do this, we will get an error 'not a sequence'
when trying to drop a sequence that is hidden by a temporary
table.
*/
for (table= tables; table; table= table->next_global)
{
if (table->open_type == OT_TEMPORARY_OR_BASE &&
is_temporary_table(table) && !table->table->s->sequence)
{
thd->mark_tmp_table_as_free_for_reuse(table->table);
table->table= NULL;
}
}
}
if (lock_table_names(thd, tables, NULL,
thd->variables.lock_wait_timeout, 0))
DBUG_RETURN(true);