HDFS-16593. Correct the BlocksRemoved metric on DataNode side (#4353). Contributed by ZanderXu.
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
7bf95d7949
commit
ac42519ade
|
@ -741,7 +741,6 @@ class BPOfferService {
|
|||
// Exceptions caught here are not expected to be disk-related.
|
||||
throw e;
|
||||
}
|
||||
dn.metrics.incrBlocksRemoved(toDelete.length);
|
||||
break;
|
||||
case DatanodeProtocol.DNA_CACHE:
|
||||
LOG.info("DatanodeCommand action: DNA_CACHE for " +
|
||||
|
|
|
@ -2350,6 +2350,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
removing = volumeMap.remove(bpid, invalidBlks[i]);
|
||||
addDeletingBlock(bpid, removing.getBlockId());
|
||||
LOG.debug("Block file {} is to be deleted", removing.getBlockURI());
|
||||
datanode.getMetrics().incrBlocksRemoved(1);
|
||||
if (removing instanceof ReplicaInPipeline) {
|
||||
((ReplicaInPipeline) removing).releaseAllBytesReserved();
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.apache.hadoop.hdfs.server.datanode.fsdataset.DataNodeVolumeMetrics;
|
|||
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
|
||||
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi.FsVolumeReferences;
|
||||
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi;
|
||||
import org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics;
|
||||
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
||||
import org.apache.hadoop.io.MultipleIOException;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
|
@ -226,6 +227,8 @@ public class TestFsDatasetImpl {
|
|||
final ShortCircuitRegistry shortCircuitRegistry =
|
||||
new ShortCircuitRegistry(conf);
|
||||
when(datanode.getShortCircuitRegistry()).thenReturn(shortCircuitRegistry);
|
||||
DataNodeMetrics dataNodeMetrics = DataNodeMetrics.create(conf, "mockName");
|
||||
when(datanode.getMetrics()).thenReturn(dataNodeMetrics);
|
||||
|
||||
createStorageDirs(storage, conf, NUM_INIT_VOLUMES);
|
||||
dataset = new FsDatasetImpl(datanode, storage, conf);
|
||||
|
|
Loading…
Reference in New Issue