HDDS-16282. Avoid O(n^2) key removal in S3 DeleteObjects - #11126
Open
rjgoyln wants to merge 1 commit into
Open
Conversation
A multi-object DELETE may carry up to 1000 keys, and the audit list of failed deletions was derived by removing every successfully deleted key from an ArrayList, making the response loop quadratic in the number of keys.
Contributor
|
is there a benchmark that shows performance improvement for these changes? |
Contributor
Author
Yes, I've updated the PR body to include the benchmark results and performance details. Please take a look! Thank you. |
rjgoyln
marked this pull request as ready for review
August 27, 2026 05:33
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.
What changes were proposed in this pull request?
A multi-object DELETE carries up to 1000 keys, and the
failedDeletesaudit list was derived by removing every successfully deleted key from the request list — quadratic in the size of the request. Building the failure list directly leaves the response and the audit output unchanged.Timing that loop in isolation at the 1000-key cap, median of 2000 iterations after warmup on JDK 25:
The peak sits near a 50% failure rate rather than at either extreme, because failed keys accumulate at the head of the list and every later
remove(Object)scans past them. Against the OM round trip the saving is small; what it buys is dropping a quadratic term from a capped path.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16282
How was this patch tested?
Two new unit tests pin the response and the
failedDeletesaudit parameter, for a mixed success/failure request and for a batch delete that fails outright. Both also pass against the previous implementation — that is what they are for. The fullozone-s3gatewaysuite (760 tests) and checkstyle pass locally.Generated-by: Claude Code (Opus 5)