pgmonitor icon indicating copy to clipboard operation
pgmonitor copied to clipboard

Account for logical replication slots on replicas with patroni

Open keithf4 opened this issue 1 year ago • 0 comments

Describe the issue: postgres_exporter gives scrape error warnings on replicas when permanent logical replication slots are in use with patroni.

postgres=# SELECT slot_name, active::int, pg_wal_lsn_diff(pg_current_wal_insert_lsn(), restart_lsn) AS retained_bytes FROM pg_catalog.pg_replication_slots;
ERROR:  recovery is in progress
HINT:  WAL control functions cannot be executed during recovery.

Describe the expected behavior: Normally there's no slots on a replica, so this would return null there. However, patroni makes "permanent" replication slots that exist on replicas. Either have to remove the retained_bytes data or rewrite the query to work despite it.

Tell us about your environment:

  • pgMonitor version: 4.6
  • Container or non-container:
  • Container name / image:
  • Operating System for non-container: R7
  • PostgreSQL Version: 13
  • Exporter(s) in use (incl. version): postgres_exporter 0.10.1
  • Prometheus version:
  • AlertManager version:
  • Grafana version:

keithf4 avatar Aug 09 '22 17:08 keithf4