Skip to content

HDDS-15940. Handle unexpected OMExceptions in S3 putBucketLifecycleConfiguration#10848

Open
priyeshkaratha wants to merge 1 commit into
apache:masterfrom
priyeshkaratha:HDDS-15940
Open

HDDS-15940. Handle unexpected OMExceptions in S3 putBucketLifecycleConfiguration#10848
priyeshkaratha wants to merge 1 commit into
apache:masterfrom
priyeshkaratha:HDDS-15940

Conversation

@priyeshkaratha

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

BucketCrudHandler.putBucketLifecycleConfiguration() was catching OMException, but it only re-threw the exception for ACCESS_DENIED and INVALID_REQUEST. If any other error occurred such as QUOTA_EXCEEDED, NOT_SUPPORTED_OPERATION, or an unexpected internal OM error, then the exception was swallowed. The method then returned Response.ok().build(), causing the client to receive an incorrect HTTP 200 success response even though the operation had actually failed.

Other S3 gateway handlers don't behave this way. They simply convert every OMException into the appropriate S3 error by calling

} catch (OMException ex) {
  throw S3ErrorTable.newError(bucketName, ex);
}

This change makes BucketCrudHandler follow the same pattern. S3ErrorTable.newError(bucketName, ex) translates the OM error into the correct S3 response. For example, QUOTA_EXCEEDED becomes a 403 response, while unexpected errors become InternalError (HTTP 500). ACCESS_DENIED and INVALID_REQUEST continue to behave exactly as before, but now the original exception is also preserved as the cause, making audit logs and stack traces more useful and consistent with the improvements from HDDS-15000.

What is the link to the Apache JIRA

HDDS-15940

How was this patch tested?

Tested using added test cases and existing unit test cases.

@priyeshkaratha
priyeshkaratha marked this pull request as ready for review July 23, 2026 10:47
@priyeshkaratha
priyeshkaratha requested a review from ChenSammi July 23, 2026 10:47
@ChenSammi
ChenSammi requested a review from Copilot July 24, 2026 09:17

Copilot AI 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.

Pull request overview

Fixes S3 Gateway bucket lifecycle PUT handling so unexpected OMException result codes are no longer swallowed and incorrectly returned as HTTP 200; instead they’re consistently translated into the appropriate S3 error response via S3ErrorTable.

Changes:

  • Update BucketCrudHandler.putBucketLifecycleConfiguration() to translate all OMExceptions using S3ErrorTable.newError(bucketName, ex) rather than selectively rethrowing only a subset.
  • Add unit tests to ensure QUOTA_EXCEEDED maps to HTTP 403 and unexpected/internal OM failures map to HTTP 500 (instead of returning a false success).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketCrudHandler.java Ensures all OM failures during lifecycle config PUT are surfaced as proper S3 errors (no false HTTP 200).
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestS3LifecycleConfigurationPut.java Adds regression tests verifying non-explicitly handled OM errors are propagated as OS3Exception with correct HTTP/status codes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants