53 Commits

Author SHA1 Message Date
Gaspard Douady
9530d7fa4c ConnPool begin should not retry if ctx is done 2017-11-21 16:54:58 +01:00
Mike Graf
30896744c8 Return ErrClosedPool when Acquire() with closed pool 2017-08-28 22:30:42 -07:00
Jack Christensen
8f4178b3d3 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen
73f496d7de Finish core batch operations 2017-06-03 11:49:27 -05:00
Jack Christensen
d1fd222ca5 Add transaction context support 2017-05-20 17:58:19 -05:00
Jack Christensen
f04c58338b Introduce pgproto3 package
pgproto3 will wrap the message encoding and decoding for the PostgreSQL
frontend/backend protocol version 3.
2017-04-29 10:02:38 -05:00
Jack Christensen
adb54d06ce Tweak timing sensitive test 2017-04-12 18:03:43 -05:00
Jack Christensen
39dad2b795 Merge branch 'master' into v3-experimental 2017-02-04 11:27:12 -06:00
Jack Christensen
d398d95764 Explicitly close checked-in connections on ConnPool.Reset 2017-01-23 22:48:17 -06:00
Jack Christensen
69434056c6 Remove Conn.TxStatus 2017-01-07 14:10:11 -06:00
Jack Christensen
ec513248ac Conn.PID accessed through method 2017-01-07 13:37:36 -06:00
Jack Christensen
430d4943c7 Replace BeginIso with BeginEx
Adds support for read/write mode and deferrable modes.
2016-12-31 11:48:45 -06:00
Jack Christensen
93e5c68f69 Merge branch 'master' into v3-experimental 2016-12-10 12:21:08 -06:00
Jack Christensen
bf1cc4dbac Fix test for new named ErrAcquireTimeout 2016-10-05 08:42:30 -05:00
Jack Christensen
79acbeac0e Tweak test for better travis compat. 2016-09-22 07:47:28 -05:00
Martin Hamrle
9f6b99e332 Cleanups
Cleanups suggested by gometalinter tools.
2016-08-30 20:05:44 +02:00
Jack Christensen
73124171e2 Rename Pid to PID 2016-08-02 15:10:00 -05:00
Jack Christensen
7477020000 Test ConnPool non-blocking connections locally
- instead of hitting microsoft.com
2016-07-15 14:45:02 -05:00
konstantin
b96777edf3 Merge branch 'Non_blocking_ConnPool_Acquire' into tmp
Conflicts:
	conn_pool.go
2016-07-06 16:58:04 +03:00
konstantin
809be4bfcb Make ConnPool.Acquire() non blocking, feedback 2016-07-06 16:22:59 +03:00
konstantin
7f9373c7c0 Make ConnPool.Acquire() non blocking
When there was an issue with DB server ConnPool.Acquire() used to block
until it heard back from the server or its OpenTimeout hit. If we had
OpenTimeout set to 3 secs, and there were X go routines trying to aquire a
connection in parallel, the very last go routine would receive timeout
error in X*OpenTimeout seconds because of the blocking nature of the
ConnPool.Acquire().

With this commit ConnPool.Acquire() is not blocking any more, and all
X requests will take about 1*OpenTimeout secs to fail.
2016-07-05 18:04:41 +03:00
Jack Christensen
acd9c01bd6 Fix ConnPool.Deallocate 2016-04-30 12:22:26 -05:00
konstantin
d4258bb47f Add AcquireTimeout support 2016-04-11 13:35:16 -07:00
Jack Christensen
1ad4c0090a Add ConnPool Prepare and Deallocate
fixes #68
2016-03-04 16:26:27 -06:00
Jack Christensen
9d7cf39563 Fix go vet identified format strings 2016-02-15 12:32:24 -06:00
Jack Christensen
f004f0802c Add ConnPool.Reset method
refs #110
2015-12-12 13:15:14 -06:00
Jack Christensen
c668caeb31 Fix error message in tests. 2015-10-16 14:15:26 -05:00
Jack Christensen
86837e5576 Add guards against usage of busy connection 2015-09-16 10:22:16 -05:00
Jack Christensen
93aa2b2e80 ConnPool.Begin retry logic checks connection IsAlive
ErrDeadConn is returned when calling an already dead connection. But the initial failure returns the real error. So we check for IsAlive instead of ErrDeadConn.

Added test for ConnPool.Begin retry logic.
2015-09-12 19:39:37 -05:00
Jack Christensen
6e5fa60c4c Fix cases where net conn write failure was not marking connection as dead
Also added loop to run these timing sensitive tests multiple times.
2015-09-12 19:32:55 -05:00
Jack Christensen
6ac98ef613 Add test for ConnPool.Begin retry
Also fix bug where conn is not released on non ErrDeadConn error
returned from Conn.Begin
2015-09-12 19:10:55 -05:00
Jack Christensen
db5300358a Allow ConnPool to have MaxConnections of 1 2015-05-25 09:54:56 -05:00
Karl Seguin
e5b2fbd819 select; is valid in 9.4. This causes the two tests to exec successfully when
we're trying to get a syntax error.
2014-11-17 21:21:08 +07:00
Jack Christensen
d2ce556450 ConnPool no longer creates connections just to release them. 2014-11-12 08:11:33 -06:00
Brian Dunn and Jack Christensen
3e174dda8b Remove debug Println 2014-09-16 16:52:42 -05:00
Brian Dunn and Jack Christensen
a68115fc03 Fix data race with Rows and ConnPool
In an effort to reduce memory allocations, Rows was stored on the
Conn. This caused a race condition where Rows are closed and this
returns the Conn to the Pool. The Pool could then give out the Conn
again. Rows would then be reanimated and the original Rows could reclose
it.
2014-09-16 16:29:45 -05:00
Jack Christensen
56d0518e04 Add test for ConnPool.Exec 2014-07-29 17:49:13 -05:00
Jack Christensen
88d5a25fc4 Fix ConnPool test 2014-07-12 21:38:08 -05:00
Jack Christensen
ae6a87545b Use database/sql style transaction interface 2014-07-12 07:59:30 -05:00
Jack Christensen
f31665c5db wip 2014-07-12 07:11:16 -05:00
Jack Christensen
646136fb44 Rename *Rows.NextRow to *Rows.Next
Conform closer to database/sql
2014-07-11 08:26:01 -05:00
Jack Christensen
d7529600e0 Rename QueryResult to Rows
This helps conform closer to database/sql
2014-07-11 08:21:29 -05:00
Jack Christensen
c11c7c7ad5 Test ConnPool.QueryRow 2014-07-09 08:34:16 -05:00
Jack Christensen
43dcd47a92 Move to Scan interface
Remove SelectValue
2014-07-05 18:23:19 -05:00
Jack Christensen
d30ef1b8b9 Replace SelectFunc with Query as core 2014-06-28 17:07:31 -05:00
Jack Christensen
b6ac3ef2b0 Rename Execute to Exec 2014-06-27 14:56:27 -05:00
Jack Christensen
6bb0a9fa75 Default ConnPool MaxConnections to 5, require min of 2 2014-06-21 18:21:41 -05:00
Jack Christensen
b2c1a14fcc Update github.com/JackC to github.com/jackc 2014-06-21 08:36:20 -05:00
Jack Christensen
839ddcf75f Allow running tests in parallel 2014-06-20 15:27:49 -05:00
Jack Christensen
6d6fb4561a ConnPoolConfig embeds ConnConfig 2014-05-19 07:59:51 -05:00