mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Backport of:
------------------------------------------------------------ revno: 2630.9.1 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w3 timestamp: Sun 2008-06-08 22:13:58 +0400 message: WL#3726 "DDL locking for all metadata objects" After review fixes in progress. Some adjustments to the patch that removes thd->locked_tables sql/sp_head.cc: Fix conditions which were wrongly translated by previous patch. sql/sql_base.cc: close_thread_tables(): Add comment clarifying control flow in case of LTM_LOCK_TABLES mode and statements requiring prelocking. Be consistent with other places where we clear OPTION_TABLE_LOCK flag. lock_tables(): Always set THD::lock to 0 after freeing memory to which it points.
This commit is contained in:
@ -1375,6 +1375,7 @@ void close_thread_tables(THD *thd,
|
||||
bool skip_mdl)
|
||||
{
|
||||
TABLE *table;
|
||||
bool clear_table_lock_option= FALSE;
|
||||
DBUG_ENTER("close_thread_tables");
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
@ -1446,6 +1447,11 @@ void close_thread_tables(THD *thd,
|
||||
/*
|
||||
We are under simple LOCK TABLES or we're inside a sub-statement
|
||||
of a prelocked statement, so should not do anything else.
|
||||
|
||||
Note that even if we are in LTM_LOCK_TABLES mode and statement
|
||||
requires prelocking (e.g. when we are closing tables after
|
||||
failing ot "open" all tables required for statement execution)
|
||||
we will exit this function a few lines below.
|
||||
*/
|
||||
if (! thd->lex->requires_prelocking())
|
||||
DBUG_VOID_RETURN;
|
||||
@ -1462,7 +1468,7 @@ void close_thread_tables(THD *thd,
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
thd->locked_tables_mode= LTM_NONE;
|
||||
thd->options&= ~OPTION_TABLE_LOCK;
|
||||
clear_table_lock_option= TRUE;
|
||||
|
||||
/*
|
||||
Note that we are leaving prelocked mode so we don't need
|
||||
@ -1502,6 +1508,9 @@ void close_thread_tables(THD *thd,
|
||||
mdl_remove_all_locks(&thd->mdl_context);
|
||||
}
|
||||
|
||||
if (clear_table_lock_option)
|
||||
thd->options&= ~OPTION_TABLE_LOCK;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -5452,6 +5461,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
||||
need to care about THD::locked_tables_root here.
|
||||
*/
|
||||
mysql_unlock_tables(thd, thd->lock);
|
||||
thd->lock= 0;
|
||||
thd->options&= ~(OPTION_TABLE_LOCK);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user