fix(election-iomgr-refactor): config replication and RDHUP failover chain
- cluster.c: fix upgradeConfig handler (standbys apply, not primaries) - cluster.c: fix raw_pkt_copy opcode peek (read scalar before capn_free) - config_repl.h: enable CONF_ENABLE_UPGRADE_CONFIG=1 - config_repl.c: use client_ssl_ctx for outgoing config fetch connections - config_repl.c: after config fetch, run cluster_init_phase2 + find_primary - join.c: push config to newly-joined standbys on OPCode_join - myapp.c: schedule fetch_config_from_primary after skipping own election - ha.c: arm heartbeat timeout watchdog after find_and_connect_to_primary
This commit is contained in:
parent
2f5a738b36
commit
fd93997f78
6 changed files with 70 additions and 10 deletions
|
|
@ -809,9 +809,13 @@ static int do_one_config_fetch(cluster_t *c, const char *host, uint32_t port,
|
|||
SSL *ssl = NULL;
|
||||
int sock = -1;
|
||||
|
||||
/* 1. Connect + SSL handshake */
|
||||
/* 1. Connect + SSL handshake — use client_ssl_ctx (TLS_client_method) for
|
||||
* outgoing connections; ssl_ctx is the server context (TLS_server_method). */
|
||||
SSL_CTX *out_ctx = c->ha.client_ssl_ctx
|
||||
? (SSL_CTX *)c->ha.client_ssl_ctx
|
||||
: (SSL_CTX *)c->ha.ssl_ctx;
|
||||
int rc = connect_ssl_raw(
|
||||
(SSL_CTX *)c->ha.ssl_ctx, host, port,
|
||||
out_ctx, host, port,
|
||||
(int)c->ha.config.probe_connect_timeout_ms,
|
||||
&c->ha, &ssl, &sock);
|
||||
if (rc != 0)
|
||||
|
|
@ -940,6 +944,20 @@ int fetch_config_from_primary(cluster_t *c)
|
|||
INFO("HA: config received from primary"
|
||||
" (tag=%016" PRIx64 ")",
|
||||
c->myconf->config_version_tag);
|
||||
/* Config loaded — complete standby bootstrap:
|
||||
* 1. cluster_init_phase2 to set up data structures with config
|
||||
* 2. ha_find_and_connect_to_primary to establish the persistent
|
||||
* control channel needed for RDHUP failover detection */
|
||||
#ifndef XCE_TESTING
|
||||
{
|
||||
extern int cluster_init_phase2(cluster_t *c);
|
||||
int p2rc = cluster_init_phase2(c);
|
||||
if (p2rc == 0) {
|
||||
ha_find_and_connect_to_primary(&c->ha, &c->ha.config,
|
||||
&c->myconf->peers_cfg, c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue