Repository navigation
Retry transient per-key DeleteObjects errors - #22
Merged
Merged
Conversation
DeleteObjects can answer HTTP 200 with per-key errors in the body. Two production delete attempts stopped on InternalError for one key and then three keys; neither the urllib3 status retries nor remove_objects_reconnecting() sees those errors, so the run raised S3DeletionError and the Job needed an operator rerun. Acceptance criteria: - After a batch, only keys whose error code is allowlisted (InternalError) and whose name is in the request just sent are resent, in a new DeleteObjects request. - Confirmed successes are tombstoned before any backoff or resend, so an interruption during a retry cannot lose S3-confirmed deletions. - Retries use exponential backoff with full jitter, bounded by --s3-delete-retries / S3GC_S3_DELETE_RETRIES rounds (default 3, 0 disables, negative is rejected before any delete) and by a fixed elapsed deadline checked before each resend, because resends keep the ClickHouse result stream paused. A spent budget raises S3DeletionError. - Any non-allowlisted or missing error code stops retries for the batch. - An error with no key name, or a name not in the request just sent, tombstones nothing from that response and is not retried. Previously an unmatched name let the failed key be tombstoned as deleted. - Each key is tombstoned once; checkpoint counters and run-log rows match. Each retry round logs codes, key count, attempt and delay, and writes a run-log "retry" row. - With retries disabled, behavior matches today's apart from the unmatched-name fix. The per-object remove_object path is unchanged. - README, CLI reference and CHANGELOG are updated; TODO drops the item. This commit adds the failing tests; the implementation follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements the spec in af5e667. Batch deletion now checkpoints a response's confirmed deletions, then resends only keys that failed with InternalError, with full-jitter exponential backoff bounded by --s3-delete-retries (default 3, 0 disables) and a fixed 20 s elapsed deadline. A response error that names no requested key checkpoints nothing. The per-object GCS path is unchanged. Docs, CHANGELOG and TODO are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deadline gates new retry rounds only; a resend in flight is bounded by the S3 timeouts. The run-log retry row no longer writes per-round counts into the running-total objects/bytes columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fe81f350f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A retry resends the key name only, like the first attempt. Record that in the CLI reference and changelog, and restore the deferred requirement to protect object identity across in-process resends in TODO.md. Co-Authored-By: Claude Opus 5.5 <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.
Problem
DeleteObjectscan return HTTP 200 with per-key errors in the body. Two production delete attempts stopped onInternalErrorfor 1 key, then 3 keys. Neither the urllib3 status retries norremove_objects_reconnecting()sees these errors, so each attempt raisedS3DeletionErrorand needed a replacement Job.Change
InternalErrorare resent.--s3-delete-retries/S3GC_S3_DELETE_RETRIESrounds (default 3,0disables, a negative value is rejected). No new round starts past a fixed 20 s per batch, because the ClickHouse stream is paused while we wait.S3DeletionError, as before. Job reruns stay manual.retryrun-log event.Fixed along the way: if S3 reported an error for a key that wasn't in the request (e.g. a name mismatch), the old code tombstoned every key in the batch, including one that may not have been deleted. Such a response now tombstones nothing and fails the Job.
Decisions
InternalErroris retried, because that's what production returned.SlowDownandServiceUnavailableare a TODO item.http_send_timeoutdefault wasn't checked.--s3-retries, so Kubernetes Jobs use the default. Turning retries off gains no safety: the keys stay in the inventory and the Job fails exactly as it does once the budget runs out.s3:GetObject, which the docs don't list, and would not protect the larger window between collect and delete. The limitation is documented, and the requirement is back under "Protect object identity" inTODO.md.DeleteErrordoesn't include one.Commits
af5e667spec and failing tests (spec in the commit message)dc5f66dimplementation, docs, CHANGELOG, TODO8fe81f3exact deadline wording; theretryrow leaves the running-total columns alone368b9efdocument the retry identity limit; restore the deferred requirement in TODOChecks
pytest -m "not dev_cluster": 167 passedrender.py example.envand kubeconform-strict: valid🤖 Generated with Claude Code