ivandika3 commented on code in PR #10203:
URL: https://github.com/apache/ozone/pull/10203#discussion_r3460044149
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -995,29 +1023,36 @@ void copy(OzoneVolume volume, DigestInputStream src,
long srcKeyLen,
S3ConditionalRequest.WriteConditions writeConditions)
throws IOException {
long copyLength;
-
+ final String eTag;
+ final long modificationTime;
if (isDatastreamEnabled() && !(replication != null &&
replication.getReplicationType() == EC) &&
srcKeyLen > getDatastreamMinLength()) {
perf.appendStreamMode();
- copyLength = ObjectEndpointStreaming
+ final CopyResult copyResult = ObjectEndpointStreaming
.copyKeyWithStream(volume.getBucket(destBucket), destKey, srcKeyLen,
getChunkSize(), replication, metadata, src, perf, startNanos,
tags,
writeConditions);
+ eTag = copyResult.getETag();
+ copyLength = copyResult.getSize();
+ modificationTime = copyResult.getModificationTime();
} else {
- try (OzoneOutputStream dest = openKeyForPut(
+ final OzoneOutputStream destStream = openKeyForPut(
volume.getName(), destBucket, destKey, srcKeyLen,
- replication, metadata, tags, writeConditions)) {
+ replication, metadata, tags, writeConditions);
+ try (OzoneOutputStream dest = destStream) {
long metadataLatencyNs =
getMetrics().updateCopyKeyMetadataStats(startNanos);
perf.appendMetaLatencyNanos(metadataLatencyNs);
copyLength = IOUtils.copyLarge(src, dest, 0, srcKeyLen, new
byte[getIOBufferSize(srcKeyLen)]);
- final String md5Hash =
DatatypeConverter.printHexBinary(src.getMessageDigest().digest()).toLowerCase();
- dest.getMetadata().put(OzoneConsts.ETAG, md5Hash);
+ eTag =
DatatypeConverter.printHexBinary(src.getMessageDigest().digest()).toLowerCase();
+ destStream.getMetadata().put(OzoneConsts.ETAG, eTag);
Review Comment:
Nit: Unnecessary change, previously this is intentional since this means
that the ETag is a md5Hash for this case (it might not be for other case).
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/BlockDataStreamOutputEntryPool.java:
##########
@@ -254,8 +255,9 @@ void commitKey(long offset) throws IOException {
if (keyArgs.getIsMultipartKey()) {
commitUploadPartInfo =
omClient.commitMultipartUploadPart(buildKeyArgs(), openID);
+ modificationTime = commitUploadPartInfo.getModificationTime();
} else {
- omClient.commitKey(buildKeyArgs(), openID);
+ modificationTime = omClient.commitKey(buildKeyArgs(), openID);
Review Comment:
If it never reach here (e.g. uploading process failed), then would
`modificationTime` equals zero? In that case, would it be better to use `Long`
and check for nullity?
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -985,8 +1002,19 @@ private Response createMultipartKey(OzoneVolume volume,
OzoneBucket ozoneBucket,
}
}
+ private static OMException findOMException(Throwable t) {
+ Throwable currentException = t;
+ while (currentException != null) {
+ if (currentException instanceof OMException) {
+ return (OMException) currentException;
+ }
+ currentException = currentException.getCause();
+ }
+ return null;
Review Comment:
Nit: Use the HddsClientUtils.containsException
--
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]