hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r794007 - in /hadoop/hdfs/trunk: ./ src/java/org/apache/hadoop/hdfs/server/namenode/ src/java/org/apache/hadoop/hdfs/server/namenode/metrics/ src/test/hdfs/org/apache/hadoop/hdfs/
Date Tue, 14 Jul 2009 18:40:02 GMT
Author: szetszwo
Date: Tue Jul 14 18:40:01 2009
New Revision: 794007

URL: http://svn.apache.org/viewvc?rev=794007&view=rev
Log:
HDFS-443. Add a new metrics numExpiredHeartbeats to the Namenode.  Contributed by Jitendra
Nath Pandey

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeReport.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=794007&r1=794006&r2=794007&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Jul 14 18:40:01 2009
@@ -36,6 +36,9 @@
 
     HDFS-278. HDFS Outputstream close does not hang forever. (dhruba)
 
+    HDFS-443. Add a new metrics numExpiredHeartbeats to the Namenode.
+    (Jitendra Nath Pandey via szetszwo)
+
   BUG FIXES
     HDFS-76. Better error message to users when commands fail because of 
     lack of quota. Allow quota to be set even if the limit is lower than

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=794007&r1=794006&r2=794007&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Tue
Jul 14 18:40:01 2009
@@ -2225,6 +2225,7 @@
              it.hasNext();) {
           DatanodeDescriptor nodeInfo = it.next();
           if (isDatanodeDead(nodeInfo)) {
+            myFSMetrics.numExpiredHeartbeats.inc();
             foundDead = true;
             nodeID = nodeInfo;
             break;

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java?rev=794007&r1=794006&r2=794007&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
Tue Jul 14 18:40:01 2009
@@ -27,6 +27,7 @@
 import org.apache.hadoop.metrics.util.MetricsIntValue;
 import org.apache.hadoop.metrics.util.MetricsLongValue;
 import org.apache.hadoop.metrics.util.MetricsRegistry;
+import org.apache.hadoop.metrics.util.MetricsTimeVaryingInt;
 
 /**
  * 
@@ -59,6 +60,8 @@
   final MetricsIntValue scheduledReplicationBlocks = new MetricsIntValue("ScheduledReplicationBlocks",
registry);
   final MetricsIntValue missingBlocks = new MetricsIntValue("MissingBlocks", registry); 
  
   final MetricsIntValue blockCapacity = new MetricsIntValue("BlockCapacity", registry);
+  public final MetricsTimeVaryingInt numExpiredHeartbeats = 
+                          new MetricsTimeVaryingInt("ExpiredHeartbeats", registry);
 
   private final FSNamesystem fsNameSystem;
 

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeReport.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeReport.java?rev=794007&r1=794006&r2=794007&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeReport.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeReport.java Tue Jul
14 18:40:01 2009
@@ -26,6 +26,7 @@
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
+import org.apache.hadoop.hdfs.server.namenode.metrics.FSNamesystemMetrics;
 
 /**
  * This test ensures the all types of data node report work correctly.
@@ -40,6 +41,7 @@
   public void testDatanodeReport() throws Exception {
     conf.setInt(
         "heartbeat.recheck.interval", 500); // 0.5s
+    conf.setLong("dfs.heartbeat.interval", 1L);
     MiniDFSCluster cluster = 
       new MiniDFSCluster(conf, NUM_OF_DATANODES, true, null);
     try {
@@ -73,6 +75,11 @@
                    NUM_OF_DATANODES-1);
       assertEquals(client.datanodeReport(DatanodeReportType.ALL).length,
                    NUM_OF_DATANODES);
+
+      Thread.sleep(5000);
+      FSNamesystemMetrics fsMetrics = 
+                     cluster.getNameNode().getNamesystem().getFSNamesystemMetrics();
+      assertEquals(1,fsMetrics.numExpiredHeartbeats.getCurrentIntervalValue());
     }finally {
       cluster.shutdown();
     }



Mime
View raw message