<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/database/sql/sql_test.go, branch fix-runtime-test-GOMAXPROCS</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2025-02-10T20:34:55Z</updated>
<entry>
<title>database/sql: use t.Context in tests</title>
<updated>2025-02-10T20:34:55Z</updated>
<author>
<name>apocelipes</name>
<email>seve3r@outlook.com</email>
</author>
<published>2025-02-08T01:15:29Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=7715ca32fcaad84059752c944f40768374796651'/>
<id>urn:sha1:7715ca32fcaad84059752c944f40768374796651</id>
<content type='text'>
Replace "context.WithCancel(context.Background())" with "t.Context()".

Updates #36532

Change-Id: I78a8ba422f076f4c697910922cf6dc35c628b1a7
GitHub-Last-Rev: 2eacdbe9ea97ac8d928704c2b605b276626d95dd
GitHub-Pull-Request: golang/go#71599
Reviewed-on: https://go-review.googlesource.com/c/go/+/647555
Reviewed-by: Jorropo &lt;jorropo.pgm@gmail.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>database/sql: rewrite Null[T].Value method, update doc for Null[T]</title>
<updated>2024-10-21T18:42:47Z</updated>
<author>
<name>Jes Cok</name>
<email>xigua67damn@gmail.com</email>
</author>
<published>2024-10-21T04:42:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=971ab11ee2477cf81f7b7db520bb5c151440d298'/>
<id>urn:sha1:971ab11ee2477cf81f7b7db520bb5c151440d298</id>
<content type='text'>
Update doc for Null[T] to clarify that T should be one of the types
accepted by driver.Value.

Modify the Value() method of Null[T]:
1) recognize T implementing driver.Valuer interface and invoke it.
2) use the DefaultParameterConverter to convert native types that
are not directly supported as driver.Value types.

Fixes #69728
Fixes #69837

Change-Id: Iba782c878b2bde168125f5390abf319b88424149
GitHub-Last-Rev: 3df182d23dd57bd04828c3e9bd0c5222d8bef152
GitHub-Pull-Request: golang/go#69938
Reviewed-on: https://go-review.googlesource.com/c/go/+/620858
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>database/sql: fix panic with concurrent Conn and Close</title>
<updated>2024-08-24T00:26:08Z</updated>
<author>
<name>Nic Klaassen</name>
<email>nic@nicklaassen.ca</email>
</author>
<published>2024-08-22T23:37:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=08707d66c350927560faa11b0c195d37d281ab89'/>
<id>urn:sha1:08707d66c350927560faa11b0c195d37d281ab89</id>
<content type='text'>
The current implementation has a panic when the database is closed
concurrently with a new connection attempt.

connRequestSet.CloseAndRemoveAll sets connRequestSet.s to a nil slice.
If this happens between calls to connRequestSet.Add and
connRequestSet.Delete, there is a panic when trying to write to the nil
slice. This is sequence is likely to occur in DB.conn, where the mutex
is released between calls to db.connRequests.Add and
db.connRequests.Delete

This change updates connRequestSet.CloseAndRemoveAll to set the curIdx
to -1 for all pending requests before setting its internal slice to nil.
CloseAndRemoveAll already iterates the full slice to close all the request
channels. It seems appropriate to set curIdx to -1 before deleting the
slice for 3 reasons:
1. connRequestSet.deleteIndex also sets curIdx to -1
2. curIdx will not be relevant to anything after the slice is set to nil
3. connRequestSet.Delete already checks for negative indices

Fixes #68949

