HDFS-16131. Show storage type for failed volumes on namenode web (#3211). Contributed by tomscut.
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
b7431c3ed5
commit
5d765497c5
|
@ -723,7 +723,7 @@ public class DataNode extends ReconfigurableBase
|
||||||
for (Iterator<StorageLocation> newLocationItr =
|
for (Iterator<StorageLocation> newLocationItr =
|
||||||
results.newLocations.iterator(); newLocationItr.hasNext();) {
|
results.newLocations.iterator(); newLocationItr.hasNext();) {
|
||||||
StorageLocation newLocation = newLocationItr.next();
|
StorageLocation newLocation = newLocationItr.next();
|
||||||
if (newLocation.getNormalizedUri().toString().equals(
|
if (newLocation.toString().equals(
|
||||||
failedStorageLocation)) {
|
failedStorageLocation)) {
|
||||||
// The failed storage is being re-added. DataNode#refreshVolumes()
|
// The failed storage is being re-added. DataNode#refreshVolumes()
|
||||||
// will take care of re-assessing it.
|
// will take care of re-assessing it.
|
||||||
|
|
|
@ -728,7 +728,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
||||||
infos.length);
|
infos.length);
|
||||||
for (VolumeFailureInfo info: infos) {
|
for (VolumeFailureInfo info: infos) {
|
||||||
failedStorageLocations.add(
|
failedStorageLocations.add(
|
||||||
info.getFailedStorageLocation().getNormalizedUri().toString());
|
info.getFailedStorageLocation().toString());
|
||||||
}
|
}
|
||||||
return failedStorageLocations.toArray(
|
return failedStorageLocations.toArray(
|
||||||
new String[failedStorageLocations.size()]);
|
new String[failedStorageLocations.size()]);
|
||||||
|
@ -767,7 +767,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
||||||
long estimatedCapacityLostTotal = 0;
|
long estimatedCapacityLostTotal = 0;
|
||||||
for (VolumeFailureInfo info: infos) {
|
for (VolumeFailureInfo info: infos) {
|
||||||
failedStorageLocations.add(
|
failedStorageLocations.add(
|
||||||
info.getFailedStorageLocation().getNormalizedUri().toString());
|
info.getFailedStorageLocation().toString());
|
||||||
long failureDate = info.getFailureDate();
|
long failureDate = info.getFailureDate();
|
||||||
if (failureDate > lastVolumeFailureDate) {
|
if (failureDate > lastVolumeFailureDate) {
|
||||||
lastVolumeFailureDate = failureDate;
|
lastVolumeFailureDate = failureDate;
|
||||||
|
|
|
@ -215,6 +215,10 @@ public class TestDataNodeVolumeFailure {
|
||||||
BlockManagerTestUtil.checkHeartbeat(bm);
|
BlockManagerTestUtil.checkHeartbeat(bm);
|
||||||
// NN now should have latest volume failure
|
// NN now should have latest volume failure
|
||||||
assertEquals(1, cluster.getNamesystem().getVolumeFailuresTotal());
|
assertEquals(1, cluster.getNamesystem().getVolumeFailuresTotal());
|
||||||
|
// assert failedStorageLocations
|
||||||
|
assertTrue(dn.getFSDataset().getVolumeFailureSummary()
|
||||||
|
.getFailedStorageLocations()[0]
|
||||||
|
.contains("[DISK]"));
|
||||||
|
|
||||||
// verify number of blocks and files...
|
// verify number of blocks and files...
|
||||||
verify(filename, filesize);
|
verify(filename, filesize);
|
||||||
|
|
|
@ -721,7 +721,10 @@ public class TestDataNodeVolumeFailureReporting {
|
||||||
String[] absolutePaths = new String[locations.length];
|
String[] absolutePaths = new String[locations.length];
|
||||||
for (int count = 0; count < locations.length; count++) {
|
for (int count = 0; count < locations.length; count++) {
|
||||||
try {
|
try {
|
||||||
absolutePaths[count] = new File(new URI(locations[count]))
|
String location = locations[count];
|
||||||
|
location = location.contains("]")
|
||||||
|
? location.substring(location.indexOf("]") + 1) : location;
|
||||||
|
absolutePaths[count] = new File(new URI(location))
|
||||||
.getAbsolutePath();
|
.getAbsolutePath();
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
//if the provided location is not an URI,
|
//if the provided location is not an URI,
|
||||||
|
|
Loading…
Reference in New Issue