hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r762958 - in /hadoop/core/trunk: ./ src/ src/core/org/apache/hadoop/ src/core/org/apache/hadoop/http/ src/core/org/apache/hadoop/metrics/ src/core/org/apache/hadoop/metrics/file/ src/core/org/apache/hadoop/metrics/ganglia/ src/core/org/apac...
Date Tue, 07 Apr 2009 20:53:56 GMT
Author: cdouglas
Date: Tue Apr  7 20:53:56 2009
New Revision: 762958

URL: http://svn.apache.org/viewvc?rev=762958&view=rev
Log:
Revert HADOOP-5469

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/core/org/apache/hadoop/HadoopVersionAnnotation.java
    hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ContextFactory.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/MetricsContext.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/file/FileContext.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ganglia/GangliaContext.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
    hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/OutputRecord.java
    hadoop/core/trunk/src/core/org/apache/hadoop/util/VersionInfo.java
    hadoop/core/trunk/src/saveVersion.sh

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Apr  7 20:53:56 2009
@@ -80,9 +80,6 @@
     HADOOP-5518. Add contrib/mrunit, a MapReduce unit test framework.
     (Aaron Kimball via cutting)
 
-    HADOOP-5469.  Add /metrics servlet to daemons, providing metrics
-    over HTTP as either text or JSON.  (Philip Zeyliger via cutting)
-
   IMPROVEMENTS
 
     HADOOP-4565. Added CombineFileInputFormat to use data locality information

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/HadoopVersionAnnotation.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/HadoopVersionAnnotation.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/HadoopVersionAnnotation.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/HadoopVersionAnnotation.java Tue Apr  7 20:53:56
2009
@@ -42,7 +42,7 @@
    * @return the date in unix 'date' format
    */
   String date();
-    
+  
   /**
    * Get the url for the subversion repository.
    */
@@ -59,11 +59,4 @@
    * @return The branch name, e.g. "trunk" or "branches/branch-0.20"
    */
   String branch();
-
-  /**
-   * Get a checksum of the source files from which
-   * Hadoop was compiled.
-   * @return a string that uniquely identifies the source
-   **/
-  String srcChecksum();    
 }

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java Tue Apr  7 20:53:56
2009
@@ -37,7 +37,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.log.LogLevel;
-import org.apache.hadoop.metrics.MetricsServlet;
 import org.apache.hadoop.util.ReflectionUtils;
 
 import org.mortbay.jetty.Connector;
@@ -189,7 +188,6 @@
     // set up default servlets
     addServlet("stacks", "/stacks", StackServlet.class);
     addServlet("logLevel", "/logLevel", LogLevel.Servlet.class);
-    addServlet("metrics", "/metrics", MetricsServlet.class);
   }
 
   public void addContext(Context ctxt, boolean isFiltered)

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ContextFactory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ContextFactory.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ContextFactory.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ContextFactory.java Tue Apr  7 20:53:56
2009
@@ -22,8 +22,6 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -144,14 +142,6 @@
            IllegalAccessException {
     return getContext(contextName, contextName);
   }
-  
-  /** 
-   * Returns all MetricsContexts built by this factory.
-   */
-  public synchronized Collection<MetricsContext> getAllContexts() {
-    // Make a copy to avoid race conditions with creating new contexts.
-    return new ArrayList<MetricsContext>(contextMap.values());
-  }
     
   /**
    * Returns a "null" context - one which does nothing.

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/MetricsContext.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/MetricsContext.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/MetricsContext.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/MetricsContext.java Tue Apr  7 20:53:56
2009
@@ -21,10 +21,6 @@
 package org.apache.hadoop.metrics;
 
 import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.hadoop.metrics.spi.OutputRecord;
 
 /**
  * The main interface to the metrics package. 
@@ -107,12 +103,5 @@
    * Returns the timer period.
    */
   public abstract int getPeriod();
