feat(ha-repl-hardening): add observability log statements (task 5.4)

- config_repl.c: INFO at WAL catch-up start with start/target LSN (Req 7.1)
- config_repl.c: INFO at snapshot transfer start and complete with
  checkpoint_lsn and size (Req 7.3)
- ha.c committing_timeout_fn_for_test: add WARN log counting
  n_converged/n_pending before promotion, matching production path (Req 7.5)
- Reqs 7.2 (standby converged INFO) and 7.4 (majority INFO) were
  already present from tasks 3.1 and 5.2 respectively
This commit is contained in:
Rongsong Shen 2026-06-05 05:36:27 +00:00
parent 0762577bf7
commit 5defe7cc01
3 changed files with 36 additions and 3 deletions

View file

@ -2756,8 +2756,24 @@ int committing_timeout_fn_for_test(ha_state_t *ha, cluster_t *c,
return 0;
ctrl_role_t role = (ctrl_role_t)atomic_load_explicit(&ha->role,
memory_order_acquire);
if (role == CTRL_PRIMARY_COMMITTING && c != NULL)
ha_promote_to_primary(c);
if (role == CTRL_PRIMARY_COMMITTING) {
/* Count converged vs pending standbys for the WARN log (Req 7.5). */
int n_converged = 0;
int n_pending = 0;
int n_peers = ha->n_peers;
for (int i = 0; i < n_peers; i++) {
if (ha->standby_converged[i])
n_converged++;
else
n_pending++;
}
WARN("HA: committing timeout — majority convergence not reached within timeout; "
"%d/%d standbys converged, %d still pending; "
"promoting to PRIMARY in degraded mode (Req 6.4, 7.5)",
n_converged, n_peers, n_pending);
if (c != NULL)
ha_promote_to_primary(c);
}
return 0;
}