HDFS-10935. TestFileChecksum fails in some cases. Contributed by Sammi Chen

This commit is contained in:
Kai Zheng 2016-10-26 09:40:31 +06:00
parent 9dce9011ad
commit 287effff93

View File

@ -132,6 +132,7 @@ private long checksumWithTargetOutput(byte[] outputData, int toReconstructLen,
// case-2) length of data bytes which is less than bytesPerCRC // case-2) length of data bytes which is less than bytesPerCRC
if (partialLength > 0) { if (partialLength > 0) {
byte[] partialCrc = new byte[getChecksum().getChecksumSize()]; byte[] partialCrc = new byte[getChecksum().getChecksumSize()];
getChecksum().reset();
getChecksum().update(outputData, dataOffset, partialLength); getChecksum().update(outputData, dataOffset, partialLength);
getChecksum().writeValue(partialCrc, 0, true); getChecksum().writeValue(partialCrc, 0, true);
digester.update(partialCrc); digester.update(partialCrc);