pgcat icon indicating copy to clipboard operation
pgcat copied to clipboard

PAUSE command not working as expected

Open bhargavtheertham-cb opened this issue 10 months ago • 1 comments

Describe the bug Hello, When I issue a command to PAUSE pgcat either globally using PAUSE or at the pool level PAUSE db,user , the command is succeding and SHOW DATABASES shows the paused = 1 but I still see client connections being serviced in pgcat and hitting the database. I am not sure if this is what is expected per documentation. I was expecting to see client connections queing up and backend connections not serving requests..

pgcat=> PAUSE; PAUSE pgcat=>

        name            |                                      host                                      | port | database | force_user | pool_size | min_pool_size | reserve_pool |  pool_mode  | max_connections | current_connections | p

aused | disabled ----------------------------+--------------------------------------------------------------------------------+------+----------+------------+-----------+---------------+--------------+-------------+-----------------+---------------------+-- ------+---------- stage-db_shard_0_primary | xyz | 5432 | postgres | stage-user | 20 | 3 | 0 | transaction | 20 | 3 |
1 | 0 stage-db_shard_0_replica_0 | abc | 5432 | postgres | stage-user | 20 | 3 | 0 | transaction | 20 | 3 |
1 | 0 stage-db_shard_1_primary | abc | 5432 | postgres | stage-user | 20 | 3 | 0 | transaction | 20 | 3 |
1 | 0 stage-db_shard_1_replica_0 | abc | 5432 | postgres | stage-user | 20 | 3 | 0 | transaction | 20 | 3 |
1 | 0 (4 rows)

But still see queries running in our dashboard

pgcat log shows that its still creating server connections

2025-03-22T03:35:53.271734Z INFO ThreadId(06) pgcat::pool: Creating a new server connection Address { id: 3, host: "stage-datastores-aurora-16.cluster-ro-cjcgwfomiic3.us-east-1.rds.amazonaws.com", port: 5432, shard: 1, database: "postgres", role: Replica, replica_number: 0, address_index: 1, username: "stage-user", pool_name: "stage-db", mirrors: [], stats: AddressStats { total: AddressStatFields { xact_count: 51, query_count: 51, bytes_received: 3366, bytes_sent: 714, xact_time: 0, query_time: 27, wait_time: 307703, errors: 0 }, current: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages_updated: false }, error_count: 0 }

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

bhargavtheertham-cb avatar Mar 22 '25 03:03 bhargavtheertham-cb

I have checked the source code, seems like there's no code to actually stop/wait to complete the running queries?

szguoxz avatar Jun 15 '25 00:06 szguoxz