From 7c2d4e35d091509dd394acf7bc334e2c1048a0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 9 Jan 2018 21:19:46 +0100 Subject: [PATCH] Bug fix for #1323 --- lib/ProxySQL_Cluster.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ProxySQL_Cluster.cpp b/lib/ProxySQL_Cluster.cpp index c89119620..5be0b9e18 100644 --- a/lib/ProxySQL_Cluster.cpp +++ b/lib/ProxySQL_Cluster.cpp @@ -179,6 +179,7 @@ void * ProxySQL_Cluster_Monitor_thread(void *args) { } else { sleep(1); // do not monitor if the username is empty } + rc_bool = GloProxyCluster->Update_Node_Metrics(node->hostname, node->port, NULL, 0); // added extra check, see #1323 } __exit_monitor_thread: if (conn) @@ -1113,7 +1114,13 @@ bool ProxySQL_Cluster_Nodes::Update_Node_Metrics(char * _h, uint16_t _p, MYSQL_R std::unordered_map::iterator ite = umap_proxy_nodes.find(hash_); if (ite != umap_proxy_nodes.end()) { ProxySQL_Node_Entry * node = ite->second; - node->set_metrics(_r, _response_time); + if (_r) { + node->set_metrics(_r, _response_time); + } else { + // if _r is NULL, this function is being called only to verify if + // the node should still be checked or not + // see bug #1323 + } ret = true; } pthread_mutex_unlock(&mutex);