-  
-  /**
-   * Retrieves all the records managed by this MetricsContext.
-   * Useful for monitoring systems that are polling-based.
-   * 
-   * @return A non-null map from all record names to the records managed.
-   */
-   Map<String, Collection<OutputRecord>> getAllRecords();
+    
 }

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/file/FileContext.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/file/FileContext.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/file/FileContext.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/file/FileContext.java Tue Apr  7
20:53:56 2009
@@ -27,6 +27,7 @@
 import java.io.PrintWriter;
 
 import org.apache.hadoop.metrics.ContextFactory;
+import org.apache.hadoop.metrics.MetricsException;
 import org.apache.hadoop.metrics.spi.AbstractMetricsContext;
 import org.apache.hadoop.metrics.spi.OutputRecord;
 
@@ -61,7 +62,18 @@
       file = new File(fileName);
     }
         
-    parseAndSetPeriod(PERIOD_PROPERTY);
+    String periodStr = getAttribute(PERIOD_PROPERTY);
+    if (periodStr != null) {
+      int period = 0;
+      try {
+        period = Integer.parseInt(periodStr);
+      } catch (NumberFormatException nfe) {
+      }
+      if (period <= 0) {
+        throw new MetricsException("Invalid period: " + periodStr);
+      }
+      setPeriod(period);
+    }
   }
 
   /**

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ganglia/GangliaContext.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ganglia/GangliaContext.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ganglia/GangliaContext.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/ganglia/GangliaContext.java Tue Apr
 7 20:53:56 2009
@@ -88,7 +88,19 @@
     
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
-    parseAndSetPeriod(PERIOD_PROPERTY);
+        
+    String periodStr = getAttribute(PERIOD_PROPERTY);
+    if (periodStr != null) {
+      int period = 0;
+      try {
+        period = Integer.parseInt(periodStr);
+      } catch (NumberFormatException nfe) {
+      }
+      if (period <= 0) {
+        throw new MetricsException("Invalid period: " + periodStr);
+      }
+      setPeriod(period);
+    }
         
     metricsServers = 
       Util.parse(getAttribute(SERVERS_PROPERTY), DEFAULT_PORT); 

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java Tue
Apr  7 20:53:56 2009
@@ -26,7 +26,6 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.Timer;
@@ -61,7 +60,7 @@
   private ContextFactory factory = null;
   private String contextName = null;
     
-  public static class TagMap extends TreeMap<String,Object> {
+  static class TagMap extends TreeMap<String,Object> {
     private static final long serialVersionUID = 3546309335061952993L;
     TagMap() {
       super();
@@ -84,14 +83,8 @@
     }
   }
   
-  public static class MetricMap extends TreeMap<String,Number> {
+  static class MetricMap extends TreeMap<String,Number> {
     private static final long serialVersionUID = -7495051861141631609L;
-    MetricMap() {
-      super();
-    }
-    MetricMap(MetricMap orig) {
-      super(orig);
-    }
   }
             
   static class RecordMap extends HashMap<TagMap,MetricMap> {
@@ -316,28 +309,6 @@
     }
     flush();
   }
-  
-  /**
-   * Retrieves all the records managed by this MetricsContext.
-   * Useful for monitoring systems that are polling-based.
-   * @return A non-null collection of all monitoring records.
-   */
-  public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
-    Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
-    for (String recordName : bufferedData.keySet()) {
-      RecordMap recordMap = bufferedData.get(recordName);
-      synchronized (recordMap) {
-        List<OutputRecord> records = new ArrayList<OutputRecord>();
-        Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet();
-        for (Entry<TagMap, MetricMap> entry : entrySet) {
-          OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
-          records.add(outRec);
-        }
-        out.put(recordName, records);
-      }
-    }
-    return out;
-  }
 
   /**
    * Sends a record to the metrics system.
@@ -453,23 +424,4 @@
   protected void setPeriod(int period) {
     this.period = period;
   }
-  
-  /**
-   * If a period is set in the attribute passed in, override
-   * the default with it.
-   */
-  protected void parseAndSetPeriod(String attributeName) {
-    String periodStr = getAttribute(attributeName);
-    if (periodStr != null) {
-      int period = 0;
-      try {
-        period = Integer.parseInt(periodStr);
-      } catch (NumberFormatException nfe) {
-      }
-      if (period <= 0) {
-        throw new MetricsException("Invalid period: " + periodStr);
-      }
-      setPeriod(period);
-    }
-  }
 }

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
(original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
Tue Apr  7 20:53:56 2009
@@ -44,7 +44,21 @@
   
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
-    parseAndSetPeriod(PERIOD_PROPERTY);
+    
+    // If period is specified, use it, otherwise the default is good enough
+        
+    String periodStr = getAttribute(PERIOD_PROPERTY);
+    if (periodStr != null) {
+      int period = 0;
+      try {
+        period = Integer.parseInt(periodStr);
+      } catch (NumberFormatException nfe) {
+      }
+      if (period <= 0) {
+        throw new MetricsException("Invalid period: " + periodStr);
+      }
+      setPeriod(period);
+    }
   }
    
     

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/OutputRecord.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/OutputRecord.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/OutputRecord.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/metrics/spi/OutputRecord.java Tue Apr  7
20:53:56 2009
@@ -21,11 +21,7 @@
 package org.apache.hadoop.metrics.spi;
 
 import java.util.Collections;
