PgBouncer transaction pooling: `prepare` runs outside the read transaction and can land on another backend
Los mantenedores suelen responder en 1 día
@sprihaanand-juspay ya está trabajando en esto.
Desde el 27/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 129
- Forks
- 7
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de juspay/streamgres
-
Make the top-L client diff cost depend on what changed, not on the limitPosiblemente ocupada @SahilKhan101 la tomó hace 2 días. Abiertoenhancement
juspay/streamgres#64 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Query optimisation: share initial snapshots across LIMIT variants of the same query (donor windows)Posiblemente ocupada @sprihaanand-juspay la tomó hace 3 días. Abierto
juspay/streamgres#58 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 Más de una semana Aptitud para principiantes 38/100
juspay/streamgres#56 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
juspay/streamgres#55 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
juspay/streamgres#49 ·
Los mantenedores suelen responder en 1 día
Todos los issues de juspay/streamgres
Issues similares
-
Android: a long press's `contextmenu` event carries no point (`clientX` and `clientY` are 0)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Test connection's password prompt says the password is never saved, also for a keychain profileAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
area: settings bug Haiku review: no-score ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MMFoundation/WallpaperMachine#346 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rubys/roundhouse#2473 ·
-
bug mod: quantum info
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Qiskit/qiskit#17699 · 2 comentarios ·
Los mantenedores suelen responder en 1 día