HDFS-15406. Improve the speed of Datanode Block Scan. Contributed by hemanthboyina
(cherry picked from commit 123777823e
)
This commit is contained in:
parent
a8d3d4a2a8
commit
9d891f08c2
|
@ -133,6 +133,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
|
||||||
protected volatile long configuredCapacity;
|
protected volatile long configuredCapacity;
|
||||||
private final FileIoProvider fileIoProvider;
|
private final FileIoProvider fileIoProvider;
|
||||||
private final DataNodeVolumeMetrics metrics;
|
private final DataNodeVolumeMetrics metrics;
|
||||||
|
private URI baseURI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Per-volume worker pool that processes new blocks to cache.
|
* Per-volume worker pool that processes new blocks to cache.
|
||||||
|
@ -175,6 +176,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
|
||||||
File parent = currentDir.getParentFile();
|
File parent = currentDir.getParentFile();
|
||||||
cacheExecutor = initializeCacheExecutor(parent);
|
cacheExecutor = initializeCacheExecutor(parent);
|
||||||
this.metrics = DataNodeVolumeMetrics.create(conf, parent.getPath());
|
this.metrics = DataNodeVolumeMetrics.create(conf, parent.getPath());
|
||||||
|
this.baseURI = new File(currentDir.getParent()).toURI();
|
||||||
} else {
|
} else {
|
||||||
cacheExecutor = null;
|
cacheExecutor = null;
|
||||||
this.metrics = null;
|
this.metrics = null;
|
||||||
|
@ -500,7 +502,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI getBaseURI() {
|
public URI getBaseURI() {
|
||||||
return new File(currentDir.getParent()).toURI();
|
return baseURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -239,7 +239,7 @@ public class DataNodeTestUtils {
|
||||||
try (FsDatasetSpi.FsVolumeReferences volumes = dn.getFSDataset()
|
try (FsDatasetSpi.FsVolumeReferences volumes = dn.getFSDataset()
|
||||||
.getFsVolumeReferences()) {
|
.getFsVolumeReferences()) {
|
||||||
for (FsVolumeSpi vol : volumes) {
|
for (FsVolumeSpi vol : volumes) {
|
||||||
if (vol.getBaseURI().equals(basePath.toURI())) {
|
if (new File(vol.getBaseURI()).equals(basePath)) {
|
||||||
return (FsVolumeImpl) vol;
|
return (FsVolumeImpl) vol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue