Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(65)

Issue 5785043: code review 5785043: database/sql{,driver}: add ErrBadConn (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by bradfitz
Modified:
13 years, 1 month ago
Reviewers:
blake.mizerany, kr
CC:
golang-dev, rsc
Visibility:
Public.

Description

database/sql{,driver}: add ErrBadConn

Patch Set 1 #

Patch Set 2 : diff -r 8602e1593d53 https://go.googlecode.com/hg #

Patch Set 3 : diff -r 8602e1593d53 https://go.googlecode.com/hg #

Patch Set 4 : diff -r 8602e1593d53 https://go.googlecode.com/hg #

Patch Set 5 : diff -r 8602e1593d53 https://go.googlecode.com/hg #

Total comments: 14

Patch Set 6 : diff -r 9974201aa263 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+86 lines, -34 lines) Patch
M src/pkg/database/sql/driver/driver.go View 1 2 3 4 5 1 chunk +11 lines, -0 lines 0 comments Download
M src/pkg/database/sql/sql.go View 1 2 3 4 5 8 chunks +75 lines, -34 lines 0 comments Download

Messages

Total messages: 21
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg
13 years, 1 month ago (2012-03-07 22:05:12 UTC) #1
rsc
What if it doesn't implement this?
13 years, 1 month ago (2012-03-07 22:06:06 UTC) #2
bradfitz
On Wed, Mar 7, 2012 at 2:06 PM, Russ Cox <rsc@golang.org> wrote: > What if ...
13 years, 1 month ago (2012-03-07 22:07:48 UTC) #3
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 1 month ago (2012-03-07 23:29:34 UTC) #4
rsc
LGTM http://codereview.appspot.com/5785043/diff/6001/src/pkg/database/sql/driver/driver.go File src/pkg/database/sql/driver/driver.go (right): http://codereview.appspot.com/5785043/diff/6001/src/pkg/database/sql/driver/driver.go#newcode46 src/pkg/database/sql/driver/driver.go:46: // ErrBadConn should be returned by drivers to ...
13 years, 1 month ago (2012-03-08 15:26:13 UTC) #5
bradfitz
http://codereview.appspot.com/5785043/diff/6001/src/pkg/database/sql/driver/driver.go File src/pkg/database/sql/driver/driver.go (right): http://codereview.appspot.com/5785043/diff/6001/src/pkg/database/sql/driver/driver.go#newcode46 src/pkg/database/sql/driver/driver.go:46: // ErrBadConn should be returned by drivers to signal ...
13 years, 1 month ago (2012-03-08 18:07:23 UTC) #6
bradfitz
*** Submitted as http://code.google.com/p/go/source/detail?r=7a8c58d0b7b8 *** database/sql{,driver}: add ErrBadConn R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/5785043
13 years, 1 month ago (2012-03-08 18:09:51 UTC) #7
blake.mizerany
I see a problem with this: If the database returns a FATAL error to me, ...
13 years, 1 month ago (2012-03-08 21:50:28 UTC) #8
rsc
I don't understand. If you want the driver to try a new connection, return ErrBadConn. ...
13 years, 1 month ago (2012-03-08 21:57:44 UTC) #9
blake.mizerany
I'm saying I want to have my cake and eat it. I need to get ...
13 years, 1 month ago (2012-03-08 22:10:42 UTC) #10
rsc
On Thu, Mar 8, 2012 at 17:10, Blake Mizerany <blake.mizerany@gmail.com> wrote: > I need to ...
13 years, 1 month ago (2012-03-08 22:14:51 UTC) #11
bradfitz
Get this "FATAL" thing from Postgres, set a "broken" bit on your Conn type, return ...
13 years, 1 month ago (2012-03-08 22:15:16 UTC) #12
kr
I suggest letting the conn expose a flag to indicate whether it's ok to continue ...
13 years, 1 month ago (2012-03-08 23:25:05 UTC) #13
bradfitz
ErrBadConn never makes it to the user. On Fri, Mar 9, 2012 at 10:25 AM, ...
13 years, 1 month ago (2012-03-08 23:42:34 UTC) #14
blake.mizerany
Ah. I see that now. I apologize. On Thu, Mar 8, 2012 at 3:42 PM, ...
13 years, 1 month ago (2012-03-08 23:51:02 UTC) #15
kr
Is the flexibility of having a special-case error value worth the extra complexity? Do we ...
13 years, 1 month ago (2012-03-09 00:23:24 UTC) #16
rsc
> Also, I suspect the ErrBadConn strategy will > be more error-prone. Rerunning queries 10 ...
13 years, 1 month ago (2012-03-09 03:26:48 UTC) #17
kr
On Thu, Mar 8, 2012 at 7:26 PM, Russ Cox <rsc@golang.org> wrote: > There's an ...
13 years, 1 month ago (2012-03-09 04:57:02 UTC) #18
rsc
On Thu, Mar 8, 2012 at 23:56, Keith Rarick <kr@xph.us> wrote: > ErrBadConn has the ...
13 years, 1 month ago (2012-03-09 05:05:09 UTC) #19
kr
On Thu, Mar 8, 2012 at 9:05 PM, Russ Cox <rsc@golang.org> wrote: > If you ...
13 years, 1 month ago (2012-03-09 05:55:15 UTC) #20
rsc
13 years, 1 month ago (2012-03-09 19:11:02 UTC) #21
On Fri, Mar 9, 2012 at 00:55, Keith Rarick <kr@xph.us> wrote:
> Yes, a subset of errors make the conn unusable, and
> a subset of those errors can be safely retried.
> ErrBadConn has an advantage if it's desirable to
> hide that smaller subset from the user. Is that
> a goal? It might be preferable for the user to be
> able to see those errors. And, even if we want to
> hide those errors, is that smaller subset large
> enough to be worth the cost?
>
> (I'm not asking rhetorically; I honestly don't know.)

I don't know either.  However, the possible benefit seems
large - if this case comes up, we can handle it - and the
cost seems miniscule: people writing drivers have to write a
few more lines of code.  How many drivers will there ever be?
10?  50?

FWIW, I do think that the case comes up: if you have a
long-standing TCP connection to a database server and
an idle connection drops between calls, you can return ErrBadConn
from the next call and avoid showing that connection drop
to the user.

Russ
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b