PgBouncer transaction pooling: `prepare` runs outside the read transaction and can land on another backend
Maintainer antworten meist innerhalb von 1 Tag
@sprihaanand-juspay arbeitet bereits daran.
Seit 27.11.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Summary
STREAMGRES_READ_PG_DSN is documented as able to point at PgBouncer in transaction pooling mode (docs/deploy.md), and reads are designed around that: one BEGIN … SET TRANSACTION SNAPSHOT …; SELECT …; COMMIT transaction, so the PgBouncer backend stays assigned through snapshot import and query.
That holds on the fast path, but not on the slow one. When a table has a result type the driver does not already know (driver_knows is false — enums, extension types, hand-declared columns without a type OID), Pool::read resolves the result types with client.prepare(sql) before the transaction is opened:
// src/sync/pg/mod.rs — read()
let statement = if driver_knows {
None
} else {
match client.prepare(sql).await { // <-- outside the transaction
Ok(statement) => Some(statement),
...
}
};
// then: batch_execute("BEGIN … SET TRANSACTION SNAPSHOT …") + query_raw + COMMIT
Under transaction pooling that prepare is a standalone round trip on a pooled client connection. PgBouncer may assign it a different backend than the one that later runs BEGIN … SET TRANSACTION SNAPSHOT, and a prepared statement is backend-local, so the subsequent query_raw can fail (prepared statement "…" does not exist), or PgBouncer can reject the prepare outright (prepared statements are not supported in transaction pooling mode, depending on version and max_prepared_statements). Either way, the read fails for tables whose types are not in the driver's known-type table — exactly the tables the prepare path exists for.
The driver_knows == true path is unaffected: it streams through query_typed_raw and never prepares.
- Vorherrschende Sprache
- Rust
- Sterne
- 129
- Forks
- 7
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus juspay/streamgres
-
Make the top-L client diff cost depend on what changed, not on the limitEvtl. vergeben @SahilKhan101 hat das vor 2 Tagen übernommen. Offenenhancement
juspay/streamgres#64 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Query optimisation: share initial snapshots across LIMIT variants of the same query (donor windows)Evtl. vergeben @sprihaanand-juspay hat das vor 3 Tagen übernommen. Offen
juspay/streamgres#58 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 Über eine Woche Anfängerfreundlichkeit 38/100
juspay/streamgres#56 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
juspay/streamgres#55 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
juspay/streamgres#49 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in juspay/streamgres
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Test connection's password prompt says the password is never saved, also for a keychain profileOffenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
area: settings bug Haiku review: no-score ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
MMFoundation/WallpaperMachine#346 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
rubys/roundhouse#2473 ·
-
bug mod: quantum info
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Qiskit/qiskit#17699 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag