Self-managed install guide claims AR works behind a pooler, but CNPG cannot configure one
Problem
docs/dev/self-managed-install.md:45 tells the operator:
Note on connection poolers like pgbouncer: AR works behind a pooler in transaction pooling mode — its query code uses the simple query protocol for exactly this reason.
iam-data-accessbreaks behind a pooler in transaction mode, because its migration tool holds a session-level advisory lock and its driver uses prepared statements; session mode works.
AR's goose runner holds the same kind of session-level advisory lock
(internal/datastore/migrations/migrations.go:62), so the contrast with
iam-data-access does not hold. AR survives a pooled topology only when the
pooler endpoint is configured separately from the database endpoint, and the
documented setup cannot express that.
Why there is no documented configuration that works
The migration client passes postgres.WithConnectionPool(false)
(internal/datastore/postgres.go:48), so it connects to host/port while
the application client uses pool_host/pool_port. Both pool fields fall back
to host/port when unset.
The install guide has the operator create the PostgreSQL secret in the
CNPG layout (step 9, and format: CNPG in step 12). LabKit's CNPG
projection preset maps five keys and no pool fields at all
(postgres/params.go:37 in labkit/v2@v2.49.0):
CNPG: { host, port, dbname, username, password }
CRUNCHY: { host, port, database, user, password, pgbouncer-host, pgbouncer-port }So an operator with a pooler has only host to put it in. The migration client
then goes through the pooler as well, goose cannot hold its session-level lock
across a transaction-pooled connection, and boot fails after retrying once a
second for 300 attempts (migrations/runner.go trips its 5-minute cap).
Consequence
An operator who reads the note, puts pgbouncer in front of AR, and follows the
documented secret layout gets a crash-looping install at first boot. This is
the same failure the guide already records for iam-data-access under Known
gaps row 8, while telling the operator AR is not affected.
Options
- Document CRUNCHY, or a projection override, as the layout a pooled deployment must use, and say plainly that CNPG cannot express a pooler.
- Withdraw the claim: tell the operator not to put a pooler in front of AR until there is a supported way to configure one.
- Surface
pool_host/pool_portthrough the chart independently of the secret-format preset.
Option 2 is the honest short-term position if 1 or 3 is not close.
Not in scope of the MR that found this
!2725 (merged) corrects docs/dev/database.md's claim that .com routes through
PgBouncer. The install guide's claim predates it and is not made worse by it,
and no sentence added there would make a pooled install work.