<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/database, branch dev.go2go</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/'/>
<entry>
<title>database/sql: close driver.Connector if it implements io.Closer</title>
<updated>2021-02-25T19:34:27+00:00</updated>
<author>
<name>Ivan Trubach</name>
<email>mr.trubach@icloud.com</email>
</author>
<published>2021-02-25T19:15:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=194b636f8f1ff7d6b709b5b9010d1d14b3919e66'/>
<id>194b636f8f1ff7d6b709b5b9010d1d14b3919e66</id>
<content type='text'>
This change allows driver implementations to manage resources in
driver.Connector, e.g. to share the same underlying database handle
between multiple connections. That is, it allows embedded databases
with in-memory backends like SQLite and Genji to safely release the
resources once the sql.DB is closed.

This makes it possible to address oddities with in-memory stores in
SQLite and Genji drivers without introducing too much complexity in
the driver implementations.

See also:
- https://github.com/mattn/go-sqlite3/issues/204
- https://github.com/mattn/go-sqlite3/issues/511
- https://github.com/genjidb/genji/issues/210

Fixes #41790

Change-Id: Idbd19763134438ed38288b9d44f16608e4e97fd7
GitHub-Last-Rev: 962c785dfb3bb6ad98b2216bcedd84ba383fe872
GitHub-Pull-Request: golang/go#41710
Reviewed-on: https://go-review.googlesource.com/c/go/+/258360
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change allows driver implementations to manage resources in
driver.Connector, e.g. to share the same underlying database handle
between multiple connections. That is, it allows embedded databases
with in-memory backends like SQLite and Genji to safely release the
resources once the sql.DB is closed.

This makes it possible to address oddities with in-memory stores in
SQLite and Genji drivers without introducing too much complexity in
the driver implementations.

See also:
- https://github.com/mattn/go-sqlite3/issues/204
- https://github.com/mattn/go-sqlite3/issues/511
- https://github.com/genjidb/genji/issues/210

Fixes #41790

Change-Id: Idbd19763134438ed38288b9d44f16608e4e97fd7
GitHub-Last-Rev: 962c785dfb3bb6ad98b2216bcedd84ba383fe872
GitHub-Pull-Request: golang/go#41710
Reviewed-on: https://go-review.googlesource.com/c/go/+/258360
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database: remove race in TestTxContextWait</title>
<updated>2021-02-24T14:10:04+00:00</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2021-02-01T16:35:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=e49612089196be102b4b7f86c417b8cfba2521aa'/>
<id>e49612089196be102b4b7f86c417b8cfba2521aa</id>
<content type='text'>
This test contained a data race.
On line 437, db.BeginTx starts a goroutine that runs tx.awaitDone,
which reads tx.keepConnOnRollback.
On line 445, the test writes to tx.keepConnOnRollback.
tx.awaitDone waits on ctx, but because ctx is timeout-based,
there's no ordering guarantee between the write and the read.

The race detector never caught this before
because the context package implementation of Done
contained enough synchronization to make it safe.
That synchronization is not package of the context API or guarantees,
and the first several releases it was not present.
Another commit soon will remove that synchronization,
exposing the latent data race.

To fix the race, emulate a time-based context
using an explicit cancellation-based context.
This gives us enough control to avoid the race.

Change-Id: I103fe9b987b1d4c02e7a20ac3c22a682652128b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288493
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test contained a data race.
On line 437, db.BeginTx starts a goroutine that runs tx.awaitDone,
which reads tx.keepConnOnRollback.
On line 445, the test writes to tx.keepConnOnRollback.
tx.awaitDone waits on ctx, but because ctx is timeout-based,
there's no ordering guarantee between the write and the read.

The race detector never caught this before
because the context package implementation of Done
contained enough synchronization to make it safe.
That synchronization is not package of the context API or guarantees,
and the first several releases it was not present.
Another commit soon will remove that synchronization,
exposing the latent data race.

To fix the race, emulate a time-based context
using an explicit cancellation-based context.
This gives us enough control to avoid the race.

Change-Id: I103fe9b987b1d4c02e7a20ac3c22a682652128b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288493
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: fix typo in comment</title>
<updated>2020-12-10T18:23:15+00:00</updated>
<author>
<name>Hein Khant Zaw</name>
<email>heinkhantzaw1@gmail.com</email>
</author>
<published>2020-12-10T16:45:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=422dc83baa2816ca1d9a0aa3f1aaf4c47c8098ad'/>
<id>422dc83baa2816ca1d9a0aa3f1aaf4c47c8098ad</id>
<content type='text'>
Fixes #43116

