fix(ha-bootstrap): standby nodes with local config skip fetch — only config_tag=0 nodes fetch from primary

This commit is contained in:
Rongsong Shen 2026-05-29 15:13:26 +00:00
parent e4e34d8f60
commit e25d2cc645

View file

@ -158,12 +158,19 @@ int myapp_run(myconf_t* myconf)
c.ha.defer_config_fetch = false;
}
/* Standby: fetch config from primary before Phase 2 */
rc = fetch_config_from_primary(&c);
if (rc != 0) {
cluster_fini(&c);
myconf_fini(myconf);
return rc;
/* Standby: fetch config from primary before Phase 2.
* Skip if this node already has a valid local config (ground-truth
* nodes should not fetch from primary — they ARE the ground truth). */
if (myconf->config_version_tag == 0) {
rc = fetch_config_from_primary(&c);
if (rc != 0) {
cluster_fini(&c);
myconf_fini(myconf);
return rc;
}
} else {
INFO("Standby has local config (tag=%016llx) — skipping fetch from primary",
(unsigned long long)myconf->config_version_tag);
}
/* Role stays CTRL_STANDBY — already set by ha_init(). */
}