mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Backport of:
------------------------------------------------------------ revno: 2630.4.18 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w2 timestamp: Tue 2008-06-03 21:07:58 +0400 message: WL#3726 "DDL locking for all metadata objects". After review fixes in progress. Now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. This makes API a bit more clear and makes adjust_mdl_locks_upgradability() much nicer. sql/lock.cc: lock_table_names(): Set TABLE_LIST::mdl_lock_data when allocating new metadata lock request object for table list element. sql/mdl.cc: Now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. Adjusted upgrade/ downgrade functions accordingly. We also got rid of mdl_release_exclusive_locks() and now release locks individually. To simplify this process mdl_release_all_locks_for_name() was introduced. sql/mdl.h: Now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. Adjusted upgrade/ downgrade functions accordingly. We also got rid of mdl_release_exclusive_locks() and now release locks individually. To simplify this process mdl_release_all_locks_for_name() was introduced. sql/sql_base.cc: Now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. We also got rid of mdl_release_exclusive_locks() and now release locks individually. sql/sql_parse.cc: adjust_mdl_locks_upgradability() is much simplier now due to the fact that now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. sql/sql_table.cc: Now during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context. Adjusted upgrade/ downgrade functions accordingly. We also got rid of mdl_release_exclusive_locks() and now release locks individually. To simplify this process mdl_release_all_locks_for_name() was introduced. sql/sql_trigger.cc: ow during upgrading/downgrading metadata locks we deal with individual metadata lock requests rather than with all requests for this object in the context.
This commit is contained in:
@@ -8114,31 +8114,10 @@ bool parse_sql(THD *thd,
|
||||
|
||||
static void adjust_mdl_locks_upgradability(TABLE_LIST *tables)
|
||||
{
|
||||
TABLE_LIST *tab, *otab;
|
||||
|
||||
for (tab= tables; tab; tab= tab->next_global)
|
||||
for (TABLE_LIST *tab= tables; tab; tab= tab->next_global)
|
||||
{
|
||||
if (tab->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
tab->mdl_upgradable= TRUE;
|
||||
else
|
||||
{
|
||||
/*
|
||||
TODO: To get rid of this loop we need to change our code to do
|
||||
metadata lock upgrade only for those instances of tables
|
||||
which are write locked instead of doing such upgrade for
|
||||
all instances of tables.
|
||||
*/
|
||||
for (otab= tables; otab; otab= otab->next_global)
|
||||
if (otab->lock_type >= TL_WRITE_ALLOW_WRITE &&
|
||||
otab->db_length == tab->db_length &&
|
||||
otab->table_name_length == tab->table_name_length &&
|
||||
!strcmp(otab->db, tab->db) &&
|
||||
!strcmp(otab->table_name, tab->table_name))
|
||||
{
|
||||
tab->mdl_upgradable= TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user