1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Pre-requisite patch for bug #51263 "Deadlock between

transactional SELECT and ALTER TABLE ... REBUILD PARTITION".

The goal of this patch is to decouple type of metadata
lock acquired for table by open_tables() from type of
table-level lock to be acquired on it.

To achieve this we change approach to how we determine what
type of metadata lock should be acquired on table to be open.
Now instead of inferring it at open_tables() time from flags
and type of table-level lock we rely on that type of metadata
lock is properly set at parsing time and is not changed
further.
This commit is contained in:
Dmitry Lenev
2010-05-25 16:35:01 +04:00
parent 6ceacd4fb9
commit a3c080be7a
20 changed files with 359 additions and 227 deletions

View File

@ -880,6 +880,8 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
before calling it. Also it cannot be called while holding
LOCK_open mutex. Both these invariants are enforced by asserts
in MDL_context::acquire_locks().
@note Initialization of MDL_request members of TABLE_LIST elements
is a responsibility of the caller.
@retval FALSE Success.
@retval TRUE Failure (OOM or thread was killed).
@ -894,12 +896,7 @@ bool lock_table_names(THD *thd, TABLE_LIST *table_list)
global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
for (lock_table= table_list; lock_table; lock_table= lock_table->next_local)
{
lock_table->mdl_request.init(MDL_key::TABLE,
lock_table->db, lock_table->table_name,
MDL_EXCLUSIVE);
mdl_requests.push_front(&lock_table->mdl_request);
}
mdl_requests.push_front(&global_request);