]> Cypherpunks repositories - gostls13.git/commit
database/sql: do not bypass the driver locks with Context methods
authorDaniel Theophanes <kardianos@gmail.com>
Fri, 28 Oct 2016 17:10:46 +0000 (10:10 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 Nov 2016 18:52:38 +0000 (18:52 +0000)
commit0d163ce1c95d03a173eba246de6d45db69e678ac
treebd18bad84298aa575921cc73aa0d321f56c51a3f
parent3825656e285155d40f286ff9e1e5deb60cf99094
database/sql: do not bypass the driver locks with Context methods

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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/database/sql/ctxutil.go
src/database/sql/driver/driver.go
src/database/sql/fakedb_test.go
src/database/sql/sql.go
src/database/sql/sql_test.go