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:
parent
0762577bf7
commit
5defe7cc01
3 changed files with 36 additions and 3 deletions
|
|
@ -1441,6 +1441,11 @@ int ha_stream_wal_to_standby(endpoint_t *ep, const char *wal_path,
|
|||
if (standby_lsn >= committed_lsn)
|
||||
return 0; /* nothing to stream */
|
||||
|
||||
/* Req 7.1: log WAL catch-up start with start/target LSN */
|
||||
INFO("ha_stream_wal_to_standby: starting WAL catch-up "
|
||||
"start_lsn=%" PRIu64 " target_lsn=%" PRIu64,
|
||||
standby_lsn + 1, committed_lsn);
|
||||
|
||||
/* ── Enumerate WAL segment files, sort ascending by first LSN ── */
|
||||
DIR *d = opendir(wal_path);
|
||||
if (!d)
|
||||
|
|
@ -1586,6 +1591,11 @@ int ha_send_snapshot_to_standby(endpoint_t *ep, const char *snap_dir,
|
|||
return -errno;
|
||||
uint64_t total_size = (uint64_t)st.st_size;
|
||||
|
||||
/* Req 7.3: log snapshot transfer start with checkpoint_lsn and size */
|
||||
INFO("ha_send_snapshot_to_standby: snapshot transfer start "
|
||||
"checkpoint_lsn=%" PRIu64 " size=%" PRIu64,
|
||||
checkpoint_lsn, total_size);
|
||||
|
||||
FILE *f = fopen(snap_path, "rb");
|
||||
if (!f)
|
||||
return -errno;
|
||||
|
|
@ -1647,6 +1657,13 @@ int ha_send_snapshot_to_standby(endpoint_t *ep, const char *snap_dir,
|
|||
|
||||
free(buf);
|
||||
fclose(f);
|
||||
|
||||
/* Req 7.3: log snapshot transfer complete (on success only) */
|
||||
if (rc == 0)
|
||||
INFO("ha_send_snapshot_to_standby: snapshot transfer complete "
|
||||
"checkpoint_lsn=%" PRIu64 " size=%" PRIu64,
|
||||
checkpoint_lsn, total_size);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue