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

PostgreSQL replication is displayed as long query in PostgreSQL 14 #1465

Open
okbob opened this issue Apr 6, 2022 · 8 comments
Open

PostgreSQL replication is displayed as long query in PostgreSQL 14 #1465

okbob opened this issue Apr 6, 2022 · 8 comments

Comments

@okbob
Copy link

okbob commented Apr 6, 2022

Describe the bug
PostgreSQL 14 shows replication's slots in pg_stat_activity - like START_REPLICATION SLOT "readonly02" 6DA6/E9000000 TIMELINE 1. The state is active. The column backend_type = walsender can be used for filtering.

To Reproduce
Steps to reproduce the behavior:

  1. check munin against PostgreSQL 14
  2. start replication by using replication slot
  3. check pg_stat_activity table

Expected behavior
This command is permanent, and I don't want to see this command in munin long queries

Desktop (please complete the following information):

  • Linux, Fedora 36, Firefox
  • This page was generated by Munin version 2.0.66 at 2022-04-06 06:50:21+0200 (CEST).
@sumpfralle
Copy link
Collaborator

sumpfralle commented Apr 6, 2022

Thanks for reporting this isse!

Could you prepare a diff for this plugin, which would fix this issue for your?

@okbob
Copy link
Author

okbob commented Apr 7, 2022

I am not an expert on Munin or perl, so it should be rechecked. The column backend_type exists from pg 10. Diff against file postgres_querylength_

<         "SELECT 'query',COALESCE(max(extract(epoch FROM CURRENT_TIMESTAMP-query_start)),0) FROM pg_stat_activity WHERE state NOT LIKE 'idle%' %%FILTER%%
---
>         "SELECT 'query',COALESCE(max(extract(epoch FROM CURRENT_TIMESTAMP-query_start)),0) FROM pg_stat_activity WHERE backend_type = 'client backend' and state NOT LIKE 'idle%' %%FILTER%%

sumpfralle added a commit to sumpfralle/munin that referenced this issue Apr 7, 2022
PostgreSQL 14 shows replication's slots in pg_stat_activity - like
`START_REPLICATION SLOT "readonly02" 6DA6/E9000000 TIMELINE 1`.
The state is active.
The column `backend_type = walsender` can be used for filtering
replication activity.

Thanks, Pavel Stehule!

Closes: munin-monitoring#1465
@sumpfralle
Copy link
Collaborator

Thank you for preparing the diff!

I created a pull request for this change (#1466).

It would be great, if you could download the adjusted plugin file, fix the shebang line (the first one in the file) from @@PERL@@ to /usr/bin/perl (this substitution is usually part of the build process) and test, whether this updated plugin works for you.

My change should lead to the new query being used for all versions of the postgresql server starting from 10.0. I guess, this is correct?

@okbob
Copy link
Author

okbob commented Apr 7, 2022 via email

@sumpfralle
Copy link
Collaborator

there is not any specification so this change should be applied for pg 10 and higher, so or I don't see it

I understand the version specifications as "use this query, if the version is equal or below ...".
In order to avoid any potential confusion or mistakes, I would be happy, if you could test the plugin.

@sumpfralle
Copy link
Collaborator

@okbob: where you able to test my proposal?

@okbob
Copy link
Author

okbob commented Apr 22, 2022 via email

@ingvarha
Copy link
Contributor

ingvarha commented Mar 7, 2023

Any news on this bug? We found the same in one of our setups, with Ubuntu 20.04, postgresql-13, munin-2.0.56. @okbob's patch works for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants