feat(election-iomgr-refactor): implement ha_start_election_async — task 2.4
Non-blocking election initiator that returns immediately after registering vote endpoints with iomgr and scheduling the election timeout watchdog. - Single-node shortcircuit (n_peers==1): allocates self-only ha_elect_ctx_t, calls ha_elect_evaluate_and_signal directly, frees ctx inline — no iomgr or delaymgr involvement; returns in < 1ms - Multi-node: allocates ha_elect_ctx_t, per-peer vote_ep_ctx_t, calls endpoint_connect + iomgr_monitor for each peer; schedules election timeout via delay_task_ms; skips peer on connect failure (counted as denied) - election_timeout_fn: delaymgr callback that fires ha_elect_evaluate_and_signal after election_timeout_ms, unless cancelled flag is set (lock-free cancellation) - vote_ep_err_handler: counts unreachable peers as denied votes - Declares ha_start_election_async in ha.h with full doc comment - 5 Unity tests in test_ha_start_election_async.c: returns < 5ms, stores n_peers, shortcircuit fires immediately, n_peers stored for multi-peer, term incremented — all GREEN with ASAN enabled
This commit is contained in:
parent
bd58e5045a
commit
e50afd02f6
5 changed files with 479 additions and 0 deletions
|
|
@ -112,6 +112,7 @@ controller_unit_test_src = [
|
|||
'testsuite/test_ha_ctrlhello.c',
|
||||
'testsuite/test_ha_failover.c',
|
||||
'testsuite/test_ha_vote_send.c',
|
||||
'testsuite/test_ha_start_election_async.c',
|
||||
'startup_validation.c',
|
||||
'worker.c',
|
||||
'persist.c',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue