summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2013-05-30 08:23:49 +0300
committerunknown <sanja@montyprogram.com>2013-05-30 08:23:49 +0300
commit22b60fa95cf1e33aff4bf7c43934d55e751f8908 (patch)
tree0f7d110910030402d592acbdb50f4b60329d90f1 /sql/sql_cache.cc
parent1db0c42e535d3cf97543e3bb0855f5283d73f075 (diff)
downloadmariadb-git-22b60fa95cf1e33aff4bf7c43934d55e751f8908.tar.gz
MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on concurrent drop event and event executio
Fix for embedded library, where thd->net.vio is not set which efficently switched off QC in emmbedded server for previous patch.
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 10cdadd5d95..086a6f2ff5b 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3986,6 +3986,18 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
/*
+In non-embedded QC intercepts result in net_real_write
+but if we have no net.vio then net_real_write
+will not be called, so QC can't get results of the query
+*/
+#ifdef EMBEDDED_LIBRARY
+#define qc_is_able_to_intercept_result(T) 1
+#else
+#define qc_is_able_to_intercept_result(T) ((T)->net.vio)
+#endif
+
+
+/*
If query is cacheable return number tables in query
(query without tables are not cached)
*/
@@ -4001,7 +4013,7 @@ Query_cache::is_cacheable(THD *thd, LEX *lex,
(thd->variables.query_cache_type == 1 ||
(thd->variables.query_cache_type == 2 && (lex->select_lex.options &
OPTION_TO_QUERY_CACHE))) &&
- thd->net.vio)
+ qc_is_able_to_intercept_result(thd))
{
DBUG_PRINT("qcache", ("options: %lx %lx type: %u",
(long) OPTION_TO_QUERY_CACHE,
@@ -4028,7 +4040,7 @@ Query_cache::is_cacheable(THD *thd, LEX *lex,
(long) OPTION_TO_QUERY_CACHE,
(long) lex->select_lex.options,
(int) thd->variables.query_cache_type,
- (uint) test(thd->net.vio)));
+ (uint) test(qc_is_able_to_intercept_result(thd))));
DBUG_RETURN(0);
}