diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-08 13:38:36 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-08 13:38:36 +0200 |
commit | 985f63cce1057d7b3fd6e86e65a2a2ee7d970073 (patch) | |
tree | b517479e6778d1701f123b842233a6015bdf12c1 /sql | |
parent | e84c62d59b8036138998b0e521a47bdde4ac3875 (diff) | |
parent | 530da97c65a8018ef049dfb990df6b98bc5e4ccd (diff) | |
download | mariadb-git-mariadb-10.2.32.tar.gz |
Merge branch '10.1' into 10.2mariadb-10.2.32
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 9 | ||||
-rw-r--r-- | sql/table.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f31c3f36aa8..45916220896 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4445,10 +4445,19 @@ bool Lock_tables_prelocking_strategy:: handle_table(THD *thd, Query_tables_list *prelocking_ctx, TABLE_LIST *table_list, bool *need_prelocking) { + TABLE_LIST **last= prelocking_ctx->query_tables_last; + if (DML_prelocking_strategy::handle_table(thd, prelocking_ctx, table_list, need_prelocking)) return TRUE; + /* + normally we don't need to open FK-prelocked tables for RESTRICT, + MDL is enough. But under LOCK TABLES we have to open everything + */ + for (TABLE_LIST *tl= *last; tl; tl= tl->next_global) + tl->open_strategy= TABLE_LIST::OPEN_NORMAL; + /* We rely on a caller to check that table is going to be changed. */ DBUG_ASSERT(table_list->lock_type >= TL_WRITE_ALLOW_WRITE); diff --git a/sql/table.h b/sql/table.h index e0541ef3f2e..0cf0e4efe00 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1818,6 +1818,9 @@ struct TABLE_LIST open_type= routine ? OT_TEMPORARY_OR_BASE : OT_BASE_ONLY; belong_to_view= belong_to_view_arg; trg_event_map= trg_event_map_arg; + /* MDL is enough for read-only FK checks, we don't need the table */ + if (prelocking_placeholder == FK && lock_type < TL_WRITE_ALLOW_WRITE) + open_strategy= OPEN_STUB; **last_ptr= this; prev_global= *last_ptr; |