diff options
author | Filippo Valsorda <filippo@golang.org> | 2021-04-21 17:08:59 +0200 |
---|---|---|
committer | Filippo Valsorda <filippo@golang.org> | 2021-04-21 17:08:59 +0200 |
commit | be25192f119eb66e29a59d8c66622080852cbb58 (patch) | |
tree | fbfd537a2058c30cb5f0fb5e109c61468546e8d2 /src/database/sql/sql.go | |
parent | 229a39e347178614d2b5c103cbdc96b7f30a015a (diff) | |
parent | 8c163e85267d146274f68854fe02b4a495586584 (diff) | |
download | go-be25192f119eb66e29a59d8c66622080852cbb58.tar.gz go-be25192f119eb66e29a59d8c66622080852cbb58.zip |
[dev.boringcrypto.go1.15] all: merge go1.15.11 into dev.boringcrypto.go1.15
Change-Id: I964039a36b7c2c6ef217717755ad78595a3b71fb
Diffstat (limited to 'src/database/sql/sql.go')
-rw-r--r-- | src/database/sql/sql.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go index b3d0653f5c..3d1367d28f 100644 --- a/src/database/sql/sql.go +++ b/src/database/sql/sql.go @@ -2080,10 +2080,10 @@ func (tx *Tx) isDone() bool { // that has already been committed or rolled back. var ErrTxDone = errors.New("sql: transaction has already been committed or rolled back") -// closeLocked returns the connection to the pool and +// close returns the connection to the pool and // must only be called by Tx.rollback or Tx.Commit while -// closemu is Locked and tx already canceled. -func (tx *Tx) closeLocked(err error) { +// tx is already canceled and won't be executed concurrently. +func (tx *Tx) close(err error) { tx.releaseConn(err) tx.dc = nil tx.txi = nil @@ -2157,7 +2157,7 @@ func (tx *Tx) Commit() error { // to ensure no other connection has an active query. tx.cancel() tx.closemu.Lock() - defer tx.closemu.Unlock() + tx.closemu.Unlock() var err error withLock(tx.dc, func() { @@ -2166,7 +2166,7 @@ func (tx *Tx) Commit() error { if err != driver.ErrBadConn { tx.closePrepared() } - tx.closeLocked(err) + tx.close(err) return err } @@ -2189,7 +2189,7 @@ func (tx *Tx) rollback(discardConn bool) error { // to ensure no other connection has an active query. tx.cancel() tx.closemu.Lock() - defer tx.closemu.Unlock() + tx.closemu.Unlock() var err error withLock(tx.dc, func() { @@ -2201,7 +2201,7 @@ func (tx *Tx) rollback(discardConn bool) error { if discardConn { err = driver.ErrBadConn } - tx.closeLocked(err) + tx.close(err) return err } |