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

FEATURE requested : Add a command to get the global status of the pgbouncer server (paused or resumed) #528

Closed
lohengrin1870 opened this issue Sep 16, 2020 · 6 comments · Fixed by #599
Labels
feature discussion about functionality that does not exist yet

Comments

@lohengrin1870
Copy link

Hello,
I try to find a command which indicates if a pgbouncer has been paused but didn't find : the only way is to look in the log file. Would it be possible to implement such command ? Thank you and best regards

@petere
Copy link
Member

petere commented Oct 7, 2020

The per-database pause mode can be seen in the output of SHOW DATABASES. The global pause mode is currently not visible. Any suggestions how to show that?

@petere petere added feature discussion about functionality that does not exist yet moreinfo labels Oct 21, 2020
@davidfetter
Copy link

Is there any difference between global pause mode and all databases are paused? If not, a thing that scans for unpaused databases and stops if it finds one that's not would be a thing that could be made directly visible. This would be a pretty trivial thing to do with https://github.com/davidfetter/pgbouncer_wrapper or https://github.com/CrunchyData/pgbouncer_fdw

@petere
Copy link
Member

petere commented Nov 19, 2020

Is there any difference between global pause mode and all databases are paused?

Yes, see here: https://github.com/pgbouncer/pgbouncer/blob/master/src/admin.c#L1071-L1088

@davidfetter
Copy link

So I see that the cf_pause_mode global, which at a quick glance changes how pgbouncer responds to SIGUSR2 and I'm not quite sure what else that would make any difference, gets set there in one case but not the other. I guess reference counting would be a bit of a pain, as it always is when there's a potential for a race condition, if there was some desire to make the conditions equivalent. Is that the reason they're different, or is it more along the lines of how that would change all databases are paused from doing nothing on SIGUSR2 to suddenly waking up? I guess if people were counting on that difference, it could be a pretty important one.

@lohengrin1870
Copy link
Author

Thanks for your involvement. The issue we have faced is that we have a script (promote and follow) at one time which has launched a SIGUSR1 to the pgbouncer process but didn't launch the SIGUSR2 signal...The pgbouncer was blocked but didn't know that the SIGUSR1 was received by the pgbouncer. It's only in the log. So I thought it would be a good idea to have a command which shows that the pgbouncer is paused, what do you think ?

@lohengrin1870 lohengrin1870 changed the title Is it possible to get the status of the server ? (paused or resumed) FEATURE requested : Add a command to get the status of the pgbouncer server (paused or resumed) Jan 5, 2021
@lohengrin1870 lohengrin1870 changed the title FEATURE requested : Add a command to get the status of the pgbouncer server (paused or resumed) FEATURE requested : Add a command to get the global status of the pgbouncer server (paused or resumed) Jan 5, 2021
@petere petere removed the moreinfo label Feb 10, 2021
eulerto added a commit to eulerto/pgbouncer that referenced this issue May 17, 2021
This new command exposes the current PgBouncer state which can be:
active, pause or suspend (see PauseMode). Although it is possible to
obtain this state looking at SHOW DATABASES, you have to process
multiple entries to discover the global state; it seems a fragile
solution. PgBouncer has an internal variable that knows the current
state so let's expose it.

Closes pgbouncer#528
eulerto added a commit to eulerto/pgbouncer that referenced this issue May 31, 2021
This new command exposes the current PgBouncer state which can be:
active, pause or suspend (see PauseMode). Although it is possible to
obtain this state looking at SHOW DATABASES, you have to process
multiple entries to discover the global state; it seems a fragile
solution. PgBouncer has an internal variable that knows the current
state so let's expose it.

Closes pgbouncer#528
eulerto added a commit to eulerto/pgbouncer that referenced this issue May 31, 2021
This new command exposes PgBouncer states which are active, pause or
suspend (see PauseMode). Although it is possible to obtain this state
looking at SHOW DATABASES, you have to process multiple entries to
discover the global state; it seems a fragile solution. PgBouncer has an
internal variable that knows the current state so let's expose it.

It shows one state per row so we have some room for additional states in
the future.

Closes pgbouncer#528
@lohengrin1870
Copy link
Author

Hello
Did you have an update about this feature requested ? I can see that there is a PR still opened, is there any chance to see this feature one day ? What's blocking ?
@eulerto Anyway thank you for having implemented this feature

eulerto added a commit to eulerto/pgbouncer that referenced this issue Jan 3, 2023
This new command exposes PgBouncer states which are active, paused or
suspended (see PauseMode). Although it is possible to obtain this state
looking at SHOW DATABASES, you have to process multiple entries to
discover the global state; it seems a fragile solution. PgBouncer has an
internal variable that knows the current state so let's expose it.

It shows one state per row so we have some room for additional states in
the future.

Closes pgbouncer#528
eulerto added a commit that referenced this issue Jan 3, 2023
This new command exposes PgBouncer states which are active, paused or
suspended (see PauseMode). Although it is possible to obtain this state
looking at SHOW DATABASES, you have to process multiple entries to
discover the global state; it seems a fragile solution. PgBouncer has an
internal variable that knows the current state so let's expose it.

It shows one state per row so we have some room for additional states in
the future.

Closes #528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature discussion about functionality that does not exist yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants