Skip to content

HDDS-12336. Support Prefix, Delimiter, and CommonPrefixes in ListMultipartUploads#9286

Draft
0lai0 wants to merge 21 commits intoapache:masterfrom
0lai0:HDDS-12336
Draft

HDDS-12336. Support Prefix, Delimiter, and CommonPrefixes in ListMultipartUploads#9286
0lai0 wants to merge 21 commits intoapache:masterfrom
0lai0:HDDS-12336

Conversation

@0lai0
Copy link
Contributor

@0lai0 0lai0 commented Nov 12, 2025

What changes were proposed in this pull request?

To enhance the AWS behavior of the ListMultipartUploads API in Ozone S3 Gateway:

  • Add delimiter and encoding-type query parameters, and include Delimiter, EncodingType, and CommonPrefixes in the response.
  • The response class ListMultipartUploadsResult now wraps Prefix and Delimiter with EncodingTypeObject, and supports CommonPrefixes.
  • The BucketEndpoint's list logic groups multiple file uploads using the ListObjects/V2 method, correctly generating common prefixes.

What is the link to the Apache JIRA

HDDS-12336

@peterxcli peterxcli self-requested a review November 12, 2025 12:28
@peterxcli peterxcli added the s3 S3 Gateway label Nov 12, 2025
@ivandika3
Copy link
Contributor

@echonesis Please also help take a look.

Copy link
Contributor

@echonesis echonesis left a comment

Choose a reason for hiding this comment

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

@0lai0 Thanks for the patch, left some comments.

@0lai0
Copy link
Contributor Author

0lai0 commented Nov 13, 2025

Thanks @echonesis for pointing this out. I'll get on this.

Copy link
Contributor

@chungen0126 chungen0126 left a comment

Choose a reason for hiding this comment

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

Thanks @0lai0 for the patch. Left some comments

Copy link
Contributor

@chungen0126 chungen0126 left a comment

Choose a reason for hiding this comment

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

+1 LGTM

Copy link
Member

@peterxcli peterxcli left a comment

Choose a reason for hiding this comment

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

Thanks for this patch, left some comments.

Few thoughts that I didnt list in the code comments:

  1. lets add a builder for list multipart uploads response class, and move the complex common prefix extracting logic into it.
  2. Please add some test case coverage into AWS SDK IT

new ListMultipartUploadsResult.Upload(
upload.getKeyName(),
String prevDir = null;
for (OzoneMultipartUpload upload : ozoneMultipartUploadList.getUploads()) {
Copy link
Member

Choose a reason for hiding this comment

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

These extract common prefix should only happen if delimiter has value

String prevDir = null;
for (OzoneMultipartUpload upload : ozoneMultipartUploadList.getUploads()) {
String keyName = upload.getKeyName();
if (bucket.getBucketLayout().isFileSystemOptimized() &&
Copy link
Member

Choose a reason for hiding this comment

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

Please could you add some comment to explain the logic here? thanks very much!

Comment on lines +426 to +427
if (!addedAsPrefix) {
result.addUpload(new ListMultipartUploadsResult.Upload(
Copy link
Member

Choose a reason for hiding this comment

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

Is this intentional? some records return from OM would disappear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, When delimiter is provided, uploads sharing a common prefix are collapsed into CommonPrefixes instead of appearing individually in Uploads. So I think it would not disappear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I wasn't 100% sure about this part. Does this implementation look correct ? If I still get incorrect way , could you provide some guidance? Thank you so much.

@peterxcli peterxcli requested a review from ivandika3 November 18, 2025 14:12
@0lai0
Copy link
Contributor Author

0lai0 commented Nov 20, 2025

Thanks @peterxcli . I'll get on this.

@ivandika3
Copy link
Contributor

ivandika3 commented Nov 24, 2025

Thanks @0lai0 for the patch, I'll take a look soon. Meanwhile, please kindly refer to the https://issues.apache.org/jira/browse/HDDS-12882 comment regarding the case where Delimiter is specified (i.e. how to derive CommonPrefixes and Contents).

@0lai0
Copy link
Contributor Author

0lai0 commented Nov 24, 2025

Thanks @ivandika3 for pointing this out. I'll look into this.

@ivandika3
Copy link
Contributor

@0lai0 Thanks, please also add similar tests in TestBucketList and also add pagination tests to AWS SDK integration tests (i.e. AbstractS3SDKV1Tests and AbstractS3SDKV2Tests).

@0lai0
Copy link
Contributor Author

0lai0 commented Nov 24, 2025

Thank you. I'll do some research on how to approach this.

@0lai0 0lai0 requested a review from peterxcli December 4, 2025 09:07
@github-actions
Copy link

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Dec 26, 2025
@github-actions github-actions bot removed the stale label Dec 27, 2025
@0lai0 0lai0 requested a review from echonesis January 19, 2026 15:09
Copy link
Contributor

@echonesis echonesis left a comment

Choose a reason for hiding this comment

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

Thanks @0lai0 for the patch.

Comment on lines +453 to +455
if (keyName.length() < normalizedPrefix.length()) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This check is redundant when getBucketLayout().isFileSystemOptimized() is true
(covered by L450's startsWith check).

Should the prefix filtering apply to all bucket layouts?

&& currentDirName.equals(prevDir)) {
lastProcessedKey = keyName;
lastProcessedUploadId = upload.getUploadId();
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

processedUploads won't be added in this condition.
Is that what we want?

@github-actions
Copy link

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Feb 17, 2026
Comment on lines +129 to +136
final String aclMarker = queryParams().get(QueryParams.ACL);
if (aclMarker != null) {
s3GAction = S3GAction.GET_ACL;
S3BucketAcl result = getAcl(bucketName);
getMetrics().updateGetAclSuccessStats(startNanos);
auditReadSuccess(s3GAction);
return Response.ok(result, MediaType.APPLICATION_XML_TYPE).build();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't restore this, it was moved to BucketAclHandler in HDDS-14360.

Comment on lines +355 to +356
String delimiter,
String encodingType,
Copy link
Contributor

Choose a reason for hiding this comment

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

listMultipartUploads call does not pass these new arguments, causing compile error.

Comment on lines +381 to +382
AUDIT.logReadSuccess(buildAuditMessageForSuccess(s3GAction,
getAuditParameters()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep simplified auditReadSuccess(s3GAction) call.

@github-actions github-actions bot removed the stale label Feb 21, 2026
@0lai0 0lai0 marked this pull request as draft March 1, 2026 02:40
@github-actions
Copy link

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Mar 23, 2026
@github-actions github-actions bot removed the stale label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s3 S3 Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants