Skip to content

HDDS-16072. Implement GetObjectAttributes: ETag, ObjectSize, StorageClass, and ObjectParts count - #10930

Open
Gargi-jais11 wants to merge 5 commits into
apache:masterfrom
Gargi-jais11:HDDS-16072
Open

HDDS-16072. Implement GetObjectAttributes: ETag, ObjectSize, StorageClass, and ObjectParts count#10930
Gargi-jais11 wants to merge 5 commits into
apache:masterfrom
Gargi-jais11:HDDS-16072

Conversation

@Gargi-jais11

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Implement the initial GetObjectAttributes support in the S3 Gateway.

PR Changes:

  • API : GET /{bucket}/{key}?attributes
  • Required header: x-amz-object-attributes
  • Supported attributes:
    - ETag — object ETag (MD5 or composite hash for multipart objects)
    - ObjectSize — object size in bytes
    - StorageClass — storage/replication class
    - ObjectParts — for multipart objects,
  • Response format: XML GetObjectAttributesResponse with Last-Modified response header
  • Error handling: 404 NoSuchKey when the object does not exist, 403 AccessDenied on authorization failure, 400 InvalidArgument when the attributes header is missing or invalid
  • Audit and metrics: GET_OBJECT_ATTRIBUTES audit action and success/failure metrics

Out of scope:

  • Populating Checksum - non-MD5 checksums are not stored in ozone.
  • ObjectParts.Part[] with per-part PartNumber / Size -> this will be implemented in follow-up PR
  • Pagination (MaxParts, markers, real IsTruncated behavior) -> this will be implemented in followip PR
  • versionId and SSE-C -> Not implemented in ozone

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16072

How was this patch tested?

Added unit test and integration test.
Manually tested:

bash-5.1$ BUCKET=get-attr-test-bucket
KEY=get-attr-test-key
bash-5.1$ aws s3api create-bucket --bucket "$BUCKET" --endpoint-url http://s3g:9878/
{
    "Location": "http://s3g:9878/get-attr-test-bucket"
}
bash-5.1$ echo "hello-get-object-attributes" | aws s3 cp - "s3://$BUCKET/$KEY" --endpoint-url http://s3g:9878/
bash-5.1$ aws s3api get-object-attributes \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --object-attributes ETag ObjectSize StorageClass \
  --endpoint-url http://s3g:9878/
{
    "LastModified": "Mon, 03 Aug 2026 06:39:03 GMT",
    "ETag": "\"88fa5b0b7b11af7d6bdd31a64e1cad0a\"",
    "StorageClass": "STANDARD",
    "ObjectSize": 28
}
--------------------------------
// Test multipart ObjectParts
--------------------------------
bash-5.1$ dd if=/dev/zero of=/tmp/mpu-test.bin bs=1M count=15
15+0 records in
15+0 records out
15728640 bytes (16 MB, 15 MiB) copied, 0.00987967 s, 1.6 GB/s
bash-5.1$ aws s3 cp /tmp/mpu-test.bin "s3://$BUCKET/mpu-key" --endpoint-url http://s3g:9878/
upload: ../../tmp/mpu-test.bin to s3://get-attr-test-bucket/mpu-key
bash-5.1$ aws s3api get-object-attributes   --bucket "$BUCKET"   --key "mpu-key"   --object-attributes ETag ObjectSize ObjectParts   --endpoint-url http://s3g:9878/
{
    "LastModified": "Mon, 03 Aug 2026 06:40:01 GMT",
    "ETag": "\"cb075a2e9cd2c450e3822ba742921b31-2\"",
    "ObjectParts": {
        "TotalPartsCount": 2,
        "PartNumberMarker": 0,
        "NextPartNumberMarker": 0,
        "MaxParts": 0,
        "IsTruncated": false
    },
    "ObjectSize": 15728640
}

@Gargi-jais11
Gargi-jais11 marked this pull request as ready for review August 3, 2026 10:02
@Gargi-jais11
Gargi-jais11 requested review from chungen0126, ivandika3 and peterxcli and removed request for ivandika3 August 3, 2026 10:03
@Gargi-jais11 Gargi-jais11 added the s3 S3 Gateway label Aug 3, 2026
OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED_DEFAULT);
if (isFsoDirCreationEnabled &&
!key.isFile() &&
!keyPath.endsWith("/")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can key.isFile() return true for the key ends with '/'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No — for FSO directory keys, isFile() is false. A file key has isFile()==true. the trailing-slash check only gates directory access without /.

@Gargi-jais11
Gargi-jais11 requested review from priyeshkaratha and yandrey321 and removed request for yandrey321 August 4, 2026 05:47
@Gargi-jais11

Copy link
Copy Markdown
Contributor Author

@yandrey321 Please take a look again, I have updated the PR.

@priyeshkaratha priyeshkaratha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Gargi-jais11 for working on this. Please check the provided inline comment.

@priyeshkaratha priyeshkaratha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Gargi-jais11 for updating the patch. Changes LGTM

@chungen0126 chungen0126 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall, LGTM. Just some nits.

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.

4 participants