summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-22 08:28:01 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-22 08:28:01 -0200
commitecfdc3560c1e20c673337420761fa11c084ed2d8 (patch)
treef51942abc6312aa29e64b57ebda8c11b8278ccd6 /sql/sql_cache.cc
parentbdec5458aebded82d52cb535810ad73be244b690 (diff)
downloadmariadb-git-ecfdc3560c1e20c673337420761fa11c084ed2d8.tar.gz
Bug#40264: Aborted cached query causes query to hang indefinitely on next cache hit
The problem is that the query cache was storing partial results if the statement failed when sending the results to the client. This could cause clients to hang when trying to read the results from the cache as they would, for example, wait indefinitely for a eof packet that wasn't saved. The solution is to always discard the caching of a query that failed to send its results to the associated client. mysql-test/r/query_cache_notembedded.result: Add test case result for Bug#40264 mysql-test/t/query_cache_notembedded.test: Add test case for Bug#40264 sql/sql_cache.cc: Abort if a unreported error was raised.
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 4a521d83192..b55fa148e24 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -710,7 +710,12 @@ void query_cache_end_of_result(THD *thd)
if (thd->net.query_cache_query == 0)
DBUG_VOID_RETURN;
- if (thd->killed)
+ /*
+ Check if the NET layer raised a unreported error -- my_error() and
+ as a consequence query_cache_abort() haven't been called. Abort the
+ cached result as it might be only partially complete.
+ */
+ if (thd->killed || thd->net.report_error)
{
query_cache_abort(&thd->net);
DBUG_VOID_RETURN;