You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by sz...@apache.org on 2021/09/15 09:22:08 UTC

[ozone] branch revert-2640-fix-checksum-2 created (now f385309)

This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a change to branch revert-2640-fix-checksum-2
in repository https://gitbox.apache.org/repos/asf/ozone.git.


      at f385309  Revert "HDDS-5742. [Ozone-Streaming] Avoid unnecessary Bytebuffer conversions (#2640)"

This branch includes the following new commits:

     new f385309  Revert "HDDS-5742. [Ozone-Streaming] Avoid unnecessary Bytebuffer conversions (#2640)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org


[ozone] 01/01: Revert "HDDS-5742. [Ozone-Streaming] Avoid unnecessary Bytebuffer conversions (#2640)"

Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch revert-2640-fix-checksum-2
in repository https://gitbox.apache.org/repos/asf/ozone.git

commit f3853095f07b353b0d915a90288c442f3beba53b
Author: Tsz-Wo Nicholas Sze <sz...@cloudera.com>
AuthorDate: Wed Sep 15 17:21:55 2021 +0800

    Revert "HDDS-5742. [Ozone-Streaming] Avoid unnecessary Bytebuffer conversions (#2640)"
    
    This reverts commit fe15324d4c7c445a5139d39e92a67f3c11c67a0c.
---
 .../apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java    | 3 ++-
 .../src/main/java/org/apache/hadoop/ozone/common/Checksum.java   | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java
index c69af90..d0419fa 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java
@@ -485,7 +485,8 @@ public class BlockDataStreamOutput implements ByteBufferStreamOutput {
       throws IOException {
     final int effectiveChunkSize = buf.remaining();
     final long offset = chunkOffset.getAndAdd(effectiveChunkSize);
-    ChecksumData checksumData = checksum.computeChecksum(buf);
+    ChecksumData checksumData =
+        checksum.computeChecksum(buf.asReadOnlyBuffer());
     ChunkInfo chunkInfo = ChunkInfo.newBuilder()
         .setChunkName(blockID.get().getLocalID() + "_chunk_" + ++chunkIndex)
         .setOffset(offset)
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
index 67e5d47..76f84c4 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
@@ -139,10 +139,6 @@ public class Checksum {
    */
   public ChecksumData computeChecksum(ByteBuffer data)
       throws OzoneChecksumException {
-    if (checksumType == ChecksumType.NONE) {
-      // Since type is set to NONE, we do not need to compute the checksums
-      return new ChecksumData(checksumType, bytesPerChecksum);
-    }
     if (!data.isReadOnly()) {
       data = data.asReadOnlyBuffer();
     }
@@ -158,6 +154,11 @@ public class Checksum {
 
   public ChecksumData computeChecksum(ChunkBuffer data)
       throws OzoneChecksumException {
+    if (checksumType == ChecksumType.NONE) {
+      // Since type is set to NONE, we do not need to compute the checksums
+      return new ChecksumData(checksumType, bytesPerChecksum);
+    }
+
     final Function<ByteBuffer, ByteString> function;
     try {
       function = Algorithm.valueOf(checksumType).newChecksumFunction();

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org