HDFS-8981. Adding revision to data node jmx getVersion() method. (Siqi Li via mingma)

This commit is contained in:
Ming Ma 2015-09-04 11:55:58 -07:00
parent 715b9c6499
commit 30db1adac3
4 changed files with 29 additions and 4 deletions

View File

@ -36,6 +36,9 @@ Trunk (Unreleased)
HDFS-8895. Remove deprecated BlockStorageLocation APIs. (wang)
HDFS-8981. Adding revision to data node jmx getVersion() method. (Siqi Li
via mingma)
NEW FEATURES
HDFS-3125. Add JournalService to enable Journal Daemon. (suresh)

View File

@ -2902,10 +2902,15 @@ public class DataNode extends ReconfigurableBase
}
@Override // DataNodeMXBean
public String getVersion() {
public String getSoftwareVersion() {
return VersionInfo.getVersion();
}
@Override // DataNodeMXBean
public String getVersion() {
return VersionInfo.getVersion() + ", r" + VersionInfo.getRevision();
}
@Override // DataNodeMXBean
public String getRpcPort(){
InetSocketAddress ipcAddr = NetUtils.createSocketAddr(
@ -2918,6 +2923,10 @@ public class DataNode extends ReconfigurableBase
return this.getConf().get("dfs.datanode.info.port");
}
public String getRevision() {
return VersionInfo.getRevision();
}
/**
* @return the datanode's http port
*/

View File

@ -37,6 +37,13 @@ public interface DataNodeMXBean {
*/
public String getVersion();
/**
* Get the version of software running on the DataNode
*
* @return a string representing the version
*/
public String getSoftwareVersion();
/**
* Gets the rpc port.
*

View File

@ -51,6 +51,12 @@ public class TestDataNodeMXBean {
// get attribute "Version"
String version = (String)mbs.getAttribute(mxbeanName, "Version");
Assert.assertEquals(datanode.getVersion(),version);
// get attribute "SotfwareVersion"
String softwareVersion =
(String)mbs.getAttribute(mxbeanName, "SoftwareVersion");
Assert.assertEquals(datanode.getSoftwareVersion(),softwareVersion);
Assert.assertEquals(version, softwareVersion
+ ", r" + datanode.getRevision());
// get attribute "RpcPort"
String rpcPort = (String)mbs.getAttribute(mxbeanName, "RpcPort");
Assert.assertEquals(datanode.getRpcPort(),rpcPort);