diff --git a/include/MySQL_Session.h b/include/MySQL_Session.h index 771d1ae4cc..8f88a63be7 100644 --- a/include/MySQL_Session.h +++ b/include/MySQL_Session.h @@ -216,6 +216,7 @@ class MySQL_Session void MySQL_Stmt_Result_to_MySQL_wire(MYSQL_STMT *stmt, MySQL_Connection *myconn); unsigned int NumActiveTransactions(); bool HasOfflineBackends(); + bool SetEventInOfflineBackends(); int FindOneActiveTransaction(); unsigned long long IdleTime(); diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 53513a4217..ca2b62a8d0 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4902,6 +4902,23 @@ bool MySQL_Session::HasOfflineBackends() { return ret; } +bool MySQL_Session::SetEventInOfflineBackends() { + bool ret=false; + if (mybes==0) return ret; + MySQL_Backend *_mybe; + unsigned int i; + for (i=0; i < mybes->len; i++) { + _mybe=(MySQL_Backend *)mybes->index(i); + if (_mybe->server_myds) + if (_mybe->server_myds->myconn) + if (_mybe->server_myds->myconn->IsServerOffline()) { + _mybe->server_myds->revents|=POLLIN; + ret = true; + } + } + return ret; +} + int MySQL_Session::FindOneActiveTransaction() { int ret=-1; if (mybes==0) return ret; diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index cbe984a0bf..d71a1551a2 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -3579,8 +3579,14 @@ void MySQL_Thread::process_all_sessions() { } if (servers_table_version_current != servers_table_version_previous) { // bug fix for #1085 // Immediatelly kill all client connections using an OFFLINE node - if (sess->HasOfflineBackends()) { - sess->killed=true; + //if (sess->HasOfflineBackends()) { + // sess->killed=true; + //} + // Search for connections that should be terminated, and simulate data in them + // the following 2 lines of code replace the previous 2 lines + // instead of killing the sessions, fails the backend connections + if (sess->SetEventInOfflineBackends()) { + sess->to_process=1; } } }