fix(ha-heartbeat-liveness): start primary heartbeat in COMMITTING phase (task 4.3)

Call ha_start_primary_heartbeat in raft_cb_become_leader when entering
CTRL_PRIMARY_COMMITTING so standbys receive NOPs during the committing
window. Fixes 60s stability: 0 false RDHUP events on standbys.
This commit is contained in:
Rongsong Shen 2026-06-01 15:56:36 +00:00
parent aceadf0357
commit 529552c127
2 changed files with 8 additions and 2 deletions

View file

@ -434,6 +434,12 @@ static void raft_cb_become_leader(void *ctx, uint64_t term)
#else
ha_send_ctrlhello_to_all_standbys(c);
#endif
/* Start primary heartbeat immediately in COMMITTING so standbys receive
* NOP during the committing window and their liveness poll does not fire.
* ha_start_primary_heartbeat is also called in ha_promote_to_primary;
* the idempotency guard (role check at fn top) prevents double-arming. */
ha_start_primary_heartbeat(c);
/* Arm committing timeout watchdog */
committing_timeout_ctx_t *ct = calloc(1, sizeof(*ct));
if (ct) {