NickJavaDev88 opened a new pull request, #10888:
URL: https://github.com/apache/ozone/pull/10888

   ## What changes were proposed in this pull request?
   
   `DeleteBucketLifecycle` in the S3 Gateway did not comply with the AWS S3 API 
contract: per the AWS spec, this operation must be idempotent and return `204 
No Content` even when no lifecycle configuration exists on the bucket. Instead, 
`BucketCrudHandler#deleteLifecycleConfiguration` caught the `OMException` with 
result code `LIFECYCLE_CONFIGURATION_NOT_FOUND` and re-threw it as a 
`NO_SUCH_LIFECYCLE_CONFIGURATION` S3 error, returning `404 Not Found` to the 
client. This also caused the `s3-tests` `lifecycle_delete` compatibility test 
to fail.
   
   The fix inverts the condition in the `catch` block: the handler now only 
re-throws when the `OMException` result code is **not** 
`LIFECYCLE_CONFIGURATION_NOT_FOUND`. When the lifecycle configuration is 
missing, the method returns normally, so the caller 
(`deleteBucketLifecycleConfiguration`) proceeds to its existing 
`Response.noContent().build()` and the client gets `204`, matching the behavior 
of normal key deletion elsewhere in the S3 Gateway (see 
`ObjectEndpoint#delete`), which already treats a missing target as a no-op for 
the same reason.
   
   
`TestS3LifecycleConfigurationDelete#testDeleteNonExistentLifecycleConfiguration`
 was updated to assert the new contract: deleting a lifecycle configuration on 
a bucket that never had one now expects `204`, instead of expecting an 
`OS3Exception` with `404`.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16005
   
   ## How was this patch tested?
   
   * Added/updated unit test: `TestS3LifecycleConfigurationDelete` (both 
`testDeleteNonExistentLifecycleConfiguration` and 
`testDeleteLifecycleConfiguration`) passes.
   * `checkstyle.sh` run locally with 0 violations.
   


-- 
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