summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-21 08:46:32 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-21 08:46:32 +0300
commita45c451e4002875187a40ec17e872d3b69a3452a (patch)
tree3b77baea158d3e2c0cc92b0f5b01bb3f7eb9ae37 /sql
parent75e8ce6d7316900e3b9431e9d50889fe00d2928c (diff)
downloadmariadb-git-a45c451e4002875187a40ec17e872d3b69a3452a.tar.gz
Fix for bug lp:1039277 "Crash in sql_cache.cc".
The crash happend when combining query cache, prepared statements and using a read only cursor. sql/sql_cache.cc: Fixed unlikely error when one adjust query cache size in middle of operation sql/sql_cursor.cc: Disable query cache when using cursors. This fixed lp:1039277 tests/mysql_client_test.c: Test case for lp:1039277
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cache.cc3
-rw-r--r--sql/sql_cursor.cc2
2 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 7edd28446a2..191cc4e01c8 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1813,7 +1813,10 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
goto err;
if (query_cache_size == 0)
+ {
+ thd->query_cache_is_applicable= 0; // Query can't be cached
goto err_unlock;
+ }
Query_cache_block *query_block;
if (thd->variables.query_cache_strip_comments)
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index c50cded7470..b8b979a282b 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -115,6 +115,8 @@ int mysql_open_cursor(THD *thd, select_result *result,
&thd->security_ctx->priv_user[0],
(char *) thd->security_ctx->host_or_ip,
2);
+ /* Mark that we can't use query cache with cursors */
+ thd->query_cache_is_applicable= 0;
rc= mysql_execute_command(thd);
MYSQL_QUERY_EXEC_DONE(rc);