1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Backport of:

------------------------------------------------------------
revno: 2630.4.20
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w2
timestamp: Wed 2008-06-04 16:27:06 +0400
message:
  WL#3726 "DDL locking for all metadata objects"

  After review fixes in progress.

  Got rid of TABLE_LIST::mdl_upgradable member and related functions
  by using special flag which to be passed to open_table() which
  asks it to take upgradable metadata lock on table being opened.
This commit is contained in:
Konstantin Osipov
2009-12-01 16:38:00 +03:00
parent 11eb7b9458
commit ded468704d
7 changed files with 19 additions and 49 deletions

View File

@@ -47,7 +47,6 @@
"FUNCTION" : "PROCEDURE")
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
static void adjust_mdl_locks_upgradability(TABLE_LIST *tables);
const char *any_db="*any*"; // Special symbol for check_access
@@ -3608,9 +3607,9 @@ end_with_restore_list:
thd->options|= OPTION_TABLE_LOCK;
alloc_mdl_locks(all_tables, &thd->locked_tables_root);
thd->mdl_el_root= &thd->locked_tables_root;
adjust_mdl_locks_upgradability(all_tables);
if (!(res= simple_open_n_lock_tables(thd, all_tables)))
if (!(res= open_and_lock_tables_derived(thd, all_tables, FALSE,
MYSQL_OPEN_TAKE_UPGRADABLE_MDL)))
{
#ifdef HAVE_QUERY_CACHE
if (thd->variables.query_cache_wlock_invalidate)
@@ -8106,21 +8105,6 @@ bool parse_sql(THD *thd,
return ret_value;
}
/**
Auxiliary function which marks metadata locks for all tables
on which we plan to take write lock as upgradable.
*/
static void adjust_mdl_locks_upgradability(TABLE_LIST *tables)
{
for (TABLE_LIST *tab= tables; tab; tab= tab->next_global)
{
if (tab->lock_type >= TL_WRITE_ALLOW_WRITE)
tab->mdl_upgradable= TRUE;
}
}
/**
@} (end of group Runtime_Environment)
*/