HDFS-17011. Fix the metric of "HttpPort" at DataNodeInfo (#5657). Contributed by Zhaohui Wang.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
wangzhaohui 2023-05-18 14:42:11 +08:00 committed by GitHub
parent 5ddaf2e133
commit 03163f9de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -3558,7 +3558,7 @@ public class DataNode extends ReconfigurableBase
@Override // DataNodeMXBean @Override // DataNodeMXBean
public String getHttpPort(){ public String getHttpPort(){
return this.getConf().get("dfs.datanode.info.port"); return String.valueOf(infoPort);
} }
@Override // DataNodeMXBean @Override // DataNodeMXBean

View File

@ -92,6 +92,7 @@ public class TestDataNodeMXBean extends SaslDataTransferTestCase {
Assert.assertEquals(datanode.getRpcPort(),rpcPort); Assert.assertEquals(datanode.getRpcPort(),rpcPort);
// get attribute "HttpPort" // get attribute "HttpPort"
String httpPort = (String)mbs.getAttribute(mxbeanName, "HttpPort"); String httpPort = (String)mbs.getAttribute(mxbeanName, "HttpPort");
Assert.assertNotNull(httpPort);
Assert.assertEquals(datanode.getHttpPort(),httpPort); Assert.assertEquals(datanode.getHttpPort(),httpPort);
// get attribute "NamenodeAddresses" // get attribute "NamenodeAddresses"
String namenodeAddresses = (String)mbs.getAttribute(mxbeanName, String namenodeAddresses = (String)mbs.getAttribute(mxbeanName,