hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject git commit: HBASE-11767 [0.94] Unnecessary garbage produced by schema metrics during scanning.
Date Sun, 17 Aug 2014 04:52:07 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.94 dfcf767ae -> 0ea4b86b0


HBASE-11767 [0.94] Unnecessary garbage produced by schema metrics during scanning.


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

Branch: refs/heads/0.94
Commit: 0ea4b86b07b32d46b23f4f35de032370d64dd021
Parents: dfcf767
Author: Lars Hofhansl <larsh@apache.org>
Authored: Sat Aug 16 21:51:51 2014 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Sat Aug 16 21:51:51 2014 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/regionserver/HRegionServer.java   |  4 ++--
 .../apache/hadoop/hbase/regionserver/StoreScanner.java    | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0ea4b86b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index e6622a0..ed278c7 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -2679,7 +2679,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
         }
         if (bypass != null) {
           return s.isFilterDone() && results.isEmpty() ? null
-              : results.toArray(new Result[0]);
+              : results.toArray(new Result[results.size()]);
         }
       }
 
@@ -2722,7 +2722,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
       // and wants to tell the client to stop the scan. This is done by passing
       // a null result.
       return s.isFilterDone() && results.isEmpty() ? null
-          : results.toArray(new Result[0]);
+          : results.toArray(new Result[results.size()]);
     } catch (Throwable t) {
       if (t instanceof NotServingRegionException && scannerName != null) {
         this.scanners.remove(scannerName);

http://git-wip-us.apache.org/repos/asf/hbase/blob/0ea4b86b/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
index 6cb9711..c4ee384 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
@@ -53,6 +53,7 @@ public class StoreScanner extends NonLazyKeyValueScanner
 
 
   private String metricNamePrefix;
+  private String metricNamePrefixNext;
   // Used to indicate that the scanner has closed (see HBASE-1107)
   // Doesnt need to be volatile because it's always accessed via synchronized methods
   private boolean closing = false;
@@ -455,8 +456,13 @@ public class StoreScanner extends NonLazyKeyValueScanner
       }
     } finally {
       if (cumulativeMetric > 0 && metric != null) {
-        RegionMetricsStorage.incrNumericMetric(this.metricNamePrefix + metric,
-            cumulativeMetric);
+        // OK to use identity here
+        if (metric == SchemaMetrics.METRIC_NEXTSIZE) {
+          if (metricNamePrefixNext == null) metricNamePrefixNext = metricNamePrefix + metric;
+          RegionMetricsStorage.incrNumericMetric(metricNamePrefixNext, cumulativeMetric);
+        } else {
+          RegionMetricsStorage.incrNumericMetric(metricNamePrefix + metric, cumulativeMetric);
+        }
       }
     }
 


Mime
View raw message