|
@@ -700,24 +700,25 @@ final class BlockChecksumHelper {
|
|
blockGroup, ecPolicy, blockIndices, datanodes, errIndices);
|
|
blockGroup, ecPolicy, blockIndices, datanodes, errIndices);
|
|
BlockChecksumType groupChecksumType =
|
|
BlockChecksumType groupChecksumType =
|
|
getBlockChecksumOptions().getBlockChecksumType();
|
|
getBlockChecksumOptions().getBlockChecksumType();
|
|
- final StripedBlockChecksumReconstructor checksumRecon =
|
|
|
|
|
|
+ try (StripedBlockChecksumReconstructor checksumRecon =
|
|
groupChecksumType == BlockChecksumType.COMPOSITE_CRC ?
|
|
groupChecksumType == BlockChecksumType.COMPOSITE_CRC ?
|
|
new StripedBlockChecksumCompositeCrcReconstructor(
|
|
new StripedBlockChecksumCompositeCrcReconstructor(
|
|
getDatanode().getErasureCodingWorker(), stripedReconInfo,
|
|
getDatanode().getErasureCodingWorker(), stripedReconInfo,
|
|
blockChecksumBuf, blockLength) :
|
|
blockChecksumBuf, blockLength) :
|
|
new StripedBlockChecksumMd5CrcReconstructor(
|
|
new StripedBlockChecksumMd5CrcReconstructor(
|
|
getDatanode().getErasureCodingWorker(), stripedReconInfo,
|
|
getDatanode().getErasureCodingWorker(), stripedReconInfo,
|
|
- blockChecksumBuf, blockLength);
|
|
|
|
- checksumRecon.reconstruct();
|
|
|
|
-
|
|
|
|
- DataChecksum checksum = checksumRecon.getChecksum();
|
|
|
|
- long crcPerBlock = checksum.getChecksumSize() <= 0 ? 0
|
|
|
|
- : checksumRecon.getChecksumDataLen() / checksum.getChecksumSize();
|
|
|
|
- setOrVerifyChecksumProperties(errBlkIndex,
|
|
|
|
- checksum.getBytesPerChecksum(), crcPerBlock,
|
|
|
|
- checksum.getChecksumType());
|
|
|
|
- LOG.debug("Recalculated checksum for the block index:{}, checksum={}",
|
|
|
|
- errBlkIndex, checksumRecon.getDigestObject());
|
|
|
|
|
|
+ blockChecksumBuf, blockLength)) {
|
|
|
|
+ checksumRecon.reconstruct();
|
|
|
|
+
|
|
|
|
+ DataChecksum checksum = checksumRecon.getChecksum();
|
|
|
|
+ long crcPerBlock = checksum.getChecksumSize() <= 0 ? 0
|
|
|
|
+ : checksumRecon.getChecksumDataLen() / checksum.getChecksumSize();
|
|
|
|
+ setOrVerifyChecksumProperties(errBlkIndex,
|
|
|
|
+ checksum.getBytesPerChecksum(), crcPerBlock,
|
|
|
|
+ checksum.getChecksumType());
|
|
|
|
+ LOG.debug("Recalculated checksum for the block index:{}, checksum={}",
|
|
|
|
+ errBlkIndex, checksumRecon.getDigestObject());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void setOrVerifyChecksumProperties(int blockIdx, int bpc,
|
|
private void setOrVerifyChecksumProperties(int blockIdx, int bpc,
|