mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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. sql/mysql_priv.h: Added one more argument to open_n_lock_single_table() call to be able to pass flags to open_table() and mysql_lock_tables() called by it. Added new flag for controlling open_table() behavior asks it to take upgradable metadata locks on tables open for write. sql/sql_base.cc: Added new flag for controlling open_table() behavior asks it to take upgradable metadata locks on tables open for write. This allowed us to get rid of TABLE_LIST::mdl_upgradable member. Added one more argument to open_n_lock_single_table() call to be able to pass flags to open_table() and mysql_lock_tables() called by it. sql/sql_insert.cc: Added one more argument to open_n_lock_single_table() call to be able to pass flags to open_table() and mysql_lock_tables() called by it. sql/sql_parse.cc: Got rid of TABLE_LIST::mdl_upgradable member by using special flag which to be passed to open_table() which asks it to take upgradable metadata lock on table being opened. As result also got rid of adjust_mdl_locks_upgradability() function. sql/sql_table.cc: 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. sql/sql_view.cc: 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. sql/table.h: 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:
@ -2598,6 +2598,9 @@ void table_share_release_hook(void *share)
|
||||
No version number checking is done.
|
||||
MYSQL_OPEN_TEMPORARY_ONLY - Open only temporary
|
||||
table not the base table or view.
|
||||
MYSQL_OPEN_TAKE_UPGRADABLE_MDL - Obtain upgradable
|
||||
metadata lock for tables on which we are going to
|
||||
take some kind of write table-level lock.
|
||||
|
||||
IMPLEMENTATION
|
||||
Uses a cache of open tables to find a table not in use.
|
||||
@ -2825,7 +2828,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
{
|
||||
bool retry;
|
||||
|
||||
if (table_list->mdl_upgradable)
|
||||
if (flags & MYSQL_OPEN_TAKE_UPGRADABLE_MDL &&
|
||||
table_list->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
mdl_set_upgradable(mdl_lock_data);
|
||||
mdl_set_lock_priority(mdl_lock_data, (flags & MYSQL_LOCK_IGNORE_FLUSH) ?
|
||||
MDL_HIGH_PRIO : MDL_NORMAL_PRIO);
|
||||
@ -4146,7 +4150,6 @@ static int add_merge_table_list(TABLE_LIST *tlist)
|
||||
|
||||
/* Set lock type. */
|
||||
child_l->lock_type= tlist->lock_type;
|
||||
child_l->mdl_upgradable= tlist->mdl_upgradable;
|
||||
|
||||
/* Set parent reference. */
|
||||
child_l->parent_l= tlist;
|
||||
@ -4905,6 +4908,8 @@ static bool check_lock_and_start_stmt(THD *thd, TABLE *table,
|
||||
@param[in] thd thread handle
|
||||
@param[in] table_l table to open is first table in this list
|
||||
@param[in] lock_type lock to use for table
|
||||
@param[in] flags options to be used while opening and locking
|
||||
table (see open_table(), mysql_lock_tables())
|
||||
|
||||
@return table
|
||||
@retval != NULL OK, opened table returned
|
||||
@ -4930,7 +4935,7 @@ static bool check_lock_and_start_stmt(THD *thd, TABLE *table,
|
||||
*/
|
||||
|
||||
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
|
||||
thr_lock_type lock_type)
|
||||
thr_lock_type lock_type, uint flags)
|
||||
{
|
||||
TABLE_LIST *save_next_global;
|
||||
DBUG_ENTER("open_n_lock_single_table");
|
||||
@ -4946,7 +4951,7 @@ TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
|
||||
table_l->required_type= FRMTYPE_TABLE;
|
||||
|
||||
/* Open the table. */
|
||||
if (simple_open_n_lock_tables(thd, table_l))
|
||||
if (open_and_lock_tables_derived(thd, table_l, FALSE, flags))
|
||||
table_l->table= NULL; /* Just to be sure. */
|
||||
|
||||
/* Restore list. */
|
||||
|
Reference in New Issue
Block a user