feat(ha-config-bootstrap): implement EPOLLRDHUP failover and heartbeat timeout vtask (task 9.4)

This commit is contained in:
Rongsong Shen 2026-05-29 07:17:55 +00:00
parent 9bbff7b016
commit 0d5f2cb1bb
6 changed files with 434 additions and 1 deletions

View file

@ -225,7 +225,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
- _Boundary: Persistent Control Channel (ha.c, cluster.c), Replication Layer (repl.c)_
- _Depends: 7.5, 9.1_
- [ ] 9.4 Implement EPOLLRDHUP failover and heartbeat timeout vtask
- [x] 9.4 Implement EPOLLRDHUP failover and heartbeat timeout vtask
- `EPOLLRDHUP` event on `primary_ctrl_fd` → close fd, set `primary_ctrl_fd = -1`, transition to `CTRL_ELECTING`, call `persist_truncate_wal_above(last_known_committed_lsn)`, fire `am_i_primary_quorum()`
- Heartbeat timeout vtask: armed on each heartbeat receipt; fires after `election_timeout_ms + rand_jitter` of silence; same action as EPOLLRDHUP path
- On `CTRL_STANDBY` after new election → close outbound primary fd; on `CTRL_PRIMARY` after new election → accept inbound `OP_ctrlHello` connections; reuse per-standby fd table