summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <bell@52.0.168.192.in-addr.arpa>2005-08-10 18:58:55 +0300
committerunknown <bell@52.0.168.192.in-addr.arpa>2005-08-10 18:58:55 +0300
commit307ed9b4da9abfcb868f11ce7deb77d36ab4c662 (patch)
treeeb229d2cf0f3f3e30bd22691e0530fa99065ff61 /sql/sql_cache.cc
parent04bf09424d052ba6ecc3957ecc6fe56f1773f5e9 (diff)
downloadmariadb-git-307ed9b4da9abfcb868f11ce7deb77d36ab4c662.tar.gz
block using QC in case of having tables locked by LOCK... (BUG#12385)
sql/sql_cache.cc: block QC using if tables are locked with LOCK unlock QC mysql-test/r/query_cache_noembeded.result: New BitKeeper file ``mysql-test/r/query_cache_noembeded.result'' mysql-test/t/query_cache_noembeded.test: New BitKeeper file ``mysql-test/t/query_cache_noembeded.test''
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index d729a6cc301..667b6e546d3 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -739,7 +739,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
TABLE_COUNTER_TYPE local_tables;
ulong tot_length;
DBUG_ENTER("Query_cache::store_query");
- if (query_cache_size == 0)
+ if (query_cache_size == 0 || thd->locked_tables)
DBUG_VOID_RETURN;
if ((local_tables= is_cacheable(thd, thd->query_length,
@@ -750,7 +750,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size == 0)
+ {
+ STRUCT_UNLOCK(&structure_guard_mutex);
DBUG_VOID_RETURN;
+ }
DUMP(this);
/* Key is query + database + flag */
@@ -874,7 +877,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
byte flags;
DBUG_ENTER("Query_cache::send_result_to_client");
- if (query_cache_size == 0 ||
+ if (query_cache_size == 0 || thd->locked_tables ||
/*
it is not possible to check has_transactions() function of handler
because tables not opened yet