Drafting configuration of QC

Related to issue #171
Added variable mysql-query_cache_size_MB

Also removed compiling of simple_kv.cpp
pull/674/head
René Cannaò 10 years ago
parent c710f54987
commit d276262ebe

@ -314,6 +314,7 @@ class MySQL_Threads_Handler
char * ssl_p2s_cert;
char * ssl_p2s_key;
char * ssl_p2s_cipher;
int query_cache_size_MB;
} variables;
PtrArray *bind_fds;
MySQL_Listeners_Manager *MLM;

@ -6,7 +6,7 @@
#include "query_cache.hpp"
#include "mysql_connection.h"
#include "sqlite3db.h"
#include "simple_kv.h"
//#include "simple_kv.h"
#include "gen_utils.h"
#include "StatCounters.h"
#include "MySQL_Monitor.hpp"

@ -507,7 +507,7 @@ struct _global_variables_t {
unsigned int mysql_query_cache_default_timeout;
unsigned long long mysql_wait_timeout;
unsigned long long mysql_query_cache_size;
//unsigned long long mysql_query_cache_size;
unsigned long long mysql_max_resultset_size;
int mysql_max_query_size;
@ -737,6 +737,9 @@ __thread bool mysql_thread___query_digests;
__thread bool mysql_thread___default_reconnect;
__thread bool mysql_thread___sessions_sort;
/* variables used for Query Cache */
__thread int mysql_thread___query_cache_size_MB;
/* variables used for SSL , from proxy to server (p2s) */
__thread char * mysql_thread___ssl_p2s_ca;
__thread char * mysql_thread___ssl_p2s_cert;
@ -812,6 +815,9 @@ extern __thread bool mysql_thread___query_digests;
extern __thread bool mysql_thread___default_reconnect;
extern __thread bool mysql_thread___sessions_sort;
/* variables used for Query Cache */
extern __thread int mysql_thread___query_cache_size_MB;
/* variables used for SSL , from proxy to server (p2s) */
extern __thread char * mysql_thread___ssl_p2s_ca;
extern __thread char * mysql_thread___ssl_p2s_cert;

@ -47,7 +47,7 @@ default: libproxysql.a
_OBJ = c_tokenizer.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
_OBJ_CPP = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo simple_kv.oo sqlite3db.oo global_variables.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo
_OBJ_CPP = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo sqlite3db.oo global_variables.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo
OBJ_CPP = $(patsubst %,$(ODIR)/%,$(_OBJ_CPP))
%.ko: %.cpp

@ -191,6 +191,7 @@ static char * mysql_thread_variables_names[]= {
(char *)"default_query_delay",
(char *)"default_query_timeout",
(char *)"long_query_time",
(char *)"query_cache_size_MB",
(char *)"ping_interval_server_msec",
(char *)"ping_timeout_server",
(char *)"default_schema",
@ -266,6 +267,7 @@ MySQL_Threads_Handler::MySQL_Threads_Handler() {
variables.default_query_delay=0;
variables.default_query_timeout=24*3600*1000;
variables.long_query_time=1000;
variables.query_cache_size_MB=256;
variables.init_connect=NULL;
variables.ping_interval_server_msec=10000;
variables.ping_timeout_server=200;
@ -471,6 +473,7 @@ int MySQL_Threads_Handler::get_variable_int(char *name) {
if (!strcasecmp(name,"default_query_timeout")) return (int)variables.default_query_timeout;
if (!strcasecmp(name,"default_max_latency_ms")) return (int)variables.default_max_latency_ms;
if (!strcasecmp(name,"long_query_time")) return (int)variables.long_query_time;
if (!strcasecmp(name,"query_cache_size_MB")) return (int)variables.query_cache_size_MB;
if (!strcasecmp(name,"free_connections_pct")) return (int)variables.free_connections_pct;
if (!strcasecmp(name,"ping_interval_server_msec")) return (int)variables.ping_interval_server_msec;
if (!strcasecmp(name,"ping_timeout_server")) return (int)variables.ping_timeout_server;
@ -687,6 +690,10 @@ char * MySQL_Threads_Handler::get_variable(char *name) { // this is the public f
sprintf(intbuf,"%d",variables.long_query_time);
return strdup(intbuf);
}
if (!strcasecmp(name,"query_cache_size_MB")) {
sprintf(intbuf,"%d",variables.query_cache_size_MB);
return strdup(intbuf);
}
if (!strcasecmp(name,"ping_interval_server_msec")) {
sprintf(intbuf,"%d",variables.ping_interval_server_msec);
return strdup(intbuf);
@ -1010,6 +1017,15 @@ bool MySQL_Threads_Handler::set_variable(char *name, char *value) { // this is t
return false;
}
}
if (!strcasecmp(name,"query_cache_size_MB")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1024*10240) {
variables.query_cache_size_MB=intv;
return true;
} else {
return false;
}
}
if (!strcasecmp(name,"ping_interval_server_msec")) {
int intv=atoi(value);
if (intv >= 1000 && intv <= 7*24*3600*1000) {
@ -1995,6 +2011,7 @@ void MySQL_Thread::refresh_variables() {
mysql_thread___default_query_timeout=GloMTH->get_variable_int((char *)"default_query_timeout");
mysql_thread___default_max_latency_ms=GloMTH->get_variable_int((char *)"default_max_latency_ms");
mysql_thread___long_query_time=GloMTH->get_variable_int((char *)"long_query_time");
mysql_thread___query_cache_size_MB=GloMTH->get_variable_int((char *)"query_cache_size_MB");
mysql_thread___ping_interval_server_msec=GloMTH->get_variable_int((char *)"ping_interval_server_msec");
mysql_thread___ping_timeout_server=GloMTH->get_variable_int((char *)"ping_timeout_server");
mysql_thread___shun_on_failures=GloMTH->get_variable_int((char *)"shun_on_failures");

Loading…
Cancel
Save