Skip to content

HDDS-15510. Implement OM read/write paths for bucket tagging with audit and metrics#10498

Open
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15510
Open

HDDS-15510. Implement OM read/write paths for bucket tagging with audit and metrics#10498
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15510

Conversation

@Gargi-jais11

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Implement Ozone Manager support for storing and retrieving S3-style bucket tags on OmBucketInfo. PUT and DELETE are write operations; GET is a read path via OmMetadataReader. Tags are stored on the source bucket record in OM DB.

Scope:

- Write path

  • S3PutBucketTaggingRequest.java — set tags on bucket, update modification time
  • S3DeleteBucketTaggingRequest.java — clear tags
  • Register in OzoneManagerRatisUtils.java

- Read path

  • OmMetadataReader.getBucketTagging() — read tags from OmBucketInfo
  • OzoneManagerRequestHandler.getBucketTagging()
  • OzoneManager.getBucketTagging()
  • Cross-cutting
  • OMAction — PUT_BUCKET_TAGGING, GET_BUCKET_TAGGING, DELETE_BUCKET_TAGGING
  • OMAuditLogger mapping
  • OMMetrics / OmMetadataReaderMetrics counters
  • IOmMetadataReader interface

- Bucket Links

  • support bucket tag on source bucket of link bucket.

- OM unit tests

  • Put tagging on bucket
  • Delete tagging

What is the link to the Apache JIRA

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

How was this patch tested?

Added two new unit tests TestS3PutBucketTagging and TestS3DeleteBucketTagging.

@Gargi-jais11 Gargi-jais11 added the s3 S3 Gateway label Jun 12, 2026
@Gargi-jais11 Gargi-jais11 marked this pull request as ready for review June 12, 2026 08:33
@Gargi-jais11

Copy link
Copy Markdown
Contributor Author

@ivandika3, @peterxcli and @ChenSammi could you please review this 2nd PR for bucketTagging implementation.

@Gargi-jais11 Gargi-jais11 requested a review from ChenSammi June 15, 2026 05:56

@sreejasahithi sreejasahithi 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.

Thanks @Gargi-jais11 for the PR. left few comments wrt the tests added.

Please add assertions in the success tests that the saved bucket is updated correctly, not only the tags.

Where:

TestS3PutBucketTaggingRequest.testValidateAndUpdateCacheSuccess — after the tag assertions
TestS3DeleteBucketTaggingRequest.testValidateAndUpdateCacheSuccess — after the tag assertions

Add:

assertThat(updatedBucketInfo.getModificationTime())
    .isGreaterThan(bucketInfo.getModificationTime());
assertEquals(2L, updatedBucketInfo.getUpdateID());

because the requirement says PUT/DELETE should update modification time. testPreExecute only checks that the request gets a new modificationTime, the success tests never verify it was persisted on the bucket. updateID should match the transaction index passed to validateAndUpdateCache (2L in these tests), that is also not checked today.

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.

you can add a test to verify that a second PutBucketTagging replaces the existing tag set instead of merging with it.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketTagging.html#:~:text=When%20this%20operation%20sets%20the%20tags%20for%20a%20bucket%2C%20it%20will%20overwrite

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.

That will be added in later part of the Bucket Tagging implementation when client side implementation is also done.
This is only for ozone manager side implementation for put an delete request.

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.

The test i am suggesting is OM-only though, as S3PutBucketTaggingRequest already replaces tags via setTags(), so we can cover it with a unit test here (two puts, assert old keys are gone).

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.

Okay let me see as initially I had added it. But then removed on taking reference from objectTagging OM side unit tests.

OmBucketInfo updatedBucketInfo = getBucketFromDb(volumeName, bucketName);
assertEquals(bucketInfo.getVolumeName(), updatedBucketInfo.getVolumeName());
assertEquals(bucketInfo.getBucketName(), updatedBucketInfo.getBucketName());
assertTrue(bucketInfo.getTags().isEmpty());

@sreejasahithi sreejasahithi Jun 15, 2026

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.

we should do:
assertTrue(updatedBucketInfo.getTags().isEmpty());
because current line checks the old object before update, not the result.

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.

2 participants