#At file:///opt/local/work/trunk-runtime/ based on revid:kostja@stripped
3095 Konstantin Osipov 2010-08-05
A preliminary patch that fixes Bug#41158 "DROP TABLE holds
LOCK_open during unlink()". This patch is a pre-requisite for
the fix for Bug#52044.
modified:
sql/datadict.cc
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/sql_base.cc
sql/sql_base.h
sql/sql_insert.cc
sql/sql_parse.cc
sql/sql_rename.cc
sql/sql_table.cc
sql/sql_trigger.cc
sql/sys_vars.cc
=== modified file 'sql/datadict.cc'
--- a/sql/datadict.cc 2010-06-06 11:19:29 +0000
+++ b/sql/datadict.cc 2010-08-05 10:57:55 +0000
@@ -152,9 +152,7 @@ bool dd_recreate_table(THD *thd, const c
build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0);
/* Attempt to reconstruct the table. */
- mysql_mutex_lock(&LOCK_open);
error= ha_create_table(thd, path, db, table_name, &create_info, TRUE);
- mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(error);
}
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-07-29 15:35:22 +0000
+++ b/sql/ha_ndbcluster.cc 2010-08-05 10:57:55 +0000
@@ -680,7 +680,7 @@ int ha_ndbcluster::ndb_err(NdbTransactio
bzero((char*) &table_list,sizeof(table_list));
table_list.db= m_dbname;
table_list.alias= table_list.table_name= m_tabname;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
break;
}
default:
@@ -5702,7 +5702,7 @@ int ha_ndbcluster::create(const char *na
m_table->getObjectVersion(),
(is_truncate) ?
SOT_TRUNCATE_TABLE : SOT_CREATE_TABLE,
- 0, 0, 1);
+ 0, 0);
break;
}
}
@@ -6143,7 +6143,7 @@ int ha_ndbcluster::rename_table(const ch
old_dbname, m_tabname,
ndb_table_id, ndb_table_version,
SOT_RENAME_TABLE,
- m_dbname, new_tabname, 1);
+ m_dbname, new_tabname);
}
// If we are moving tables between databases, we need to recreate
@@ -6337,7 +6337,7 @@ retry_temporary_error1:
thd->query(), thd->query_length(),
share->db, share->table_name,
ndb_table_id, ndb_table_version,
- SOT_DROP_TABLE, 0, 0, 1);
+ SOT_DROP_TABLE, 0, 0);
}
else if (table_dropped && share && share->op) /* ndbcluster_log_schema_op
will do a force GCP */
@@ -7019,7 +7019,6 @@ int ndbcluster_drop_database_impl(const
while ((tabname=it++))
{
tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1);
- mysql_mutex_lock(&LOCK_open);
if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname))
{
const NdbError err= dict->getNdbError();
@@ -7029,7 +7028,6 @@ int ndbcluster_drop_database_impl(const
ret= ndb_to_mysql_error(&err);
}
}
- mysql_mutex_unlock(&LOCK_open);
}
DBUG_RETURN(ret);
}
@@ -7056,7 +7054,7 @@ static void ndbcluster_drop_database(han
ha_ndbcluster::set_dbname(path, db);
ndbcluster_log_schema_op(thd, 0,
thd->query(), thd->query_length(),
- db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
+ db, "", 0, 0, SOT_DROP_DB, 0, 0);
#endif
DBUG_VOID_RETURN;
}
@@ -7181,7 +7179,6 @@ int ndbcluster_find_all_files(THD *thd)
my_free(data);
my_free(pack_data);
- mysql_mutex_lock(&LOCK_open);
if (discover)
{
/* ToDo 4.1 database needs to be created if missing */
@@ -7199,7 +7196,6 @@ int ndbcluster_find_all_files(THD *thd)
TRUE);
}
#endif
- mysql_mutex_unlock(&LOCK_open);
}
}
while (unhandled && retries);
@@ -7292,19 +7288,16 @@ int ndbcluster_find_files(handlerton *ht
file_name->str, reg_ext, 0);
if (my_access(name, F_OK))
{
- mysql_mutex_lock(&LOCK_open);
DBUG_PRINT("info", ("Table %s listed and need discovery",
file_name->str));
if (ndb_create_table_from_engine(thd, db, file_name->str))
{
- mysql_mutex_unlock(&LOCK_open);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_EXISTS_ERROR,
"Discover of table %s.%s failed",
db, file_name->str);
continue;
}
- mysql_mutex_unlock(&LOCK_open);
}
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name->str));
file_on_disk= TRUE;
@@ -7361,10 +7354,8 @@ int ndbcluster_find_files(handlerton *ht
file_name_str= (char*)my_hash_element(&ok_tables, i);
end= end1 +
tablename_to_filename(file_name_str, end1, sizeof(name) - (end1 - name));
- mysql_mutex_lock(&LOCK_open);
ndbcluster_create_binlog_setup(ndb, name, end-name,
db, file_name_str, TRUE);
- mysql_mutex_unlock(&LOCK_open);
}
}
#endif
@@ -7426,7 +7417,6 @@ int ndbcluster_find_files(handlerton *ht
}
/* Lock mutex before creating .FRM files. */
- mysql_mutex_lock(&LOCK_open);
/* Create new files. */
List_iterator_fast<char> it2(create_list);
while ((file_name_str=it2++))
@@ -7441,8 +7431,6 @@ int ndbcluster_find_files(handlerton *ht
}
}
- mysql_mutex_unlock(&LOCK_open);
-
my_hash_free(&ok_tables);
my_hash_free(&ndb_tables);
@@ -8452,8 +8440,7 @@ int handle_trailing_share(NDB_SHARE *sha
bzero((char*) &table_list,sizeof(table_list));
table_list.db= share->db;
table_list.alias= table_list.table_name= share->table_name;
- mysql_mutex_assert_owner(&LOCK_open);
- close_cached_tables(thd, &table_list, TRUE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
mysql_mutex_lock(&ndbcluster_mutex);
/* ndb_share reference temporary free */
@@ -10612,13 +10599,13 @@ int ndbcluster_alter_tablespace(handlert
thd->query(), thd->query_length(),
"", alter_info->tablespace_name,
0, 0,
- SOT_TABLESPACE, 0, 0, 0);
+ SOT_TABLESPACE, 0, 0);
else
ndbcluster_log_schema_op(thd, 0,
thd->query(), thd->query_length(),
"", alter_info->logfile_group_name,
0, 0,
- SOT_LOGFILE_GROUP, 0, 0, 0);
+ SOT_LOGFILE_GROUP, 0, 0);
#endif
DBUG_RETURN(FALSE);
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2010-07-29 16:27:20 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2010-08-05 10:57:55 +0000
@@ -360,7 +360,6 @@ ndbcluster_binlog_open_table(THD *thd, N
int error;
DBUG_ENTER("ndbcluster_binlog_open_table");
- mysql_mutex_assert_owner(&LOCK_open);
init_tmp_table_share(thd, table_share, share->db, 0, share->table_name,
share->key);
if ((error= open_table_def(thd, table_share, 0)))
@@ -376,7 +375,9 @@ ndbcluster_binlog_open_table(THD *thd, N
free_table_share(table_share);
DBUG_RETURN(error);
}
+ mysql_mutex_lock(&LOCK_open);
assign_new_table_id(table_share);
+ mysql_mutex_unlock(&LOCK_open);
if (!reopen)
{
@@ -625,7 +626,7 @@ ndbcluster_binlog_log_query(handlerton *
{
ndbcluster_log_schema_op(thd, 0, query, query_length,
db, table_name, 0, 0, type,
- 0, 0, 0);
+ 0, 0);
}
DBUG_VOID_RETURN;
}
@@ -908,9 +909,7 @@ int ndbcluster_setup_binlog_table_shares
if (!ndb_schema_share &&
ndbcluster_check_ndb_schema_share() == 0)
{
- mysql_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_SCHEMA_TABLE);
- mysql_mutex_unlock(&LOCK_open);
if (!ndb_schema_share)
{
ndbcluster_create_schema_table(thd);
@@ -922,9 +921,7 @@ int ndbcluster_setup_binlog_table_shares
if (!ndb_apply_status_share &&
ndbcluster_check_ndb_apply_status_share() == 0)
{
- mysql_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_APPLY_TABLE);
- mysql_mutex_unlock(&LOCK_open);
if (!ndb_apply_status_share)
{
ndbcluster_create_ndb_apply_status_table(thd);
@@ -934,12 +931,10 @@ int ndbcluster_setup_binlog_table_shares
}
if (!ndbcluster_find_all_files(thd))
{
- mysql_mutex_lock(&LOCK_open);
ndb_binlog_tables_inited= TRUE;
if (opt_ndb_extra_logging)
sql_print_information("NDB Binlog: ndb tables writable");
- close_cached_tables(NULL, NULL, TRUE, FALSE);
- mysql_mutex_unlock(&LOCK_open);
+ close_cached_tables(NULL, NULL, FALSE);
/* Signal injector thread that all is setup */
mysql_cond_signal(&injector_cond);
}
@@ -1276,8 +1271,7 @@ int ndbcluster_log_schema_op(THD *thd, N
uint32 ndb_table_id,
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type,
- const char *new_db, const char *new_table_name,
- int have_lock_open)
+ const char *new_db, const char *new_table_name)
{
DBUG_ENTER("ndbcluster_log_schema_op");
Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -1580,11 +1574,6 @@ end:
int max_timeout= DEFAULT_SYNC_TIMEOUT;
mysql_mutex_lock(&ndb_schema_object->mutex);
- if (have_lock_open)
- {
- mysql_mutex_assert_owner(&LOCK_open);
- mysql_mutex_unlock(&LOCK_open);
- }
while (1)
{
struct timespec abstime;
@@ -1640,10 +1629,6 @@ end:
"distributing", ndb_schema_object->key);
}
}
- if (have_lock_open)
- {
- mysql_mutex_lock(&LOCK_open);
- }
mysql_mutex_unlock(&ndb_schema_object->mutex);
}
@@ -1726,7 +1711,6 @@ ndb_handle_schema_change(THD *thd, Ndb *
{
DBUG_DUMP("frm", (uchar*) altered_table->getFrmData(),
altered_table->getFrmLength());
- mysql_mutex_lock(&LOCK_open);
Ndb_table_guard ndbtab_g(dict, tabname);
const NDBTAB *old= ndbtab_g.get_table();
if (!old &&
@@ -1752,7 +1736,7 @@ ndb_handle_schema_change(THD *thd, Ndb *
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char *)dbname;
table_list.alias= table_list.table_name= (char *)tabname;
- close_cached_tables(thd, &table_list, TRUE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
if ((error= ndbcluster_binlog_open_table(thd, share,
table_share, table, 1)))
@@ -1858,7 +1842,7 @@ ndb_handle_schema_change(THD *thd, Ndb *
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char *)dbname;
table_list.alias= table_list.table_name= (char *)tabname;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
/* ndb_share reference create free */
DBUG_PRINT("NDB_SHARE", ("%s create free use_count: %u",
share->key, share->use_count));
@@ -1979,7 +1963,7 @@ ndb_binlog_thread_handle_schema_event(TH
bzero((char*) &table_list,sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
}
/* ndb_share reference temporary free */
if (share)
@@ -2096,7 +2080,7 @@ ndb_binlog_thread_handle_schema_event(TH
mysql_mutex_unlock(&ndb_schema_share_mutex);
/* end protect ndb_schema_share */
- close_cached_tables(NULL, NULL, FALSE, FALSE);
+ close_cached_tables(NULL, NULL, FALSE);
// fall through
case NDBEVENT::TE_ALTER:
ndb_handle_schema_change(thd, ndb, pOp, tmp_share);
@@ -2253,7 +2237,7 @@ ndb_binlog_thread_handle_schema_event_po
bzero((char*) &table_list,sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE);
}
if (schema_type != SOT_ALTER_TABLE)
break;
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2010-03-31 14:05:33 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2010-08-05 10:57:55 +0000
@@ -158,8 +158,7 @@ int ndbcluster_log_schema_op(THD *thd, N
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type,
const char *new_db,
- const char *new_table_name,
- int have_lock_open);
+ const char *new_table_name);
int ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
NDB_SHARE *share,
const char *type_str);
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-08-04 16:29:13 +0000
+++ b/sql/sql_base.cc 2010-08-05 10:57:55 +0000
@@ -314,8 +314,6 @@ void table_def_start_shutdown(void)
if (table_def_inited)
{
mysql_mutex_lock(&LOCK_open);
- /* Free all cached but unused TABLEs and TABLE_SHAREs first. */
- close_cached_tables(NULL, NULL, TRUE, FALSE);
/*
Ensure that TABLE and TABLE_SHARE objects which are created for
tables that are open during process of plugins' shutdown are
@@ -324,6 +322,8 @@ void table_def_start_shutdown(void)
*/
table_def_shutdown_in_progress= TRUE;
mysql_mutex_unlock(&LOCK_open);
+ /* Free all cached but unused TABLEs and TABLE_SHAREs. */
+ close_cached_tables(NULL, NULL, FALSE);
}
}
@@ -940,16 +940,14 @@ static void kill_delayed_threads_for_tab
lock taken by thread trying to obtain global read lock.
*/
-bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
- bool wait_for_refresh)
+bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool wait_for_refresh)
{
bool result= FALSE;
bool found= TRUE;
DBUG_ENTER("close_cached_tables");
DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
- if (!have_lock)
- mysql_mutex_lock(&LOCK_open);
+ mysql_mutex_lock(&LOCK_open);
if (!tables)
{
refresh_version++; // Force close of open tables
@@ -986,15 +984,11 @@ bool close_cached_tables(THD *thd, TABLE
wait_for_refresh=0; // Nothing to wait for
}
- if (!have_lock)
- mysql_mutex_unlock(&LOCK_open);
+ mysql_mutex_unlock(&LOCK_open);
if (!wait_for_refresh)
DBUG_RETURN(result);
- /* Code below assume that LOCK_open is released. */
- DBUG_ASSERT(!have_lock);
-
if (thd->locked_tables_mode)
{
/*
@@ -1108,7 +1102,7 @@ err_with_reopen:
*/
bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
- LEX_STRING *connection, bool have_lock)
+ LEX_STRING *connection)
{
uint idx;
TABLE_LIST tmp, *tables= NULL;
@@ -1118,8 +1112,7 @@ bool close_cached_connection_tables(THD
bzero(&tmp, sizeof(TABLE_LIST));
- if (!have_lock)
- mysql_mutex_lock(&LOCK_open);
+ mysql_mutex_lock(&LOCK_open);
for (idx= 0; idx < table_def_cache.records; idx++)
{
@@ -1147,12 +1140,10 @@ bool close_cached_connection_tables(THD
tables= (TABLE_LIST *) memdup_root(thd->mem_root, (char*)&tmp,
sizeof(TABLE_LIST));
}
+ mysql_mutex_unlock(&LOCK_open);
if (tables)
- result= close_cached_tables(thd, tables, TRUE, FALSE);
-
- if (!have_lock)
- mysql_mutex_unlock(&LOCK_open);
+ result= close_cached_tables(thd, tables, FALSE);
if (if_wait_for_refresh)
{
=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h 2010-08-04 16:29:13 +0000
+++ b/sql/sql_base.h 2010-08-05 10:57:55 +0000
@@ -226,11 +226,9 @@ TABLE *open_performance_schema_table(THD
Open_tables_state *backup);
void close_performance_schema_table(THD *thd, Open_tables_state *backup);
-bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
- bool wait_for_refresh);
+bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool wait_for_refresh);
bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
- LEX_STRING *connect_string,
- bool have_lock = FALSE);
+ LEX_STRING *connect_string);
void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
bool remove_from_locked_tables);
OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2010-07-27 10:25:53 +0000
+++ b/sql/sql_insert.cc 2010-08-05 10:57:55 +0000
@@ -3600,11 +3600,9 @@ static TABLE *create_table_from_items(TH
*/
if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
{
- mysql_mutex_lock(&LOCK_open);
quick_rm_table(create_info->db_type, create_table->db,
table_case_name(create_info, create_table->table_name),
0);
- mysql_mutex_unlock(&LOCK_open);
}
else
table= create_table->table;
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2010-07-29 12:32:11 +0000
+++ b/sql/sql_parse.cc 2010-08-05 10:57:55 +0000
@@ -6854,7 +6854,7 @@ bool reload_acl_and_cache(THD *thd, ulon
tmp_write_to_binlog= 0;
if (thd->global_read_lock.lock_global_read_lock(thd))
return 1; // Killed
- if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+ if (close_cached_tables(thd, tables, (options & REFRESH_FAST) ?
FALSE : TRUE))
result= 1;
@@ -6894,7 +6894,7 @@ bool reload_acl_and_cache(THD *thd, ulon
}
}
- if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+ if (close_cached_tables(thd, tables, (options & REFRESH_FAST) ?
FALSE : TRUE))
result= 1;
}
=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc 2010-07-01 13:53:46 +0000
+++ b/sql/sql_rename.cc 2010-08-05 10:57:55 +0000
@@ -152,8 +152,13 @@ bool mysql_rename_tables(THD *thd, TABLE
for (ren_table= table_list; ren_table; ren_table= ren_table->next_local)
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, ren_table->db,
ren_table->table_name);
+ mysql_mutex_unlock(&LOCK_open);
error=0;
+ /*
+ An exclusive lock on table names is satisfactory to ensure
+ no other thread accesses this table.
+ */
if ((ren_table=rename_tables(thd,table_list,0)))
{
/* Rename didn't succeed; rename back the tables in reverse order */
@@ -175,17 +180,6 @@ bool mysql_rename_tables(THD *thd, TABLE
error= 1;
}
- /*
- An exclusive lock on table names is satisfactory to ensure
- no other thread accesses this table.
- However, NDB assumes that handler::rename_tables is called under
- LOCK_open. And it indeed is, from ALTER TABLE.
- TODO: remove this limitation.
- We still should unlock LOCK_open as early as possible, to provide
- higher concurrency - query_cache_invalidate can take minutes to
- complete.
- */
- mysql_mutex_unlock(&LOCK_open);
if (!silent && !error)
{
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2010-07-29 12:32:11 +0000
+++ b/sql/sql_table.cc 2010-08-05 10:57:55 +0000
@@ -2111,7 +2111,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
DEBUG_SYNC(thd, "rm_table_part2_before_delete_table");
DBUG_EXECUTE_IF("sleep_before_part2_delete_table",
my_sleep(100000););
- mysql_mutex_lock(&LOCK_open);
if (drop_temporary ||
((access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
@@ -2131,8 +2130,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
char *end;
/*
Cannot use the db_type from the table, since that might have changed
- while waiting for the exclusive name lock. We are under LOCK_open,
- so reading from the frm-file is safe.
+ while waiting for the exclusive name lock.
*/
if (frm_db_type == DB_TYPE_UNKNOWN)
{
@@ -2173,7 +2171,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
error|= new_error;
}
}
- mysql_mutex_unlock(&LOCK_open);
if (error)
{
if (wrong_tables.length())
@@ -6775,7 +6772,6 @@ bool mysql_alter_table(THD *thd,char *ne
else
{
*fn_ext(new_name)=0;
- mysql_mutex_lock(&LOCK_open);
if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias, 0))
error= -1;
else if (Table_triggers_list::change_table_name(thd, db, table_name,
@@ -6785,7 +6781,6 @@ bool mysql_alter_table(THD *thd,char *ne
table_name, 0);
error= -1;
}
- mysql_mutex_unlock(&LOCK_open);
}
}
@@ -7404,7 +7399,6 @@ bool mysql_alter_table(THD *thd,char *ne
/* This type cannot happen in regular ALTER. */
new_db_type= old_db_type= NULL;
}
- mysql_mutex_lock(&LOCK_open);
if (mysql_rename_table(old_db_type, db, table_name, db, old_name,
FN_TO_IS_TMP))
{
@@ -7431,8 +7425,6 @@ bool mysql_alter_table(THD *thd,char *ne
if (! error)
(void) quick_rm_table(old_db_type, db, old_name, FN_IS_TMP);
- mysql_mutex_unlock(&LOCK_open);
-
if (error)
{
/* This shouldn't happen. But let us play it safe. */
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2010-07-27 10:25:53 +0000
+++ b/sql/sql_trigger.cc 2010-08-05 10:57:55 +0000
@@ -394,9 +394,7 @@ bool mysql_create_or_drop_trigger(THD *t
/*
We don't want perform our operations while global read lock is held
so we have to wait until its end and then prevent it from occurring
- again until we are done, unless we are under lock tables. (Acquiring
- LOCK_open is not enough because global read lock is held without holding
- LOCK_open).
+ again until we are done, unless we are under lock tables.
*/
if (!thd->locked_tables_mode &&
thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
@@ -516,11 +514,9 @@ bool mysql_create_or_drop_trigger(THD *t
goto end;
}
- mysql_mutex_lock(&LOCK_open);
result= (create ?
table->triggers->create_trigger(thd, tables, &stmt_query):
table->triggers->drop_trigger(thd, tables, &stmt_query));
- mysql_mutex_unlock(&LOCK_open);
if (result)
goto end;
@@ -1680,9 +1676,6 @@ bool add_table_for_trigger(THD *thd,
@param db schema for table
@param name name for table
- @note
- The calling thread should hold the LOCK_open mutex;
-
@retval
False success
@retval
@@ -1912,14 +1905,10 @@ bool Table_triggers_list::change_table_n
/*
This method interfaces the mysql server code protected by
- either LOCK_open mutex or with an exclusive metadata lock.
- In the future, only an exclusive metadata lock will be enough.
+ an exclusive metadata lock.
*/
-#ifndef DBUG_OFF
- if (thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, old_table,
- MDL_EXCLUSIVE))
- mysql_mutex_assert_owner(&LOCK_open);
-#endif
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, old_table,
+ MDL_EXCLUSIVE));
DBUG_ASSERT(my_strcasecmp(table_alias_charset, db, new_db) ||
my_strcasecmp(table_alias_charset, old_table, new_table));
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-07-27 14:32:42 +0000
+++ b/sql/sys_vars.cc 2010-08-05 10:57:55 +0000
@@ -1492,7 +1492,7 @@ static bool fix_read_only(sys_var *self,
can cause to wait on a read lock, it's required for the client application
to unlock everything, and acceptable for the server to wait on all locks.
*/
- if ((result= close_cached_tables(thd, NULL, FALSE, TRUE)))
+ if ((result= close_cached_tables(thd, NULL, TRUE)))
goto end_with_read_lock;
if ((result= thd->global_read_lock.make_global_read_lock_block_commit(thd)))
Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100805105755-o3ewa9e19jsvr7ny.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-runtime branch (kostja:3095) Bug#41158Bug#52044 | Konstantin Osipov | 5 Aug |