hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1089316 - in /hadoop/hdfs/branches/yahoo-merge/src: java/org/apache/hadoop/hdfs/server/datanode/ java/org/apache/hadoop/hdfs/server/datanode/metrics/ java/org/apache/hadoop/hdfs/server/namenode/ java/org/apache/hadoop/hdfs/server/namenode/...
Date Wed, 06 Apr 2011 06:22:35 GMT
Author: omalley
Date: Wed Apr  6 06:22:35 2011
New Revision: 1089316

URL: http://svn.apache.org/viewvc?rev=1089316&view=rev
Log:
commit 4ce754f9aad5f64287066069d6d72f9f34860a7a
Author: Owen O'Malley <omalley@apache.org>
Date:   Tue Apr 5 15:40:58 2011 -0700

    HADOOP-6728 unregister mxbeans upon shutdown (Luke Lu)
    
    Conflicts:
    
    	src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java

Modified:
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java
    hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
    hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMetrics.java

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Wed Apr  6 06:22:35 2011
@@ -368,6 +368,8 @@ public class DataNode extends Configured
   private AbstractList<File> dataDirs;
   private Configuration conf;
 
+  private ObjectName mxBeanName;
+
   /**
    * Create the DataNode given a configuration and an array of dataDirs.
    * 'dataDirs' is where the blocks are stored.
@@ -1399,8 +1401,15 @@ public class DataNode extends Configured
         conf.get("dfs.datanode.http.address", "0.0.0.0:50075"));
   }
   
-  private void registerMXBean() {
-    MBeans.register("DataNode", "DataNodeInfo", this);
+  private synchronized void registerMXBean() {
+    mxBeanName = MBeans.register("DataNode", "DataNodeInfo", this);
+  }
+
+  private synchronized void unregisterMXBean() {
+    if (mxBeanName != null) {
+      MBeans.unregister(mxBeanName);
+      mxBeanName = null;
+    }
   }
   
   int getPort() {
@@ -1640,6 +1649,7 @@ public class DataNode extends Configured
     if (metrics != null) {
       metrics.shutdown();
     }
+    unregisterMXBean();
   }
   
   

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
Wed Apr  6 06:22:35 2011
@@ -1081,7 +1081,8 @@ public class FSDataset implements FSCons
   // Used for synchronizing access to usage stats
   private final Object statsLock = new Object();
 
-  final boolean supportAppends;
+  boolean supportAppends = true;
+  boolean hasShutdown = false;
 
   /**
    * An FSDataset has a directory where it loads its data files.
@@ -2010,7 +2011,7 @@ public class FSDataset implements FSCons
     return "FSDataset{dirpath='"+volumes+"'}";
   }
 
-  private ObjectName mbeanName;
+  private volatile ObjectName mbeanName;
   private Random rand = new Random();
   
   /**
@@ -2038,16 +2039,24 @@ public class FSDataset implements FSCons
   }
 
   @Override // FSDatasetInterface
-  public void shutdown() {
-    if (mbeanName != null)
+  public synchronized void shutdown() {
+    if (hasShutdown) return;
+    hasShutdown = true;
+
+    if (mbeanName != null) {
       MBeans.unregister(mbeanName);
-    
+    }
+
     if (asyncDiskService != null) {
       asyncDiskService.shutdown();
     }
-    
-    if(volumes != null) {
-      volumes.shutdown();
+
+    if (volumes != null) {
+      for (FSVolume volume : volumes.volumes) {
+        if(volume != null) {
+          volume.shutdown();
+        }
+      }
     }
   }
 

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java
Wed Apr  6 06:22:35 2011
@@ -32,9 +32,7 @@ import org.apache.hadoop.classification.
  * be published as an interface.
  * 
  * <p>
- * Data Node runtime statistic  info is report in another MBean
- * @see org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeActivityMBean
- *
+ * Data Node runtime statistic info is report in the metrics MBean
  */
 @InterfaceAudience.Private
 public interface FSDatasetMBean {

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Wed Apr  6 06:22:35 2011
@@ -4477,16 +4477,17 @@ public class FSNamesystem implements FSC
     return isInSafeMode() ? "safeMode" : "Operational";
   }
   
-  private ObjectName mbeanName;
+  private ObjectName mBeanName, mxBeanName;
+
   /**
    * Register the FSNamesystem MBean using the name
    *        "hadoop:service=NameNode,name=FSNamesystemState"
    */
-  void registerMBean() {
+  synchronized void registerMBean() {
     // We can only implement one MXBean interface, so we keep the old one.
     try {
       StandardMBean bean = new StandardMBean(this, FSNamesystemMBean.class);
-      mbeanName = MBeans.register("NameNode", "FSNamesystemState", bean);
+      mBeanName = MBeans.register("NameNode", "FSNamesystemState", bean);
     } catch (NotCompliantMBeanException e) {
       throw new RuntimeException("Bad MBean setup", e);
     }
@@ -4496,9 +4497,15 @@ public class FSNamesystem implements FSC
   /**
    * shutdown FSNamesystem
    */
-  public void shutdown() {
-    if (mbeanName != null)
-      MBeans.unregister(mbeanName);
+  public synchronized void shutdown() {
+    if (mBeanName != null) {
+      MBeans.unregister(mBeanName);
+      mBeanName = null;
+    }
+    if (mxBeanName != null) {
+      MBeans.unregister(mxBeanName);
+      mxBeanName = null;
+    }
   }
   
 
@@ -5144,8 +5151,8 @@ public class FSNamesystem implements FSC
   /**
    * Register NameNodeMXBean
    */
-  private void registerMXBean() {
-    MBeans.register("NameNode", "NameNodeInfo", this);
+  private synchronized void registerMXBean() {
+    mxBeanName = MBeans.register("NameNode", "NameNodeInfo", this);
   }
 
   /**

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java
Wed Apr  6 06:22:35 2011
@@ -31,9 +31,7 @@ import org.apache.hadoop.classification.
  * be published as an interface.
  * 
  * <p>
- * Name Node runtime activity statistic  info is report in another MBean
- * @see org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeActivityMBean
- *
+ * Name Node runtime activity statistic info is report in the metrics MBean
  */
 @InterfaceAudience.Private
 public interface FSNamesystemMBean {

Modified: hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
Wed Apr  6 06:22:35 2011
@@ -893,8 +893,11 @@ public class SimulatedFSDataset  impleme
     DataNode.LOG.info("Registered FSDatasetState MBean");
   }
 
-  public void shutdown() {
-    if (mbeanName != null) MBeans.unregister(mbeanName);
+  public synchronized void shutdown() {
+    if (mbeanName != null) {
+      mbeanName = null;
+      MBeans.unregister(mbeanName);
+    }
   }
 
   public String getStorageInfo() {

Modified: hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMetrics.java?rev=1089316&r1=1089315&r2=1089316&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMetrics.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMetrics.java
Wed Apr  6 06:22:35 2011
@@ -24,7 +24,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DFSTestUtil;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
 import static org.apache.hadoop.test.MetricsAsserts.*;



Mime
View raw message