From 7062ae00787f8e36748dfa0f0dcbb6ea3024c134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Thu, 12 Jan 2023 13:16:46 +0100 Subject: [PATCH] Fix 'AWS_NO_PINGABLE_SRV' error counters This commit fixes the invalid increase of 'NO_PINGABLE_SRV' counters using 'mmsd' data from the previous check, and an invalid check over the current value of 'mmsd' to determine if a pingable host has been found. --- lib/MySQL_Monitor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 5bb98446f2..28741c35b5 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -4978,6 +4978,9 @@ void * monitor_AWS_Aurora_thread_HG(void *arg) { found_pingable_host = true; cur_host_idx = rnd; } else { + MyHGM->p_update_mysql_error_counter( + p_mysql_error_type::proxysql, wHG, hpa[rnd].host, hpa[rnd].port, ER_PROXYSQL_AWS_NO_PINGABLE_SRV + ); // the randomly picked host didn't work work shuffle_hosts(hpa,num_hosts); for (unsigned int i=0; (found_pingable_host == false && ip_update_mysql_error_counter( + p_mysql_error_type::proxysql, wHG, hpa[i].host, hpa[i].port, ER_PROXYSQL_AWS_NO_PINGABLE_SRV + ); } } } @@ -4996,9 +5003,8 @@ void * monitor_AWS_Aurora_thread_HG(void *arg) { } #endif // TEST_AURORA - if (found_pingable_host == false&&mmsd) { + if (found_pingable_host == false) { proxy_error("No node is pingable for AWS Aurora cluster with writer HG %u\n", wHG); - MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, ER_PROXYSQL_AWS_NO_PINGABLE_SRV); next_loop_at = t1 + check_interval_ms * 1000; continue; }