fix(cleanup): retry transient S3 errors during batch deletes#7
Open
jan-exa wants to merge 1 commit into
Open
Conversation
When deleting millions of files, S3 occasionally returns InternalError or 503 responses. Previously, a single transient error aborted the entire cleanup run, wasting hours of manifest reading. Now delete_batch_with_retry wraps each batch deletion with up to 3 retries and exponential backoff (5s, 10s, 20s). Only transient errors (InternalError, 503, SlowDown, ServiceUnavailable, RequestTimeout) are retried; permanent errors propagate immediately. Co-Authored-By: Jan van der Vegt <jan@exa.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
When deleting millions of files during cleanup (e.g. 35.9M deletion vectors in atlas_v3.lance), S3 occasionally returns transient
InternalErrorresponses. Previously, a single transient error immediately aborted the entire cleanup run, wasting the ~5 hours spent re-reading manifests.Added
delete_batch_with_retry()which wraps each batch deletion with up to 3 retries and exponential backoff (5s, 10s, 20s). Only transient S3 errors are retried:InternalError— S3 transient internal failure503/SlowDown— S3 throttlingServiceUnavailable— S3 temporarily unavailableRequestTimeout— S3 request timeoutPermanent errors (AccessDenied, NoSuchBucket, etc.) propagate immediately.
Review & Testing Checklist for Human
Notes
In our atlas_v3.lance cleanup, attempt 0 deleted 3.14M files before S3 InternalError (6.1h wasted), and attempt 1 deleted 775K files before the same error (5.4h wasted). With this fix, those transient errors would be retried 3 times with backoff instead of aborting the entire run.
Link to Devin session: https://app.devin.ai/sessions/bb810ab5769542e0a12b08c2505d2ae1
Requested by: @jan-exa