diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-04-01 14:07:02 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-04-01 14:07:02 +0400 |
commit | 334e7c9bccbc6892efbb35f5930f80ccf1d770a8 (patch) | |
tree | 7ddc38e5c776a4f82c9a9731f8d6d3a79103eef0 /sql/lock.cc | |
parent | cbc5157feb9801310e458f7ed10983ad478c881e (diff) | |
download | mariadb-git-bb-mdev7895.tar.gz |
MDEV-7895 - HANDLER READ doesn't upgrade metadata lock from S to SRbb-mdev7895
Change code for HANDLER READ statements to upgrade S metadata lock to
SR metadata lock for the duration of read. This allows us properly
isolate HANDLER READ from LOCK TABLES WRITE and makes metadata locking
for these statements consistent with locking for other DML.
HANDLER-related tests had to be adjusted to take into account that
HANDLER READ will wait for and acquire SR lock.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index c241e635e6b..ad0aedbee40 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -165,18 +165,12 @@ lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags) write we must own metadata lock of MDL_SHARED_WRITE or stronger type. For table to be locked for read we must own metadata lock of MDL_SHARED_READ or stronger type). - The only exception are HANDLER statements which are allowed to - lock table for read while having only MDL_SHARED lock on it. */ DBUG_ASSERT(t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? - MDL_SHARED_WRITE : MDL_SHARED_READ) || - (t->open_by_handler && - thd->mdl_context.is_lock_owner(MDL_key::TABLE, - t->s->db.str, t->s->table_name.str, - MDL_SHARED))); + MDL_SHARED_WRITE : MDL_SHARED_READ)); /* Prevent modifications to base tables if READ_ONLY is activated. |