ivandika3 commented on code in PR #9612:
URL: https://github.com/apache/ozone/pull/9612#discussion_r2700634883
##########
hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java:
##########
@@ -235,7 +236,6 @@ public void testPutObject() {
assertEquals("\"37b51d194a7513e45b56f6524f2d51f2\"",
getObjectResponse.eTag());
}
- @Test
Review Comment:
Wrong omission?
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -1064,8 +1075,15 @@ private Response createMultipartKey(OzoneVolume volume,
OzoneBucket ozoneBucket,
putLength = IOUtils.copyLarge(multiDigestInputStream,
ozoneOutputStream, 0, length,
new byte[getIOBufferSize(length)]);
byte[] digest =
multiDigestInputStream.getMessageDigest(OzoneConsts.MD5_HASH).digest();
- ozoneOutputStream.getMetadata()
- .put(OzoneConsts.ETAG,
DatatypeConverter.printHexBinary(digest).toLowerCase());
+ String eTag = DatatypeConverter.printHexBinary(digest).toLowerCase();
+ String clientContentMD5 =
getHeaders().getHeaderString(S3Consts.CHECKSUM_HEADER);
+ if (clientContentMD5 != null) {
+ CheckedRunnable<IOException> checkContentMD5Hook = () -> {
+ S3Utils.validateContentMD5(clientContentMD5, eTag, key);
+ };
+
ozoneOutputStream.getKeyOutputStream().setPreCommits(Collections.singletonList(checkContentMD5Hook));
+ }
+ ozoneOutputStream.getMetadata().put(OzoneConsts.ETAG, eTag);
Review Comment:
Nit: Since now MD5 hash is used for both ETag and content-md5 verification,
let's rename variable `eTag` to `md5Hash`. This also applied to other places.
Let's also change `getMessageDigestDistance` and `ETAG_PROVIDER` to
something like `getMD5DigestInstance` and `MD5_PROVIDER`.
--
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]