feat(controller-status): source election time in ctrlstatus_fill (task 7.4)
ctrlstatus_fill now unconditionally reads ha->last_known_elected_at_ms into the reply's elected_at_ms field -- one atomic-acquire load, no role-branch, mirroring how the handler already reports raw term unconditionally. Serves both a self-stamped primary and a heartbeat-learned standby from the same field. "Unknown" display gating is deliberately left to the client command (task 7.5), not this handler. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
30adc52ea3
commit
93f32b5d84
3 changed files with 87 additions and 1 deletions
|
|
@ -90,6 +90,20 @@ void ctrlstatus_fill(cluster_t* c, xce_ctrlstatus_t* st)
|
|||
memory_order_acquire);
|
||||
st->term = atomic_load_explicit(&ha->term, memory_order_acquire);
|
||||
|
||||
/* current primary's election time (Req 12.1, 12.2, 12.5): a single
|
||||
* unconditional read of last_known_elected_at_ms -- no role-branch. Both
|
||||
* promotion roads self-stamp this field at the instant they commit to
|
||||
* CTRL_PRIMARY (task 7.2), and it is unconditionally learned off-primary
|
||||
* via heartbeat (task 7.3), so one atomic load correctly serves both the
|
||||
* primary (self-stamped) and standby (heartbeat-learned) case -- unlike
|
||||
* committedLsn/committedConfigVersion above, there is no separate
|
||||
* primary-only marker to branch on here. "Unknown" display gating (Req
|
||||
* 12.3) is a client-side print-layer decision (task 7.5), not this
|
||||
* handler's concern -- mirrors how st->term above is also read
|
||||
* unconditionally regardless of whether a primary is currently known. */
|
||||
st->elected_at_ms = atomic_load_explicit(&ha->last_known_elected_at_ms,
|
||||
memory_order_acquire);
|
||||
|
||||
/* primary identity (Req 2.1/2.2/2.3). Only the PRIMARY can authoritatively
|
||||
* name the primary — itself. The controller does NOT track the current
|
||||
* primary's NAME on a standby: ha->primary_host is vestigial (never written)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue