diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-04-05 12:54:09 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-04-24 11:15:38 +0200 |
commit | 5d510fdbf006afa82c8acc9ea2e0c6cbeaebe0fa (patch) | |
tree | 2fe83bb6954d5e53d4b408d8e570ff4132f579f0 /sql/sql_base.cc | |
parent | 5057d4637525eadad438d25ee6a4870a4e6b384c (diff) | |
download | mariadb-git-5d510fdbf006afa82c8acc9ea2e0c6cbeaebe0fa.tar.gz |
MDEV-18507 can't update temporary table when joined with table with triggers on read-only
triggers are opened and tables used in triggers are prelocked in
open_tables(). But multi-update can detect what tables will actually
be updated only later, after all main tables are opened.
Meaning, if a table is used in multi-update, but is not actually updated,
its on-update treggers will be opened and tables will be prelocked,
even if it's unnecessary. This can cause more tables to be
write-locked than needed, causing read_only errors, privilege errors
and lock waits.
Fix: don't open/prelock triggers unless table->updating is true.
In multi-update after setting table->updating=true, do a second
open_tables() for newly added tables, if any.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9a2da7a8658..c774334e695 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4484,7 +4484,7 @@ bool extend_table_list(THD *thd, TABLE_LIST *tables, LEX *lex= thd->lex; if (thd->locked_tables_mode <= LTM_LOCK_TABLES && - ! has_prelocking_list && + ! has_prelocking_list && tables->updating && tables->lock_type >= TL_WRITE_ALLOW_WRITE) { bool need_prelocking= FALSE; |