hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077718 - in /hadoop/common/branches/branch-0.20-security-patches/src: hdfs/org/apache/hadoop/hdfs/server/datanode/ hdfs/org/apache/hadoop/hdfs/server/namenode/ test/org/apache/hadoop/hdfs/server/datanode/ test/org/apache/hadoop/hdfs/serve...
Date Fri, 04 Mar 2011 04:47:48 GMT
Author: omalley
Date: Fri Mar  4 04:47:47 2011
New Revision: 1077718

URL: http://svn.apache.org/viewvc?rev=1077718&view=rev
Log:
commit deb8c8f2c2b18659ad2b263b94b4af8cd0c58701
Author: Tanping Wang <tanping@yahoo-inc.com>
Date:   Mon Sep 20 14:59:47 2010 -0700

    []add hostname to name node and data node MXBean.

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Fri Mar  4 04:47:47 2011
@@ -1834,6 +1834,12 @@ public class DataNode extends Configured
     return NetUtils.createSocketAddr(address);
   }
 
+  
+  @Override // DataNodeMXBean
+  public String getHostName() {
+    return this.machineName;
+  }
+  
   @Override // DataNodeMXBean
   public String getVersion() {
     return VersionInfo.getVersion();

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNodeMXBean.java
Fri Mar  4 04:47:47 2011
@@ -24,6 +24,11 @@ package org.apache.hadoop.hdfs.server.da
 public interface DataNodeMXBean {
   
   /**
+   * @return the host name
+   */
+  public String getHostName();
+  
+  /**
    * Gets the version of Hadoop.
    * 
    * @return the version of Hadoop

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Fri Mar  4 04:47:47 2011
@@ -341,6 +341,7 @@ public class FSNamesystem implements FSC
 
   // precision of access times.
   private long accessTimePrecision = 0;
+  private String nameNodeHostName;
   
   /**
    * FSNamesystem constructor.
@@ -414,6 +415,9 @@ public class FSNamesystem implements FSC
       dnsToSwitchMapping.resolve(new ArrayList<String>(hostsReader.getHosts()));
     }
     
+    InetSocketAddress socAddr = NameNode.getAddress(conf);
+    this.nameNodeHostName = socAddr.getHostName();
+    
     registerWith(DefaultMetricsSystem.INSTANCE);
   }
 
@@ -5159,9 +5163,11 @@ public class FSNamesystem implements FSC
     return authMethod;
   }
   
-  /**
-   * Class representing Namenode information for JMX interfaces
-   */
+  @Override // NameNodeMXBean
+  public String getHostName() {
+    return this.nameNodeHostName;
+  }
+  
   @Override // NameNodeMXBean
   public String getVersion() {
     return VersionInfo.getVersion();

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java
Fri Mar  4 04:47:47 2011
@@ -24,6 +24,11 @@ package org.apache.hadoop.hdfs.server.na
 public interface NameNodeMXBean {
 
   /**
+   * @return the host name
+   */
+  public String getHostName();
+  
+  /**
    * Gets the version of Hadoop.
    * 
    * @return the version

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMXBean.java
Fri Mar  4 04:47:47 2011
@@ -45,7 +45,10 @@ public class TestDataNodeMXBean {
       MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); 
       ObjectName mxbeanName = new ObjectName(
           "Hadoop:service=DataNode,name=DataNodeInfo");
-          // get attribute "Version"
+      // get attribute "HostName"
+      String hostname = (String) mbs.getAttribute(mxbeanName, "HostName");
+      Assert.assertEquals(datanode.getHostName(), hostname);
+      // get attribute "Version"
       String version = (String)mbs.getAttribute(mxbeanName, "Version");
       Assert.assertEquals(datanode.getVersion(),version);
       // get attribute "RpcPort"

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java?rev=1077718&r1=1077717&r2=1077718&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
Fri Mar  4 04:47:47 2011
@@ -47,6 +47,9 @@ public class TestNameNodeMXBean {
       MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
       ObjectName mxbeanName = new ObjectName(
         "Hadoop:service=NameNode,name=NameNodeInfo");
+      // get attribute "HostName"
+      String hostname = (String) mbs.getAttribute(mxbeanName, "HostName");
+      Assert.assertEquals(fsn.getHostName(), hostname);
       // get attribute "Version"
       String version = (String) mbs.getAttribute(mxbeanName, "Version");
       Assert.assertEquals(fsn.getVersion(), version);



Mime
View raw message