Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dan-aksenov opened this issue Jun 28, 2021 · 4 comments

Comments

@dan-aksenov
Copy link

dan-aksenov commented Jun 28, 2021

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

@michael-todorovic
Copy link

Hello,
We identified the issue at my company with standby clusters and we're currently working on a fix ;) I was forking the repo to send the PR today or tomorrow

@maudrid
Copy link

maudrid commented Sep 20, 2022

Thanks, this fixed my issue also.

@lcaflc
Copy link

lcaflc commented Oct 19, 2022

Hi all,

Any reason the fix is still not merged into upstream version ? We can workaround this error in monitoring system but this is not clean where this can be simply fixed in the exporter.

Thanks.

@mhbahmani
Copy link

Hi,

This issue is open since 2021! I was wondering when it gets fixed.
I encountered this issue on postgresql 14.

Thanks.

mblp pushed a commit to mblp/postgres_exporter that referenced this issue Sep 16, 2023
@mblp mblp mentioned this issue Sep 16, 2023
mblp pushed a commit to mblp/postgres_exporter that referenced this issue Sep 17, 2023
Signed-off-by: Andrey Kozlov <kozlov_ae@pik.ru>
mblp pushed a commit to mblp/postgres_exporter that referenced this issue Oct 2, 2023
Signed-off-by: Andrey Kozlov <kozlov_ae@pik.ru>
saz added a commit to saz/postgres_exporter that referenced this issue Jun 20, 2024
Signed-off-by: Steffen Zieger <github@saz.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants