Skip to content

Commit

Permalink
Merge pull request #4053 from sysown/v2.x-fix_several_warnings
Browse files Browse the repository at this point in the history
Fix several simple compiler warnings
  • Loading branch information
renecannao authored Dec 14, 2022
2 parents 48d0702 + 6f163f8 commit 6907c03
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/MySQL_Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "MySQL_Protocol.h"
#include "SQLite3_Server.h"
#include "MySQL_Variables.h"
#include "ProxySQL_Cluster.hpp"


#include "libinjection.h"
Expand Down
12 changes: 6 additions & 6 deletions lib/ProxySQL_Cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions lib/ProxySQL_RESTAPI_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class sync_resource : public http_resource {
}

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.
Expand Down Expand Up @@ -290,19 +290,25 @@ class sync_resource : public http_resource {
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<http_response> 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);
}
Expand Down

0 comments on commit 6907c03

Please sign in to comment.