Skip to content

Improve SHOW CLIENTS by adding "idle" state - #1191

Merged
JelteF merged 6 commits into
pgbouncer:masterfrom
rajaryanece:add_idle_state_in_show_clients
Apr 16, 2025
Merged

JelteF merged 6 commits into
pgbouncer:masterfrom
rajaryanece:add_idle_state_in_show_clients

Conversation

@rajaryanece

@rajaryanece rajaryanece commented Oct 25, 2024 •

Copy link
Copy Markdown
Contributor

Closes #1071
As @JelteF suggested in #1071 -

I do think that reporting could be improved here though, because this report definitely confused me too. Maybe we can introduce an idle state.

@JelteF

JelteF commented Oct 28, 2024

Copy link
Copy Markdown
Member

Code looks good. But docs need to be updated to explain this new value (and update the docs for active)

@rajaryanece

Copy link
Copy Markdown
Contributor Author

Sure , will update the doc and add the changes here.

(and update the docs for active)

what does this mean ? in addition to updating the docs for admin commands with this state, where else would we need to update this reporting?

@eulerto

eulerto commented Nov 2, 2024

Copy link
Copy Markdown
Member

@rajaryanece I think @JelteF is referring to cl_active (SHOW POOLS). I didn't review this PR yet but in a quick look, isn't it better to change the state instead of creating a fake state based on 2 values? If you want to have a real idle state, you need to set the client state as idle.

@JelteF

JelteF commented Dec 2, 2024

Copy link
Copy Markdown
Member

I kinda agree that having a dedicated state is more in line with how all the other states work in PgBouncer. But we set client->link to NULL in many places, so we'd have to change all those places to also set the state to CF_IDLE. And I'd be pretty worried that something would break because it did not check for CF_IDLE.

I think this 1 line change is far less risky, because it only involves the reporting code for the admin commands. And it does solve a real confusing thing for users. So I would prefer this change over a change that introduces a new state.

@JelteF

JelteF commented Dec 24, 2024

Copy link
Copy Markdown
Member

This still needs a documentation update

@rajaryanece

Copy link
Copy Markdown
Contributor Author

working on the test and documentation will add the commit

@rajaryanece
rajaryanece force-pushed the add_idle_state_in_show_clients branch from 828dd2d to e38d2bc Compare January 16, 2025 12:46
@rajaryanece

Copy link
Copy Markdown
Contributor Author

tests failing due to unrelated - issue

@AndrewJackson2020

Copy link
Copy Markdown
Contributor

tests failing due to unrelated - issue

Opened #1249 with a potential fix to this.

@rajaryanece
rajaryanece force-pushed the add_idle_state_in_show_clients branch from cfc3f20 to 2b466ad Compare January 20, 2025 15:06
@rajaryanece

rajaryanece commented Jan 20, 2025 •

Copy link
Copy Markdown
Contributor Author

pulled latest with fix of the issue from master and the update pr - the tests are passing now.

@rajaryanece

Copy link
Copy Markdown
Contributor Author

Hi @JelteF, As I added the test and documentation, I think this PR is ready to be reviewed, please help review it again. Thanks a lot.

@JelteF JelteF left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good now. I'll wait with merging until after the next patch release is done though.

@JelteF JelteF changed the title Improve show clients reporting (#1071) Improve SHOW CLIENTS by adding "idle" state Apr 16, 2025
@JelteF
JelteF merged commit 046505d into pgbouncer:master Apr 16, 2025
@rajaryanece
rajaryanece deleted the add_idle_state_in_show_clients branch April 19, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pgbouncer PAUSE command getting executed without completing the transaction in transaction mode.

4 participants