HDFS-17369. Add uuid into datanode info for NameNodeMXBean (#6521) Contributed by Haiyang Hu.

Reviewed-by: ZanderXu <zanderxu@apache.org>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
huhaiyang 2024-02-03 19:20:04 +08:00 committed by GitHub
parent d74e5160cd
commit 6464507cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -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() {
.<String, Object> 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() {
.<String, Object> builder()
.put("xferaddr", node.getXferAddr())
.put("location", node.getNetworkLocation())
.put("uuid", node.getDatanodeUuid())
.put("underReplicatedBlocks",
node.getLeavingServiceStatus().getUnderReplicatedBlocks())
.put("maintenanceOnlyReplicas",

View File

@ -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<String, Map<String, Object>>) JSON.parse(alivenodeinfo1);
for (Map<String, Object> liveNode : liveNodes1.values()) {
assertTrue(liveNode.containsKey("location"));
assertTrue(liveNode.containsKey("uuid"));
}
// get attributes DeadNodes