HDDS-16650. Reuse bucket metadata in S3 lifecycle PUT and DELETE - #11372
Conversation
…teBucketLifecycle
…ucketLifecycleConfiguration
| } | ||
|
|
||
| private void verifyBucketOwner(S3RequestContext context, String bucketName) throws OS3Exception { | ||
| private OzoneBucket verifyBucketOwner(S3RequestContext context, String bucketName) throws OS3Exception { |
There was a problem hiding this comment.
Could we also reuse the verified bucket in the PUT and GET lifecycle paths to avoid the second getBucket() call?
There was a problem hiding this comment.
@Russole Thanks for mention that! The PUT change is already prepared under HDDS-16649. GET was addressed in #11355, which is merged and calls ClientProtocol directly without the extra bucket lookup.
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks, that makes sense. I'll combine the PUT and DELETE changes here and use the request-context approach you suggested in #11374.
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @rich7420 for updating the patch.
| bucketName = name; | ||
| } else { | ||
| Preconditions.assertTrue(bucketName.equals(name), "Multiple buckets in one request are not supported"); |
There was a problem hiding this comment.
minor optimization: bucketName is not needed, since bucket knows its name
| bucketName = name; | |
| } else { | |
| Preconditions.assertTrue(bucketName.equals(name), "Multiple buckets in one request are not supported"); | |
| } else { | |
| Preconditions.assertEquals(bucket.getName(), name, "Multiple buckets in one request are not supported"); |
| private final EndpointBase endpoint; | ||
| private S3GAction action; | ||
| private OzoneVolume volume; | ||
| private String bucketName; |
There was a problem hiding this comment.
| private String bucketName; |
|
@adoroszlai and @Russole thanks for the review! |
|
Thanks @rich7420 for working on this, @adoroszlai for the review. However, This change does not reduce the number of RPCs. The original implementation already caches OzoneBucket, so there wouldn't be a second InfoBucket RPC. Please verify via distributed tracing after the modification to see if it behaves as expected. |
@chungen0126 Thanks for checking. Can you please point to the place where |
|
Thanks @chungen0126. I verified this with real S3 Gateway → OM RPCs in a MiniOzoneCluster, using paired client/server traces. For both lifecycle PUT and DELETE, |
|
I have also verified with compose cluster using |
You are right, I missed that case. Thanks for the detailed verification and providing the traces! |
|
Thanks for checking! |
|
BTW, it may be easier to check in OM audit log than distributed tracing. |
My bad. I thought it was called from |
What changes were proposed in this pull request?
Reuse bucket metadata in
S3RequestContextfor PUT and DELETE lifecycle configuration requests. Owner verification and the subsequent operation share the sameOzoneBucket, avoiding a secondInfoBucketRPC when expected-owner verification succeeds. This preserves the existing bucket READ requirement, owner validation, bucket layout handling, and error mapping. GET continues to callClientProtocoldirectly.This combines the PUT change from #11374 with the DELETE change, as suggested in review.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16650
https://issues.apache.org/jira/browse/HDDS-16649
How was this patch tested?