hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1243205 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/metrics2/util/SampleStat.java src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java
Date Sun, 12 Feb 2012 07:24:43 GMT
Author: mattf
Date: Sun Feb 12 07:24:43 2012
New Revision: 1243205

URL: http://svn.apache.org/viewvc?rev=1243205&view=rev
Log:
HADOOP-8052. Hadoop Metrics2 should emit Float.MAX_VALUE (instead of Double.MAX_VALUE) to
avoid making Ganglia's gmetad core. Contributed by Varun Kapoor.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/metrics2/util/SampleStat.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1243205&r1=1243204&r2=1243205&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Sun Feb 12 07:24:43 2012
@@ -159,7 +159,7 @@ Release 1.1.0 - unreleased
     HDFS-2741. Document the max transfer threads property for branch-1. Backport of HDFS-1866.
(Markus Jelsma via harsh)
 
 
-Release 1.0.1 - 2012.02.08
+Release 1.0.1 - 2012.02.12
 
   NEW FEATURES
 
@@ -191,6 +191,10 @@ Release 1.0.1 - 2012.02.08
     HADOOP-8010. hadoop-config.sh errors when HADOOP_HOME_WARN_SUPPRESS is set 
     to true and HADOOP_HOME is present. (Roman Shaposhnik via mattf)
 
+    HADOOP-8052. Hadoop Metrics2 should emit Float.MAX_VALUE (instead of 
+    Double.MAX_VALUE) to avoid making Ganglia's gmetad core. (Varun Kapoor
+    via mattf)
+
 Release 1.0.0 - 2011.12.15
 
   NEW FEATURES

Propchange: hadoop/common/branches/branch-1/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 12 07:24:43 2012
@@ -3,7 +3,7 @@
 /hadoop/common/branches/branch-0.20-security-203/CHANGES.txt:1096071,1097011,1097249,1097269,1097281,1097966,1098816,1098819,1098823,1098827,1098832,1098839,1098854,1098863,1099088,1099191,1099324,1099330,1099333,1102071,1128115
 /hadoop/common/branches/branch-0.20-security-204/CHANGES.txt:1128390,1147228,1148069,1149316,1152887,1154413,1159730,1161741
 /hadoop/common/branches/branch-0.20-security-205/CHANGES.txt:1170696,1171234,1171294,1174368,1174370,1174917,1176042,1176248,1176638,1176645,1200050,1200078,1200199,1202378,1203419,1205530
-/hadoop/common/branches/branch-1.0/CHANGES.txt:1208934,1209370,1211431,1211738,1214655,1214658,1214661,1214675,1238997,1242072
+/hadoop/common/branches/branch-1.0/CHANGES.txt:1208934,1209370,1211431,1211738,1214655,1214658,1214661,1214675,1238997,1242072,1243204
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.19/CHANGES.txt:713112
 /hadoop/core/trunk/CHANGES.txt:727001,727117,727191,727212,727228,727255,727869,728187,729052,729987,732385,732572,732613,732777,732838,732869,733887,734870,734916,735082,736426,738602,738697,739416,740077,740157,741703,741762,743296,743745,743816,743892,744894,745180,745268,746010,746193,746206,746227,746233,746274,746902-746903,746925,746944,746968,746970,747279,747289,747802,748084,748090,748783,749262,749318,749863,750533,752073,752514,752555,752590,752609,752834,752836,752913,752932,753112-753113,753346,754645,754847,754927,755035,755226,755348,755370,755418,755426,755790,755905,755938,755986,755998,756352,757448,757624,757849,758156,758180,759398,759932,760502,760783,761046,761482,761632,762216,762879,763107,763502,764967,765016,765809,765951,771607,772844,772876,772884,772920,773889,776638,778962,778966,779893,781720,784661,785046,785569

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/metrics2/util/SampleStat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/metrics2/util/SampleStat.java?rev=1243205&r1=1243204&r2=1243205&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/metrics2/util/SampleStat.java
(original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/metrics2/util/SampleStat.java
Sun Feb 12 07:24:43 2012
@@ -141,8 +141,16 @@ public class SampleStat {
   @SuppressWarnings("PublicInnerClass")
   public static class MinMax {
 
-    private double min = Double.MAX_VALUE;
-    private double max = Double.MIN_VALUE;
+    // Float.MAX_VALUE is used rather than Double.MAX_VALUE, even though the
+    // min and max variables are of type double.
+    // Float.MAX_VALUE is big enough, and using Double.MAX_VALUE makes 
+    // Ganglia core due to buffer overflow.
+    // The same reasoning applies to the MIN_VALUE counterparts.
+    static final double DEFAULT_MIN_VALUE = Float.MAX_VALUE;
+    static final double DEFAULT_MAX_VALUE = Float.MIN_VALUE;
+
+    private double min = DEFAULT_MIN_VALUE;
+    private double max = DEFAULT_MAX_VALUE;
 
     public void add(double value) {
       if (value > max) max = value;
@@ -153,8 +161,8 @@ public class SampleStat {
     public double max() { return max; }
 
     public void reset() {
-      min = Double.MAX_VALUE;
-      max = Double.MIN_VALUE;
+      min = DEFAULT_MIN_VALUE;
+      max = DEFAULT_MAX_VALUE;
     }
 
     public void reset(MinMax other) {

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java?rev=1243205&r1=1243204&r2=1243205&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/metrics2/util/TestSampleStat.java
Sun Feb 12 07:24:43 2012
@@ -36,8 +36,8 @@ public class TestSampleStat {
     assertEquals("mean", 0.0, stat.mean(), EPSILON);
     assertEquals("variance", 0.0, stat.variance(), EPSILON);
     assertEquals("stddev", 0.0, stat.stddev(), EPSILON);
-    assertEquals("min", Double.MAX_VALUE, stat.min(), EPSILON);
-    assertEquals("max", Double.MIN_VALUE, stat.max(), EPSILON);
+    assertEquals("min", SampleStat.MinMax.DEFAULT_MIN_VALUE, stat.min(), EPSILON);
+    assertEquals("max", SampleStat.MinMax.DEFAULT_MAX_VALUE, stat.max(), EPSILON);
 
     stat.add(3);
     assertEquals("num samples", 1L, stat.numSamples());
@@ -60,8 +60,8 @@ public class TestSampleStat {
     assertEquals("mean", 0.0, stat.mean(), EPSILON);
     assertEquals("variance", 0.0, stat.variance(), EPSILON);
     assertEquals("stddev", 0.0, stat.stddev(), EPSILON);
-    assertEquals("min", Double.MAX_VALUE, stat.min(), EPSILON);
-    assertEquals("max", Double.MIN_VALUE, stat.max(), EPSILON);
+    assertEquals("min", SampleStat.MinMax.DEFAULT_MIN_VALUE, stat.min(), EPSILON);
+    assertEquals("max", SampleStat.MinMax.DEFAULT_MAX_VALUE, stat.max(), EPSILON);
   }
 
 }



Mime
View raw message