<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/database/sql/sql_test.go, branch go1.8.4</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=go1.8.4</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=go1.8.4'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2017-05-23T19:41:50Z</updated>
<entry>
<title>[release-branch.go1.8] database/sql: ensure releaseConn is defined before a possible close</title>
<updated>2017-05-23T19:41:50Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-05-03T15:57:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=6efa2f22ac45e9f12eccdc0eafe1799b9eb78dd3'/>
<id>urn:sha1:6efa2f22ac45e9f12eccdc0eafe1799b9eb78dd3</id>
<content type='text'>
Applies https://golang.org/cl/42139 to the go1.8 release branch.

Also correct two minor issues detected with go vet.

Fixes #20217

Change-Id: I2c41af9497493598fbcfc140439b4e25b9bb7e72
Reviewed-on: https://go-review.googlesource.com/42532
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Chris Broadfoot &lt;cbro@golang.org&gt;
</content>
</entry>
<entry>
<title>[release-branch.go1.8] database/sql: convert test timeouts to explicit waits with checks</title>
<updated>2017-02-13T19:22:34Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-02-12T23:12:52Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=ae13ccfd6dee7113d11aba0c1c287bfa2897488d'/>
<id>urn:sha1:ae13ccfd6dee7113d11aba0c1c287bfa2897488d</id>
<content type='text'>
When testing context cancelation behavior do not rely on context
timeouts. Use explicit checks in all such tests. In closeDB
convert the simple check for zero open conns with a wait loop
for zero open conns.

Fixes #19024
Fixes #19041

Change-Id: Iecfcc4467e91249fceb21ffd1f7c62c58140d8e9
Reviewed-on: https://go-review.googlesource.com/36902
Run-TryBot: Daniel Theophanes &lt;kardianos@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Reviewed-on: https://go-review.googlesource.com/36917
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</content>
</entry>
<entry>
<title>[release-branch.go1.8] database/sql: do not exhaust connection pool on conn request timeout</title>
<updated>2017-02-10T17:53:29Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-02-08T18:32:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=f1e44a4b7426e03bff7ed4f75a91e57c498d3463'/>
<id>urn:sha1:f1e44a4b7426e03bff7ed4f75a91e57c498d3463</id>
<content type='text'>
Previously if a context was canceled while it was waiting for a
connection request, that connection request would leak.

To prevent this remove the pending connection request if the
context is canceled and ensure no connection has been sent on the channel.
This requires a change to how the connection requests are represented in the DB.

Fixes #18995

Change-Id: I9a274b48b8f4f7ca46cdee166faa38f56d030852
Reviewed-on: https://go-review.googlesource.com/36563
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-on: https://go-review.googlesource.com/36613
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>[release-branch.go1.8] database/sql: record the context error in Rows if canceled</title>
<updated>2017-02-09T03:47:26Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-02-07T18:19:02Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=3ade54063e9a219e50e53a6a042013e2cafc1251'/>
<id>urn:sha1:3ade54063e9a219e50e53a6a042013e2cafc1251</id>
<content type='text'>
Previously it was intended that Rows.Scan would return
an error and Rows.Err would return nil. This was problematic
because drivers could not differentiate between a normal
Rows.Close or a context cancel close.

The alternative is to require drivers to return a Scan to return
an error if the driver is closed while there are still rows to be read.
This is currently not how several drivers currently work and may be
difficult to detect when there are additional rows.

At the same time guard the the Rows.lasterr and prevent a close
while a Rows operation is active.

For the drivers that do not have Context methods, do not check for
context cancelation after the operation, but before for any operation
that may modify the database state.

Fixes #18961

Change-Id: I49a25318ecd9f97a35d5b50540ecd850c01cfa5e
Reviewed-on: https://go-review.googlesource.com/36485
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-on: https://go-review.googlesource.com/36614
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: fix race when canceling queries immediately</title>
<updated>2017-01-26T06:25:37Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-01-21T01:12:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2b283cedef2a62e37b7422ef3badc7b758bd26c8'/>
<id>urn:sha1:2b283cedef2a62e37b7422ef3badc7b758bd26c8</id>
<content type='text'>
Previously the following could happen, though in practice it would
be rare.

Goroutine 1:
	(*Tx).QueryContext begins a query, passing in userContext

