chihsuan commented on code in PR #11019:
URL: https://github.com/apache/ozone/pull/11019#discussion_r3788522475


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java:
##########
@@ -380,8 +388,12 @@ public MultiDeleteResponse multiDelete(
         }
         getMetrics().updateDeleteKeySuccessStats(startNanos);
       } catch (IOException ex) {
-        LOG.error("Delete key failed: {}", ex.getMessage());
         getMetrics().updateDeleteKeyFailureStats(startNanos);
+        final OMException omEx = (OMException) 
HddsClientUtils.containsException(ex, OMException.class);

Review Comment:
   Currently, we only handle ACCESS_DENIED, and non-ACCESS_DENIED OM errors 
still return HTTP 200 with ALL/InternalError. Should we translate every 
contained OMException here so that errors like `TOKEN_EXPIRED` and 
`BUCKET_NOT_FOUND` retain their S3 response?



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java:
##########
@@ -380,8 +388,12 @@ public MultiDeleteResponse multiDelete(
         }
         getMetrics().updateDeleteKeySuccessStats(startNanos);
       } catch (IOException ex) {
-        LOG.error("Delete key failed: {}", ex.getMessage());
         getMetrics().updateDeleteKeyFailureStats(startNanos);
+        final OMException omEx = (OMException) 
HddsClientUtils.containsException(ex, OMException.class);
+        if (omEx != null && S3ErrorTable.translateResultCode(omEx) == 
S3ErrorTable.ACCESS_DENIED) {
+          throw newError(S3ErrorTable.ACCESS_DENIED, bucketName, omEx);

Review Comment:
   This throw skips the audit block below, so rejected multi-delete requests 
leave no failure audit record. I wonder if we should audit the failure before 
propagating it.



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