CrunchyData / pgmonitor

PostgreSQL Monitoring, Metrics Collection and Alerting Resources from Crunchy Data
Other
564 stars 89 forks source link

Account for logical replication slots on replicas with patroni #290

Closed keithf4 closed 1 year ago

keithf4 commented 2 years ago

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:

keithf4 commented 1 year ago

Fixed in #291