From 2ab0ce82bf3458455e41426b4cc99d954dd64671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 25 Oct 2015 23:52:51 +0000 Subject: [PATCH] Fix bug #417 Closes #417 Closes #418 --- include/MySQL_HostGroups_Manager.h | 2 +- lib/MySQL_HostGroups_Manager.cpp | 9 ++++++++- lib/mysql_connection.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/MySQL_HostGroups_Manager.h b/include/MySQL_HostGroups_Manager.h index 99bf26079..e0aacec8e 100644 --- a/include/MySQL_HostGroups_Manager.h +++ b/include/MySQL_HostGroups_Manager.h @@ -60,7 +60,7 @@ class MySrvC { // MySQL Server Container MySrvConnList *ConnectionsFree; MySrvC(char *, uint16_t, unsigned int, enum MySerStatus, unsigned int, unsigned int _max_connections, unsigned int _max_replication_lag); ~MySrvC(); - void connect_error(); + void connect_error(int); }; class MySrvList { // MySQL Server List diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 081b8474c..be9bb24dc 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -125,11 +125,18 @@ MySrvC::MySrvC(char *add, uint16_t p, unsigned int _weight, enum MySerStatus _st ConnectionsFree=new MySrvConnList(this); } -void MySrvC::connect_error() { +void MySrvC::connect_error(int err_num) { // NOTE: this function operates without any mutex // although, it is not extremely important if any counter is lost // as a single connection failure won't make a significant difference __sync_fetch_and_add(&connect_ERR,1); + switch (err_num) { + case 1045: // access denied + return; + break; + default: + break; + } time_t t=time(NULL); if (t!=time_last_detected_error) { time_last_detected_error=t; diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index 84905518d..cbdfe313d 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -435,11 +435,11 @@ handler_again: __sync_fetch_and_add(&parent->connect_OK,1); break; case ASYNC_CONNECT_FAILED: - parent->connect_error(); + 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); - parent->connect_error(); + parent->connect_error(mysql_errno(mysql)); break; case ASYNC_CHANGE_USER_START: change_user_start();