diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 209db423b8c..73dc5846a91 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -723,7 +723,7 @@ public class DataNode extends ReconfigurableBase for (Iterator newLocationItr = results.newLocations.iterator(); newLocationItr.hasNext();) { StorageLocation newLocation = newLocationItr.next(); - if (newLocation.getNormalizedUri().toString().equals( + if (newLocation.toString().equals( failedStorageLocation)) { // The failed storage is being re-added. DataNode#refreshVolumes() // will take care of re-assessing it. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index b399588285c..597ffbe8066 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -728,7 +728,7 @@ class FsDatasetImpl implements FsDatasetSpi { infos.length); for (VolumeFailureInfo info: infos) { failedStorageLocations.add( - info.getFailedStorageLocation().getNormalizedUri().toString()); + info.getFailedStorageLocation().toString()); } return failedStorageLocations.toArray( new String[failedStorageLocations.size()]); @@ -767,7 +767,7 @@ class FsDatasetImpl implements FsDatasetSpi { long estimatedCapacityLostTotal = 0; for (VolumeFailureInfo info: infos) { failedStorageLocations.add( - info.getFailedStorageLocation().getNormalizedUri().toString()); + info.getFailedStorageLocation().toString()); long failureDate = info.getFailureDate(); if (failureDate > lastVolumeFailureDate) { lastVolumeFailureDate = failureDate; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailure.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailure.java index e15baacac84..6b5faee9849 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailure.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailure.java @@ -215,6 +215,10 @@ public class TestDataNodeVolumeFailure { BlockManagerTestUtil.checkHeartbeat(bm); // NN now should have latest volume failure assertEquals(1, cluster.getNamesystem().getVolumeFailuresTotal()); + // assert failedStorageLocations + assertTrue(dn.getFSDataset().getVolumeFailureSummary() + .getFailedStorageLocations()[0] + .contains("[DISK]")); // verify number of blocks and files... verify(filename, filesize); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailureReporting.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailureReporting.java index 326c54c8f36..6011d6eeef1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailureReporting.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailureReporting.java @@ -721,7 +721,10 @@ public class TestDataNodeVolumeFailureReporting { String[] absolutePaths = new String[locations.length]; for (int count = 0; count < locations.length; count++) { 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(); } catch (URISyntaxException e) { //if the provided location is not an URI,