fix(ha-bootstrap): skip pre-election config probe; unconfigured nodes defer to post-election fetch

This commit is contained in:
Rongsong Shen 2026-05-29 13:15:46 +00:00
parent 4e9924e95c
commit c7badd3f96
2 changed files with 67 additions and 60 deletions

View file

@ -177,8 +177,12 @@ static void test_bootstrap_no_defer_when_all_peers_have_zero_tag(void)
TEST_ASSERT_EQUAL_INT_MESSAGE(0, rc,
"bootstrap_config_if_needed must return 0 when all peers have tag=0");
TEST_ASSERT_FALSE_MESSAGE(c->ha.defer_config_fetch,
"defer_config_fetch must be false when all peers are unconfigured (tag=0)");
/* Revised design: unconfigured nodes (config_tag=0) always defer config fetch
* to post-election, regardless of peer tags. The election protocol carries
* config_tag in OP_requestVote so freshness is enforced without a pre-probe.
* defer_config_fetch=true for all tag=0 nodes — they fetch from the winner. */
TEST_ASSERT_TRUE_MESSAGE(c->ha.defer_config_fetch,
"defer_config_fetch must be true for unconfigured nodes (config_tag=0)");
free_bootstrap_cluster(c);
printf("test_bootstrap_no_defer_when_all_peers_have_zero_tag: PASS\n");