diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ec/reconstruction/ECReconstructionCoordinator.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ec/reconstruction/ECReconstructionCoordinator.java index 8fadd19b67d..4273ed2b716 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ec/reconstruction/ECReconstructionCoordinator.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ec/reconstruction/ECReconstructionCoordinator.java @@ -42,7 +42,6 @@ import org.apache.hadoop.hdds.utils.IOUtils; import org.apache.hadoop.io.ByteBufferPool; import org.apache.hadoop.io.ElasticByteBufferPool; -import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.client.io.BlockInputStreamFactory; import org.apache.hadoop.ozone.client.io.BlockInputStreamFactoryImpl; import org.apache.hadoop.ozone.client.io.ECBlockInputStreamProxy; @@ -370,7 +369,7 @@ private void logBlockGroupDetails(BlockLocationInfo blockLocationInfo, .append(" block length: ") .append(data.getSize()) .append(" block group length: ") - .append(getBlockDataLength(data)) + .append(data.getBlockGroupLength()) .append(" chunk list: \n"); int cnt = 0; for (ContainerProtos.ChunkInfo chunkInfo : data.getChunks()) { @@ -572,7 +571,7 @@ private long calcEffectiveBlockGroupLen(BlockData[] blockGroup, continue; } - long putBlockLen = getBlockDataLength(blockGroup[i]); + long putBlockLen = blockGroup[i].getBlockGroupLength(); // Use safe length is the minimum of the lengths recorded across the // stripe blockGroupLen = Math.min(putBlockLen, blockGroupLen); @@ -580,16 +579,6 @@ private long calcEffectiveBlockGroupLen(BlockData[] blockGroup, return blockGroupLen == Long.MAX_VALUE ? 0 : blockGroupLen; } - private long getBlockDataLength(BlockData blockData) { - String lenStr = blockData.getMetadata() - .get(OzoneConsts.BLOCK_GROUP_LEN_KEY_IN_PUT_BLOCK); - // If we don't have the length, then it indicates a problem with the stripe. - // All replica should carry the length, so if it is not there, we return 0, - // which will cause us to set the length of the block to zero and not - // attempt to reconstruct it. - return (lenStr == null) ? 0 : Long.parseLong(lenStr); - } - public ECReconstructionMetrics getECReconstructionMetrics() { return this.metrics; }