adoroszlai commented on code in PR #6490:
URL: https://github.com/apache/ozone/pull/6490#discussion_r1557235189
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -1208,12 +1210,30 @@ private CopyObjectResponse copyObject(OzoneVolume
volume,
}
}
long sourceKeyLen = sourceKeyDetails.getDataSize();
+
+ // Custom metadata in copyObject with metadata directive
+ Map<String, String> customMetadata;
+ String metadataCopyDirective =
headers.getHeaderString(CUSTOM_METADATA_COPY_DIRECTIVE_HEADER);
+ if (StringUtils.isEmpty(metadataCopyDirective) ||
metadataCopyDirective.equals(CopyDirective.COPY.name())) {
+ // The custom metadata will be copied from the source key
+ customMetadata = sourceKeyDetails.getMetadata();
+ } else if (metadataCopyDirective.equals(CopyDirective.REPLACE.name())) {
+ // Replace the metadata with the metadata form the request headers
+ customMetadata =
getCustomMetadataFromHeaders(headers.getRequestHeaders());
+ } else {
+ OS3Exception ex = newError(INVALID_ARGUMENT, metadataCopyDirective);
+ ex.setErrorMessage("An error occurred (InvalidArgument) " +
+ "when calling the CopyObjet operation: " +
Review Comment:
```suggestion
"when calling the CopyObject operation: " +
```
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -1208,12 +1210,30 @@ private CopyObjectResponse copyObject(OzoneVolume
volume,
}
}
long sourceKeyLen = sourceKeyDetails.getDataSize();
+
+ // Custom metadata in copyObject with metadata directive
+ Map<String, String> customMetadata;
+ String metadataCopyDirective =
headers.getHeaderString(CUSTOM_METADATA_COPY_DIRECTIVE_HEADER);
+ if (StringUtils.isEmpty(metadataCopyDirective) ||
metadataCopyDirective.equals(CopyDirective.COPY.name())) {
+ // The custom metadata will be copied from the source key
+ customMetadata = sourceKeyDetails.getMetadata();
+ } else if (metadataCopyDirective.equals(CopyDirective.REPLACE.name())) {
+ // Replace the metadata with the metadata form the request headers
+ customMetadata =
getCustomMetadataFromHeaders(headers.getRequestHeaders());
+ } else {
+ OS3Exception ex = newError(INVALID_ARGUMENT, metadataCopyDirective);
+ ex.setErrorMessage("An error occurred (InvalidArgument) " +
+ "when calling the CopyObjet operation: " +
+ "The metadata directive specified is invalid. The valid values are
COPY or REPLACE.");
Review Comment:
```suggestion
"The metadata directive specified is invalid. Valid values are
COPY or REPLACE.");
```
--
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]