refactor(ha): passive standby model — primary connects outbound to all peers
Remove fetch_config_from_primary, ha_find_and_connect_to_primary, and the tier-1/2/3 discovery path. Standbys never initiate outbound connections to the primary; the primary owns all inter-controller channels. Key changes: - ha.c: add primary heartbeat loop (ha_start_primary_heartbeat) that sends OPCode_nop to connected standbys every heartbeat_interval_ms; loop self-cancels on demotion via role check before re-arm. - ha.c: add outbound reconnect in primary_heartbeat_fn — for peers absent from standby_endpoints, open fresh outbound TLS connection (on_standby_connected sends ctrlhello; standby_ep_ctx_t mirrors vote_ep_ctx_t layout). - ha.c: remove ha_find_and_connect_to_primary + helpers (ha_raw_tcp_connect, ha_tcp_connect_hook); remove election_timeout_fn (superseded by raft_election_timeout_fn); remove fetch_config_from_primary call from ha_elect_evaluate_and_signal STANDBY branch. - cluster.c: OPCode_requestVote denial no longer reuses inbound connection; late joiners are bootstrapped via primary heartbeat outbound connect. - config_repl.c: remove connect_ssl_raw, do_one_config_fetch, fetch_config_from_primary (~250 LOC). - myapp.c: remove my_tag > 0 fetch branch; all standbys wait passively. - ha.h: remove ha_find_and_connect_to_primary declaration + macros + ha_tcp_connect_hook seam; add ha_start_primary_heartbeat declaration. - meson.build: remove test_ha_connect.c (tests deleted function). - controller_test.c: remove test_ha_connect registration. - CLAUDE.md, src/controller/CLAUDE.md: document passive standby model, inbound-vs-outbound connection ownership, async I/O constraint, heartbeat model. - request.h: add xce_request declaration (removes scattered local externs).
This commit is contained in:
parent
842b9a838e
commit
7b39650229
11 changed files with 716 additions and 919 deletions
|
|
@ -40,7 +40,6 @@ extern void test_ha_bootstrap(void);
|
|||
extern void test_ha_durability(void);
|
||||
extern void test_repl_majority(void);
|
||||
extern void test_persist_truncate(void);
|
||||
extern void test_ha_connect(void);
|
||||
extern void test_ha_ctrlhello(void);
|
||||
extern void test_ha_failover(void);
|
||||
extern void test_ha_vote_send(void);
|
||||
|
|
@ -49,6 +48,7 @@ extern void test_ha_vote_gate(void);
|
|||
extern void test_ha_evaluate_committing(void);
|
||||
extern void test_ha_repl_push(void);
|
||||
extern void test_ha_repl_ack(void);
|
||||
extern void test_ha_connection_reuse(void);
|
||||
|
||||
void setUp(void) { return; }
|
||||
|
||||
|
|
@ -158,7 +158,6 @@ int main(int argc, char* argv[])
|
|||
TEST(test_ha_durability);
|
||||
TEST(test_repl_majority);
|
||||
TEST(test_persist_truncate);
|
||||
TEST(test_ha_connect);
|
||||
TEST(test_ha_ctrlhello);
|
||||
TEST(test_ha_failover);
|
||||
TEST(test_ha_vote_send);
|
||||
|
|
@ -167,6 +166,7 @@ int main(int argc, char* argv[])
|
|||
TEST(test_ha_evaluate_committing);
|
||||
TEST(test_ha_repl_push);
|
||||
TEST(test_ha_repl_ack);
|
||||
TEST(test_ha_connection_reuse);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue