feat(election-iomgr-refactor): remove old blocking election code (am_i_primary_quorum, vote_request_thread, bootstrap_config_if_needed) — task 5.3

This commit is contained in:
Rongsong Shen 2026-05-30 13:04:19 +00:00
parent 31a54043d5
commit 27ea14cd9a
7 changed files with 83 additions and 512 deletions

View file

@ -352,20 +352,6 @@ int handle_request_vote(ha_state_t *ha,
*/
ctrl_role_t ha_elect_evaluate_and_signal(ha_state_t *ha, ha_elect_ctx_t *ctx);
/*
* am_i_primary_quorum: top-level Raft-style quorum election entrypoint.
* Single-node: self-elects immediately (Req 2.9). Multi-node: spawns per-peer
* vote-request threads, blocks on ctx->done, retries once on split vote (Req 2.10).
* Returns CTRL_PRIMARY or CTRL_STANDBY.
* Requirements: 2.1, 2.9, 2.10, 2.11
*/
ctrl_role_t am_i_primary_quorum(ha_state_t *ha,
int n_peers,
xce_candidate_t **peers,
uint64_t my_config_tag,
uint64_t my_lsn,
const char *my_name);
/*
* handle_request_vote_reply: process an incoming reply to an OP_requestVote RPC.
*
@ -393,15 +379,6 @@ void handle_request_vote_reply(ha_state_t *ha,
uint64_t peer_config_tag,
uint64_t peer_lsn);
/*
* bootstrap_config_if_needed: pre-election config probe.
* If the local config tag is 0 and at least one peer has config, sets
* ha->defer_config_fetch = true and returns without fetching.
* The actual fetch is deferred to post-election (after a winner is known).
* Returns 0 on success, -errno on unrecoverable error.
*/
int bootstrap_config_if_needed(cluster_t *c);
/*
* xce_probe_config_tag: single-RTT OP_probeConfigTag RPC to one peer.
* Fills *tag_out with the peer's current config_tag on success.
@ -432,7 +409,7 @@ ctrl_role_t ha_wait_for_heartbeat_or_timeout(ha_state_t *ha);
* ha_on_primary_ctrl_fd_rdhup: EPOLLRDHUP event handler.
* Closes primary_ctrl_fd, transitions to CTRL_ELECTING, truncates WAL to
* last_known_committed_lsn, fires am_i_primary_quorum (via cluster when non-NULL).
* last_known_committed_lsn, fires ha_start_election_async (via cluster when non-NULL).
* Pass c == NULL to skip persist/election (unit test mode).
*/
void ha_on_primary_ctrl_fd_rdhup(ha_state_t *ha, cluster_t *c);