Change-Id: Ib04fab6ae03f322aa1508ec00523f628d891247a
GitHub-Last-Rev: 0a86e665b2c320e0b2aef75ee53bd7281b19b013
GitHub-Pull-Request: golang/go#43122
Reviewed-on: https://go-review.googlesource.com/c/go/+/276992
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #43116

Change-Id: Ib04fab6ae03f322aa1508ec00523f628d891247a
GitHub-Last-Rev: 0a86e665b2c320e0b2aef75ee53bd7281b19b013
GitHub-Pull-Request: golang/go#43122
Reviewed-on: https://go-review.googlesource.com/c/go/+/276992
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql, runtime: correct *.Fatal inside goroutines in tests</title>
<updated>2020-10-31T20:30:19+00:00</updated>
<author>
<name>Emmanuel T Odeke</name>
<email>emmanuel@orijtech.com</email>
</author>
<published>2020-05-30T00:19:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=715d4e2e014fa54f527ee109f26a31f941196381'/>
<id>715d4e2e014fa54f527ee109f26a31f941196381</id>
<content type='text'>
Found by go vet pass "testinggoroutines".

Change-Id: I6360af2079617b7aa62dcb9bd7254578ca5d1c1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/235527
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Found by go vet pass "testinggoroutines".

Change-Id: I6360af2079617b7aa62dcb9bd7254578ca5d1c1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/235527
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: fix TestTxStmtDeadlock test</title>
<updated>2020-10-29T00:19:20+00:00</updated>
<author>
<name>Tzu-Chiao Yeh</name>
<email>su3g4284zo6y7@gmail.com</email>
</author>
<published>2020-10-28T22:03:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=d8044a6744f9570e964c6e35e12827473ff12cde'/>
<id>d8044a6744f9570e964c6e35e12827473ff12cde</id>
<content type='text'>
Drop error check because errors can be
not only ErrTxDone for tx stmt executions,
and the purpose of the test is just reproducing
deadlock.

Fixes #42259

Change-Id: I9e7105ada1403ec7064dcc1c3385b36893a1c195
Reviewed-on: https://go-review.googlesource.com/c/go/+/266097
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drop error check because errors can be
not only ErrTxDone for tx stmt executions,
and the purpose of the test is just reproducing
deadlock.

Fixes #42259

Change-Id: I9e7105ada1403ec7064dcc1c3385b36893a1c195
Reviewed-on: https://go-review.googlesource.com/c/go/+/266097
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: fix tx stmt deadlock when rollback</title>
<updated>2020-10-28T16:55:17+00:00</updated>
<author>
<name>Tzu-Chiao Yeh</name>
<email>su3g4284zo6y7@gmail.com</email>
</author>
<published>2020-08-24T14:04:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=d4c1ad882973e407ff85b977f4ce5b9435451190'/>
<id>d4c1ad882973e407ff85b977f4ce5b9435451190</id>
<content type='text'>
Tx acquires tx.closemu W-lock and then acquires stmt.closemu.W-lock
to fully close the transaction and associated prepared statement.
Stmt query and execution run in reverse ways - acquires
stmt.closemu.R-lock and then acquires tx.closemu.R-lock to grab tx
connection, which may cause deadlock.

Prevent the lock is held around tx.closePrepared to ensure no
deadlock happens.

Fixes #40985

Change-Id: If53909822b87bce11861a6e3035ecb9476d2cd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/250178
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tx acquires tx.closemu W-lock and then acquires stmt.closemu.W-lock
to fully close the transaction and associated prepared statement.
Stmt query and execution run in reverse ways - acquires
stmt.closemu.R-lock and then acquires tx.closemu.R-lock to grab tx
connection, which may cause deadlock.

Prevent the lock is held around tx.closePrepared to ensure no
deadlock happens.

Fixes #40985

Change-Id: If53909822b87bce11861a6e3035ecb9476d2cd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/250178
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: fix comment on DB.stop()</title>
<updated>2020-10-27T15:12:12+00:00</updated>
<author>
<name>Ayzat Sadykov</name>
<email>ayzat.ziko.93@gmail.com</email>
</author>
<published>2020-10-24T22:11:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=de477138d1b11982e86d8d0898e2a471771899b6'/>
<id>de477138d1b11982e86d8d0898e2a471771899b6</id>
<content type='text'>
Previously, 2 goroutines were created in OpenDB and a comment in the DB.close() field indicated that they were canceled. Later, session Resetter () was removed, but the comment remained the same. This commit just fixes this message

