Commit Graph

33 Commits (809be4bfcb60fdd8367c57724eacbf688ede89a3)

Author SHA1 Message Date
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
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
Jack Christensen 9067b2d991 Rename ConnectionPoolOptions to ConnPoolConfig 2014-05-17 13:44:55 -05:00
Jack Christensen 2da1751e1a Rename ConnectionPoolStat to ConnPoolStat 2014-05-17 13:41:44 -05:00
Jack Christensen f9a2501100 Rename ConnectionPool to ConnPool 2014-05-17 13:40:50 -05:00