Change-Id: I6b7ebc5a71b67322908271d13865fa12f2469b87
GitHub-Last-Rev: 7d2669155b24043dd9d276f915689511572f2e49
GitHub-Pull-Request: golang/go#68953
Reviewed-on: https://go-review.googlesource.com/c/go/+/607238
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@golang.org&gt;
Commit-Queue: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
</content>
</entry>
<entry>
<title>std: fix calls to Printf(s) with non-constant s</title>
<updated>2024-05-23T18:42:28Z</updated>
<author>
<name>Alan Donovan</name>
<email>adonovan@google.com</email>
</author>
<published>2024-05-23T14:47:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=bf91eb3a8bb057a620f3823e4d6b74a529c0a44d'/>
<id>urn:sha1:bf91eb3a8bb057a620f3823e4d6b74a529c0a44d</id>
<content type='text'>
In all cases the intent was not to interpret s as a format string.
In one case (go/types), this was a latent bug in production.
(These were uncovered by a new check in vet's printf analyzer.)

Updates #60529

Change-Id: I3e17af7e589be9aec1580783a1b1011c52ec494b
Reviewed-on: https://go-review.googlesource.com/c/go/+/587855
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: avoid clobbering driver-owned memory in RawBytes</title>
<updated>2024-04-10T20:23:22Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2024-01-23T23:59:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c23579f031ecd09bf37c644723b33736dffa8b92'/>
<id>urn:sha1:c23579f031ecd09bf37c644723b33736dffa8b92</id>
<content type='text'>
Depending on the query, a RawBytes can contain memory owned by the
driver or by database/sql:

If the driver provides the column as a []byte,
RawBytes aliases that []byte.

If the driver provides the column as any other type,
RawBytes contains memory allocated by database/sql.
Prior to this CL, Rows.Scan will reuse existing capacity in a
RawBytes to permit a single allocation to be reused across rows.

When a RawBytes is reused across queries, this can result
in database/sql writing to driver-owned memory.

Add a buffer to Rows to store RawBytes data, and reuse this
buffer across calls to Rows.Scan.

Fixes #65201

Change-Id: Iac640174c7afa97eeb39496f47dec202501b2483
Reviewed-on: https://go-review.googlesource.com/c/go/+/557917
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Reviewed-by: Roland Shoemaker &lt;roland@golang.org&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>database/sql: use slices to simplify the code</title>
<updated>2024-04-01T12:38:07Z</updated>
<author>
<name>apocelipes</name>
<email>seve3r@outlook.com</email>
</author>
<published>2024-03-29T20:09:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=6bfaafd3c34325515e8ffbe7446b9beda3f49698'/>
<id>urn:sha1:6bfaafd3c34325515e8ffbe7446b9beda3f49698</id>
<content type='text'>
Change-Id: Ia198272330626271ee7d4e1ae46afca819ab2933
GitHub-Last-Rev: e713ac31638671f60cc3cf62fa514f784e834e66
GitHub-Pull-Request: golang/go#66572
Reviewed-on: https://go-review.googlesource.com/c/go/+/574995
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Than McIntosh &lt;thanm@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: qiulaidongfeng &lt;2645477756@qq.com&gt;
</content>
</entry>
<entry>
<title>database/sql: close rows in test</title>
<updated>2024-03-19T11:20:27Z</updated>
<author>
<name>guoguangwu</name>
<email>guoguangwug@gmail.com</email>
</author>
<published>2024-03-18T05:20:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0b7b90cf198b17dd2d164e3bf013aa5846356b55'/>
<id>urn:sha1:0b7b90cf198b17dd2d164e3bf013aa5846356b55</id>
<content type='text'>
This change invokes defer rows.Close() in TestQuery to properly close the rows.

Change-Id: I1ab0d172ad2130e9caab7dbda93d671550c33c6b
GitHub-Last-Rev: 76883a3bceefb80873e57150356a4acc001ee1a3
GitHub-Pull-Request: golang/go#66371
Reviewed-on: https://go-review.googlesource.com/c/go/+/572197
Reviewed-by: David Chase &lt;drchase@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>database/sql: optimize connection request pool</title>
<updated>2024-03-18T23:40:44Z</updated>
<author>
<name>Brad Fitzpatrick</name>
<email>bradfitz@golang.org</email>
</author>
<published>2024-03-17T01:29:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=190d0d3e69b113bea0b6b604ba2f0beb62c08741'/>
<id>urn:sha1:190d0d3e69b113bea0b6b604ba2f0beb62c08741</id>
<content type='text'>
This replaces a map used as a set with a slice.

We were using a surprising amount of CPU in this code, making mapiters
to pull out a random element of the map. Instead, just rand.IntN to pick
a random element of the slice.

It also adds a benchmark:

                     │    before    │                after                │
                     │    sec/op    │   sec/op     vs base                │
    ConnRequestSet-8   1818.0n ± 0%   452.4n ± 0%  -75.12% (p=0.000 n=10)

(whether random is a good policy is a bigger question, but this
 optimizes the current policy without changing behavior)

Updates #66361

Change-Id: I3d456a819cc720c2d18e1befffd2657e5f50f1e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/572119
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: David Chase &lt;drchase@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>database/sql: remove useless error check</title>
<updated>2024-03-06T19:14:36Z</updated>
<author>
<name>guoguangwu</name>
<email>guoguangwug@gmail.com</email>
</author>
<published>2024-03-05T02:38:41Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0e89b67ed22f8130f53dea41d73d7b254c0402bc'/>
<id>urn:sha1:0e89b67ed22f8130f53dea41d73d7b254c0402bc</id>
<content type='text'>
Change-Id: Id2d45a4b43b05deba4e2c31f7c03008c2f2c18a2
GitHub-Last-Rev: 587bed9a64da08d5b476d87333aed72649dad470
GitHub-Pull-Request: golang/go#66110
Reviewed-on: https://go-review.googlesource.com/c/go/+/569075
Reviewed-by: Michael Knyszek &lt;mknyszek@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Jorropo &lt;jorropo.pgm@gmail.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>database/sql: wrap errors with %w in driverArgsConnLocked</title>
<updated>2024-02-27T16:30:20Z</updated>
<author>
<name>aimuz</name>
<email>mr.imuz@gmail.com</email>
</author>
<published>2024-02-21T02:15:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=d8311c86239eebe36e9882760297fd85197add3c'/>
<id>urn:sha1:d8311c86239eebe36e9882760297fd85197add3c</id>
<content type='text'>
Use fmt.Errorf %w verb to wrap errors in driverArgsConnLocked,
which allows for easier unwrapping and checking of error types.

Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query
correctly wrap underlying Valuer errors, adhering to the new change.

Fixes #64707.

Change-Id: Id9f80e265735d0849ee7abba63e58e4c26e658ad
GitHub-Last-Rev: 0df367e0fb5b213513d4e0ab7f5a87984798f96d
GitHub-Pull-Request: golang/go#64728
Reviewed-on: https://go-review.googlesource.com/c/go/+/550116
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Carlos Amedee &lt;carlos@golang.org&gt;
Reviewed-by: Mauri de Souza Meneguzzo &lt;mauri870@gmail.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
</feed>
