mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Backport of:
---------------------------------------------------------- revno: 2617.69.20 committer: Konstantin Osipov <kostja@sun.com> branch nick: 5.4-4284-1-assert timestamp: Thu 2009-08-13 18:29:55 +0400 message: WL#4284 "Transactional DDL locking" A review fix. Since WL#4284 implementation separated MDL_request and MDL_ticket, MDL_request becamse a utility object necessary only to get a ticket. Store it by-value in TABLE_LIST with the intent to merge MDL_request::key with table_list->table_name and table_list->db in future. Change the MDL subsystem to not require MDL_requests to stay around till close_thread_tables(). Remove the list of requests from the MDL context. Requests for shared metadata locks acquired in open_tables() are only used as a list in recover_from_failed_open_table_attempt(), which calls mdl_context.wait_for_locks() for this list. To keep such list for recover_from_failed_open_table_attempt(), introduce a context class (Open_table_context), that collects all requests. A lot of minor cleanups and simplications that became possible with this change.
This commit is contained in:
@ -1107,7 +1107,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
select_lex.table_list.link_in_list((uchar*) &table_list,
|
||||
(uchar**) &table_list.next_local);
|
||||
thd->lex->add_to_query_tables(&table_list);
|
||||
alloc_mdl_requests(&table_list, thd->mem_root);
|
||||
init_mdl_requests(&table_list);
|
||||
|
||||
/* switch on VIEW optimisation: do not fill temporary tables */
|
||||
thd->lex->sql_command= SQLCOM_SHOW_FIELDS;
|
||||
@ -3337,18 +3337,16 @@ end_with_restore_list:
|
||||
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
|
||||
goto error;
|
||||
|
||||
alloc_mdl_requests(all_tables, thd->locked_tables_list.locked_tables_root());
|
||||
init_mdl_requests(all_tables);
|
||||
|
||||
thd->options|= OPTION_TABLE_LOCK;
|
||||
thd->in_lock_tables=1;
|
||||
thd->locked_tables_root= thd->locked_tables_list.locked_tables_root();
|
||||
|
||||
res= (open_and_lock_tables_derived(thd, all_tables, FALSE,
|
||||
MYSQL_OPEN_TAKE_UPGRADABLE_MDL) ||
|
||||
thd->locked_tables_list.init_locked_tables(thd));
|
||||
|
||||
thd->in_lock_tables= 0;
|
||||
thd->locked_tables_root= NULL;
|
||||
|
||||
if (res)
|
||||
{
|
||||
@ -6021,9 +6019,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
||||
ptr->next_name_resolution_table= NULL;
|
||||
/* Link table in global list (all used tables) */
|
||||
lex->add_to_query_tables(ptr);
|
||||
ptr->mdl_request=
|
||||
MDL_request::create(0, ptr->db, ptr->table_name, thd->locked_tables_root ?
|
||||
thd->locked_tables_root : thd->mem_root);
|
||||
ptr->mdl_request.init(0, ptr->db, ptr->table_name, MDL_SHARED);
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user