fix: reduce retry attempts and use exponential backoff for presign/stage upload#401
Merged
youngsofun merged 1 commit intodatabendlabs:mainfrom May 8, 2026
Merged
Conversation
…age upload - MaxRetryAttempts: 20 -> 5 for both PresignClient and stage upload - Replace linear sleep (attempts*100ms) with exponential backoff (min(1s*2^n, 30s)) - Remove sinceStart >= 900s check: it incorrectly included file transfer time, causing large file uploads to exhaust retries after a single slow transfer - Reduce timeouts: connectTimeout 600s->30s, write/readTimeout 900s/600s->300s - Short-circuit isRetryableIOException for NonRetryableHttpStatusException to prevent body keywords like "timeout" from triggering false retries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes retry behavior for presign upload/download and stage upload.
Changes
PresignClientand stage uploadattempts*100mswithmin(1s * 2^n, 30s)(max ~31s total wait across 5 retries)connectTimeout600s→30s,write/readTimeout900s/600s→300s (300s is still generous for large files; 600s connect timeout was meaningless)isRetryableIOExceptionbefore checking error keywords, preventing response bodies containing "timeout" from triggering retriesRetryableHttpFailureclassTesting
Updated
testDownloadStreamPresignedRetryExhaustionRaisesSQLExceptionto reflect new attempt count (6) and extended timeout to 60s to accommodate exponential backoff.