Change-Id: Ie81026f51d7770e9cf8004818154021f626fb2e8
GitHub-Last-Rev: 38b338a0d1cd713d71fa547aa842d395e6d75484
GitHub-Pull-Request: golang/go#42191
Reviewed-on: https://go-review.googlesource.com/c/go/+/264838
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Trust: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, 2 goroutines were created in OpenDB and a comment in the DB.close() field indicated that they were canceled. Later, session Resetter () was removed, but the comment remained the same. This commit just fixes this message

Change-Id: Ie81026f51d7770e9cf8004818154021f626fb2e8
GitHub-Last-Rev: 38b338a0d1cd713d71fa547aa842d395e6d75484
GitHub-Pull-Request: golang/go#42191
Reviewed-on: https://go-review.googlesource.com/c/go/+/264838
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Trust: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: shortestIdleTimeLocked correct min comparison</title>
<updated>2020-08-29T09:20:35+00:00</updated>
<author>
<name>Shinnosuke Sawada</name>
<email>6warashi9@gmail.com</email>
</author>
<published>2020-08-17T11:37:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=4fc3896e7933e31822caa50e024d4e139befc75f'/>
<id>4fc3896e7933e31822caa50e024d4e139befc75f</id>
<content type='text'>
When zero or less, maxIdleTime and maxLifetime means unlimited.
Helper function shortestIdleTimeLocked must not return the
minimum of the two until both are verified to be greater
then zero.

Fixes #40841

Change-Id: I1130332baf4ad259cd90c10f4221f5def8510655
Reviewed-on: https://go-review.googlesource.com/c/go/+/248817
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When zero or less, maxIdleTime and maxLifetime means unlimited.
Helper function shortestIdleTimeLocked must not return the
minimum of the two until both are verified to be greater
then zero.

Fixes #40841

Change-Id: I1130332baf4ad259cd90c10f4221f5def8510655
Reviewed-on: https://go-review.googlesource.com/c/go/+/248817
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql: make Rows.Scan properly wrap underlying errors</title>
<updated>2020-08-14T17:45:39+00:00</updated>
<author>
<name>Tim Möhlmann</name>
<email>muhlemmer@gmail.com</email>
</author>
<published>2020-08-13T08:56:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=a20cb4ca5c14ff27bdf16989d450c83b22f156d8'/>
<id>a20cb4ca5c14ff27bdf16989d450c83b22f156d8</id>
<content type='text'>
The prior implementation used the format verb %v which unfortunately
improperly wrapped any underlying scanner errors, and we couldn't use
errors.Is nor errors.As. This change fixes that by using the %w verb.

Added a unit to ensure that both error sub string matching works, but
also that errors.Is works as expected.

Fixes #38099

Change-Id: Iea667041dd8081d961246f77f2542330417292dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/248337
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The prior implementation used the format verb %v which unfortunately
improperly wrapped any underlying scanner errors, and we couldn't use
errors.Is nor errors.As. This change fixes that by using the %w verb.

Added a unit to ensure that both error sub string matching works, but
also that errors.Is works as expected.

Fixes #38099

Change-Id: Iea667041dd8081d961246f77f2542330417292dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/248337
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>database/sql/driver: use correct method name "Connect" in DriverContext docs</title>
<updated>2020-05-30T03:20:54+00:00</updated>
<author>
<name>Brad Erickson</name>
<email>bderickson@gmail.com</email>
</author>
<published>2020-05-30T03:10:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=1ed57c1b720d6ffa8bc8d074aa9a5751a2c81b87'/>
<id>1ed57c1b720d6ffa8bc8d074aa9a5751a2c81b87</id>
<content type='text'>
Change-Id: I755fedebb1f8f4d3f27b2b3f8626bca03bd36c88
GitHub-Last-Rev: 4a123572d55ad3b0104d3e6501eef5b2f37af4cd
GitHub-Pull-Request: golang/go#39305
Reviewed-on: https://go-review.googlesource.com/c/go/+/235518
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I755fedebb1f8f4d3f27b2b3f8626bca03bd36c88
GitHub-Last-Rev: 4a123572d55ad3b0104d3e6501eef5b2f37af4cd
GitHub-Pull-Request: golang/go#39305
Reviewed-on: https://go-review.googlesource.com/c/go/+/235518
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
Reviewed-by: Daniel Theophanes &lt;kardianos@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
