anmolanmol1234 commented on code in PR #6069:
URL: https://github.com/apache/hadoop/pull/6069#discussion_r1329629701


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:
##########
@@ -1412,6 +1421,54 @@ private void appendIfNotEmpty(StringBuilder sb, String 
regEx,
     }
   }
 
+  private void addCheckSumHeaderForRead(List<AbfsHttpHeader> requestHeaders,
+      final int bufferLength, final AbfsHttpHeader rangeHeader) {
+    if(getAbfsConfiguration().getIsChecksumEnabled() &&
+        requestHeaders.contains(rangeHeader) && bufferLength <= 4 * ONE_MB) {
+       requestHeaders.add(new AbfsHttpHeader(X_MS_RANGE_GET_CONTENT_MD5, 
TRUE));
+    }
+  }
+
+  private void addCheckSumHeaderForWrite(List<AbfsHttpHeader> requestHeaders,
+      final byte[] buffer) {
+    if(getAbfsConfiguration().getIsChecksumEnabled()) {
+      try {
+        MessageDigest md5Digest = MessageDigest.getInstance("MD5");
+        byte[] md5Bytes = md5Digest.digest(buffer);
+        String md5Hash = Base64.getEncoder().encodeToString(md5Bytes);
+        requestHeaders.add(new AbfsHttpHeader(CONTENT_MD5, md5Hash));
+      } catch (NoSuchAlgorithmException e) {
+        e.printStackTrace();
+      }
+    }
+  }
+
+  private void verifyCheckSumForRead(final byte[] buffer, final 
AbfsHttpOperation result)

Review Comment:
   javadocs



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to