Revert "HDFS-14353. Erasure Coding: metrics xmitsInProgress become to negative. Contributed by maobaolong."

This reverts commit 1cb2eb0df3.
This commit is contained in:
Inigo Goiri 2019-05-24 10:23:47 -07:00
parent 93d7630062
commit c9393dd17f
4 changed files with 1 additions and 19 deletions

View File

@ -170,8 +170,4 @@ public final class ErasureCodingWorker {
stripedReconstructionPool.shutdown();
stripedReadPool.shutdown();
}
public float getXmitWeight() {
return xmitWeight;
}
}

View File

@ -67,11 +67,7 @@ class StripedBlockReconstructor extends StripedReconstructor
LOG.warn("Failed to reconstruct striped block: {}", getBlockGroup(), e);
getDatanode().getMetrics().incrECFailedReconstructionTasks();
} finally {
float xmitWeight = getErasureCodingWorker().getXmitWeight();
// if the xmits is smaller than 1, the xmitsSubmitted should be set to 1
// because if it set to zero, we cannot to measure the xmits submitted
int xmitsSubmitted = Math.max((int) (getXmits() * xmitWeight), 1);
getDatanode().decrementXmitsInProgress(xmitsSubmitted);
getDatanode().decrementXmitsInProgress(getXmits());
final DataNodeMetrics metrics = getDatanode().getMetrics();
metrics.incrECReconstructionTasks();
metrics.incrECReconstructionBytesRead(getBytesRead());

View File

@ -275,8 +275,4 @@ abstract class StripedReconstructor {
DataNode getDatanode() {
return datanode;
}
public ErasureCodingWorker getErasureCodingWorker() {
return erasureCodingWorker;
}
}

View File

@ -514,8 +514,6 @@ public class TestReconstructStripedFile {
@Test(timeout = 180000)
public void testErasureCodingWorkerXmitsWeight() throws Exception {
testErasureCodingWorkerXmitsWeight(0.5f,
(int) (ecPolicy.getNumDataUnits() * 0.5f));
testErasureCodingWorkerXmitsWeight(1f, ecPolicy.getNumDataUnits());
testErasureCodingWorkerXmitsWeight(0f, 1);
testErasureCodingWorkerXmitsWeight(10f, 10 * ecPolicy.getNumDataUnits());
@ -569,10 +567,6 @@ public class TestReconstructStripedFile {
} finally {
barrier.await();
DataNodeFaultInjector.set(oldInjector);
for (final DataNode curDn : cluster.getDataNodes()) {
GenericTestUtils.waitFor(() -> curDn.getXceiverCount() > 1, 10, 60000);
assertEquals(0, curDn.getXmitsInProgress());
}
}
}
}