Skip to content

Commit

Permalink
HDDS-11499. Remove redundant code from ECReconstructionCoordinator. (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 authored Sep 30, 2024
1 parent adb2821 commit 1e6e4b3
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -572,24 +571,14 @@ 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);
}
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;
}
Expand Down

0 comments on commit 1e6e4b3

Please sign in to comment.