hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r673894 - in /hadoop/core/branches/branch-0.18: ./ src/hdfs/org/apache/hadoop/dfs/ src/hdfs/org/apache/hadoop/dfs/namenode/metrics/
Date Fri, 04 Jul 2008 02:15:40 GMT
Author: cdouglas
Date: Thu Jul  3 19:15:39 2008
New Revision: 673894

URL: http://svn.apache.org/viewvc?rev=673894&view=rev
Log:
HADOOP-3683. Fix dfs metrics to count file listings rather than files
listed. Contributed by lohit vijayarenu.

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNode.java
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNodeMetrics.java
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatistics.java
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatisticsMBean.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=673894&r1=673893&r2=673894&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Thu Jul  3 19:15:39 2008
@@ -711,6 +711,9 @@
     HADOOP-3678. Avoid spurious exceptions logged at DataNode when clients
     read from DFS. (rangadi)
 
+    HADOOP-3683. Fix dfs metrics to count file listings rather than files
+    listed. (lohit vijayarenu via cdouglas)
+
 Release 0.17.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNode.java?rev=673894&r1=673893&r2=673894&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNode.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNode.java Thu Jul
 3 19:15:39 2008
@@ -286,6 +286,7 @@
             null, masked),
         clientName, clientMachine, overwrite, replication, blockSize);
     myMetrics.numFilesCreated.inc();
+    myMetrics.numCreateFileOps.inc();
   }
 
   /** Coming in a future release.... */
@@ -326,7 +327,10 @@
                                String clientName) throws IOException {
     stateChangeLog.debug("*BLOCK* NameNode.addBlock: file "
                          +src+" for "+clientName);
-    return namesystem.getAdditionalBlock(src, clientName);
+    LocatedBlock locatedBlock = namesystem.getAdditionalBlock(src, clientName);
+    if (locatedBlock != null)
+      myMetrics.numAddBlockOps.inc();
+    return locatedBlock;
   }
 
   /**
@@ -418,7 +422,10 @@
       stateChangeLog.debug("*DIR* Namenode.delete: src=" + src
           + ", recursive=" + recursive);
     }
-    return namesystem.delete(src, recursive);
+    boolean ret = namesystem.delete(src, recursive);
+    if (ret) 
+      myMetrics.numDeleteFileOps.inc();
+    return ret;
   }
 
   /**
@@ -456,7 +463,7 @@
   public DFSFileInfo[] getListing(String src) throws IOException {
     DFSFileInfo[] files = namesystem.getListing(src);
     if (files != null) {
-      myMetrics.numFilesListed.inc(files.length);
+      myMetrics.numGetListingOps.inc();
     }
     return files;
   }

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNodeMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNodeMetrics.java?rev=673894&r1=673893&r2=673894&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNodeMetrics.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/NameNodeMetrics.java Thu
Jul  3 19:15:39 2008
@@ -48,9 +48,15 @@
     public MetricsTimeVaryingInt numFilesCreated = new MetricsTimeVaryingInt("FilesCreated");
     public MetricsTimeVaryingInt numGetBlockLocations = new MetricsTimeVaryingInt("GetBlockLocations");
     public MetricsTimeVaryingInt numFilesRenamed = new MetricsTimeVaryingInt("FilesRenamed");
-    public MetricsTimeVaryingInt numFilesListed = new MetricsTimeVaryingInt("FilesListed");
+    public MetricsTimeVaryingInt numGetListingOps = 
+                                   new MetricsTimeVaryingInt("GetListingOps");
+    public MetricsTimeVaryingInt numCreateFileOps = 
+                                   new MetricsTimeVaryingInt("CreateFileOps");
+    public MetricsTimeVaryingInt numDeleteFileOps = 
+                                   new MetricsTimeVaryingInt("DeleteFileOps");
+    public MetricsTimeVaryingInt numAddBlockOps = 
+                                   new MetricsTimeVaryingInt("AddBlockOps");
 
-    
     public MetricsTimeVaryingRate transactions = new MetricsTimeVaryingRate("Transactions");
     public MetricsTimeVaryingRate syncs = new MetricsTimeVaryingRate("Syncs");
     public MetricsTimeVaryingRate blockReport = new MetricsTimeVaryingRate("blockReport");
@@ -94,8 +100,10 @@
         numFilesCreated.pushMetric(metricsRecord);
         numGetBlockLocations.pushMetric(metricsRecord);
         numFilesRenamed.pushMetric(metricsRecord);
-        numFilesListed.pushMetric(metricsRecord);
-
+        numGetListingOps.pushMetric(metricsRecord);
+        numCreateFileOps.pushMetric(metricsRecord);
+        numDeleteFileOps.pushMetric(metricsRecord);
+        numAddBlockOps.pushMetric(metricsRecord);
 
         transactions.pushMetric(metricsRecord);
         syncs.pushMetric(metricsRecord);

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatistics.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatistics.java?rev=673894&r1=673893&r2=673894&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatistics.java
(original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatistics.java
Thu Jul  3 19:15:39 2008
@@ -163,11 +163,40 @@
     return myMetrics.numFilesCreated.getPreviousIntervalValue();
   }
 
+  /** 
+   *@deprecated call getNumGetListingOps() instead
+   */
+  @Deprecated
+  public int getNumFilesListed() {
+    return getNumGetListingOps();
+  }
+
   /**
    * @inheritDoc
    */
-  public int getNumFilesListed() {
-    return myMetrics.numFilesListed.getPreviousIntervalValue();
+  public int getNumGetListingOps() {
+    return myMetrics.numGetListingOps.getPreviousIntervalValue();
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public int getNumCreateFileOps() {
+    return myMetrics.numCreateFileOps.getPreviousIntervalValue();
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public int getNumDeleteFileOps() {
+    return myMetrics.numDeleteFileOps.getPreviousIntervalValue();
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public int getNumAddBlockOps() {
+    return myMetrics.numAddBlockOps.getPreviousIntervalValue();
   }
 
   /** @inheritDoc */

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatisticsMBean.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatisticsMBean.java?rev=673894&r1=673893&r2=673894&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatisticsMBean.java
(original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/namenode/metrics/NameNodeStatisticsMBean.java
Thu Jul  3 19:15:39 2008
@@ -156,6 +156,32 @@
   /**
    *   Number of files listed in the last interval
    * @return number of operations
+   * @deprecated Use getNumGetListingOps() instead
    */
+  @Deprecated
   int getNumFilesListed();
+
+  /**
+   *   Number of files listed in the last interval
+   * @return number of operations
+   */
+  int getNumGetListingOps();
+
+  /**
+   *   Number of file creation operations in the last interval
+   * @return number of file creation operations
+   */
+  int getNumCreateFileOps();
+
+  /**
+   *   Number of file deletion operations in the last interval
+   * @return number of file deletion operations
+   */
+  int getNumDeleteFileOps();
+
+  /**
+   *   Number of add block operations in the last interval
+   * @return number of add block operations
+   */
+  int getNumAddBlockOps();
 }



Mime
View raw message