HDFS-16194. Simplify the code with DatanodeID#getXferAddrWithHostname (#3354). Contributed by tomscut.
This commit is contained in:
parent
cc6b545365
commit
364a1fbfb3
|
@ -484,7 +484,7 @@ public class NamenodeBeanMetrics
|
|||
innerinfo.put("blockPoolUsed", node.getBlockPoolUsed());
|
||||
innerinfo.put("blockPoolUsedPercent", node.getBlockPoolUsedPercent());
|
||||
innerinfo.put("volfails", -1); // node.getVolumeFailures()
|
||||
info.put(node.getHostName() + ":" + node.getXferPort(),
|
||||
info.put(node.getXferAddrWithHostname(),
|
||||
Collections.unmodifiableMap(innerinfo));
|
||||
}
|
||||
} catch (StandbyException e) {
|
||||
|
|
|
@ -1815,10 +1815,9 @@ public class DataNode extends ReconfigurableBase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return name useful for logging
|
||||
* @return name useful for logging or display
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
// NB: our DatanodeID may not be set yet
|
||||
return hostName + ":" + getXferPort();
|
||||
}
|
||||
|
||||
|
|
|
@ -6537,7 +6537,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
if (node.getUpgradeDomain() != null) {
|
||||
innerinfo.put("upgradeDomain", node.getUpgradeDomain());
|
||||
}
|
||||
info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo.build());
|
||||
info.put(node.getXferAddrWithHostname(), innerinfo.build());
|
||||
}
|
||||
return JSON.toString(info);
|
||||
}
|
||||
|
@ -6560,7 +6560,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
.put("xferaddr", node.getXferAddr())
|
||||
.put("location", node.getNetworkLocation())
|
||||
.build();
|
||||
info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo);
|
||||
info.put(node.getXferAddrWithHostname(), innerinfo);
|
||||
}
|
||||
return JSON.toString(info);
|
||||
}
|
||||
|
@ -6588,7 +6588,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
.put("underReplicateInOpenFiles",
|
||||
node.getLeavingServiceStatus().getUnderReplicatedInOpenFiles())
|
||||
.build();
|
||||
info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo);
|
||||
info.put(node.getXferAddrWithHostname(), innerinfo);
|
||||
}
|
||||
return JSON.toString(info);
|
||||
}
|
||||
|
@ -6616,7 +6616,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
.put("underReplicateInOpenFiles",
|
||||
node.getLeavingServiceStatus().getUnderReplicatedInOpenFiles())
|
||||
.build();
|
||||
nodesMap.put(node.getHostName() + ":" + node.getXferPort(), attrMap);
|
||||
nodesMap.put(node.getXferAddrWithHostname(), attrMap);
|
||||
}
|
||||
return JSON.toString(nodesMap);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue