ChenSammi commented on code in PR #10197:
URL: https://github.com/apache/ozone/pull/10197#discussion_r3387320838
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -889,52 +890,55 @@ private Response createMultipartKey(OzoneVolume volume,
OzoneBucket ozoneBucket,
+ rangeHeader.getStartOffset() + " actual: " + skipped);
}
}
- try (OzoneOutputStream ozoneOutputStream = getClientProtocol()
- .createMultipartKey(volume.getName(), bucketName, key, length,
- partNumber, uploadID)) {
- metadataLatencyNs =
- getMetrics().updateCopyKeyMetadataStats(startNanos);
- copyLength = IOUtils.copyLarge(sourceObject, ozoneOutputStream, 0,
length,
- new byte[getIOBufferSize(length)]);
- ozoneOutputStream.getMetadata()
- .putAll(sourceKeyDetails.getMetadata());
- String raw = ozoneOutputStream.getMetadata().get(OzoneConsts.ETAG);
- if (raw != null) {
- ozoneOutputStream.getMetadata().put(OzoneConsts.ETAG,
stripQuotes(raw));
+ final long finalLength = length;
+ final long bytesToCopy = length;
+ omMultipartCommitUploadPartInfo = runWithS3ActionString("PutObject",
() -> {
+ final OzoneOutputStream ozoneOutputStream =
getClientProtocol().createMultipartKey(
+ volume.getName(), bucketName, key, finalLength, partNumber,
uploadID);
+ try (OzoneOutputStream ignored = ozoneOutputStream) {
+ metadataLatencyHolder[0] =
getMetrics().updateCopyKeyMetadataStats(startNanos);
+ copyLengthHolder[0] = IOUtils.copyLarge(
+ sourceObject, ozoneOutputStream, 0, bytesToCopy, new
byte[getIOBufferSize(bytesToCopy)]);
+ ozoneOutputStream.getMetadata()
+ .putAll(sourceKeyDetails.getMetadata());
+ final String raw =
ozoneOutputStream.getMetadata().get(OzoneConsts.ETAG);
+ if (raw != null) {
+ ozoneOutputStream.getMetadata().put(OzoneConsts.ETAG,
stripQuotes(raw));
+ }
}
- outputStream = ozoneOutputStream;
- }
- getMetrics().incCopyObjectSuccessLength(copyLength);
- perf.appendSizeBytes(copyLength);
+ return ozoneOutputStream.getCommitUploadPartInfo();
+ });
+ metadataLatencyNs = metadataLatencyHolder[0];
+ getMetrics().incCopyObjectSuccessLength(copyLengthHolder[0]);
+ perf.appendSizeBytes(copyLengthHolder[0]);
}
} else {
- long putLength;
- try (OzoneOutputStream ozoneOutputStream = getClientProtocol()
+ final long putLength;
+ final OzoneOutputStream ozoneOutputStream = getClientProtocol()
Review Comment:
runWithS3ActionString("PutObject" is missed here. ozoneOutputStream is not
closed
--
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]