-import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
-import java.util.Map.Entry;
-
 import org.apache.hadoop.metrics.spi.AbstractMetricsContext.MetricMap;
 import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap;
 
@@ -72,19 +68,5 @@
   public Number getMetric(String name) {
     return metricMap.get(name);
   }
-  
-
-  /**
-   * Returns a copy of this record's tags.
-   */
-  public TagMap getTagsCopy() {
-    return new TagMap(tagMap);
-  }
-  
-  /**
-   * Returns a copy of this record's metrics.
-   */
-  public MetricMap getMetricsCopy() {
-    return new MetricMap(metricMap);
-  }
+    
 }

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/util/VersionInfo.java?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/util/VersionInfo.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/util/VersionInfo.java Tue Apr  7 20:53:56
2009
@@ -87,15 +87,7 @@
   public static String getUrl() {
     return version != null ? version.url() : "Unknown";
   }
-
-  /**
-   * Get the checksum of the source files from which Hadoop was
-   * built.
-   **/
-  public static String getSrcChecksum() {
-    return version != null ? version.srcChecksum() : "Unknown";
-  }
-
+  
   /**
    * Returns the buildVersion which includes version, 
    * revision, user and date. 
@@ -104,13 +96,12 @@
     return VersionInfo.getVersion() + 
     " from " + VersionInfo.getRevision() +
     " by " + VersionInfo.getUser() + 
-    " source checksum " + VersionInfo.getSrcChecksum();
+    " on " + VersionInfo.getDate();
   }
   
   public static void main(String[] args) {
     System.out.println("Hadoop " + getVersion());
     System.out.println("Subversion " + getUrl() + " -r " + getRevision());
     System.out.println("Compiled by " + getUser() + " on " + getDate());
-    System.out.println("From source with checksum " + getSrcChecksum());
   }
 }

Modified: hadoop/core/trunk/src/saveVersion.sh
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/saveVersion.sh?rev=762958&r1=762957&r2=762958&view=diff
==============================================================================
--- hadoop/core/trunk/src/saveVersion.sh (original)
+++ hadoop/core/trunk/src/saveVersion.sh Tue Apr  7 20:53:56 2009
@@ -41,19 +41,16 @@
   branch="Unknown"
   url="file://$cwd"
 fi
-srcChecksum=`find src -name '*.java' | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' '
-f 1`
-
 mkdir -p build/src/org/apache/hadoop
 cat << EOF | \
   sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
       -e "s|URL|$url|" -e "s/REV/$revision/" \
-      -e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
+      -e "s|BRANCH|$branch|" \
       > build/src/org/apache/hadoop/package-info.java
 /*
  * Generated by src/saveVersion.sh
  */
 @HadoopVersionAnnotation(version="VERSION", revision="REV", branch="BRANCH",
-                         user="USER", date="DATE", url="URL",
-                         srcChecksum="SRCCHECKSUM")
+                         user="USER", date="DATE", url="URL")
 package org.apache.hadoop;
 EOF



Mime
View raw message