diff options
author | unknown <kostja@bodhi.(none)> | 2007-07-16 15:57:20 +0400 |
---|---|---|
committer | unknown <kostja@bodhi.(none)> | 2007-07-16 15:57:20 +0400 |
commit | 02a832df2e9743fbe132fe84f906761fc00c1279 (patch) | |
tree | e7aeefe6bd764a8c6df3cf1f7e3cbffb74e0316d /sql/sql_rename.cc | |
parent | 7416224c60a876c5cde518e41469911d1b00b3ce (diff) | |
download | mariadb-git-02a832df2e9743fbe132fe84f906761fc00c1279.tar.gz |
A follow up after the fix for Bug#21074 - fix NDB tests breaking on
asserts.
The patch for Bug#21074 replaces acquisition of the global LOCK_open lock
with exclusive locks on table names in such operations ad DROP TABLE
and RENAME TABLE.
Unfortunately, NDB internally assumes that LOCK_open is acquired and
tries to release it.
This dependency should be fixed by a separate (and significant in size)
patch. For now we just satisfy it - after all, the original
goal of the patch for Bug#21074 was to move query_cache_invalidate
outside of the scope of LOCK_open, and we still can do that.
This fixes some failing NDB tests in the runtime tree.
sql/sql_rename.cc:
Move release of LOCK_open after ha_ndbcluster::rename_tables to
satisfy an assert in ndb_log_schema_op.
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r-- | sql/sql_rename.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index e68a360f2d4..f5e1b8988f3 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -150,7 +150,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) pthread_mutex_unlock(&LOCK_open); goto err; } - pthread_mutex_unlock(&LOCK_open); error=0; if ((ren_table=rename_tables(thd,table_list,0))) @@ -174,6 +173,17 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) 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. + */ + pthread_mutex_unlock(&LOCK_open); /* Lets hope this doesn't fail as the result will be messy */ if (!silent && !error) |