Skip to content

Commit 96c686d

Browse files
committed
MySQL_Monitor: GR thread ignores cached ping state on first iteration
Why: mysql_server_ping_log can carry stale "unpingable" entries from before monitor_GR_thread_HG was (re)started (e.g. a previous test left those hostnames marked bad). With the cache filter applied on the very first cycle, find_resp_srvs() returns empty, the writer HG stays empty for a full healthcheck_interval, and GR-based tests flake on warm-up. Probe all configured hosts on the first iteration so subsequent cycles see a fresh ping_log. The filter resumes from iteration two onward.
1 parent 96bd557 commit 96c686d

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

lib/MySQL_Monitor.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,13 @@ void* monitor_GR_thread_HG(void *arg) {
41054105

41064106
uint64_t next_check_time = 0;
41074107
uint64_t MAX_CHECK_DELAY_US = 500000;
4108+
// On first iteration after thread (re)start, ignore the cached ping state
4109+
// in mysql_server_ping_log — it may reflect stale failures from before the
4110+
// monitor was reconfigured (e.g. a previous test left these hostnames
4111+
// marked unpingable). Probing all configured hosts forces a fresh ping_log
4112+
// entry, so subsequent iterations see real state instead of skipping
4113+
// healthcheck_interval seconds while the writer HG stays empty.
4114+
bool first_iteration = true;
41084115

41094116
while (GloMyMon->shutdown == false && mysql_thread___monitor_enabled == true) {
41104117
if (!GloMTH) { break; } // quick exit during shutdown/restart
@@ -4145,8 +4152,16 @@ void* monitor_GR_thread_HG(void *arg) {
41454152
continue;
41464153
}
41474154

4148-
// Get the current 'pingable' status for the servers.
4149-
const vector<gr_host_def_t>& resp_srvs { find_resp_srvs(hosts_defs) };
4155+
// Get the current 'pingable' status for the servers. See first_iteration
4156+
// note above: skip the cache filter on the very first cycle so we do not
4157+
// inherit stale ping failures from before this thread was started.
4158+
vector<gr_host_def_t> resp_srvs;
4159+
if (first_iteration) {
4160+
resp_srvs = hosts_defs;
4161+
first_iteration = false;
4162+
} else {
4163+
resp_srvs = find_resp_srvs(hosts_defs);
4164+
}
41504165
if (resp_srvs.empty()) {
41514166
proxy_error("No node is pingable for Group Replication cluster with writer HG %u\n", wr_hg);
41524167
next_check_time = curtime + mysql_thread___monitor_groupreplication_healthcheck_interval * 1000;

0 commit comments

Comments
 (0)