HDFS-15406. Improve the speed of Datanode Block Scan. Contributed by hemanthboyina

This commit is contained in:
S O'Donnell 2020-06-18 12:26:22 +01:00
parent 9cbd76cc77
commit 123777823e
2 changed files with 4 additions and 2 deletions

View File

@ -133,6 +133,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
protected volatile long configuredCapacity;
private final FileIoProvider fileIoProvider;
private final DataNodeVolumeMetrics metrics;
private URI baseURI;
/**
* Per-volume worker pool that processes new blocks to cache.
@ -182,6 +183,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
File parent = currentDir.getParentFile();
cacheExecutor = initializeCacheExecutor(parent);
this.metrics = DataNodeVolumeMetrics.create(conf, parent.getPath());
this.baseURI = new File(currentDir.getParent()).toURI();
} else {
cacheExecutor = null;
this.metrics = null;
@ -506,7 +508,7 @@ BlockPoolSlice getBlockPoolSlice(String bpid) throws IOException {
@Override
public URI getBaseURI() {
return new File(currentDir.getParent()).toURI();
return baseURI;
}
@Override

View File

@ -239,7 +239,7 @@ public static FsVolumeImpl getVolume(DataNode dn, File basePath) throws
try (FsDatasetSpi.FsVolumeReferences volumes = dn.getFSDataset()
.getFsVolumeReferences()) {
for (FsVolumeSpi vol : volumes) {
if (vol.getBaseURI().equals(basePath.toURI())) {
if (new File(vol.getBaseURI()).equals(basePath)) {
return (FsVolumeImpl) vol;
}
}