HDFS-16089. Add metric EcReconstructionValidateTimeMillis for StripedBlockReconstructor (#3146)

(cherry picked from commit 95454d821c)
This commit is contained in:
litao 2021-06-29 18:15:12 +08:00 committed by Wei-Chiu Chuang
parent 8538881710
commit 4ee7bd345f
No known key found for this signature in database
GPG Key ID: B362E1C021854B9D
3 changed files with 14 additions and 1 deletions

View File

@ -135,9 +135,16 @@ class StripedBlockReconstructor extends StripedReconstructor
resetBuffers(inputs); resetBuffers(inputs);
DataNodeFaultInjector.get().badDecoding(outputs); DataNodeFaultInjector.get().badDecoding(outputs);
long start = Time.monotonicNow();
try { try {
getValidator().validate(inputs, erasedIndices, outputs); getValidator().validate(inputs, erasedIndices, outputs);
long validateEnd = Time.monotonicNow();
getDatanode().getMetrics().incrECReconstructionValidateTime(
validateEnd - start);
} catch (InvalidDecodingException e) { } catch (InvalidDecodingException e) {
long validateFailedEnd = Time.monotonicNow();
getDatanode().getMetrics().incrECReconstructionValidateTime(
validateFailedEnd - start);
getDatanode().getMetrics().incrECInvalidReconstructionTasks(); getDatanode().getMetrics().incrECInvalidReconstructionTasks();
throw e; throw e;
} }

View File

@ -168,6 +168,8 @@ public class DataNodeMetrics {
private MutableCounterLong ecReconstructionDecodingTimeMillis; private MutableCounterLong ecReconstructionDecodingTimeMillis;
@Metric("Milliseconds spent on write by erasure coding worker") @Metric("Milliseconds spent on write by erasure coding worker")
private MutableCounterLong ecReconstructionWriteTimeMillis; private MutableCounterLong ecReconstructionWriteTimeMillis;
@Metric("Milliseconds spent on validating by erasure coding worker")
private MutableCounterLong ecReconstructionValidateTimeMillis;
@Metric("Sum of all BPServiceActors command queue length") @Metric("Sum of all BPServiceActors command queue length")
private MutableCounterLong sumOfActorCommandQueueLength; private MutableCounterLong sumOfActorCommandQueueLength;
@Metric("Num of processed commands of all BPServiceActors") @Metric("Num of processed commands of all BPServiceActors")
@ -605,6 +607,10 @@ public class DataNodeMetrics {
ecReconstructionDecodingTimeMillis.incr(millis); ecReconstructionDecodingTimeMillis.incr(millis);
} }
public void incrECReconstructionValidateTime(long millis) {
ecReconstructionValidateTimeMillis.incr(millis);
}
public DataNodeUsageReport getDNUsageReport(long timeSinceLastReport) { public DataNodeUsageReport getDNUsageReport(long timeSinceLastReport) {
return dnUsageReportUtil.getUsageReport(bytesWritten.value(), bytesRead return dnUsageReportUtil.getUsageReport(bytesWritten.value(), bytesRead
.value(), totalWriteTime.value(), totalReadTime.value(), .value(), totalWriteTime.value(), totalReadTime.value(),

View File

@ -364,7 +364,7 @@ public class TestReconstructStripedBlocks {
} }
} }
@Test(timeout=120000) // 1 min timeout @Test(timeout=120000) // 2 min timeout
public void testReconstructionWork() throws Exception { public void testReconstructionWork() throws Exception {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
conf.setLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 0); conf.setLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 0);