diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-05-03 15:42:35 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-05-08 11:08:18 +0200 |
commit | d6d7e169fbff05bcdaa52a682e6bdb96c737584d (patch) | |
tree | 0384305e52c5bcb2f29a2878c1be961d7d4c455a /sql | |
parent | 2b29c52ea83e4c6e77eec9ded171a76ff206fab5 (diff) | |
download | mariadb-git-d6d7e169fbff05bcdaa52a682e6bdb96c737584d.tar.gz |
MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
table_already_fk_prelocked() was looking for a table in the wrong
list (not the complete list of prelocked tables, but only in its tail,
starting from the current table - which is always empty for the last
added table), so for circular FKs it kept adding same tables to the list
indefinitely.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 93511bb9188..5922106c7d0 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4255,8 +4255,9 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx, else lock_type= TL_READ; - if (table_already_fk_prelocked(table_list, fk->foreign_db, - fk->foreign_table, lock_type)) + if (table_already_fk_prelocked(prelocking_ctx->query_tables, + fk->foreign_db, fk->foreign_table, + lock_type)) continue; TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST)); |