diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-07-19 01:03:14 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-09-04 09:49:53 +0200 |
commit | 9180e8666b8e31239d2e2075b703fb8bc8effc13 (patch) | |
tree | aa9a4dce29f11c49e2e161d88432f18bba6028ff /sql/sql_base.cc | |
parent | e81f101dac5c8514c362732a3b9dbc2f896390a6 (diff) | |
download | mariadb-git-9180e8666b8e31239d2e2075b703fb8bc8effc13.tar.gz |
MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
ALTER TABLE locks the table with TL_READ_NO_INSERT, to prevent the
source table modifications while it's being copied. But there's an
indirect way of modifying a table, via cascade FK actions.
After previous commits, an attempt to modify an FK parent table
will cause FK children to be prelocked, so the table-being-altered
cannot be modified by a cascade FK action, because ALTER holds a
lock and prelocking will wait.
But if a new FK is being added by this very ALTER, then the target
table is not locked yet (it's a temporary table). So, we have to
lock FK parents explicitly.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index be7d9008aa4..32ce3c3a793 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4806,8 +4806,8 @@ handle_routine(THD *thd, Query_tables_list *prelocking_ctx, @note this can be changed to use a hash, instead of scanning the linked list, if the performance of this function will ever become an issue */ -static bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db, - LEX_STRING *table, thr_lock_type lock_type) +bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db, + LEX_STRING *table, thr_lock_type lock_type) { for (; tl; tl= tl->next_global ) { |