Repository navigation
Conversation
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @rich7420 for the patch.
Sorry for being a bit late to ask this question about the changes for HDDS-16602: do we really need to essentially duplicate the surface of ClientProtocol interface with <verb>S3<object> methods? Instead, can we create a new ClientProtocol implementation that delegates to another ClientProtocol instance (the RpcClient in prod), but simply ignores volumeName parameter and passes one of two values based on omVersion? Then S3 endpoints can keep using the existing interface, passing any constant value (e.g. OZONE_S3_VOLUME_NAME_DEFAULT for simplicity).
Sorry if this was already considered and not chosen earlier, did not follow all discussions.
| verifyBucketName(bucketName); | ||
| Objects.requireNonNull(keyName, "keyName == null"); | ||
| OmKeyArgs keyArgs = new OmKeyArgs.Builder() | ||
| .setVolumeName(OzoneConfigKeys.OZONE_S3_VOLUME_NAME_DEFAULT) | ||
| .setBucketName(bucketName) | ||
| .setKeyName(keyName) | ||
| .setExpectedETag(expectedETag) | ||
| .setAssumeS3Context(true) | ||
| .build(); | ||
| ozoneManagerClient.deleteKey(keyArgs); |
There was a problem hiding this comment.
Even if we continue expanding the interface with S3-specific methods, can we avoid duplicating the implementation? Can simply decide on the volume name to use based on OM version, and call existing deleteKey?
There was a problem hiding this comment.
Thanks, I’ll try the delegating approach with deleteKey first, reusing the existing delete implementation. I’ll check how to carry assumeS3Context through that path while preserving the older-OM fallback.
There was a problem hiding this comment.
@adoroszlai, does this ClientProtocol delegation match the approach you had in mind?
| import org.apache.hadoop.ozone.client.protocol.ClientProtocol; | ||
|
|
||
| /** Adapts client operations to the S3 volume context. */ | ||
| final class S3ClientProtocol implements InvocationHandler { |
There was a problem hiding this comment.
Thanks @rich7420 for experimenting with this. I would avoid reflection, simply let S3ClientProtocol implements ClientProtocol and generate the delegation.
There was a problem hiding this comment.
Thanks, replaced reflection with explicit delegation, including all default methods
Thanks @adoroszlai, this is a great idea! However, introducing this change ( Additionally, passing a constant value (e.g. |
Thanks @chungen0126, I totally agree. Sorry I had to pick a specific PR to mention this.
Thanks @rich7420, I think that's much better. Let's continue in a separate PR. |
What changes were proposed in this pull request?
Use the S3 client delegation introduced in #11757 to let OM resolve the volume during
DeleteKeyon supported versions, removing the separateGetS3VolumeContextcall for S3DeleteObjectrequests without expected-owner checks. Older OMs retain client-side resolution, and explicit volumes and conditional deletes are preserved.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16701
How was this patch tested?
cc09103f11: Fork CI and 10×10 TestS3ClientProtocol check passed.