summaryrefslogtreecommitdiff
path: root/sql/sql_rename.cc
diff options
context:
space:
mode:
authorthek@adventure.(none) <>2007-07-02 21:03:10 +0200
committerthek@adventure.(none) <>2007-07-02 21:03:10 +0200
commit08e7d2d3128ec4d5313b0a481020ad6687ced9f9 (patch)
tree22952496fda992e3bdada73b563098c2f9e3bbea /sql/sql_rename.cc
parent1550a5ddee810a9d45fb3e779e19023001684792 (diff)
parent863e882785762bbde5b11bee7fd4568dc46d5794 (diff)
downloadmariadb-git-08e7d2d3128ec4d5313b0a481020ad6687ced9f9.tar.gz
Merge adventure.(none):/home/thek/Development/cpp/bug21074/my51-bug21074
into adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r--sql/sql_rename.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 866d82377c0..e68a360f2d4 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -144,10 +144,14 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
}
}
- VOID(pthread_mutex_lock(&LOCK_open));
- if (lock_table_names(thd, table_list))
+ pthread_mutex_lock(&LOCK_open);
+ if (lock_table_names_exclusively(thd, table_list))
+ {
+ pthread_mutex_unlock(&LOCK_open);
goto err;
-
+ }
+ pthread_mutex_unlock(&LOCK_open);
+
error=0;
if ((ren_table=rename_tables(thd,table_list,0)))
{
@@ -178,10 +182,14 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
send_ok(thd);
}
+ if (!error)
+ query_cache_invalidate3(thd, table_list, 0);
+
+ pthread_mutex_lock(&LOCK_open);
unlock_table_names(thd, table_list, (TABLE_LIST*) 0);
+ pthread_mutex_unlock(&LOCK_open);
err:
- pthread_mutex_unlock(&LOCK_open);
/* enable logging back if needed */
if (disable_logs)
{