Created new metric counters for registering 'mysql_errors'

pull/2676/head
Javier Jaramago Fernández 6 years ago
parent 8b76426baf
commit 7f8b07a0db

@ -315,10 +315,17 @@ struct p_hg_dyn_counter {
connection_pool_conn_ok,
connection_pool_queries,
gtid_executed,
proxysql_mysql_error,
mysql_error,
__size
};
};
enum class p_mysql_error_type {
mysql,
proxysql
};
struct p_hg_dyn_gauge {
enum metric {
connection_pool_conn_free = 0,
@ -397,6 +404,10 @@ class MySQL_HostGroups_Manager {
* @brief Update the "stats_mysql_gtid_executed" counters.
*/
void p_update_mysql_gtid_executed();
/**
* @brief Mutex to be taken before accessing the p_mysql_errors_map.
*/
pthread_mutex_t p_err_map_access;
void p_update_connection_pool_update_counter(std::string& endpoint_id, std::string& endpoint_addr, std::string& endpoint_port, std::string& hostgroup_id, std::map<std::string, prometheus::Counter*>& m_map, unsigned long long value, p_hg_dyn_counter::metric idx);
void p_update_connection_pool_update_gauge(std::string& endpoint_id, std::string& endpoint_addr, std::string& endpoint_port, std::string& hostgroup_id, std::map<std::string, prometheus::Gauge*>& m_map, unsigned long long value, p_hg_dyn_gauge::metric idx);
@ -468,13 +479,25 @@ class MySQL_HostGroups_Manager {
/// Prometheus gtid_executed metrics
std::map<std::string, prometheus::Counter*> p_gtid_executed_map {};
/// Prometheus mysql_error metrics
std::map<std::string, prometheus::Counter*> p_mysql_errors_map {};
//////////////////////////////////////////////////////
} status;
/**
* @brief Update the module prometheus metrics.
*/
void p_update_metrics();
/**
* @brief Updates the 'mysql_error' counter identified by the 'm_id' parameter,
* or creates a new one in case of not existing.
*
* @param hid The hostgroup identifier.
* @param address The connection address that triggered the error.
* @param port The port of the connection that triggered the error.
* @param errno The error code itself.
*/
void p_update_mysql_error_counter(p_mysql_error_type err_type, unsigned int hid, char* address, uint16_t port, unsigned int code);
wqueue<MySQL_Connection *> queue;
MySQL_HostGroups_Manager();

@ -257,7 +257,8 @@ class KillArgs {
unsigned int port;
unsigned long id;
int kill_type;
KillArgs(char *u, char *p, char *h, unsigned int P, unsigned long i, int kt, MySQL_Thread *_mt);
unsigned int hid;
KillArgs(char *u, char *p, char *h, unsigned int P, unsigned int _hdi, unsigned long i, int kt, MySQL_Thread *_mt);
~KillArgs();
};

@ -7,6 +7,7 @@
#include "MySQL_Data_Stream.h"
#include <memory>
#include <pthread.h>
#include <string>
#include <prometheus/counter.h>
@ -1234,6 +1235,13 @@ hg_metrics_map = std::make_tuple(
"Tracks the number of executed gtid per host and port.",
metric_tags {}
),
// mysql_error
std::make_tuple (
p_hg_dyn_counter::mysql_error,
"proxysql_mysql_error",
"Tracks the mysql errors encountered, identifying them by: hostgroup + hostname + port + error_code.",
metric_tags {}
)
},
// prometheus dynamic counters
hg_dyn_gauge_vector {
@ -1347,6 +1355,8 @@ MySQL_HostGroups_Manager::MySQL_HostGroups_Manager() {
init_prometheus_gauge_array<hg_metrics_map_idx, p_hg_gauge>(hg_metrics_map, this->status.p_gauge_array);
init_prometheus_dyn_counter_array<hg_metrics_map_idx, p_hg_dyn_counter>(hg_metrics_map, this->status.p_dyn_counter_array);
init_prometheus_dyn_gauge_array<hg_metrics_map_idx, p_hg_dyn_gauge>(hg_metrics_map, this->status.p_dyn_gauge_array);
pthread_mutex_init(&mysql_errors_mutex, NULL);
}
void MySQL_HostGroups_Manager::init() {
@ -1401,6 +1411,37 @@ void MySQL_HostGroups_Manager::wrlock() {
#endif
}
void MySQL_HostGroups_Manager::p_update_mysql_error_counter(p_mysql_error_type err_type, unsigned int hid, char* address, uint16_t port, unsigned int code) {
p_hg_dyn_counter::metric metric = p_hg_dyn_counter::mysql_error;
if (err_type == p_mysql_error_type::proxysql) {
metric = p_hg_dyn_counter::proxysql_mysql_error;
}
std::string s_hostgroup = std::to_string(hid);
std::string s_address = std::string(address);
std::string s_port = std::to_string(port);
// TODO: Create switch here to classify error codes
std::string s_code = std::to_string(code);
std::string metric_id = s_hostgroup + ":" + address + ":" + s_port;
std::map<string, string> metric_labels {
{ "hostgroup", s_hostgroup },
{ "address", address },
{ "port", s_port },
{ "code", s_code }
};
pthread_mutex_lock(&mysql_errors_mutex);
p_inc_map_counter(
status.p_mysql_errors_map,
status.p_dyn_counter_array[metric],
metric_id,
metric_labels
);
pthread_mutex_unlock(&mysql_errors_mutex);
}
void MySQL_HostGroups_Manager::wrunlock() {
#ifdef MHM_PTHREAD_MUTEX
pthread_mutex_unlock(&lock);
@ -3167,7 +3208,7 @@ void MySQL_HostGroups_Manager::destroy_MyConn_from_pool(MySQL_Connection *c, boo
auth_password=ui->password;
}
}
KillArgs *ka = new KillArgs(ui->username, auth_password, c->parent->address, c->parent->port, c->mysql->thread_id, KILL_CONNECTION, NULL);
KillArgs *ka = new KillArgs(ui->username, auth_password, c->parent->address, c->parent->port, c->parent->myhgc->hid, c->mysql->thread_id, KILL_CONNECTION, NULL);
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

@ -11,6 +11,7 @@
#include <mutex>
#include <thread>
#include <prometheus/counter.h>
#include "MySQL_HostGroups_Manager.h"
#include "MySQL_Monitor.hpp"
#include "proxysql.h"
#include "cpp.h"
@ -912,6 +913,7 @@ void * monitor_ping_thread(void *arg) {
}
if (mmsd->interr) { // ping failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
//proxy_warning("Got error. mmsd %p , MYSQL %p , FD %d : %s\n", mmsd, mmsd->mysql, mmsd->mysql->net.fd, mmsd->mysql_error_msg);
} else {
if (crc==false) {
@ -1058,6 +1060,7 @@ bool MySQL_Monitor_State_Data::create_new_connection() {
if (myrc==NULL) {
mysql_error_msg=strdup(mysql_error(mysql));
int myerrno=mysql_errno(mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, hostgroup_id, hostname, port, myerrno);
if (myerrno < 2000) {
mysql_close(mysql);
} else {
@ -1140,6 +1143,7 @@ void * monitor_read_only_thread(void *arg) {
if (mmsd->interr) {
// error during query
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
goto __exit_monitor_read_only_thread;
}
if (GloMyMon->shutdown==true) {
@ -1152,6 +1156,7 @@ void * monitor_read_only_thread(void *arg) {
if (mmsd->interr) {
// error during query
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
goto __exit_monitor_read_only_thread;
}
mmsd->async_exit_status=mysql_store_result_start(&mmsd->result,mmsd->mysql);
@ -1173,6 +1178,7 @@ void * monitor_read_only_thread(void *arg) {
}
if (mmsd->interr) { // ping failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
}
__exit_monitor_read_only_thread:
@ -1374,6 +1380,7 @@ void * monitor_group_replication_thread(void *arg) {
if (mmsd->interr) {
// error during query
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
goto __exit_monitor_group_replication_thread;
}
@ -1387,6 +1394,7 @@ void * monitor_group_replication_thread(void *arg) {
if (mmsd->interr) {
// error during query
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
goto __exit_monitor_group_replication_thread;
}
mmsd->async_exit_status=mysql_store_result_start(&mmsd->result,mmsd->mysql);
@ -1407,6 +1415,7 @@ void * monitor_group_replication_thread(void *arg) {
}
if (mmsd->interr) { // group replication check failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
proxy_error("Got error: mmsd %p , MYSQL %p , FD %d : %s\n", mmsd, mmsd->mysql, mmsd->mysql->net.fd, mmsd->mysql_error_msg);
GloMyMon->My_Conn_Pool->conn_unregister(mmsd);
if (mmsd->mysql) {
@ -1755,6 +1764,7 @@ void * monitor_galera_thread(void *arg) {
}
if (mmsd->interr) { // ping failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
proxy_error("Got error. mmsd %p , MYSQL %p , FD %d : %s\n", mmsd, mmsd->mysql, mmsd->mysql->net.fd, mmsd->mysql_error_msg);
if (mmsd->mysql) {
GloMyMon->My_Conn_Pool->conn_unregister(mmsd);
@ -2130,6 +2140,7 @@ void * monitor_replication_lag_thread(void *arg) {
}
if (mmsd->interr) { // replication lag check failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
unsigned long long now=monotonic_time();
#ifdef DEBUG
proxy_error("Error after %dms: mmsd %p , MYSQL %p , FD %d : %s\n", (now-mmsd->t1)/1000, mmsd, mmsd->mysql, mmsd->mysql->net.fd, mmsd->mysql_error_msg);
@ -4272,6 +4283,7 @@ void * monitor_AWS_Aurora_thread_HG(void *arg) {
}
if (mmsd->interr) { // check failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
}
__exit_monitor_aws_aurora_HG_thread:
@ -4695,6 +4707,7 @@ void * monitor_AWS_Aurora_thread(void *arg) {
}
if (mmsd->interr) { // check failed
mmsd->mysql_error_msg=strdup(mysql_error(mmsd->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql));
}
__exit_monitor_aws_aurora_thread:

@ -2639,11 +2639,15 @@ void MySQL_ResultSet::add_err(MySQL_Data_Stream *_myds) {
if (_myds && _myds->killed_at) { // see case #750
if (_myds->kill_type == 0) {
myprot->generate_pkt_ERR(false,&pkt.ptr,&pkt.size,sid,1907,sqlstate,(char *)"Query execution was interrupted, query_timeout exceeded");
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, myds->myconn->parent->myhgc->hid, myds->myconn->parent->address, myds->myconn->parent->port, 1907);
} else {
myprot->generate_pkt_ERR(false,&pkt.ptr,&pkt.size,sid,1317,sqlstate,(char *)"Query execution was interrupted");
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, myds->myconn->parent->myhgc->hid, myds->myconn->parent->address, myds->myconn->parent->port, 1317);
}
} else {
myprot->generate_pkt_ERR(false,&pkt.ptr,&pkt.size,sid,mysql_errno(_mysql),sqlstate,mysql_error(_mysql));
// TODO: Check this is a mysql error
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myds->myconn->parent->myhgc->hid, myds->myconn->parent->address, myds->myconn->parent->port, mysql_errno(_mysql));
}
PSarrayOUT.add(pkt.ptr,pkt.size);
sid++;

@ -96,11 +96,12 @@ bool Session_Regex::match(char *m) {
}
KillArgs::KillArgs(char *u, char *p, char *h, unsigned int P, unsigned long i, int kt, MySQL_Thread *_mt) {
KillArgs::KillArgs(char *u, char *p, char *h, unsigned int P, unsigned int _hid, unsigned long i, int kt, MySQL_Thread *_mt) {
username=strdup(u);
password=strdup(p);
hostname=strdup(h);
port=P;
hid=_hid;
id=i;
kill_type=kt;
mt=_mt;
@ -158,6 +159,8 @@ void * kill_query_thread(void *arg) {
}
if (!ret) {
proxy_error("Failed to connect to server %s:%d to run KILL %s %llu: Error: %s\n" , ka->hostname, ka->port, ( ka->kill_type==KILL_QUERY ? "QUERY" : "CONNECTION" ) , ka->id, mysql_error(mysql));
// TODO: Ask for this specific case: 'modify killargs to include hostgroup info
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, ka->hid, ka->hostname, ka->port, mysql_errno(mysql));
goto __exit_kill_query_thread;
}
char buf[100];
@ -1448,6 +1451,7 @@ int MySQL_Session::handler_again___status_PINGING_SERVER() {
set_status(NONE);
return -1;
} else {
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (rc==-1 || rc==-2) {
if (rc==-2) {
unsigned long long us = mysql_thread___ping_timeout_server*1000;
@ -1502,6 +1506,7 @@ int MySQL_Session::handler_again___status_RESETTING_CONNECTION() {
set_status(NONE);
return -1;
} else {
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (rc==-1 || rc==-2) {
if (rc==-2) {
proxy_error("Change user timeout during COM_CHANGE_USER on %s , %d\n", myconn->parent->address, myconn->parent->port);
@ -1542,7 +1547,7 @@ void MySQL_Session::handler_again___new_thread_to_kill_connection() {
auth_password=ui->password;
}
}
KillArgs *ka = new KillArgs(ui->username, auth_password, myds->myconn->parent->address, myds->myconn->parent->port, myds->myconn->mysql->thread_id, KILL_QUERY, thread);
KillArgs *ka = new KillArgs(ui->username, auth_password, myds->myconn->parent->address, myds->myconn->parent->port, myds->myconn->parent->myhgc->hid, myds->myconn->mysql->thread_id, KILL_QUERY, thread);
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@ -1879,6 +1884,7 @@ bool MySQL_Session::handler_again___status_SETTING_INIT_CONNECT(int *_rc) {
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (myerr >= 2000) {
bool retry_conn=false;
// client error, serious
@ -1969,6 +1975,7 @@ bool MySQL_Session::handler_again___status_SETTING_LDAP_USER_VARIABLE(int *_rc)
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr);
if (myerr >= 2000) {
bool retry_conn=false;
// client error, serious
@ -2045,6 +2052,7 @@ bool MySQL_Session::handler_again___status_SETTING_SQL_LOG_BIN(int *_rc) {
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr);
if (myerr >= 2000) {
bool retry_conn=false;
// client error, serious
@ -2109,6 +2117,7 @@ bool MySQL_Session::handler_again___status_CHANGING_CHARSET(int *_rc) {
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr);
if (myerr >= 2000) {
if (myerr == 2019) {
proxy_error("Client trying to set a charset/collation (%u) not supported by backend (%s:%d). Changing it to %u\n", charset, myconn->parent->address, myconn->parent->port, mysql_tracked_variables[SQL_CHARACTER_SET].default_value);
@ -2212,6 +2221,7 @@ bool MySQL_Session::handler_again___status_SETTING_GENERIC_VARIABLE(int *_rc, co
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr);
if (myerr >= 2000) {
bool retry_conn=false;
// client error, serious
@ -2314,6 +2324,7 @@ bool MySQL_Session::handler_again___status_SETTING_MULTI_STMT(int *_rc) {
} else {
if (rc==-1) {
proxy_error("Error setting multistatement on server %s , %d : %d, %s\n", myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql), mysql_error(myconn->mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
} else {
// rc==1 , nothing to do for now
}
@ -2351,6 +2362,7 @@ bool MySQL_Session::handler_again___status_CHANGING_SCHEMA(int *_rc) {
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr);
if (myerr >= 2000) {
bool retry_conn=false;
// client error, serious
@ -2490,6 +2502,7 @@ bool MySQL_Session::handler_again___status_CONNECTING_SERVER(int *_rc) {
break;
case -1:
case -2:
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (myds->connect_retries_on_failure >0 ) {
myds->connect_retries_on_failure--;
int myerr=mysql_errno(myconn->mysql);
@ -2569,6 +2582,7 @@ bool MySQL_Session::handler_again___status_CHANGING_USER_SERVER(int *_rc) {
previous_status.pop();
NEXT_IMMEDIATE_NEW(st);
} else {
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
@ -2661,6 +2675,7 @@ bool MySQL_Session::handler_again___status_CHANGING_AUTOCOMMIT(int *_rc) {
myds->DSS = STATE_MARIADB_GENERIC;
NEXT_IMMEDIATE_NEW(st);
} else {
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (rc==-1) {
// the command failed
int myerr=mysql_errno(myconn->mysql);
@ -3727,6 +3742,7 @@ handler_again:
RequestEnd(myds);
finishQuery(myds,myconn,prepared_stmt_with_no_params);
} else {
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, mysql_errno(myconn->mysql));
if (rc==-1) {
int myerr=mysql_errno(myconn->mysql);
char *errmsg = NULL;
@ -5858,6 +5874,7 @@ void MySQL_Session::MySQL_Stmt_Result_to_MySQL_wire(MYSQL_STMT *stmt, MySQL_Conn
MYSQL *mysql=stmt->mysql;
// no result set
int myerrno=mysql_stmt_errno(stmt);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerrno);
if (myerrno==0) {
unsigned int num_rows = mysql_affected_rows(stmt->mysql);
unsigned int nTrx=NumActiveTransactions();
@ -5938,6 +5955,7 @@ void MySQL_Session::MySQL_Result_to_MySQL_wire(MYSQL *mysql, MySQL_ResultSet *My
//client_myds->pkt_sid++;
} else {
// error
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, _myds->myconn->parent->myhgc->hid, _myds->myconn->parent->address, _myds->myconn->parent->port, myerrno);
char sqlstate[10];
sprintf(sqlstate,"%s",mysql_sqlstate(mysql));
if (_myds && _myds->killed_at) { // see case #750

@ -1,3 +1,4 @@
#include "MySQL_HostGroups_Manager.h"
#include "proxysql.h"
#include "cpp.h"
#include "SpookyV2.h"
@ -154,6 +155,7 @@ void MySQL_Connection::compute_unknown_transaction_status() {
unknown_transaction_status = false; // no error
return;
}
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, _myerrno);
if (_myerrno >= 2000 && _myerrno < 3000) { // client error
// do not change it
return;
@ -939,11 +941,13 @@ handler_again:
//}
break;
case ASYNC_CONNECT_FAILED:
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
parent->connect_error(mysql_errno(mysql));
break;
case ASYNC_CONNECT_TIMEOUT:
//proxy_error("Connect timeout on %s:%d : %llu - %llu = %llu\n", parent->address, parent->port, myds->sess->thread->curtime , myds->wait_until, myds->sess->thread->curtime - myds->wait_until);
proxy_error("Connect timeout on %s:%d : exceeded by %lluus\n", parent->address, parent->port, myds->sess->thread->curtime - myds->wait_until);
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
parent->connect_error(mysql_errno(mysql));
break;
case ASYNC_CHANGE_USER_START:
@ -1356,6 +1360,7 @@ handler_again:
case ASYNC_SET_AUTOCOMMIT_FAILED:
//fprintf(stderr,"%s\n",mysql_error(mysql));
proxy_error("Failed SET AUTOCOMMIT: %s\n",mysql_error(mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
break;
case ASYNC_SET_NAMES_START:
set_names_start();
@ -1385,6 +1390,7 @@ handler_again:
case ASYNC_SET_NAMES_FAILED:
//fprintf(stderr,"%s\n",mysql_error(mysql));
proxy_error("Failed SET NAMES: %s\n",mysql_error(mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
break;
case ASYNC_INITDB_START:
initdb_start();
@ -1413,6 +1419,7 @@ handler_again:
break;
case ASYNC_INITDB_FAILED:
proxy_error("Failed INITDB: %s\n",mysql_error(mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
//fprintf(stderr,"%s\n",mysql_error(mysql));
break;
case ASYNC_SET_OPTION_START:
@ -1442,6 +1449,7 @@ handler_again:
break;
case ASYNC_SET_OPTION_FAILED:
proxy_error("Error setting MYSQL_OPTION_MULTI_STATEMENTS : %s\n", mysql_error(mysql));
MyHGM->p_update_mysql_error_counter(p_mysql_error_type::mysql, parent->myhgc->hid, parent->address, parent->port, mysql_errno(mysql));
break;
default:

Loading…
Cancel
Save