Skip to content

HDDS-15511. Implement Ozone client API's for bucket tagging#10533

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

HDDS-15511. Implement Ozone client API's for bucket tagging#10533
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15511

Conversation

@Gargi-jais11

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  1. Expose getBucketTagging / putBucketTagging / deleteBucketTagging on Ozone client with version gating.
  • ClientProtocol.java / OzoneManagerProtocol.java — interface methods
  • OzoneManagerProtocolClientSideTranslatorPB.java — PB translation
  • RpcClient.java — getBucketTagging, putBucketTagging, deleteBucketTagging with S3_BUCKET_TAGGING_API version gate
  • OzoneBucket.java — public client API
  • OzoneRpcClientTests.java integration tests:
    - testPutBucketTagging (overwrite semantics)
    - testGetBucketTagging
    - testDeleteBucketTagging
    - Parameterized across bucket layouts (LEGACY, FILE_SYSTEM_OPTIMIZED, OBJECT_STORE)
  1. nit:
    If we could introduce a base class for bucket tagging, or make delete request to derive put request.
    the duplication between ‎S3PutBucketTaggingRequest and ‎S3DeleteBucketTaggingRequest
    Discussion link

What is the link to the Apache JIRA

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

How was this patch tested?

Added unit tests for 'OzoneRpcClientTests`.

@Gargi-jais11 Gargi-jais11 marked this pull request as ready for review June 17, 2026 13:05

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

@Gargi-jais11 Thanks for the patch. Overall LGTM. Left some comments.

/**
* S3-style bucketTags on the bucket.
*/
private final Map<String, String> bucketTags = new HashMap<>();

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.

Do we need this in-memory bucket tags? Similar to object tagging, I think we should use simply use getObjectTagging when we want to see the latest updated bucket tags (there might be other concurrent bucket concurrent bucket tags modification).

However, I also understand that OzoneBucket also contains in-memory stats that might be changed in OM DB.

@ivandika3 ivandika3 Jun 22, 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.

This is related to #10553, we can probably discuss it there.

Comment on lines +70 to +71
ResolvedBucket resolvedBucket = ozoneManager.resolveBucketLink(
Pair.of(volumeName, bucketName), this);

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.

Not related to this patch (can be addressed in future patch), I'm just thinking that for preExecute, we can attach the the bucket object ID in preExecute and let the validateAndUpdateCache check that the bucket object ID in the preExecute is the same as the bucket object ID in validateAndUpdateCache, if it doesn't we let the validateAndUpdateCache try to query the bucket link again. We might also need to do the same for permission check. This way if there is a bucket deletion and creation in the same between the preExecute and validateAndUpdateCache, we will still check the latest bucket changes.

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.

After reviewing @errose28 previous comments at jira, I’m not sure if implementing this is necessary.

However, I was thinking that we could potentially adopt this logic for conditional requests, primarily for two reasons:

  • Fail-fast: It reduces the number of unnecessary requests that need to be sent to Ratis
  • Minimal Overhead: Although incorporating this logic adds an extra validation step, it’s just a string comparison which is extremely fast. Furthermore, once the metadata is fetched from RocksDB during the initial read, it becomes warm data in the cache, ensuring that subsequent reads will result in cache hits and execute very quickly.

@ivandika3 What are your thoughts on this?

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 @chungen0126 for checking this.

I think the scenario mentioned by @errose28 is a case when the object is not overwritten, which I think is not a major problem. However, a problem is if the object is overwritten (with different object ID) and there were some pending transactions that was acting on the previous overwritten object. I think this is unlikely since it requires openKey and commitKey almost instantaneously, but it is possible.

However, I was thinking that we could potentially adopt this logic for conditional requests, primarily for two reasons:

Yes, I think @peterxcli has propose similar logic as well. For now I think we can use this for conditional requests.

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.

Thank you @ivandika3 for clarifying the scenario. I will need to think about this more deeply later on.

Yes, I think @peterxcli has propose similar logic as well. For now I think we can use this for conditional requests.

Thanks for reminding me. I just saw it.

@ivandika3 ivandika3 Jun 22, 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.

Yes, I was subconsciously reminded of this, let's review #10183 in that case.

@peterxcli peterxcli Jun 23, 2026

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.

This discussion reminds me of this: https://authzed.com/blog/new-enemies

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.

4 participants