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

Connection status misreported in pgagroal-cli output #473

Closed
fluca1978 opened this issue Sep 26, 2024 · 0 comments · Fixed by #474
Closed

Connection status misreported in pgagroal-cli output #473

fluca1978 opened this issue Sep 26, 2024 · 0 comments · Fixed by #474
Assignees
Labels
bug Something isn't working

Comments

@fluca1978
Copy link
Collaborator

Running version 40acff6 I noticed, as reported in #471 that the command pgagroal-cli status details was reporting connections are in Replica status.
Example:

% psql -h rachel -U luca -c "select pg_sleep_for( '200 seconds' );" testdb

# and in another terminal

% pgagroal-cli status details
-> TRACE cli.c:691 <status details>
-> DEBUG management.c:1852 pgagroal-cli version 20000
Status:              Running
Active connections:  1
Total connections:   6
Max connections:     15
---------------------
Server:              rachel
Host:                127.0.0.1
Port:                5432
State:               Primary
---------------------
Database:            pgbench
Username:            pgbench
Active connections:  0
Max connections:     12
Initial connections: 5
Min connections:     5
---------------------
Database:            testdb
Username:            luca
Active connections:  1
Max connections:     2
Initial connections: 1
Min connections:     1
---------------------
Connection    1:     Primary         2024-09-26 14:17:26        15     pgbench pgbench 
Connection    2:     Primary         2024-09-26 14:17:26        16     pgbench pgbench 
Connection    3:     Primary         2024-09-26 14:17:26        17     pgbench pgbench 
Connection    4:     Primary         2024-09-26 14:17:26        18     pgbench pgbench 
Connection    5:     Primary         2024-09-26 14:17:26        19     pgbench pgbench 
Connection    6:     Replica         2024-09-26 14:17:45 248540 20     luca testdb psql
Connection    7:     Not init                                            
Connection    8:     Not init                                            
Connection    9:     Not init                                            
Connection   10:     Not init                                            
Connection   11:     Not init                                            
Connection   12:     Not init                                            
Connection   13:     Not init                                            
Connection   14:     Not init                                            
Connection   15:     Not init                                      

Note how the Connection 4 is reported as in Replica instead of In Use.

The problem is that the pgagroal-cli output is decoding the status of a connection as the status of a server, and the contant values match. In other words, pgagroal_server_state_as_string is used also for connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant