From e25d2cc6457ba8c0a37e7863f23b9092d054fd97 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 29 May 2026 15:13:26 +0000 Subject: [PATCH] =?UTF-8?q?fix(ha-bootstrap):=20standby=20nodes=20with=20l?= =?UTF-8?q?ocal=20config=20skip=20fetch=20=E2=80=94=20only=20config=5Ftag?= =?UTF-8?q?=3D0=20nodes=20fetch=20from=20primary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/myapp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/controller/myapp.c b/src/controller/myapp.c index 20370cbf..b58e3f12 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(). */ }