Commit Graph

78 Commits (89f1e6ac7276b61d885db5e5aed6fcbedd1c7e31)

Author SHA1 Message Date
Gaspard Douady 9530d7fa4c ConnPool begin should not retry if ctx is done 2017-11-21 16:54:58 +01:00
Jack Christensen 23c3724fb3 Fix comment on ErrClosedPool 2017-08-29 14:53:31 -05: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 27ab289096 Use Go casing convention for OID 2017-06-03 11:53:49 -05:00
Jack Christensen 73f496d7de Finish core batch operations 2017-06-03 11:49:27 -05:00
Jack Christensen 8a7165dd98 Add ctx to PrepareEx
Remove PrepareExContext
2017-05-20 18:03:59 -05:00
Jack Christensen d1fd222ca5 Add transaction context support 2017-05-20 17:58:19 -05:00
Jack Christensen 2a49569747 Remove AfterClose() and Conn() from Tx and Rows 2017-05-06 10:00:49 -05:00
Jack Christensen 0a67735a8e ConnPool.Close does not wait for acquired conns 2017-05-06 09:25:58 -05:00
Jack Christensen 280bce7078 Added log adapter for logrus
Also changed standard logger interface to take a map instead of varargs for
extra data.
2017-04-29 21:28:38 -05:00
Jack Christensen 7b1f461ec3 Add simple protocol suuport with (Query|Exec)Ex 2017-04-10 08:58:51 -05:00
Jack Christensen 19c6689752 Add pgtype.Record and prerequisite restructuring
Because reading a record type requires the decoder to be able to look up oid
to type mapping and types such as hstore have types that are not fixed between
different PostgreSQL servers it was necessary to restructure the pgtype system
so all encoders and decodes take a *ConnInfo that includes oid/name/type
information.
2017-03-18 12:01:16 -05:00
Jack Christensen 94749e580f Remove CopyTo 2017-03-17 14:18:25 -05:00
Jack Christensen ba5f97176a Move not null Oid to pgtype
In preparation to ConnInfo implementation.
2017-03-13 21:34:38 -05:00
Jack Christensen 743b98b298 Name PG types as words
Though this doesn't follow Go naming conventions exactly it makes names more
consistent with PostgreSQL and it is easier to read. For example, TIDOID becomes
TidOid. In addition this is one less breaking change in the move to V3.
2017-03-11 17:03:23 -06:00
Jack Christensen b1fc8109db Remove AF_INET fetching system
Also remove old encode/decode inet/cidr code. This removed some functionality
from Rows.Values, but that entire system will soon change anyway.
2017-03-04 18:00:51 -06:00
Jack Christensen 908c439317 Use stdlib context 2017-03-03 16:01:06 -06:00
Jack Christensen 7fbff4a495 Merge branch 'context' into v3-experimental 2017-02-12 15:13:47 -06:00
Jack Christensen 72b6d32e2f Extracted more context handling 2017-02-07 21:49:58 -06:00
Jack Christensen 14eedb4fca Add ConnPool context methods 2017-02-06 18:54:49 -06: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 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
Alexander Staubo f1de186a93 Connection pool timeout should return a consistent error value so clients can test for it. 2016-10-03 15:56:01 -04:00
Martin Hamrle 9f6b99e332 Cleanups
Cleanups suggested by gometalinter tools.
2016-08-30 20:05:44 +02:00
Jack Christensen 5f7d01778e Add CopyTo to support PostgreSQL copy protocol
fixes #102
2016-08-10 16:27:44 -05:00
Jack Christensen 7e43eca3d3 Remove one allocation per pool query 2016-08-08 16:31:01 -05:00
Jack Christensen 390f75c0e1 Reduce Logger interface to Log method 2016-08-02 14:42:31 -05:00
Jack Christensen 214443deb7 Rename Oid to OID 2016-08-02 13:31:55 -05:00
Jack Christensen ecf158b086 Track and check number of in-progress acquires 2016-07-15 14:46:50 -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 40f00f4a82 Pass PrepareEx opts as pointer and DRY implementation 2016-05-20 08:30:10 -05:00
Jack Christensen b06560aa03 Rename Preparex to PrepareEx 2016-05-20 08:14:56 -05:00
William King 2ba5bb405b Slight doc update 2016-05-18 13:27:22 -07:00
William King e417cc2f15 Preparex 2016-05-18 13:15:15 -07:00
John Barker a282d9df90 Cache connection properties in the pool
This is a quick attempt to improve connection startup time by caching
the properties that are loaded when a connection is ready in the pool,
so that further connections don't incur this cost.

I'm not entirely convinced by the interface here, perhaps these 3 items
could live in their own type and that be passed around for clearer code,
but the idea works well.
2016-05-10 18:34:26 -04: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 04e9fbcc55 Fix some golint errors
- Add comments
- Rename variables
- Remove unnecessary "else"
2016-03-29 15:18:09 -05:00
Jack Christensen 1ad4c0090a Add ConnPool Prepare and Deallocate
fixes #68
2016-03-04 16:26:27 -06:00
Jack Christensen 20d22a67e3 Prevent deadlock on ConnPool.Acquire with Reset
If no connections are available, and the pool is reset, there will
be no connections at all in the pool. So the pool needs to be able
to create a connection after waiting for a connection to be released.
2016-03-04 16:19:48 -06:00
Jack Christensen a93025479d Add AfterClose and Conn to Rows 2016-02-13 13:03:06 -06:00
Jack Christensen e8dcf5b3ac Add *Tx.AfterClose hook
ConnPool now implements its connection with Tx via this hook instead of
manipulating the internals of Tx.
2016-02-13 11:06:44 -06:00
Jack Christensen f004f0802c Add ConnPool.Reset method
refs #110
2015-12-12 13:15:14 -06:00
Jack Christensen 20cf4f87ab Remove notifications when releasing Conn to Pool 2015-09-26 13:24:21 -05:00