feat(ha-heartbeat-committed-propagation): migrate last_known_committed_config_tag to _Atomic (task 1.1)

Mirror the sibling last_known_committed_lsn: all writes release, reads acquire.
Prereq for a heartbeat-receive writer + the ctrlstatus reader to interact
safely (Req 2.3). Pure access migration, no behavior change; controller suite
0 failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-06-20 11:27:46 +00:00
parent 9817813f54
commit f4327ce4f6
6 changed files with 20 additions and 14 deletions

View file

@ -361,7 +361,8 @@ static void test_ctrlstatus_standby_reports_learned_committed(void)
/* learned from the primary's heartbeats */
atomic_store_explicit(&c.ha.last_known_committed_lsn, 36,
memory_order_release);
c.ha.last_known_committed_config_tag = 0x00C0FFEE0000CAFEULL;
atomic_store_explicit(&c.ha.last_known_committed_config_tag,
0x00C0FFEE0000CAFEULL, memory_order_release);
xce_ctrlstatus_t st;
ctrlstatus_fill(&c, &st);
@ -393,7 +394,8 @@ static void test_ctrlstatus_standby_prelearn_committed_zero(void)
memory_order_release);
atomic_store_explicit(&c.ha.last_known_committed_lsn, 0,
memory_order_release);
c.ha.last_known_committed_config_tag = 0;
atomic_store_explicit(&c.ha.last_known_committed_config_tag, 0,
memory_order_release);
/* even if the node-local primary marker had a stale value, off-primary it
* must NOT be surfaced — prove the learned (zero) value wins. */
atomic_store_explicit(&c.persist.committed_lsn, 77, memory_order_release);
@ -429,7 +431,8 @@ static void test_ctrlstatus_primary_reports_own_committed(void)
/* stale learned values must NOT be surfaced on a primary */
atomic_store_explicit(&c.ha.last_known_committed_lsn, 9,
memory_order_release);
c.ha.last_known_committed_config_tag = 0x1111ULL;
atomic_store_explicit(&c.ha.last_known_committed_config_tag, 0x1111ULL,
memory_order_release);
xce_ctrlstatus_t st;
ctrlstatus_fill(&c, &st);

View file

@ -724,7 +724,7 @@ static void test_ctrlhello_reply_intake_stores_and_reconciles(void)
atomic_load(&g_dc.ha.last_known_committed_lsn),
"CtrlHelloReply intake must store last_known_committed_lsn (existing)");
TEST_ASSERT_EQUAL_UINT64_MESSAGE(reported_tag,
g_dc.ha.last_known_committed_config_tag,
atomic_load(&g_dc.ha.last_known_committed_config_tag),
"CtrlHelloReply intake must store the config tag (existing)");
/* Assert (intake integration): the intake also TRIGGERED reconciliation —