1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Backport of:

----------------------------------------------------------
revno: 2617.23.20
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Wed 2009-03-04 16:31:31 +0300
message:
  WL#4284 "Transactional DDL locking"
  Review comments: "Objectify" the MDL API.
  MDL_request and MDL_context still need manual construction and
  destruction, since they are used in environment that is averse
  to constructors/destructors.
This commit is contained in:
Konstantin Osipov
2009-12-04 02:52:05 +03:00
parent 195adcd201
commit a3a23ec4d3
20 changed files with 829 additions and 797 deletions

View File

@@ -329,7 +329,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
String stmt_query;
bool need_start_waiting= FALSE;
bool lock_upgrade_done= FALSE;
MDL_LOCK_TICKET *mdl_lock_ticket= NULL;
MDL_ticket *mdl_ticket= NULL;
DBUG_ENTER("mysql_create_or_drop_trigger");
@@ -465,7 +465,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
table= tables->table;
/* Later on we will need it to downgrade the lock */
mdl_lock_ticket= table->mdl_lock_ticket;
mdl_ticket= table->mdl_ticket;
if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
goto end;
@@ -513,7 +513,7 @@ end:
TABLE instance created by open_n_lock_single_table() and metadata lock.
*/
if (thd->locked_tables_mode && tables && lock_upgrade_done)
mdl_downgrade_exclusive_lock(&thd->mdl_context, mdl_lock_ticket);
mdl_ticket->downgrade_exclusive_lock();
if (need_start_waiting)
start_waiting_global_read_lock(thd);
@@ -1882,7 +1882,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
In the future, only an exclusive metadata lock will be enough.
*/
#ifndef DBUG_OFF
if (mdl_is_exclusive_lock_owner(&thd->mdl_context, 0, db, old_table))
if (thd->mdl_context.is_exclusive_lock_owner(0, db, old_table))
safe_mutex_assert_owner(&LOCK_open);
#endif