feat(ha-repl-hardening): per-standby convergence tracking from heartbeats (task 3.1)
ha_process_standby_state stores (tag, lsn) per standby, evaluates convergence (tag>=committed && lsn>=committed), sets converged flag, logs INFO only on transition. Wired into repl_ack_decode_and_dispatch. 5 tests: converged, lsn-behind, tag-behind, regression, multi-peer.
This commit is contained in:
parent
7dc657b1bd
commit
aab41fa609
4 changed files with 267 additions and 6 deletions
|
|
@ -289,6 +289,31 @@ int ha_apply_wal_catchup_entry(ha_state_t *ha, persist_t *p,
|
|||
void ha_nop_reply_state_report(ha_state_t *ha, myconf_t *myconf,
|
||||
state_report_t *sr, xce_reply_t *reply_out);
|
||||
|
||||
/*
|
||||
* ha_process_standby_state: update per-standby convergence tracking.
|
||||
*
|
||||
* Called on each heartbeat reply from a standby while the primary is in
|
||||
* CTRL_PRIMARY_COMMITTING or CTRL_PRIMARY. Stores the standby's reported
|
||||
* (config_tag, applied_lsn) and evaluates whether the standby has converged
|
||||
* with the primary's committed state.
|
||||
*
|
||||
* Convergence criteria (Req 1.3):
|
||||
* reported_tag >= committed_tag AND reported_lsn >= committed_lsn
|
||||
*
|
||||
* Logs INFO on the first transition from not-converged → converged (Req 7.2).
|
||||
* Regression (converged → not-converged) clears standby_converged[peer_idx]
|
||||
* and re-evaluates (Req 2.5).
|
||||
*
|
||||
* peer_idx: 0-based index into ha->standby_reported_* arrays; must be in
|
||||
* [0, MAX_HA_CANDIDATES).
|
||||
*
|
||||
* Requirements: 1.2, 2.2, 2.5 (ha-repl-hardening spec)
|
||||
* Boundary: Primary Heartbeat Handler (ha.c)
|
||||
*/
|
||||
void ha_process_standby_state(ha_state_t *ha, int peer_idx,
|
||||
uint64_t reported_tag, uint64_t reported_lsn,
|
||||
uint64_t committed_tag, uint64_t committed_lsn);
|
||||
|
||||
/* ── HA Config Bootstrap & Term Durability (ha-config-bootstrap spec) ── */
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue