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

CRDB retry backoff #1195

Merged
merged 1 commit into from
Apr 12, 2023
Merged

CRDB retry backoff #1195

merged 1 commit into from
Apr 12, 2023

Conversation

ecordell
Copy link
Contributor

@ecordell ecordell commented Mar 8, 2023

Adds exponential backoff to tx retries for CRDB.

This is recommended by CRDB docs, but isn't implemented in cockroach-go (which we don't use). In theory this should help under heavy contention, but I would like to test it some more before merging.

@github-actions github-actions bot added the area/datastore Affects the storage system label Mar 8, 2023
@ecordell ecordell force-pushed the crdb-retry-backoff branch 2 times, most recently from 73e6f3b to 044c634 Compare March 31, 2023 13:17
@ecordell ecordell marked this pull request as ready for review April 4, 2023 19:44
@ecordell ecordell requested a review from a team as a code owner April 4, 2023 19:44
@github-actions github-actions bot added area/CLI Affects the command line area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Apr 4, 2023
@ecordell ecordell enabled auto-merge April 5, 2023 13:12
@github-actions github-actions bot removed area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Apr 5, 2023
internal/datastore/crdb/tx.go Outdated Show resolved Hide resolved
internal/datastore/crdb/tx.go Outdated Show resolved Hide resolved
@@ -61,10 +64,17 @@ func executeWithResets(ctx context.Context, fn innerFunc, maxRetries uint8) (err
for retries = 0; retries <= maxRetries; retries++ {
err = fn(ctx)
if resettable(ctx, err) {
log.Ctx(ctx).Warn().Err(err).Msg("retrying resetteable database error")
after := retry.BackoffExponentialWithJitter(100*time.Millisecond, 0.5)(uint(retries))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this lands, I'd suggest opening an issue to make this parameterizable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@ecordell ecordell merged commit 5c6f007 into authzed:main Apr 12, 2023
24 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/CLI Affects the command line area/datastore Affects the storage system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants