Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database/sql: use errors.Is when checking for driver.ErrBadConn #47142

Closed
kardianos opened this issue Jul 12, 2021 · 5 comments
Closed

database/sql: use errors.Is when checking for driver.ErrBadConn #47142

kardianos opened this issue Jul 12, 2021 · 5 comments

Comments

@kardianos
Copy link
Contributor

As of Go1.17, retry logic and various other logic rely on the exact error value driver.ErrBadConn being returned if the connection is in a bad state. Various calls, such as the IsValid method may be called if supported on a driver that will prevent bad connections from poisoning the pool. However, right now, a driver still has to make a decision to return an interesting error or to get retry logic.

See denisenkom/go-mssqldb#586

I propose that throughout database/sql we use errors.Is rather then a direct comparison to driver.ErrBadConn.

@gopherbot gopherbot added this to the Proposal milestone Jul 12, 2021
@gopherbot
Copy link

Change https://golang.org/cl/333949 mentions this issue: database/sql: use errors.Is when checking errors for driver.ErrBadConn

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jul 14, 2021
@kardianos
Copy link
Contributor Author

@rsc What would be the process for this to move forward?

@rsc rsc moved this from Incoming to Active in Proposals (old) Oct 6, 2021
@rsc
Copy link
Contributor

rsc commented Oct 6, 2021

This seems OK as long as we document it for driver authors. Adding to minutes.

@rsc rsc moved this from Active to Likely Accept in Proposals (old) Oct 13, 2021
@rsc
Copy link
Contributor

rsc commented Oct 13, 2021

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc rsc moved this from Likely Accept to Accepted in Proposals (old) Oct 20, 2021
@rsc
Copy link
Contributor

rsc commented Oct 20, 2021

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: database/sql: use errors.Is when checking for driver.ErrBadConn database/sql: use errors.Is when checking for driver.ErrBadConn Oct 20, 2021
@rsc rsc modified the milestones: Proposal, Backlog Oct 20, 2021
@golang golang locked and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

3 participants