diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 277cc42222..44b79a3e0e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6662,6 +6662,7 @@ public String getLiveNodes() { .put("infoSecureAddr", node.getInfoSecureAddr()) .put("xferaddr", node.getXferAddr()) .put("location", node.getNetworkLocation()) + .put("uuid", node.getDatanodeUuid()) .put("lastContact", getLastContact(node)) .put("usedSpace", getDfsUsed(node)) .put("adminState", node.getAdminState().toString()) @@ -6715,6 +6716,7 @@ public String getDeadNodes() { .put("adminState", node.getAdminState().toString()) .put("xferaddr", node.getXferAddr()) .put("location", node.getNetworkLocation()) + .put("uuid", node.getDatanodeUuid()) .build(); info.put(node.getXferAddrWithHostname(), innerinfo); } @@ -6737,6 +6739,7 @@ public String getDecomNodes() { . builder() .put("xferaddr", node.getXferAddr()) .put("location", node.getNetworkLocation()) + .put("uuid", node.getDatanodeUuid()) .put("underReplicatedBlocks", node.getLeavingServiceStatus().getUnderReplicatedBlocks()) .put("decommissionOnlyReplicas", @@ -6767,6 +6770,7 @@ public String getEnteringMaintenanceNodes() { . builder() .put("xferaddr", node.getXferAddr()) .put("location", node.getNetworkLocation()) + .put("uuid", node.getDatanodeUuid()) .put("underReplicatedBlocks", node.getLeavingServiceStatus().getUnderReplicatedBlocks()) .put("maintenanceOnlyReplicas", diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java index bc46c4857a..89ae01ddd2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java @@ -211,7 +211,7 @@ public void testNameNodeMXBeanInfo() throws Exception { cluster.getDataNodes().get(3).getDatanodeId()); decommissionedNode.setDecommissioned(); - // Assert the location field is included in the mxbeanName + // Assert the location and uuid field is included in the mxbeanName // under different states String alivenodeinfo1 = (String) (mbs.getAttribute(mxbeanName, "LiveNodes")); @@ -219,6 +219,7 @@ public void testNameNodeMXBeanInfo() throws Exception { (Map>) JSON.parse(alivenodeinfo1); for (Map liveNode : liveNodes1.values()) { assertTrue(liveNode.containsKey("location")); + assertTrue(liveNode.containsKey("uuid")); } // get attributes DeadNodes