PGBouncer in transaction mode


We are using Keycloak and Keycloak is using Liquibase.

In order to shift from primary database to secondary (failover) without dropping connections to the application, ex

  • pause connections in pgbouncer
  • do a failover
  • change IP in pgbouncer
  • resume

We would like to run pgbouncer in transaction mode. (We are now using session mode).

But testing fails and we are not able to restart Keyclock when using transaction mode. We think that liquibase is run doing Keycloak startup and liquibase is expecting a session lock. (not possible in transactions mode).

Is that observation correct - that liquibase using session locks?

Or in another way prevent us for using pgbouncer in transaction mode? Can it we configure not to ?
Or maybe I just misunderstands it … then my apologies :slight_smile:

Thanks for a good product



Hi @jabi27 ,

May I confirm that when Keycload is in session mode, everything works fine? Could you elaborate on what you mean by:

Liquibase does have a notion of a session lock, but it accomplishes that by setting one row in the databasechangeloglock table.