8000 Retry transient per-key DeleteObjects errors by lesandie · Pull Request #22 · Altinity/s3gc · GitHub
[go: up one dir, main page]

Skip to content

Retry transient per-key DeleteObjects errors - #22

Merged
lesandie merged 4 commits into
masterfrom
feat/retry-transient-delete-errors
Dec 2, 2026
Merged

lesandie merged 4 commits into
masterfrom
feat/retry-transient-delete-errors

Conversation

@lesandie
@lesandie lesandie commented Dec 2, 2026 •
Copy link
Copy Markdown
Member

Problem

DeleteObjects can return HTTP 200 with per-key errors in the body. Two production delete attempts stopped on InternalError for 1 key, then 3 keys. Neither the urllib3 status retries nor remove_objects_reconnecting() sees these errors, so each attempt raised S3DeletionError and needed a replacement Job.

Change

  • Confirmed deletions in a response are tombstoned before any backoff, then only the keys that failed with InternalError are resent.
  • Retries use full-jitter exponential backoff (1 s base), at most --s3-delete-retries / S3GC_S3_DELETE_RETRIES rounds (default 3, 0 disables, 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.
  • Any other error code or a missing code, a spent budget, or an error naming a key that wasn't in the request just sent all stop the delete with S3DeletionError, as before. Job reruns stay manual.
  • Each retry round writes a retry run-log event.
  • The per-object GCS path is unchanged.

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

  • Only InternalError is retried, because that's what production returned. SlowDown and ServiceUnavailable are a TODO item.
  • The retry count is the only setting; the 20 s deadline is fixed in code. The ClickHouse server's http_send_timeout default wasn't checked.
  • The renderer doesn't pass the new option, the same as --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.
  • Object identity is not checked on retry. The TODO item asked to preserve object identity across retries. This PR doesn't: a retry resends the key name only, like the first attempt and the existing transport reconnect. A per-retry size/mtime check would need 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" in TODO.md.
  • No request ID is logged, because MinIO 7.2.20's per-key DeleteError doesn't include one.

Commits

  • af5e667 spec and failing tests (spec in the commit message)
  • dc5f66d implementation, docs, CHANGELOG, TODO
  • 8fe81f3 exact deadline wording; the retry row leaves the running-total columns alone
  • 368b9ef document the retry identity limit; restore the deferred requirement in TODO

Checks

  • pytest -m "not dev_cluster": 167 passed
  • render.py example.env and kubeconform -strict: valid

🤖 Generated with Claude Code

lesandie and others added 3 commits December 1, 2026 15:25
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>
@chatgpt-codex-connector
chatgpt-codex-connector Bot commented Dec 2, 2026 •
Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T17:28:59.251295Z 8fe81f3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread s3gc.py Resolved
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>
@lesandie lesandie self-assigned this Dec 2, 2026
@lesandie
lesandie merged commit d6edfba into master Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0