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 @@ ChangedVolumes parseChangedVolumes(String newVolumes) throws IOException {
|
||||
for (Iterator<StorageLocation> 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.
|
||||
|
@ -728,7 +728,7 @@ public String[] getFailedStorageLocations() {
|
||||
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 @@ public VolumeFailureSummary getVolumeFailureSummary() {
|
||||
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;
|
||||
|
@ -215,6 +215,10 @@ public Boolean get() {
|
||||
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);
|
||||
|
@ -721,7 +721,10 @@ private String[] convertToAbsolutePaths(String[] locations) {
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user