|
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
|
|
|
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics;
|
|
|
+import org.apache.hadoop.util.Time;
|
|
|
|
|
|
/**
|
|
|
* StripedBlockReconstructor reconstruct one or more missed striped block in
|
|
@@ -83,18 +84,28 @@ class StripedBlockReconstructor extends StripedReconstructor
|
|
|
final int toReconstructLen =
|
|
|
(int) Math.min(getStripedReader().getBufferSize(), remaining);
|
|
|
|
|
|
+ long start = Time.monotonicNow();
|
|
|
// step1: read from minimum source DNs required for reconstruction.
|
|
|
// The returned success list is the source DNs we do real read from
|
|
|
getStripedReader().readMinimumSources(toReconstructLen);
|
|
|
+ long readEnd = Time.monotonicNow();
|
|
|
|
|
|
// step2: decode to reconstruct targets
|
|
|
reconstructTargets(toReconstructLen);
|
|
|
+ long decodeEnd = Time.monotonicNow();
|
|
|
|
|
|
// step3: transfer data
|
|
|
if (stripedWriter.transferData2Targets() == 0) {
|
|
|
String error = "Transfer failed for all targets.";
|
|
|
throw new IOException(error);
|
|
|
}
|
|
|
+ long writeEnd = Time.monotonicNow();
|
|
|
+
|
|
|
+ // Only the succeed reconstructions are recorded.
|
|
|
+ final DataNodeMetrics metrics = getDatanode().getMetrics();
|
|
|
+ metrics.incrECReconstructionReadTime(readEnd - start);
|
|
|
+ metrics.incrECReconstructionDecodingTime(decodeEnd - readEnd);
|
|
|
+ metrics.incrECReconstructionWriteTime(writeEnd - decodeEnd);
|
|
|
|
|
|
updatePositionInBlock(toReconstructLen);
|
|
|
|