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


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:
##########
@@ -1427,28 +1428,45 @@ private void appendIfNotEmpty(StringBuilder sb, String 
regEx,
     }
   }
 
+  /**
+   * Add MD5 hash as checksum request header to the append request
+   * @param requestHeaders
+   * @param reqParams
+   * @param buffer
+   */
   private void addCheckSumHeaderForWrite(List<AbfsHttpHeader> requestHeaders,
-      final byte[] buffer) {
+      final AppendRequestParameters reqParams, final byte[] buffer) {
     try {
       MessageDigest md5Digest = MessageDigest.getInstance("MD5");
-      byte[] md5Bytes = md5Digest.digest(buffer);
+      byte[] md5Bytes = md5Digest.digest(
+          Arrays.copyOfRange(buffer, reqParams.getoffset(), 
reqParams.getLength()));
       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)
+  /**
+   * T verify the checksum information received from server for the data read

Review Comment:
   nit: To



-- 
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