Skip to content

Commit 69eb75f

Browse files
fmbieteJiriCtvrtkaBupycHuk
authored
pg_replication_slots in standby (#147)
WAL functions cannot be executed in standby servers ``` ERROR: recovery is in progress HINT: WAL control functions cannot be executed during recovery. ``` In PostgreSQL 16 replication slots persist in the standby servers. This is also the case when using extensions like pg_failover_slots that transfer the slot information to the standby. This condition will make those queries to return values only in the primary node avoiding the errors. Co-authored-by: Jiří Čtvrtka <[email protected]> Co-authored-by: Nurlan Moldomurov <[email protected]>
1 parent 58dd345 commit 69eb75f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmd/postgres_exporter/queries.go

+2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ var queryOverrides = map[string][]OverrideQuery{
9595
`
9696
SELECT slot_name, database, active, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn)
9797
FROM pg_replication_slots
98+
WHERE pg_is_in_recovery() = False
9899
`,
99100
},
100101
{
101102
semver.MustParseRange(">=10.0.0"),
102103
`
103104
SELECT slot_name, database, active, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
104105
FROM pg_replication_slots
106+
WHERE pg_is_in_recovery() = False
105107
`,
106108
},
107109
},

0 commit comments

Comments
 (0)