adoroszlai commented on code in PR #11374:
URL: https://github.com/apache/ozone/pull/11374#discussion_r4153044862


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketLifecycleHandler.java:
##########
@@ -128,9 +130,11 @@ private void verifyBucketOwner(S3RequestContext context, 
String bucketName) thro
 
   public Response putBucketLifecycleConfiguration(S3RequestContext context, 
String bucketName, InputStream body)
       throws IOException, OS3Exception {
-    verifyBucketOwner(context, bucketName);
+    OzoneBucket ozoneBucket = verifyBucketOwner(context, bucketName);
     S3LifecycleConfiguration s3LifecycleConfiguration;
-    OzoneBucket ozoneBucket = context.getVolume().getBucket(bucketName);
+    if (ozoneBucket == null) {
+      ozoneBucket = context.getVolume().getBucket(bucketName);
+    }

Review Comment:
   Instead of changing `verifyBucketOwner` to return the bucket and handling 
`null` case here, I would like to suggest a different approach:
   - add `OzoneBucket getBucket(String bucketName)` in `S3RequestContext`, 
storing the bucket, similar to `getVolume()`; I think each request applies to 
only one bucket, so it can reject subsequent `getBucket(differentName)` calls 
for now
   - use `context.getBucket(bucketName)` in both `verifyBucketOwner` and here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to