mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +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:
@@ -4617,7 +4617,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
if (view_operator_func == NULL)
|
||||
table->required_type=FRMTYPE_TABLE;
|
||||
|
||||
open_and_lock_tables(thd, table);
|
||||
open_and_lock_tables_derived(thd, table, TRUE,
|
||||
MYSQL_OPEN_TAKE_UPGRADABLE_MDL);
|
||||
thd->no_warnings_for_error= 0;
|
||||
table->next_global= save_next_global;
|
||||
table->next_local= save_next_local;
|
||||
@@ -5074,7 +5075,6 @@ bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
|
||||
bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
DBUG_ENTER("mysql_repair_table");
|
||||
set_all_mdl_upgradable(tables);
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
"repair", TL_WRITE, 1,
|
||||
test(check_opt->sql_flags & TT_USEFRM),
|
||||
@@ -5087,7 +5087,6 @@ bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
DBUG_ENTER("mysql_optimize_table");
|
||||
set_all_mdl_upgradable(tables);
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
"optimize", TL_WRITE, 1,0,0,0,
|
||||
&handler::ha_optimize, 0));
|
||||
@@ -6604,9 +6603,8 @@ view_err:
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
table_list->mdl_upgradable= TRUE;
|
||||
|
||||
if (!(table= open_n_lock_single_table(thd, table_list, TL_WRITE_ALLOW_READ)))
|
||||
if (!(table= open_n_lock_single_table(thd, table_list, TL_WRITE_ALLOW_READ,
|
||||
MYSQL_OPEN_TAKE_UPGRADABLE_MDL)))
|
||||
DBUG_RETURN(TRUE);
|
||||
table->use_all_columns();
|
||||
mdl_lock_data= table->mdl_lock_data;
|
||||
@@ -7898,7 +7896,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
||||
|
||||
strxmov(table_name, table->db ,".", table->table_name, NullS);
|
||||
|
||||
t= table->table= open_n_lock_single_table(thd, table, TL_READ);
|
||||
t= table->table= open_n_lock_single_table(thd, table, TL_READ, 0);
|
||||
thd->clear_error(); // these errors shouldn't get client
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
|
Reference in New Issue
Block a user