Skip to content

Update to latest sfackler - #4

Closed
halfmatthalfcat wants to merge 83 commits into
pimeys:pgbouncer-modefrom
halfmatthalfcat:update-pimeys-with-origin
Closed

Update to latest sfackler#4
halfmatthalfcat wants to merge 83 commits into
pimeys:pgbouncer-modefrom
halfmatthalfcat:update-pimeys-with-origin

Conversation

@halfmatthalfcat

@halfmatthalfcat halfmatthalfcat commented Mar 23, 2022

Copy link
Copy Markdown

This PR updates pimeys/rust-postgres/pgbouncer-mode to the latest sfackler/rust-postgres/master in order to leverage updates and my new ltree, lquery and ltxtquery functionality into quaint and Prisma proper.

sfackler and others added 30 commits April 24, 2021 10:19
…config-file

Upgrade to GitHub-native Dependabot
Updates the requirements on [hmac](https://github.com/RustCrypto/MACs) to permit the latest version.
- [Release notes](https://github.com/RustCrypto/MACs/releases)
- [Commits](RustCrypto/MACs@hmac-v0.10.0...hmac-v0.11.0)

Signed-off-by: dependabot[bot] <support@github.com>
…mac-0.11

Update hmac requirement from 0.10 to 0.11
When executing statements in parallel there is a race where we prepare
the type info queries multiple times, and so insert into the type info
caches multiple times. This resulted in any existing cached `Statement`
to be dropped, running its destructor which attempts to take out the
state lock that is already being held, resulting in a deadlock.

Fixes rust-postgres#772.
There is no reason for the buffer and typeinfo caches to share the same
lock. By splitting them it means we a) get slightly better performance,
but more importantly b) it makes it harder to accidentally deadlock.
The current implementation forwards all read requests to the operating
system through the socket causing excessive system calls. The effect is
magnified when the underlying Socket is wrapped around a TLS
implementation.

This commit changes the underlying socket to be read-buffered by default
with a buffer size of 16K, following the implementation of the official
client.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
tokio-postgres: buffer sockets to avoid excessive syscalls
…-row-getter

expose SimpleQueryRow's column names
Add support for eui48 version 1.0
Making Postgres Types Documentation More Explict For Feature Flags
This is feature-gated because those impls require Rust 1.51.
We needed to bump the version because the `array-impls` feature 
requires const generics.
…-sql-arrays

Add `FromSql` and `ToSql` impls for arrays (guarded behind feature)
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](rust-cli/env_logger@v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
…nv_logger-0.9

Update env_logger requirement from 0.8 to 0.9
sfackler and others added 25 commits December 8, 2021 18:40
- Box<dyn ToSql + Sync>
- Box<dyn ToSql + Sync + Send>
Implement `ToSql` & `FromSql` for `Box<str>`
Updates the requirements on [parking_lot](https://github.com/Amanieu/parking_lot) to permit the latest version.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](Amanieu/parking_lot@0.11.0...0.12.0)

---
updated-dependencies:
- dependency-name: parking_lot
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
…arking_lot-0.12

Update parking_lot requirement from 0.11 to 0.12
Updates the requirements on [tokio-util](https://github.com/tokio-rs/tokio) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/commits)

---
updated-dependencies:
- dependency-name: tokio-util
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
…okio-util-0.7

Update tokio-util requirement from 0.6 to 0.7
Add ToSql / FromSql for IpInet and IpCidr from cidr crate
This enables usage with pgBouncer's transaction mode. Typically when
using the transaction mode, a client gets a new connection from
pgBouncer for every new transaction. It's quite useful and allows one to
use prepared statements in this mode. The workflow goes:

```sql
-- start a new transaction
BEGIN
-- deallocate all stored statements from the server to prevent
-- collisions
DEALLOCATE ALL
-- run the queries here
-- ..
-- ..
COMMIT -- or ROLLBACK
```

Now in a case where the query uses custom types such as enums, what
tokio-postgres does is it fetches the type info for the given type,
stores the info to the cache and also caches the statements for
fetching the info to the client. Now when we have two tables with
different custom types in both of them, we can imagine the following
workflow:

```rust
// first query
client.simple_query("BEGIN")?;
client.simple_query("DEALLOCATE ALL")?;
let stmt = client.prepare("SELECT \"public\".\"User\".\"id\", \"public\".\"User\".\"userType\" FROM \"public\".\"User\" WHERE 1=1 OFFSET $1")?;
dbg!(client.query(&stmt, &[&0i64])?);
client.simple_query("COMMIT")?;

// second query
client.simple_query("BEGIN")?;
client.simple_query("DEALLOCATE ALL")?;
let stmt = client.prepare("SELECT \"public\".\"Work\".\"id\", \"public\".\"Work\".\"workType\" FROM \"public\".\"Work\" WHERE 1=1 OFFSET $1")?;
dbg!(client.query(&stmt, &[&0i64])?);
client.simple_query("COMMIT")?;
```

The `userType` and `workType` are both enums, and the preparing of the
second query will give an error `prepared statement "s1" does not
exist`, where `s1` is the query to the `pg_catalog` for the type info.

The change here gives an extra flag for the client to disable caching
of statements.
@halfmatthalfcat
halfmatthalfcat marked this pull request as ready for review March 23, 2022 04:22
@halfmatthalfcat

Copy link
Copy Markdown
Author

@pimeys - You might want to enable Actions on your fork to run the tests from this PR to validate. I'm going to continue the conversation with Jan here: prisma/orm#12306 (comment)

@pimeys

pimeys commented Mar 24, 2022

Copy link
Copy Markdown
Owner

Merged and tested manually.

@pimeys pimeys closed this Mar 24, 2022
pimeys added a commit that referenced this pull request Nov 7, 2023
Enable transactional pool mode configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.