summaryrefslogtreecommitdiff
path: root/sql/sql_rename.cc
diff options
context:
space:
mode:
authorthek@adventure.(none) <>2007-07-02 19:14:48 +0200
committerthek@adventure.(none) <>2007-07-02 19:14:48 +0200
commit863e882785762bbde5b11bee7fd4568dc46d5794 (patch)
tree6ae98744dc3b93525f63eb7f5c0c84bcbf702b47 /sql/sql_rename.cc
parent6044940b258a964e19264e466fd4fd044dc495d3 (diff)
downloadmariadb-git-863e882785762bbde5b11bee7fd4568dc46d5794.tar.gz
Bug#21074 Large query_cache freezes mysql server sporadically under heavy load
Invaldating a subset of a sufficiently large query cache can take a long time. During this time the server is efficiently frozen and no other operation can be executed. This patch addresses this problem by moving the locks which cause the freezing and also by temporarily disable the query cache while the invalidation takes place.
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 f34ec83b29c..b87c74dc179 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)))
{
@@ -183,10 +187,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)
{