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: retry + exponential backoff for SQL queries #34770

mcandre opened this issue Oct 8, 2019 · 2 comments

database/sql: retry + exponential backoff for SQL queries #34770

mcandre opened this issue Oct 8, 2019 · 2 comments


Copy link

@mcandre mcandre commented Oct 8, 2019

When a SQL query experiences a retriable failure, could we introduce a growing delay between retries?

That way, failures due to shifting Active SQL instances in a distributed formation, give the client enough time to wait for the cluster to become available again.

Same story for loadbalancing across ProxySQL instances: When one goes down, it takes a bit for the other ProxySQL to become available for servicing queries.

Copy link

@smasher164 smasher164 commented Oct 8, 2019

I'm not sure if I understand the suggestion here. Is this meant as an enhancement to database/sql, where queries are retried automatically?

AFAIK connections are already pooled and reopened up to a limit, so I suppose queries could similarly be retried. Regarding the backoff, adding jitter would likely be important if this is done, as to avoid collisions.

I'm also not sure if retryable errors are something exposed by every database driver, and what constitutes as one.


@smasher164 smasher164 changed the title Exponential backoff for SQL retries database/sql: retry + exponential backoff for SQL queries Oct 8, 2019
Copy link

@gopherbot gopherbot commented Nov 8, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Nov 8, 2019
@golang golang locked and limited conversation to collaborators Nov 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.