diff --git a/src/controller/myapp.c b/src/controller/myapp.c index 20370cb..b58e3f1 100644 --- a/src/controller/myapp.c +++ b/src/controller/myapp.c @@ -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(). */ }