You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b474e78
Browse filesBrowse the repository at this point in the historyBrowse files
Each capture also records which server answered — `pg_postmaster_start_time()` and `inet_server_addr()` — so a label that stops pointing at one machine can be noticed. A one-way change is reported as a `notice:` (a restart, or a node that was replaced). A fingerprint that *recurs* after a different one intervened is reported as a `warning:`: that is a rotating endpoint — a reader endpoint, a Kubernetes Service, a `kubectl port-forward` reconnecting to whichever pod answers — and it means two servers' cumulative counters are interleaving under one label, so deltas across those rows are wrong. Neither ever fails a capture. If the label deliberately names a pool, pass `--allow-rotation` to silence the warning; the one-way notice still prints. `system_identifier` cannot do this job: replicas inherit the primary's through base backup, so it is identical across a cluster.
57
57
58
-
Each activity row also carries four database-scoped, best-effort sections, independent of any table: `pg_stat_database` counters for the connected database (deadlocks, temp spill, commit/rollback volume, buffer hit ratio, conflicts, checksum failures), `pg_replication_slots` (per-slot activity and WAL retention risk, PG13+ fields nullable on 13-), `pg_stat_replication` peers (application_name, client_addr, state, sync_state, LSN positions, and lag), and checkpoint counters normalized from `pg_stat_checkpointer` (PG17+) or `pg_stat_bgwriter` (older). All four are CLUSTER facts riding a per-node, per-database document — a multi-database cluster reports identical checkpoint counters once per tracked database, a standby's own replication-slot list is normally empty (its slots, if any, live on the primary), and peers are normally empty on a standby unless it is itself feeding further standbys via cascading replication. A read failure on any of the four leaves it absent on the wire, never a substitute zero.
58
+
Each activity row also carries four database-scoped, best-effort sections, independent of any table: `pg_stat_database` counters for the connected database (deadlocks, temp spill, commit/rollback volume, buffer hit ratio, conflicts, checksum failures), `pg_replication_slots` (per-slot activity and WAL retention risk; `safe_wal_size` is null under the default `max_slot_wal_keep_size`, and snapshots captured below the PG14 floor may lack `wal_status`), `pg_stat_replication` peers (application_name, client_addr, state, sync_state, LSN positions, and lag), and checkpoint counters normalized from `pg_stat_checkpointer` (PG17+) or `pg_stat_bgwriter` (older). All four are CLUSTER facts riding a per-node, per-database document — a multi-database cluster reports identical checkpoint counters once per tracked database, a standby's own replication-slot list is normally empty (its slots, if any, live on the primary), and peers are normally empty on a standby unless it is itself feeding further standbys via cascading replication. A read failure on any of the four leaves it absent on the wire, never a substitute zero.
59
59
60
60
The peer section is captured on both primaries and standbys; the lag reference LSN is chosen in SQL by `pg_is_in_recovery()` — `pg_current_wal_lsn()` on a primary, `pg_last_wal_receive_lsn()` on a standby — so cascading replicas are visible without aborting the capture. Lag fields are NULL for an idle standby that has not sent a recent replay message, and state/LSN fields are NULL for a `state='backup'` walsender (a running `pg_basebackup`), so a nil field always means "unknown", never "no lag". The `pg_read_all_stats` role is required for full peer visibility; without it `pg_stat_replication` still returns one row per walsender but with every column NULL except `pid`, which dryrun records as rows with an empty `application_name` and all other fields absent. So `replication_peers_read_ok=true` with a list of such blank rows signals missing privilege, while a genuinely empty list means no standbys. To join peer rows to `describe_table` / `detect` node breakdowns, set each replica's `--label` to its `application_name` (the `primary_conninfo` setting on the replica). Peer rows also carry `client_addr` (replica IP or NULL for Unix sockets); that is infrastructure metadata, not table data, and is not routed through the column-oriented data-masking policy.
`dryrun snapshot query-stats --from "$URL" --label replica-1` still works and writes the same row through the same code, without the lock or the interval check. It is superseded by `capture --from` and kept for existing scripts.
15
15
16
-
Each row stores the raw `pg_stat_statements` rows, the grouped shapes with their rollups, and one `pg_stat_statements_info` read (`stats_reset`, `dealloc`). On PG13 the info part is absent rather than zero. A zero would look like a reset epoch that never happened.
16
+
Each row stores the raw `pg_stat_statements` rows, the grouped shapes with their rollups, and one `pg_stat_statements_info` read (`stats_reset`, `dealloc`). Where `pg_stat_statements` is older than 1.9 the info part is absent rather than zero. A zero would look like a reset epoch that never happened.
17
17
18
18
The fetch is capped at 500 rows by default; `--query-stats-limit` or `[query_stats].row_cap` changes it. A capped capture records `raw_rows` and `row_cap`. Without that, a diff couldn't tell a genuinely new shape from one that only made it under the cap this time.
// PG13 has no info view; fetchPgssInfo also returns nil on read failure.
79
+
// pgss < 1.9 has no info view; fetchPgssInfo also returns nil on read failure.
80
80
scope=append(scope, fmt.Sprintf(
81
-
"reset epoch and eviction count are unknown for %s (pg_stat_statements_info is unreadable or the node predates PG14), so the counters' age cannot be established", node))
81
+
"reset epoch and eviction count are unknown for %s (pg_stat_statements_info is unreadable or pg_stat_statements is older than 1.9), so the counters' age cannot be established", node))
"track = 'all' on %s: nested statements were excluded at capture (toplevel filter), so no time is double counted — but work done inside functions and triggers is invisible here, exactly as under track = 'top'; 'all' now only adds pg_stat_statements entry pressure", node)
169
169
}
170
170
returnfmt.Sprintf(
171
-
"track = 'all' on %s but this capture carries no top-level split: either nothing ran nested, or pg_stat_statements predates 1.9 (PG14), or the capture predates the toplevel filter — in the latter two cases nested time is counted both in its own row and in the caller's, so shares are understated", node)
171
+
"track = 'all' on %s but this capture carries no top-level split: either nothing ran nested, or pg_stat_statements predates 1.9, or the capture predates the toplevel filter — in the latter two cases nested time is counted both in its own row and in the caller's, so shares are understated", node)
172
172
}
173
173
174
174
// changeCaveats reports settings that moved between a node's last two
0 commit comments