Commit Graph

129 Commits (04bcc0219dc3acf67f27e68decd6dffe97334779)

Author SHA1 Message Date
Darius Jahandarie 6603ddfbe4
add MinIdleConns 2025-03-15 19:14:26 +09:00
Vamshi Aruru 12b37f3218 Expose puddle.Pool's EmptyAcquireWaitTime in pgxpool's Stats
Addresses: https://github.com/jackc/pgx/issues/2205
2024-12-26 13:46:49 +05:30
Peyton Foley 06a0abb75e
Update pgxpool.ParseConfig documentation
Added default values and example of valid duration string to inline documentation.
2024-11-05 03:09:43 +08:00
Jack Christensen c457de62c9 Fix doc discrepancies between Tx interface and pgxpool implementation
The error is not wrapped at the moment, but document that it may be.

fixes https://github.com/jackc/pgx/issues/2104
2024-08-07 08:03:41 -05:00
ngavinsir 532bf8f583 adjust test 2024-05-14 20:28:02 -05:00
ngavinsir 169067a364 remove ctx from release tracer 2024-05-14 20:28:02 -05:00
ngavinsir 659525c961 trace release 2024-05-14 20:28:02 -05:00
ngavinsir 4dd1810d8b persist ctx in pgxpool conn 2024-05-14 20:28:02 -05:00
ngavinsir 25914e21f3 add release tracer 2024-05-14 20:28:02 -05:00
ngavinsir 19fcb54564 add pool to trace acquire 2024-05-14 20:28:02 -05:00
ngavinsir a39632db43 feat: pgx pool acquire tracer 2024-05-14 20:28:02 -05:00
Jack Christensen a966716860 Replace DSN with keyword/value in comments and documentation
The term DSN is not used in the PostgreSQL documentation. I'm not sure
why it was originally used. Use the correct PostgreSQL terminology.
2024-05-11 14:33:35 -05:00
Alexey Palazhchenko 8fb309c631 Use Go 1.20's link syntax for `ParseConfig` 2023-07-28 17:51:42 -05:00
James Hartig e665f74c99 fix TestPoolBackgroundChecksMinConns and NewConnsCount
Previously it was checking TotalConns but that includes ConstructingConns.
Instead it should directly check IdleConns so the next Acquire takes one of
those and doesn't make a 3rd connection. The check against the context was
also wrong which prevented this from timing out after 2 minutes.

This also fixes a bug where NewConnsCount was not correctly counting
connections created by Acquire directly.

Fixes #1690
2023-07-22 08:28:39 -05:00
Jack Christensen 88b49d48f6 Disable TestPoolBackgroundChecksMinConns on Windows
https://github.com/jackc/pgx/issues/1690
2023-07-19 21:20:26 -05:00
Jack Christensen c513e2e435 Fix: pgxpool: background health check cannot overflow pool
It was previously possible for a connection to be created while the
background health check was running. The health check could create
connection(s) in excess of the maximum pool size in this case.

https://github.com/jackc/pgx/issues/1660
2023-07-15 10:09:53 -05:00
Jack Christensen 05440f9d3f Drastically increase allowed test times for potato CI
The context timeouts for tests are designed to give a better error
message when something hangs rather than the test just timing out.
Unfortunately, the potato CI frequently has some test or another
randomly take a long time. While the increased times are somewhat less
than optimal on a real computer, hopefully this will solve the
flickering CI.
2023-07-11 21:16:08 -05:00
Jack Christensen 34f17a6048 Allow more time for test on slow CI 2023-06-18 08:36:03 -05:00
Jack Christensen 737b5af236 Allow more time for test on slow CI 2023-06-17 19:03:15 -05:00
Jack Christensen f20070650f Make TestPoolBackgroundChecksMinConns less timing sensitive for CI 2023-06-17 17:34:07 -05:00
Jack Christensen 3ea2f57d8b Deprecate CheckConn in favor of Ping 2023-06-12 09:39:26 -05:00
Jack Christensen 608f39f426 Ensure pgxpool.Pool.QueryRow.Scan releases connection on panic
Otherwise a connection would be leaked and closing the pool would block.

