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

@ -153,10 +153,12 @@ void ctrlstatus_fill(cluster_t* c, xce_ctrlstatus_t* st)
} else {
st->committedLsn = atomic_load_explicit(&ha->last_known_committed_lsn,
memory_order_acquire);
/* last_known_committed_config_tag is a plain (non-atomic) uint64_t
* written under ha->lock; a best-effort aligned 8-byte read is correct
* here and must NOT take the lock on this read path. */
st->committedConfigVersion = ha->last_known_committed_config_tag;
/* last_known_committed_config_tag is an _Atomic uint64_t; an acquire
* load mirrors last_known_committed_lsn above and must NOT take the
* lock on this read path. */
st->committedConfigVersion =
atomic_load_explicit(&ha->last_known_committed_config_tag,
memory_order_acquire);
}
st->appliedLsn = atomic_load_explicit(&ha->applied_lsn,
memory_order_acquire);