feat(component-failover-adoption): reconcile N_MAX_MASTERS with MAX_HA_CANDIDATES

N_MAX_MASTERS (client.h) now derives from config.h's MAX_HA_CANDIDATES
instead of an independently-maintained literal (3 vs 4 previously).
Fixes worker's and scheduler's hardcoded `> 3` startup checks to
reference the constant symbolically, and updates the client-retry
test fixture so it doesn't exercise an uninitialized 4th slot.

Task 1.1 of component-failover-adoption (Requirement 1 AC7).
This commit is contained in:
Rongsong Shen 2026-08-11 04:31:53 +00:00
parent 0df1cf5f8d
commit fe8b4b86bf
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
5 changed files with 174 additions and 93 deletions

View file

@ -411,11 +411,11 @@ int main(int argc, char* argv[])
"Use -n.\n");
return 1;
}
if (cluster_cfg.candidates_count > 3) {
if (cluster_cfg.candidates_count > N_MAX_MASTERS) {
fprintf(stderr,
"xcecd: WARN: --peers has %d candidates; "
"only <=3 validated for HA\n",
cluster_cfg.candidates_count);
"only <=%d validated for HA\n",
cluster_cfg.candidates_count, N_MAX_MASTERS);
}
XCECD_LOG(XCE_LOG_INFO,
"HA cluster config: %d candidate(s), identity=%s",