Provide PGbouncer Session pooling interface
Problem
To make read distribution scale well for Gitaly cluster (Praefect), it depends on LISTEN/NOTIFY to invalidate cached values. GitLab provides an HA database where Transaction pooling is used, which does not support LISTEN/NOTIFY. To circumvent this, Praefect directly connects to a PG instance, to maintain a stateful connection.
This means that if that PG happens to have issues, its availability influences Praefect performance and might result in downtime.
Solution
PgBouncer can be configures with multiple users. When Praefect is used omnibus should configure an addition PgBouncer user in the [users]
section. This uses has the pool_mode
set to Session pooling.
This allows Praefect to maintain a stateful connecting with LISTEN/NOTIFY support, while PbBouncer still provides the failover.
Big shoutout to @abrandl for feeding me all this knowledge so I can type up a smart issue.