fix(ha-bootstrap): increase config fetch retries to 60, downgrade no-config log, suppress false SSL perror

This commit is contained in:
Rongsong Shen 2026-05-29 14:56:48 +00:00
parent 45f40c51c1
commit e4e34d8f60
2 changed files with 9 additions and 6 deletions

View file

@ -96,9 +96,9 @@ int load_primary_config(cluster_t *c)
char fname[256] = {0}; char fname[256] = {0};
int rc = conf_read_current_filename(conf_dir, fname, sizeof(fname)); int rc = conf_read_current_filename(conf_dir, fname, sizeof(fname));
if (rc != 0) { if (rc != 0) {
ERROR("Primary has no config at '%s/conf/current' (rc=%d) — " INFO("No config at '%s/conf/current' (rc=%d) — "
"provision the config before starting", "will fetch from primary after election",
conf_dir, rc); conf_dir, rc);
return -ENOENT; return -ENOENT;
} }
@ -924,7 +924,7 @@ int fetch_config_from_primary(cluster_t *c)
uint32_t delay_ms = 500; uint32_t delay_ms = 500;
const uint32_t max_delay_ms = 5000; const uint32_t max_delay_ms = 5000;
const int max_attempts = 20; const int max_attempts = 60; /* up to 5min: primary may still be initializing */
for (int attempt = 0; attempt < max_attempts; attempt++) { for (int attempt = 0; attempt < max_attempts; attempt++) {
/* If promoted during retry, switch to primary path */ /* If promoted during retry, switch to primary path */

View file

@ -449,8 +449,11 @@ static int handle_ssl_handshake(endpoint_t* ep)
rc = 0; rc = 0;
break; break;
default: default:
errno = ecode; /* Only log if it's a genuine error (not errno=0 after success) */
perror("SSL_do_handshake"); if (ecode != 0) {
errno = ecode;
perror("SSL_do_handshake");
}
rc = handle_error(ep); rc = handle_error(ep);
break; break;
} }