docs: correct the GitLab.com database connection topology

Corrects what this repo says about GitLab.com's database connection topology.

The topology

docs/dev/database.md said GitLab.com routes all connections through PgBouncer in transaction pooling mode. It does not: .com connects straight to CloudSQL. docs/specs/S04-database.md had the topology right, though it tied a follow-on change to PgBouncer being introduced, which never happened; see #1406.

PgBouncer compatibility stays a requirement, because Self-Managed deployments may add a pooler and .com may add one later. QueryExecModeSimpleProtocol and the ban on server-side prepared statements remain mandatory, and migration runners still need a direct connection for goose's session-level advisory locks. What changes is the reason, not the rule.

Three corrections in that file, beyond the topology sentence itself:

  • The claim that simple protocol "costs little" is unsupported, and five sites in this tree measure the cost the other way. It now says what the mode costs (nothing is prepared, so every execution parses and plans afresh) and that it stays for the pooled Self-Managed topology rather than because it is cheap.
  • The migration requirement now names the wiring that satisfies it, pool_host/pool_port and WithConnectionPool(false), and the failure it prevents: both pool fields fall back to host, so pointing only host at PgBouncer sends the migration client through it and boot fails after 300 one-second attempts on the goose session lock.
  • database-migrations.md still cited the removed "bypass PgBouncer" phrasing.

The comment in operator.go

The comment on operatorStatementTimeout asserted the deployment is pooled and inferred that from LabKit's default query-exec mode, which does not follow. The block is 13 lines on an unexported declaration, whose cap is 1, so correcting it in place was not available: it is compressed to one line.

Everything else it carried is gone: the canonical contention case, the lock_timeout alternative, and the idempotent re-run contract, which that comment was the only place near the constant to record. Both of the first two are noted in #1395.

internal/datastore/lifecycle_reap_npm.md claimed that comment records why a session setting was unavailable, so it no longer did. Those clauses are gone too.

Why the caps-gate change is not here

Earlier revisions of this branch changed check-comment-caps.sh so an edit that does not lengthen a comment is not charged. Five triggers were tried and each one, having passed its own tests, turned out to admit a block it should have charged. Growth is a property of a block across two versions of a file, and the measurements also suggest the trigger may not be the problem: 46,076 of this tree's 55,948 Go comment blocks are two lines or more, against an unexported cap of 1.

That work is #1395, with all five attempts and the measurements recorded. This branch was rebuilt from main without it, so the gate, its suite, go-style.md, .gitlab-ci.yml, the write-readable-go skill and the evals are untouched here.

Out of scope

docs/dev/self-managed-install.md tells operators AR works behind a pooler, and contrasts it with iam-data-access, whose migration tool holds a session-level advisory lock. AR's goose runner holds the same kind of lock, and the documented CNPG secret layout maps no pool fields, so there is no configuration that makes the claim true. That is #1405, and no sentence added here would fix it.

LabKit repeats the same false PgBouncer claim upstream in postgres/client.go and postgres/doc.go, the likely origin. That needs its own MR there. docs/specs/S27-background-jobs-foundation.md rests a River MUST on the same premise; that is #1392.

Edited by João Pereira

Merge request reports

Loading
Loading