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

(cherry picked from commit 123777823e)
This commit is contained in:
S O'Donnell 2020-06-18 12:26:22 +01:00
parent a8d3d4a2a8
commit 9d891f08c2
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.
@ -175,6 +176,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;
@ -500,7 +502,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
@Override
public URI getBaseURI() {
return new File(currentDir.getParent()).toURI();
return baseURI;
}
@Override

View File

@ -239,7 +239,7 @@ public class DataNodeTestUtils {
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;
}
}