From 2df11ec32035f8e12bb3de64461404e386e0bb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 1 May 2019 20:26:49 +1000 Subject: [PATCH] If max_replication_lag is changed to 0, immediately unshun the server shunned because of replication lag --- lib/MySQL_HostGroups_Manager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index fbbb5d220..169a5bbaf 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -1320,6 +1320,14 @@ bool MySQL_HostGroups_Manager::commit() { if (GloMTH->variables.hostgroup_manager_verbose) proxy_info("Changing max_replication_lag for server %u:%s:%d (%s:%d) from %d (%d) to %d\n" , mysrvc->myhgc->hid , mysrvc->address, mysrvc->port, r->fields[1], atoi(r->fields[2]), atoi(r->fields[8]) , mysrvc->max_replication_lag , atoi(r->fields[18])); mysrvc->max_replication_lag=atoi(r->fields[18]); + if (mysrvc->max_replication_lag == 0) { // we just changed it to 0 + if (mysrvc->status == MYSQL_SERVER_STATUS_SHUNNED_REPLICATION_LAG) { + // the server is currently shunned due to replication lag + // but we reset max_replication_lag to 0 + // therefore we immediately reset the status too + mysrvc->status = MYSQL_SERVER_STATUS_ONLINE; + } + } } if (atoi(r->fields[9])!=atoi(r->fields[19])) { if (GloMTH->variables.hostgroup_manager_verbose)