feat(ha-repl-hardening): add per-standby convergence tracking arrays (task 1.4)
Add standby_reported_tag/lsn/converged arrays to ha_state_t, sized MAX_HA_CANDIDATES. Zero-init via existing memset in ha_init(). Unit test verifies zero-init and writability.
This commit is contained in:
parent
0121bc0683
commit
e3ca775f0d
4 changed files with 55 additions and 1 deletions
|
|
@ -689,6 +689,11 @@ int ha_init(ha_state_t *ha, const ha_config_t *cfg, int my_priority)
|
|||
* Written by ha_on_heartbeat_received (task 2.1); read by liveness_poll_fn. */
|
||||
ha->last_activity = 0;
|
||||
|
||||
/* ha-repl-hardening Task 1.4: per-standby convergence tracking arrays.
|
||||
* memset(ha, 0, sizeof(*ha)) above already zeroes these arrays; the explicit
|
||||
* note documents the invariant: on entry to CTRL_PRIMARY_COMMITTING every
|
||||
* standby starts as not-converged (tag=0, lsn=0, converged=false). */
|
||||
|
||||
/* heartbeat_seen starts at 0: no heartbeat seen yet.
|
||||
* ha_wait_for_heartbeat_or_timeout() calls sem_timedwait on this. */
|
||||
sem_init(&ha->heartbeat_seen, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue