database/sql: correct level of write to same var for race detector

Rather then write to the same variable per fakeConn, write to either
fakeConn or rowsCursor.

Fixes #20646

Change-Id: Ifc79f989bd1606b8e3ebecb1e7844cce3ad06e17
Reviewed-on: https://go-review.googlesource.com/45393
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Daniel Theophanes 2017-06-12 11:28:18 -07:00
parent 15b1e4fb94
commit 5c37397a47
2 changed files with 51 additions and 34 deletions

View file

@ -2995,9 +2995,8 @@ func (c *concurrentRandomTest) init(t testing.TB, db *DB) {
new(concurrentStmtExecTest),
new(concurrentTxQueryTest),
new(concurrentTxExecTest),
// golang.org/issue/20646
// new(concurrentTxStmtQueryTest),
// new(concurrentTxStmtExecTest),
new(concurrentTxStmtQueryTest),
new(concurrentTxStmtExecTest),
}
for _, ct := range c.tests {
ct.init(t, db)
@ -3243,9 +3242,8 @@ func TestConcurrency(t *testing.T) {
{"StmtExec", new(concurrentStmtExecTest)},
{"TxQuery", new(concurrentTxQueryTest)},
{"TxExec", new(concurrentTxExecTest)},
// golang.org/issue/20646
// {"TxStmtQuery", new(concurrentTxStmtQueryTest)},
// {"TxStmtExec", new(concurrentTxStmtExecTest)},
{"TxStmtQuery", new(concurrentTxStmtQueryTest)},
{"TxStmtExec", new(concurrentTxStmtExecTest)},
{"Random", new(concurrentRandomTest)},
}
for _, item := range list {
@ -3582,7 +3580,6 @@ func BenchmarkConcurrentTxExec(b *testing.B) {
}
func BenchmarkConcurrentTxStmtQuery(b *testing.B) {
b.Skip("golang.org/issue/20646")
b.ReportAllocs()
ct := new(concurrentTxStmtQueryTest)
for i := 0; i < b.N; i++ {
@ -3591,7 +3588,6 @@ func BenchmarkConcurrentTxStmtQuery(b *testing.B) {
}
func BenchmarkConcurrentTxStmtExec(b *testing.B) {
b.Skip("golang.org/issue/20646")
b.ReportAllocs()
ct := new(concurrentTxStmtExecTest)
for i := 0; i < b.N; i++ {