https://github.com/jackc/pgx/issues/1628
2023-06-03 07:39:56 -05:00
Jack Christensen 5f6636d028 Add context timeouts for more pgxpool tests 2023-05-29 11:15:40 -05:00
Jack Christensen a1a97a7ca8 Add context timeouts for some pgxpool tests 2023-05-29 11:04:52 -05:00
Evan Cordell cead918e18 run tests that rely on backend PID to run against cockroach
cockroach has supported backend PIDs on connections since 22.1:
https://www.cockroachlabs.com/docs/releases/v22.1.html#v22-1-3-sql-language-changes
2023-05-15 18:06:08 -05:00
Evan Cordell 7f2bb9595f add BeforeClose to pgxpool.Pool 2023-05-15 18:06:08 -05:00
Alexey Palazhchenko f581584148 Use Go 1.19's lists for proper formatting 2023-01-23 19:54:30 -06:00
Ben Weintraub 29ad306e47 Make MaxConnLifetimeJitter setting actually jitter 2022-12-20 20:18:26 -06:00
Jack Christensen a05fb80b8a Update docs and changelog for renamed pgxpool.NewWithConfig
fixes https://github.com/jackc/pgx/issues/1306
2022-09-16 18:16:36 -05:00
Jack Christensen 90b69c0ee0 Fix atomic alignment on 32-bit platforms
refs #1288
2022-09-08 20:43:53 -05:00
Jack Christensen f015ced1bf Use puddle v2.0.0-beta.2 for Acquire in background after cancel 2022-09-03 13:20:19 -05:00
Jack Christensen ae65a8007b Use higher pgconn.FieldDescription with string Name
Instead of using pgproto3.FieldDescription through pgconn and pgx. This
lets the lowest level pgproto3 still be as memory efficient as possible.

https://github.com/jackc/pgx/pull/1281
2022-08-20 10:04:18 -05:00
Jack Christensen c842802d65 Failsafe timeout for background pool connections
Do not override existing connect timeout.
2022-08-13 09:49:06 -05:00
Jack Christensen 1819959d07 Merge branch 'master' into v5-dev 2022-08-06 06:41:33 -05:00
Jack Christensen 7ce634d62b Ensure there is a timeout for background pool connections 2022-08-06 06:22:17 -05:00
Jack Christensen f3e04b28cc Go 1.19 go fmt 2022-08-06 06:20:50 -05:00
Peter Feichtinger 3cb99532f5 pgxpool: Make BeginTx success case clearer 2022-08-04 20:22:57 -05:00
Jack Christensen 0eda0109ca Add Pool.Reset() 2022-07-30 12:22:29 -05:00
Jack Christensen 957671a6ec Use puddle v2 2022-07-30 12:16:16 -05:00
Jack Christensen 033fc6f62a Rename pgxpool.NewConfig to NewWithConfig
https://github.com/jackc/pgx/issues/1264
2022-07-30 09:16:42 -05:00
James Hartig 91c9e841e1 Ignore cancellation in puddle constructor
Fixes #1259
2022-07-30 07:54:16 -05:00
Jack Christensen b6f5cbd15e Add Conn to Rows interface
https://github.com/jackc/pgx/issues/1191
2022-07-16 17:56:24 -05:00
Jack Christensen 78875bb95a Add tracing support
Replaces existing logging support. Package tracelog provides adapter for
old style logging.

https://github.com/jackc/pgx/issues/1061
2022-07-16 12:27:10 -05:00
Jack Christensen 759e47dba3 Merge branch 'master' into v5-dev 2022-07-12 07:26:00 -05:00
Jack Christensen a059d1099f pgxpool pools always connect lazily
Rename constructor functions now that they don't actually connect.
2022-07-10 14:58:30 -05:00
Jack Christensen 31ec18cc65 Replace Begin and BeginTx methods with functions 2022-07-09 17:25:55 -05:00
Jack Christensen 76946fb5a3 Replace QueryFunc with ForEachScannedRow 2022-07-07 20:29:04 -05:00
Jack Christensen 03da9fcec6 Check conn liveness before using when idle for more than 1 second
Implemented in pgxpool.Pool and database/sql.

https://github.com/jackc/pgx/issues/672
2022-06-25 17:58:53 -05:00
James Hartig a814153aeb pgxpool: health check should avoid going below minConns 2022-06-07 18:38:03 -05:00
Jack Christensen 37c3f157bc Add Hijack from v5 2022-06-02 20:04:08 -05:00