Commit Graph

117 Commits (a7375cc503268d34a0312d22c9c17f6e943f654b)

Author SHA1 Message Date
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
Jack Christensen 1f4b34f932 Merge branch 'master' into v5-dev 2022-04-23 11:05:24 -05:00
Jack Christensen 49a860125f Try to pacify finicky timing test on CI 2022-04-21 19:52:34 -05:00
Jack Christensen 8b483e4223 Use generic / type safe puddle for pgxpool 2022-04-16 09:28:46 -05:00
Jack Christensen b03b1666a6 Add Hijack to pgxpool.Conn 2022-04-14 11:50:12 -05:00
Jack Christensen bb8c52f7e8 Add doc regarding default pgxpool.Config.MaxConns
refs #1183
2022-04-11 18:49:11 -05:00
Jack Christensen f14fb3d692 Replace interface{} with any 2022-04-09 09:12:55 -05:00
Jack Christensen 8e341e20f3 Remove ConnConfig.BuildStatementCache 2022-03-12 09:23:40 -06:00
Jack Christensen aad3d65e16 Initial restructure of simple protocol to query exec mode 2022-03-05 10:27:15 -06:00
Jack Christensen 95cbbfe441 Import pgproto3
Also copy in pgmock as an internal package.
2022-02-21 13:22:42 -06:00
Jack Christensen 9c5dfbdfb3 pgconn.CommandTag is now an opaque type
It now makes a copy instead of retaining driver memory. This is in
preparation to reuse the driver read buffer.
2022-02-12 10:26:26 -06:00
Jack Christensen 318018504a Merge branch 'master' into v5-dev 2022-02-07 11:22:01 -06:00
Jack Christensen e8857f04a1 Make BatchResults.Close safe to be called multiple times
https://github.com/jackc/pgx/issues/1138
https://github.com/jackc/pgx/issues/938
2022-02-07 10:44:39 -06:00