Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
database/sql: retry + exponential backoff for SQL queries #34770
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.
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.