This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 20c45aee39 HDDS-7161. Make Checksum.int2ByteString() zero-copy. (#3709)
20c45aee39 is described below
commit 20c45aee396f2e104367bfb3370d85938febb766
Author: Wei-Chiu Chuang <[email protected]>
AuthorDate: Thu Aug 25 04:30:39 2022 +0800
HDDS-7161. Make Checksum.int2ByteString() zero-copy. (#3709)
---
.../common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 76f84c46ab..bb4b5e3ced 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
@@ -32,6 +32,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.Ints;
import org.apache.hadoop.ozone.common.utils.BufferUtils;
import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
+import org.apache.ratis.thirdparty.com.google.protobuf.UnsafeByteOperations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +61,7 @@ public class Checksum {
}
public static ByteString int2ByteString(int n) {
- return ByteString.copyFrom(Ints.toByteArray(n));
+ return UnsafeByteOperations.unsafeWrap(Ints.toByteArray(n));
}
private static Function<ByteBuffer, ByteString>
newChecksumByteBufferFunction(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]