Skip to content

PAUSE command should wait until all active transactions have completed #917

@hasyimibhar

Description

@hasyimibhar

Is your feature request related to a problem? Please describe.

According to pgBouncer doc:

PAUSE [db]

PgBouncer tries to disconnect from all servers. Disconnecting each server connection waits for that server connection to be released according to the server pool’s pooling mode (in transaction pooling mode, the transaction must complete, in statement mode, the statement must complete, and in session pooling mode the client must disconnect). The command will not return before all server connections have been disconnected. To be used at the time of database restart.

Currently, PAUSE does not wait for queries to complete. I tested this by running SELECT pg_sleep(30), and while the query is running, run PAUSE. The command returns immediately. With pgBouncer, PAUSE waits for the query to complete before returning.

Describe the solution you'd like

It would be nice to adopt the same behavior as pgBouncer. I'm using PAUSE command to perform zero downtime blue green upgrade, and it's very important to wait for in-flight queries to complete before proceeding with the cutover.

Describe alternatives you've considered

Without this behavior, I would have to poll pgcat, e.g. by calling SHOW POOLS and wait until cl_active becomes 0.

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions