<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/database/sql/sql_test.go, branch go1.8rc3</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=go1.8rc3</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=go1.8rc3'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2017-01-26T06:25:37Z</updated>
<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>
<entry>
<title>database/sql: document expectations for named parameters</title>
<updated>2016-12-01T16:52:12Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-11-23T17:10:30Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=e5e05627745764fb9989bf3966919d6715f21abc'/>
<id>urn:sha1:e5e05627745764fb9989bf3966919d6715f21abc</id>
<content type='text'>
Require parameter names to not begin with a symbol.

Change-Id: I5dfe9d4e181f0daf71dad2f395aca41c68678cbe
Reviewed-on: https://go-review.googlesource.com/33493
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: deflake query cancel tests</title>
<updated>2016-11-30T18:40:03Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-11-30T17:30:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2a64ebfc6d247e9177190f862b0947ac98c5eb43'/>
<id>urn:sha1:2a64ebfc6d247e9177190f862b0947ac98c5eb43</id>
<content type='text'>
Rather then using a sleep in the fake DB, go to a channel
select and wait for the context to be done.

Fixes #18115

Change-Id: I6bc3a29db58c568d0a7ea06c2a354c18c9e798b2
Reviewed-on: https://go-review.googlesource.com/33712
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: rename NamedParam to NamedArg and Param to Named</title>
<updated>2016-11-30T16:42:58Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-11-29T17:57:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2b1abf75945508a602daa29a87b7a45e0b6b04af'/>
<id>urn:sha1:2b1abf75945508a602daa29a87b7a45e0b6b04af</id>
<content type='text'>
Be consistent with the argument names already provided. Also
parameter is the variable, argument is the value.

Fixes #18099

Change-Id: Idb3f4e9ffc214036c721ddb4f614ec6c95bb7778
Reviewed-on: https://go-review.googlesource.com/33660
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: do not bypass the driver locks with Context methods</title>
<updated>2016-11-29T18:52:38Z</updated>
<author>
<name>Daniel Theophanes</name>
<email>kardianos@gmail.com</email>
</author>
<published>2016-10-28T17:10:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0d163ce1c95d03a173eba246de6d45db69e678ac'/>
<id>urn:sha1:0d163ce1c95d03a173eba246de6d45db69e678ac</id>
<content type='text'>
When context methods were initially added it was attempted to unify
behavior between drivers without Context methods and those with
Context methods to always return right away when the Context expired.
However in doing so the driver call could be executed outside of the
scope of the driver connection lock and thus bypassing thread safety.

The new behavior waits until the driver operation is complete. It then
checks to see if the context has expired and if so returns that error.

Change-Id: I4a5c7c3263420c57778f36a5ed6fa0ef8cb32b20
Reviewed-on: https://go-review.googlesource.com/32422
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>
</feed>
