diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2017-10-22 20:14:52 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-10-22 20:23:09 +0300 |
commit | eea07f5f5845c2fa5009546f6c1ed703f17a60b9 (patch) | |
tree | fa39e1f36d69c9795d4c12e013568525be4ddcc3 /sql/sql_table.cc | |
parent | a3b4f575b966ff91035fd8104eadd4df366574c1 (diff) | |
download | mariadb-git-eea07f5f5845c2fa5009546f6c1ed703f17a60b9.tar.gz |
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>
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dd7baa31a12..c85a8be85ab 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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); |