hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-15222 Addendum - Use less contended classes for metrics
Date Thu, 25 Feb 2016 17:36:21 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 04a3b2733 -> 7c290e922


HBASE-15222 Addendum - Use less contended classes for metrics


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7c290e92
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7c290e92
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7c290e92

Branch: refs/heads/branch-1
Commit: 7c290e922a58f0e4d889b3e323152322152722a1
Parents: 04a3b27
Author: Elliott Clark <eclark@apache.org>
Authored: Thu Feb 25 09:08:11 2016 -0800
Committer: Elliott Clark <eclark@apache.org>
Committed: Thu Feb 25 09:34:47 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/FastLongHistogram.java   | 10 +++-------
 .../org/apache/hadoop/metrics2/lib/MutableHistogram.java  |  4 +++-
 .../apache/hadoop/metrics2/lib/MutableRangeHistogram.java |  6 ++++--
 3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7c290e92/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
index 78b2bf0..9b403d9 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
@@ -310,12 +310,8 @@ public class FastLongHistogram {
    * Resets the histogram for new counting.
    */
   public FastLongHistogram reset() {
-    if (this.bins.hasData.get()) {
-      Bins oldBins = this.bins;
-      this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
-      return new FastLongHistogram(oldBins);
-    }
-
-    return null;
+    Bins oldBins = this.bins;
+    this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
+    return new FastLongHistogram(oldBins);
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/7c290e92/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
index a6f0d14..b04ad6b 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
@@ -65,7 +65,9 @@ public class MutableHistogram extends MutableMetric implements MetricHistogram
{
   public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all)
{
     // Get a reference to the old histogram.
     FastLongHistogram histo = histogram.reset();
-    updateSnapshotMetrics(metricsRecordBuilder, histo);
+    if (histo != null) {
+      updateSnapshotMetrics(metricsRecordBuilder, histo);
+    }
   }
 
   protected void updateSnapshotMetrics(MetricsRecordBuilder metricsRecordBuilder,

http://git-wip-us.apache.org/repos/asf/hbase/blob/7c290e92/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
index ac8aee0..13187af 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
@@ -56,8 +56,10 @@ public abstract class MutableRangeHistogram extends MutableHistogram implements
   public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all)
{
     // Get a reference to the old histogram.
     FastLongHistogram histo = histogram.reset();
-    updateSnapshotMetrics(metricsRecordBuilder, histo);
-    updateSnapshotRangeMetrics(metricsRecordBuilder, histo);
+    if (histo != null) {
+      updateSnapshotMetrics(metricsRecordBuilder, histo);
+      updateSnapshotRangeMetrics(metricsRecordBuilder, histo);
+    }
   }
 
   public void updateSnapshotRangeMetrics(MetricsRecordBuilder metricsRecordBuilder,


Mime
View raw message