Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,7 @@ private void writeChunkToContainer(ByteBuffer buf)
throws IOException {
final int effectiveChunkSize = buf.remaining();
final long offset = chunkOffset.getAndAdd(effectiveChunkSize);
ChecksumData checksumData =
checksum.computeChecksum(buf.asReadOnlyBuffer());
ChecksumData checksumData = checksum.computeChecksum(buf);
ChunkInfo chunkInfo = ChunkInfo.newBuilder()
.setChunkName(blockID.get().getLocalID() + "_chunk_" + ++chunkIndex)
.setOffset(offset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public ChecksumData computeChecksum(byte[] data)
*/
public ChecksumData computeChecksum(ByteBuffer data)
throws OzoneChecksumException {
// If type is set to NONE, we do not need to compute the checksums. We also
// need to avoid unnecessary conversions.
if (checksumType == ChecksumType.NONE) {
return new ChecksumData(checksumType, bytesPerChecksum);
}
if (!data.isReadOnly()) {
data = data.asReadOnlyBuffer();
}
Expand Down