From 41acb178eeab30353cfa6f198f811a1778a16aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 16 Aug 2016 23:38:30 +0000 Subject: [PATCH] mysql_thread___query_cache_size_MB refreshed in QC Issue #171 --- lib/Query_Cache.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Query_Cache.cpp b/lib/Query_Cache.cpp index 9c7dd1e71..7dea95995 100644 --- a/lib/Query_Cache.cpp +++ b/lib/Query_Cache.cpp @@ -27,8 +27,9 @@ #else #define DEB "" #endif /* DEBUG */ -#define QUERY_CACHE_VERSION "0.2.0902" DEB +#define QUERY_CACHE_VERSION "1.2.0817" DEB +extern MySQL_Threads_Handler *GloMTH; typedef btree::btree_map BtMap_cache; @@ -340,16 +341,25 @@ uint64_t Query_Cache::flush() { void * Query_Cache::purgeHash_thread(void *) { unsigned int i; + unsigned int MySQL_Monitor__thread_MySQL_Thread_Variables_version; + MySQL_Thread * mysql_thr = new MySQL_Thread(); + MySQL_Monitor__thread_MySQL_Thread_Variables_version=GloMTH->get_global_version(); while (shutdown==0) { usleep(purge_loop_time); unsigned long long t=monotonic_time()/1000; QCnow_ms=t; - + unsigned int glover=GloMTH->get_global_version(); + if (MySQL_Monitor__thread_MySQL_Thread_Variables_version < glover ) { + MySQL_Monitor__thread_MySQL_Thread_Variables_version=glover; + mysql_thr->refresh_variables(); + max_memory_size=mysql_thread___query_cache_size_MB*1024*1024; + } if (current_used_memory_pct() < purge_threshold_pct_min ) continue; for (i=0; ipurge_some(QCnow_ms); } } + delete mysql_thr; return NULL; };