Goroutine 2:
	(*Tx).awaitDone starts to wait on the context derived from the passed in context

Goroutine 1:
	(*Tx).grabConn returns a valid (*driverConn)
	The (*driverConn) passes to (*DB).queryConn

Goroutine 3:
	userContext is canceled

Goroutine 2:
	(*Tx).awaitDone unblocks and calls (*Tx).rollback
	(*driverConn).finalClose obtains dc.Mutex
	(*driverConn).finalClose sets dc.ci = nil

Goroutine 1:
	(*DB).queryConn obtains dc.Mutex in withLock
	ctxDriverPrepare accepts dc.ci which is now nil
	ctxCriverPrepare panics on the nil ci

The fix for this is to guard the Tx methods with a RWLock
holding it exclusivly when closing the Tx and holding a read lock
when executing a query.

Fixes #18719

Change-Id: I37aa02c37083c9793dabd28f7f934a1c5cbc05ea
Reviewed-on: https://go-review.googlesource.com/35550
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: let tests wait for db pool to come to expected state</title>
<updated>2017-01-25T21:57:28Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2017-01-25T16:27:45Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=165cfbc409d54154263c26fb0cc2b2acd75d8b53'/>
<id>urn:sha1:165cfbc409d54154263c26fb0cc2b2acd75d8b53</id>
<content type='text'>
Slower builders were failing TestQueryContext because the cancel
and return to conn pool happens async. TestQueryContext already
uses a wait method for this reason. Use the same method for
other context tests.

Fixes #18759

Change-Id: I84cce697392b867e4ebdfadd38027a06ca14655f
Reviewed-on: https://go-review.googlesource.com/35750
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: fix typo and wording</title>
<updated>2017-01-02T22:17:24Z</updated>
<author>
<name>Kevin Burke</name>
<email>kev@inburke.com</email>
</author>
<published>2017-01-02T21:19:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=af7bc070490fb2024102ac9a2c8f598bcb481bc7'/>
<id>urn:sha1:af7bc070490fb2024102ac9a2c8f598bcb481bc7</id>
<content type='text'>
Clean up the phrasing a little bit, make the comment fit in 80
characters, and fix the spelling of "guard."

Change-Id: I688a3e760b8d67ea83830635f64dff04dd9a5911
Reviewed-on: https://go-review.googlesource.com/34792
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: prevent Tx.rollback from racing Tx.close</title>
<updated>2017-01-02T20:21:02Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-12-26T19:33:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=9def857072bb708a79c291bb88c4b2830f0a8376'/>
<id>urn:sha1:9def857072bb708a79c291bb88c4b2830f0a8376</id>
<content type='text'>
Previously Tx.done was being set in close, but in a Tx
rollback and Commit are the real closing methods,
and Tx.close is just a helper common to both. Prior to this
change a multiple rollback statements could be called, one
would enter close and begin closing it while the other was
still in rollback breaking it. Fix that by setting done
in rollback and Commit, not in Tx.close.

Fixes #18429

Change-Id: Ie274f60c2aa6a4a5aa38e55109c05ea9d4fe0223
Reviewed-on: https://go-review.googlesource.com/34716
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: do not store Tx options in Context</title>
<updated>2016-12-14T18:13:13Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-12-13T15:55:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=d0501f1da9c54a8053940feeb86e1644ffaae522'/>
<id>urn:sha1:d0501f1da9c54a8053940feeb86e1644ffaae522</id>
<content type='text'>
Drivers which previously supported tip will need to update to this
revision before release.

Fixes #18284

Change-Id: I70b8e7afff1558a8b5348885ce9f50e067c72ee9
Reviewed-on: https://go-review.googlesource.com/34330
Run-TryBot: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: ensure Commit and Rollback return ErrTxDone</title>
<updated>2016-12-01T22:20:31Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-12-01T19:07:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=ae9712c76688a07e1149958994a9ab3e5a99c37f'/>
<id>urn:sha1:ae9712c76688a07e1149958994a9ab3e5a99c37f</id>
<content type='text'>
Ensure documented behavior of returning ErrTxDone if the Tx has
already been committed or rolled back.

Fixes #18147

Change-Id: I07dc75bef4dbd4dd88dd252c96dc8ab99f28c00e
Reviewed-on: https://go-review.googlesource.com/33793
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
</feed>
