65 Commits

Author SHA1 Message Date
Jack Christensen
058f346079 Start pgxpool background health check after initial connections
Otherwise the health check and the create initial connection(s) may both
create connections. While this generally wouldn't be a real problem it
did cause TestPoolBackgroundChecksMinConns to flicker on CI.
2021-11-20 11:19:10 -06:00
Jack Christensen
968a00094e Further increase wait times on timing tests for CI 2021-11-20 10:43:13 -06:00
Jack Christensen
885f39c368 Increase wait time in timing sensitive test 2021-11-20 10:28:52 -06:00
Daniel
6cd6c43dcb Fix failing test 2021-11-01 07:26:49 -05:00
Daniel
8bc6aa6b49 Fix goroutine leak and unclosed connections 2021-10-30 10:25:09 -05:00
Daniel
36708a1cc6 Eager initialize minpoolsize on connect 2021-10-30 10:25:09 -05:00
Jeff Widman
3599f64629 Tweak wording 2021-10-02 07:42:32 -05:00
Dan Gillis
b28c053c39 Add comments 2021-09-25 09:26:59 -05:00
Dan Gillis
bb8d7ffc87 Add comments
Add several comments and correct ConnectConfig
2021-09-25 09:26:59 -05:00
Dan Gillis
763050e10e Add comments
Add Stat struct comment and correct Stat.MaxConns method comment
2021-09-25 09:26:59 -05:00
Dan Gillis
8876b3a4ff Add comments 2021-09-11 11:07:31 -05:00
Jack Christensen
435605a59c Fix pgxpool BatchResults for QueryFunc 2021-09-11 11:05:44 -05:00
Rulin Tang
5320ad87c8 remove query row connection release 2021-08-23 11:39:45 -05:00
Rulin Tang
c9e271df29 add missing pgx pool release for QueryRow 2021-08-23 11:39:45 -05:00
Jack Christensen
a49f4bb135 Use errors instead of golang.org/x/xerrors 2021-03-25 09:55:12 -04:00
Jack Christensen
80147fd7cc Use sync.Once to guard pool.Close
This avoids the small possibility of 2 concurrent Close calls still
double closing the channel.
2021-03-19 08:58:56 -05:00
Matt Schultz
fe366b2cf3 Prevent panics caused by attempting to close an already closed pgxpool.Pool. 2021-03-19 08:58:56 -05:00
Jack Christensen
d245ed47f1 Increase pool release conn wait time for CI
No simple way around sleeping for certain tests.
2021-03-04 20:06:15 -06:00
Jack Christensen
2b63da6f12 Skip backend PID dependent tests on CockroachDB 2021-02-27 10:03:58 -06:00
Jack Christensen
1e15bdc874 Remove deferred from test tables where unneeded 2021-02-27 09:57:14 -06:00
Jack Christensen
ac2918b9a3 Add BeginFunc and BeginTxFunc
fixes #821
2021-02-20 18:30:18 -06:00
Jack Christensen
373bb84e9d Add *pgxpool.AcquireFunc
refs #821
2021-02-20 17:16:33 -06:00
davidsbond
aa8604b5c2 Add Ping method to pgxpool.Conn
Adds the Ping method to pgxpool.Conn, returning the result of calling Ping on
the underlying pgx.Conn.
2021-01-26 20:46:57 -06:00
Robert Froehlich
210a217818 Add BeforeConnect callback to pgxpool.Config.
This allows for connection settings to be updated without having to create
a new pool. The callback is passed a copy of the pgx.ConnConfig and will
not impact existing live connections.
2021-01-02 15:08:59 -08:00
Jack Christensen
e8f959e0e1 Add QueryFunc
refs #821
2020-12-12 09:39:58 -06:00
Jack Christensen
93c6b60429 Explicityly state pgxpool's concurrency-safety
refs #866
2020-11-09 17:01:51 -06:00
drpytho
0c145a3faa Add/Copy docstring from puddle 2020-10-06 09:04:33 -05:00
Jack Christensen
997a16dbc5 Update pgconn for renamed CleanupChan 2020-08-20 22:09:50 -05:00
Jack Christensen
39b096d01e pgxpool waits for connection cleanup to finish before making room in pool
refs #679
2020-08-20 22:04:56 -05:00
georgysavva
e29ce9f6d6 Add Config.Copy() in pgx and pgxpool packages. Conn.Config() and Pool.Config() return copy of the original config. 2020-06-02 13:35:05 +03:00
Jack Christensen
9e1a67c1bc Wait longer in timing sensitive test
Less likely to fail on CI.
2020-05-25 12:04:01 -05:00
Jack Christensen
ac6c49c39d Require access to ConnString via Config
A Config object may be created via ParseConfig and then further
modified. Requiring access to the original ConnString via the Config
helps indicate that the Config is the source of truth as to how the
connection was actually established.
2020-05-16 18:12:04 -05:00
georgysavva
20c6c44f9f Expose Conn.Config() and Pool.Config(). 2020-05-16 19:53:08 +03:00
georgysavva
33cbec368f rename ConnStr -> ConnString 2020-05-16 19:24:57 +03:00
georgysavva
a62de87342 Add ConnStr getter to Pool and Conn structs. 2020-05-16 18:10:29 +03:00
Yegor Myskin
8dd3679f5a Properly close a pool on "not lazy" connect 2020-05-13 17:48:28 +03:00
Jack Christensen
f18351f61c Use ++ instead of += 1 2020-05-07 22:28:46 -05:00
Jean-Baptiste Bronisz
4127eba03f
[pgxpool] Fix connection leak if BeginTx() fail 2020-04-07 22:31:09 +02:00
georgysavva
5d453485a9 Introduce new pool setting: LazyConnect 2020-04-03 10:28:05 +03:00
Jack Christensen
f76d37a387 Do not run timing sensitive test in parallel
This test
2020-04-02 22:24:09 -05:00
Jack Christensen
0329f12e05 Remove unneeded goroutine spawn in connection pool destructor
fixes #708
2020-04-02 22:24:09 -05:00
Jack Christensen
8c9d1cc15b Add test case for #677 2020-02-07 16:07:43 -06:00
Jack Christensen
22ad987698 Add a timeout to pgxpool min connection creation
Ensure that CreateResource can't hang.
2020-02-05 11:25:15 -06:00
Patrick Ellul
a01827732f Implements MinConns, the minimum size of the connection pool.
The health check will increase the number of connections to this amount if it had dropped below.
2020-02-04 08:17:53 +11:00
Jack Christensen
2d20ba7ba4 Add doc for pool_max_conn_idle_time option 2020-02-01 09:45:20 -06:00
Patrick Ellul
5082e30c4c Implement maximum connection idle time (MaxConnIdleTime) for pgxpool.
If a connection has been idle for longer than maxConnIdleTime, the health check will destroy it.
2020-01-28 16:36:34 +11:00
Adam Pantel
167442e66b Add a couple error checks 2019-11-22 11:51:58 -05:00
Jack Christensen
0d8dcd87b0 Fix pgxpool Rows.CommandTag() 2019-10-21 13:57:39 -05:00
Jack Christensen
93a2aa5b2f Releasing a busy connection closes the connection
refs #622
2019-10-12 11:26:51 -05:00
Jack Christensen
143bc3165d Add Conn() to Tx interface.
This is necessary to allow code using a Tx to access the *Conn (and
pgconn.PgConn) on which the Tx is executing.
2019-10-12 09:35:29 -05:00