ivandika3 commented on code in PR #10196:
URL: https://github.com/apache/ozone/pull/10196#discussion_r3195640401
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -198,12 +200,23 @@ Response handlePutRequest(ObjectRequestContext context,
String keyPath, InputStr
final long startNanos = context.getStartNanos();
String copyHeader = null;
+ FileBackedOutputStream spooledBody = null;
MultiDigestInputStream multiDigestInputStream = null;
try {
OzoneVolume volume = context.getVolume();
OzoneBucket bucket = context.getBucket();
final String lengthHeader =
getHeaders().getHeaderString(HttpHeaders.CONTENT_LENGTH);
+ final String rawAmzContentSha256Header =
getHeaders().getHeaderString(S3Consts.X_AMZ_CONTENT_SHA256);
+ final boolean hasMultiChunksUpload =
+ rawAmzContentSha256Header != null &&
hasMultiChunksPayload(rawAmzContentSha256Header);
+ boolean hasCalculatedLength = false;
long length = lengthHeader != null ? Long.parseLong(lengthHeader) : 0;
+ if (lengthHeader == null && body != null && !hasMultiChunksUpload) {
+ spooledBody = new FileBackedOutputStream(32);
+ length = IOUtils.copyLarge(body, spooledBody, new
byte[getIOBufferSize(0)]);
+ body = spooledBody.asByteSource().openStream();
+ hasCalculatedLength = true;
+ }
Review Comment:
Is this going to copy everything into a temporary file on S3G machine? In
other words, is S3G required to allocate some disk space for this length
calculation?
--
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]