diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index a855f2aab..251b33990 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -646,6 +646,7 @@ __thread bool mysql_thread___default_reconnect; __thread bool mysql_thread___session_idle_show_processlist; __thread bool mysql_thread___sessions_sort; __thread bool mysql_thread___session_idle_ms; +__thread int mysql_thread___hostgroup_manager_verbose; /* variables used for Query Cache */ __thread int mysql_thread___query_cache_size_MB; @@ -759,6 +760,7 @@ extern __thread bool mysql_thread___default_reconnect; extern __thread bool mysql_thread___session_idle_show_processlist; extern __thread bool mysql_thread___sessions_sort; extern __thread bool mysql_thread___session_idle_ms; +extern __thread int mysql_thread___hostgroup_manager_verbose; /* variables used for Query Cache */ extern __thread int mysql_thread___query_cache_size_MB; diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 29fa6f38c..9ff6e8c87 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -1557,7 +1557,7 @@ void MySQL_HostGroups_Manager::generate_mysql_servers_table(int *_onlyhg) { rc=sqlite3_prepare_v2(mydb3, query32, -1, &statement32, 0); assert(rc==SQLITE_OK); - if (GloMTH->variables.hostgroup_manager_verbose) { + if (mysql_thread___hostgroup_manager_verbose) { if (_onlyhg==NULL) { proxy_info("Dumping current MySQL Servers structures for hostgroup ALL\n"); } else { @@ -1577,7 +1577,7 @@ void MySQL_HostGroups_Manager::generate_mysql_servers_table(int *_onlyhg) { MySrvC *mysrvc=NULL; for (unsigned int j=0; jmysrvs->servers->len; j++) { mysrvc=myhgc->mysrvs->idx(j); - if (GloMTH->variables.hostgroup_manager_verbose) { + if (mysql_thread___hostgroup_manager_verbose) { char *st; switch (mysrvc->status) { case 0: @@ -1647,7 +1647,7 @@ void MySQL_HostGroups_Manager::generate_mysql_servers_table(int *_onlyhg) { } sqlite3_finalize(statement1); sqlite3_finalize(statement32); - if (GloMTH->variables.hostgroup_manager_verbose) { + if (mysql_thread___hostgroup_manager_verbose) { char *error=NULL; int cols=0; int affected_rows=0; @@ -1668,7 +1668,7 @@ void MySQL_HostGroups_Manager::generate_mysql_servers_table(int *_onlyhg) { void MySQL_HostGroups_Manager::generate_mysql_replication_hostgroups_table() { if (incoming_replication_hostgroups==NULL) return; - if (GloMTH->variables.hostgroup_manager_verbose) { + if (mysql_thread___hostgroup_manager_verbose) { proxy_info("New mysql_replication_hostgroups table\n"); } for (std::vector::iterator it = incoming_replication_hostgroups->rows.begin() ; it != incoming_replication_hostgroups->rows.end(); ++it) { @@ -1689,7 +1689,7 @@ void MySQL_HostGroups_Manager::generate_mysql_replication_hostgroups_table() { //sprintf(query,"INSERT INTO mysql_replication_hostgroups VALUES(%s,%s,NULL)",r->fields[0],r->fields[1]); //} mydb->execute(query); - if (GloMTH->variables.hostgroup_manager_verbose) { + if (mysql_thread___hostgroup_manager_verbose) { fprintf(stderr,"writer_hostgroup: %s , reader_hostgroup: %s, check_type %s, comment: %s\n", r->fields[0],r->fields[1], r->fields[2], r->fields[3]); } free(query); diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index c946b0d32..9dd85b64f 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -714,6 +714,7 @@ int MySQL_Threads_Handler::get_variable_int(char *name) { if (!strcasecmp(name,"free_connections_pct")) return (int)variables.free_connections_pct; if (!strcasecmp(name,"have_compress")) return (int)variables.have_compress; if (!strcasecmp(name,"have_ssl")) return (int)variables.have_ssl; + if (!strcasecmp(name,"hostgroup_manager_verbose")) return (int)variables.hostgroup_manager_verbose; if (!strcasecmp(name,"multiplexing")) return (int)variables.multiplexing; if (!strcasecmp(name,"forward_autocommit")) return (int)variables.forward_autocommit; if (!strcasecmp(name,"enforce_autocommit_on_reads")) return (int)variables.enforce_autocommit_on_reads; @@ -3510,6 +3511,7 @@ void MySQL_Thread::refresh_variables() { mysql_thread___query_digests_lowercase=(bool)GloMTH->get_variable_int((char *)"query_digests_lowercase"); variables.stats_time_backend_query=(bool)GloMTH->get_variable_int((char *)"stats_time_backend_query"); variables.stats_time_query_processor=(bool)GloMTH->get_variable_int((char *)"stats_time_query_processor"); + mysql_thread___hostgroup_manager_verbose = GloMTH->get_variable_int((char *)"hostgroup_manager_verbose"); mysql_thread___sessions_sort=(bool)GloMTH->get_variable_int((char *)"sessions_sort"); #ifdef IDLE_THREADS mysql_thread___session_idle_show_processlist=(bool)GloMTH->get_variable_int((char *)"session_idle_show_processlist"); diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 769447334..38a4d680a 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -2064,9 +2064,12 @@ void ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign flush_sqliteserver_variables___runtime_to_database(admindb, false, false, false, true); } if (runtime_mysql_servers) { + int old_hostgroup_manager_verbose = mysql_thread___hostgroup_manager_verbose; + mysql_thread___hostgroup_manager_verbose = 0; mysql_servers_wrlock(); save_mysql_servers_runtime_to_database(true); mysql_servers_wrunlock(); + mysql_thread___hostgroup_manager_verbose = old_hostgroup_manager_verbose; } if (runtime_proxysql_servers) { mysql_servers_wrlock();