kerneltime commented on code in PR #3728:
URL: https://github.com/apache/ozone/pull/3728#discussion_r959816981
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -240,6 +252,46 @@ private Iterator<? extends OzoneBucket> iterateBuckets(
}
}
+ protected Map<String, String> getCustomMetadataFromHeaders(
+ MultivaluedMap<String, String> requestHeaders) {
+ Map<String, String> customMetadata = new HashMap<>();
+ if (requestHeaders == null || requestHeaders.isEmpty()) {
+ return customMetadata;
+ }
+
+ Set<String> customMetadataKeys = requestHeaders.keySet().stream()
+ .filter(k -> k.startsWith(CUSTOM_METADATA_HEADER_PREFIX))
+ .collect(Collectors.toSet());
+ long sizeInBytes = 0;
+ if (!customMetadataKeys.isEmpty()) {
+ for (String key : customMetadataKeys) {
+ String mapKey =
+ key.substring(CUSTOM_METADATA_HEADER_PREFIX.length());
+ List<String> values = requestHeaders.get(key);
+ String value = StringUtils.join(values, ",");
+ sizeInBytes += mapKey.getBytes(UTF_8).length;
+ sizeInBytes += value.getBytes(UTF_8).length;
+ if (sizeInBytes > 2 * KB) {
Review Comment:
This value in the original PR is coming from S3's limit. It would be good to
make it to `OzoneConsts.java`
--
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]