hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x...@apache.org
Subject hadoop git commit: HDFS-11502. Datanode UI should display hostname based on JMX bean instead of window.location.hostname. Contributed by Jeffrey E Rodriguez and Yuanbo Liu.
Date Thu, 13 Jul 2017 00:01:45 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8.2 cedd59581 -> eaef44bc4


HDFS-11502. Datanode UI should display hostname based on JMX bean instead of window.location.hostname.
Contributed by Jeffrey E Rodriguez and Yuanbo Liu.

(cherry picked from commit e15e2713e1e344b14d63726639d1c83451921515)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/eaef44bc
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/eaef44bc
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/eaef44bc

Branch: refs/heads/branch-2.8.2
Commit: eaef44bc44d37fb875bc6a4fd6846ded6a34231a
Parents: cedd595
Author: Xiaoyu Yao <xyao@apache.org>
Authored: Wed Jul 12 16:26:09 2017 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Wed Jul 12 16:39:37 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hdfs/server/datanode/DataNode.java     | 8 ++++++++
 .../apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java   | 7 +++++++
 .../hadoop-hdfs/src/main/webapps/datanode/dn.js              | 2 +-
 .../hadoop/hdfs/server/datanode/TestDataNodeMXBean.java      | 4 ++++
 4 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/eaef44bc/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
index 1ff9617..96720e1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
@@ -2935,6 +2935,14 @@ public class DataNode extends ReconfigurableBase
     return JSON.toString(info);
   }
 
+ /**
+   * Return hostname of the datanode.
+   */
+  @Override // DataNodeMXBean
+  public String getDatanodeHostname() {
+    return this.hostName;
+  }
+
   /**
    * Returned information is a JSON representation of an array,
    * each element of the array is a map contains the information

http://git-wip-us.apache.org/repos/asf/hadoop/blob/eaef44bc/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
index 66d1c6d..aafdc3a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
@@ -68,6 +68,13 @@ public interface DataNodeMXBean {
   public String getNamenodeAddresses();
 
   /**
+   * Gets the datanode hostname.
+   *
+   * @return the datanode hostname for the datanode.
+   */
+  public String getDatanodeHostname();
+
+  /**
    * Gets information of the block pool service actors.
    *
    * @return block pool service actors info

http://git-wip-us.apache.org/repos/asf/hadoop/blob/eaef44bc/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dn.js
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dn.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dn.js
index ea963cc..9e2732c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dn.js
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dn.js
@@ -25,7 +25,7 @@
   function load() {
     $.get('/jmx?qry=Hadoop:service=DataNode,name=DataNodeInfo', function(resp) {
       data.dn = workaround(resp.beans[0]);
-      data.dn.HostName=window.location.hostname;
+      data.dn.HostName = resp.beans[0]['DatanodeHostname'];
       render();
     }).fail(show_err_msg);
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/eaef44bc/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
index 5799351..c1deb03 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
@@ -71,6 +71,10 @@ public class TestDataNodeMXBean {
       String namenodeAddresses = (String)mbs.getAttribute(mxbeanName, 
           "NamenodeAddresses");
       Assert.assertEquals(datanode.getNamenodeAddresses(),namenodeAddresses);
+      // get attribute "getDatanodeHostname"
+      String datanodeHostname = (String)mbs.getAttribute(mxbeanName,
+          "DatanodeHostname");
+      Assert.assertEquals(datanode.getDatanodeHostname(),datanodeHostname);
       // get attribute "getVolumeInfo"
       String volumeInfo = (String)mbs.getAttribute(mxbeanName, "VolumeInfo");
       Assert.assertEquals(replaceDigits(datanode.getVolumeInfo()),


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message