feat(election-iomgr-refactor): config/WAL replication push to standbys in COMMITTING path — task 4.2

This commit is contained in:
Rongsong Shen 2026-05-30 11:56:31 +00:00
parent f4a6726f1b
commit 757558bb33
6 changed files with 433 additions and 0 deletions

View file

@ -507,6 +507,15 @@ int ha_find_and_connect_to_primary(ha_state_t *ha,
*/
void ha_repl_ack_received(ha_state_t *ha, cluster_t *c);
/*
* ha_send_ctrlhello_to_all_standbys: iterate ha->standby_endpoints and send
* an OP_hello CtrlHelloRequest to each connected standby.
* This triggers the existing catch-up replication path in handle_ctrlhello
* (Req 7.2). Defined in cluster.c; called from ha_elect_evaluate_and_signal
* in the COMMITTING path.
*/
void ha_send_ctrlhello_to_all_standbys(cluster_t *c);
/* ── P3-6: Test-only failover shim ────────────────────────────── */
#ifdef XCE_TESTING
@ -518,6 +527,21 @@ void ha_repl_ack_received(ha_state_t *ha, cluster_t *c);
*/
extern int (*ha_phase2_hook)(void *c);
/*
* ha_send_ctrlhello_hook: test-only seam for ha_send_ctrlhello_to_all_standbys.
* When non-NULL, ha_elect_evaluate_and_signal() calls this in the COMMITTING
* path instead of the real function (cluster.c not linked in test binary).
* Requirements: 7.2.
*/
extern int (*ha_send_ctrlhello_hook)(void *c);
/*
* ha_push_config_hook: test-only seam for push_config_to_standbys.
* When non-NULL, ha_elect_evaluate_and_signal() calls this in the COMMITTING
* path instead of the real function. Requirements: 7.1.
*/
extern int (*ha_push_config_hook)(void *c);
/* Test-only shim: demote then re-promote; returns new term.
* Exercises the manual failover state machine without a live cluster_t.
* Calls ha_do_demote() then ha_do_promote(); validates role transitions