diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 0d21e11b8..b32fa8852 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -3662,7 +3662,7 @@ void MySQL_HostGroups_Manager::group_replication_lag_action( wrlock(); int reader_hostgroup = 0; - bool writer_is_also_reader = false; + // bool writer_is_also_reader = false; // Get the reader_hostgroup for the supplied writter hostgroup const std::string t_reader_hostgroup_query { @@ -3688,7 +3688,7 @@ void MySQL_HostGroups_Manager::group_replication_lag_action( rhid_row = rhid_res->rows[0]; reader_hostgroup = atoi(rhid_row->fields[0]); - writer_is_also_reader = atoi(rhid_row->fields[1]); + // writer_is_also_reader = atoi(rhid_row->fields[1]); { MyHGC* myhgc = nullptr; diff --git a/lib/MySQL_Logger.cpp b/lib/MySQL_Logger.cpp index 509df0375..61fba5f68 100644 --- a/lib/MySQL_Logger.cpp +++ b/lib/MySQL_Logger.cpp @@ -542,7 +542,7 @@ void MySQL_Logger::events_open_log_unlocked() { events.logfile->open(filen , std::ios::out | std::ios::binary); proxy_info("Starting new mysql event log file %s\n", filen); } - catch (std::ofstream::failure e) { + catch (const std::ofstream::failure&) { proxy_error("Error creating new mysql event log file %s\n", filen); delete events.logfile; events.logfile=NULL; @@ -571,7 +571,7 @@ void MySQL_Logger::audit_open_log_unlocked() { audit.logfile->open(filen , std::ios::out | std::ios::binary); proxy_info("Starting new audit log file %s\n", filen); } - catch (std::ofstream::failure e) { + catch (const std::ofstream::failure&) { proxy_error("Error creating new audit log file %s\n", filen); delete audit.logfile; audit.logfile=NULL; diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 089db49f8..93da82c92 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -19,6 +19,7 @@ #include "MySQL_Protocol.h" #include "SQLite3_Server.h" #include "MySQL_Variables.h" +#include "ProxySQL_Cluster.hpp" #include "libinjection.h" diff --git a/lib/ProxySQL_Cluster.cpp b/lib/ProxySQL_Cluster.cpp index 7c2dd9f1d..6e6d29877 100644 --- a/lib/ProxySQL_Cluster.cpp +++ b/lib/ProxySQL_Cluster.cpp @@ -87,7 +87,7 @@ void * ProxySQL_Cluster_Monitor_thread(void *args) { GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; if (conn == NULL) { conn = mysql_init(NULL); if (conn==NULL) { @@ -906,7 +906,7 @@ void ProxySQL_Cluster::pull_mysql_query_rules_from_peer(const string& expected_c GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); //mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout_long); //mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); @@ -1177,7 +1177,7 @@ void ProxySQL_Cluster::pull_mysql_users_from_peer(const string& expected_checksu GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); //mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout_long); //mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); @@ -1498,7 +1498,7 @@ void ProxySQL_Cluster::pull_mysql_servers_from_peer(const std::string& checksum, GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); //mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout_long); //mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); @@ -1868,7 +1868,7 @@ void ProxySQL_Cluster::pull_global_variables_from_peer(const string& var_type, c GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); //mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout_long); //mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); @@ -2020,7 +2020,7 @@ void ProxySQL_Cluster::pull_proxysql_servers_from_peer(const std::string& expect GloProxyCluster->get_credentials(&username, &password); if (strlen(username)) { // do not monitor if the username is empty unsigned int timeout = 1; - unsigned int timeout_long = 60; + // unsigned int timeout_long = 60; mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); //mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout_long); //mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); diff --git a/lib/ProxySQL_RESTAPI_Server.cpp b/lib/ProxySQL_RESTAPI_Server.cpp index 94374f204..795112b9c 100644 --- a/lib/ProxySQL_RESTAPI_Server.cpp +++ b/lib/ProxySQL_RESTAPI_Server.cpp @@ -118,7 +118,7 @@ private: } std::string script; - int interval_ms; + int interval_ms = 1; auto result=find_script(req, script, interval_ms); // result == nullpts means that script was found and we can execute it. continue. @@ -290,19 +290,25 @@ public: input_params.push_back({arg.first, arg.second}); } - const char* req_path { req.get_path().c_str() }; const string s_params { input_params.dump() }; + +#ifdef DEBUG + const char* req_path { req.get_path().c_str() }; const char* p_params { s_params.c_str() }; proxy_debug(PROXY_DEBUG_RESTAPI, 1, "Processing GET - req: '%s', params: `%s`\n", req_path, p_params); +#endif return process_request(req, s_params); } const std::shared_ptr render_POST(const http_request& req) { std::string params=req.get_content(); + +#ifdef DEBUG const char* req_path { req.get_path().c_str() }; const char* p_params { params.c_str() }; proxy_debug(PROXY_DEBUG_RESTAPI, 1, "Processing POST - req: '%s', params: `%s`\n", req_path, p_params); +#endif return process_request(req, params); }