summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-04-05 12:54:09 +0200
committerSergei Golubchik <serg@mariadb.org>2019-04-24 11:15:38 +0200
commit5d510fdbf006afa82c8acc9ea2e0c6cbeaebe0fa (patch)
tree2fe83bb6954d5e53d4b408d8e570ff4132f579f0 /sql/sql_yacc.yy
parent5057d4637525eadad438d25ee6a4870a4e6b384c (diff)
downloadmariadb-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_yacc.yy')
-rw-r--r--sql/sql_yacc.yy2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9fd4cbcc26f..0da8c87ff93 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -13835,7 +13835,7 @@ table_lock:
{
thr_lock_type lock_type= (thr_lock_type) $3;
bool lock_for_write= lock_type >= TL_WRITE_ALLOW_WRITE;
- ulong table_options= 0;
+ ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0;
enum_mdl_type mdl_type= !lock_for_write
? MDL_SHARED_READ
: lock_type == TL_WRITE_CONCURRENT_INSERT