Skip to content

Error "WAL control functions cannot be executed during recovery" for pg_replication_slots #547

Closed
@dan-aksenov

Description

@dan-aksenov

What did you do?
Simply running exporter 0.0.1-rev (built with go1.15.8)

What did you expect to see?
I expect no errors

What did you see instead? Under which circumstances?

ERROR:  recovery is in progress
HINT:  WAL control functions cannot be executed during recovery.
STATEMENT:
                                SELECT slot_name, database, active, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
                                FROM pg_replication_slots

Environment

  • System information:

    insert output of uname -srm here
    Linux 5.4.0-66-generic x86_64

  • postgres_exporter version:

    insert output of postgres_exporter --version here
    postgres_exporter 0.0.1-rev (built with go1.15.8)

  • postgres_exporter flags:

/opt/postgres_exporter/postgres_exporter --web.listen-address=:9187 --log.level=warn --extend.query-path=/opt/postgres_exporter/queries.yaml
  • PostgresSQL version:

    insert PostgreSQL version here
    11.8

  • Logs:

insert logs relevant to the issue here

While looking here

"pg_replication_slots": {
{
semver.MustParseRange(">=9.4.0 <10.0.0"),
`
SELECT slot_name, database, active, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn)
FROM pg_replication_slots
`,
},
{
semver.MustParseRange(">=10.0.0"),
`
SELECT slot_name, database, active, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
FROM pg_replication_slots

I see no pg_is_in_recovery check

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions