summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-08-09 22:33:47 +0400
committerKonstantin Osipov <kostja@sun.com>2010-08-09 22:33:47 +0400
commitf8bfa3287ded5212a28c6d4bbf2d4afee8e5c403 (patch)
tree220bf71a69ee638da7cfd2c542d73122422a8c2f /sql/sql_trigger.cc
parent9862f8c7561aa34acb71e8e34444fef7086718e5 (diff)
downloadmariadb-git-f8bfa3287ded5212a28c6d4bbf2d4afee8e5c403.tar.gz
A fix for Bug#41158 "DROP TABLE holds LOCK_open during unlink()".
Remove acquisition of LOCK_open around file system operations, since such operations are now protected by metadata locks. Rework table discovery algorithm to not require LOCK_open. No new tests added since all MDL locking operations are covered in lock.test and mdl_sync.test, and as long as these tests pass despite the increased concurrency, consistency must be unaffected.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index a5664b00287..b81461e8371 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -394,9 +394,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/*
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 *thd, TABLE_LIST *tables, bool create)
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_name(THD *thd, const char *db,
/*
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));