hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/5] hbase git commit: HBASE-13312 SmallScannerCallable does not increment scan metrics
Date Fri, 01 May 2015 23:33:32 GMT
HBASE-13312 SmallScannerCallable does not increment scan metrics


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

Branch: refs/heads/branch-1.0
Commit: 7a2e7724450ce902de271cb8d8e729f669f33ee8
Parents: 099fff5
Author: Andrew Purtell <apurtell@apache.org>
Authored: Fri May 1 16:33:12 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri May 1 16:33:12 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/client/ClientSmallScanner.java |  2 ++
 .../hadoop/hbase/client/ScannerCallable.java    |  2 +-
 .../hadoop/hbase/client/TestFromClientSide.java | 33 ++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7a2e7724/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
index 5600562..13af38a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
@@ -208,6 +208,8 @@ public class ClientSmallScanner extends ClientScanner {
         } else {
           setHasMoreResultsContext(false);
         }
+        // We need to update result metrics since we are overriding call()
+        updateResultsMetrics(results);
         return results;
       } catch (ServiceException se) {
         throw ProtobufUtil.getRemoteException(se);

http://git-wip-us.apache.org/repos/asf/hbase/blob/7a2e7724/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
index 9c5cacf..e5e19df 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
@@ -299,7 +299,7 @@ public class ScannerCallable extends RegionServerCallable<Result[]>
{
     }
   }
 
-  private void updateResultsMetrics(Result[] rrs) {
+  protected void updateResultsMetrics(Result[] rrs) {
     if (this.scanMetrics == null || rrs == null || rrs.length == 0) {
       return;
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/7a2e7724/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index 9175d7d..f1eb053 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -5098,6 +5098,39 @@ public class TestFromClientSide {
     assertEquals("Did not access all the regions in the table", numOfRegions,
         scanMetrics.countOfRegions.get());
 
+    // check byte counters
+    scan2 = new Scan();
+    scan2.setScanMetricsEnabled(true);
+    scan2.setCaching(1);
+    scanner = ht.getScanner(scan2);
+    int numBytes = 0;
+    for (Result result : scanner.next(1)) {
+      for (Cell cell: result.listCells()) {
+        numBytes += CellUtil.estimatedSerializedSizeOf(cell);
+      }
+    }
+    scanner.close();
+    scanMetrics = scan2.getScanMetrics();
+    assertEquals("Did not count the result bytes", numBytes,
+      scanMetrics.countOfBytesInResults.get());
+
+    // check byte counters on a small scan
+    scan2 = new Scan();
+    scan2.setScanMetricsEnabled(true);
+    scan2.setCaching(1);
+    scan2.setSmall(true);
+    scanner = ht.getScanner(scan2);
+    numBytes = 0;
+    for (Result result : scanner.next(1)) {
+      for (Cell cell: result.listCells()) {
+        numBytes += CellUtil.estimatedSerializedSizeOf(cell);
+      }
+    }
+    scanner.close();
+    scanMetrics = scan2.getScanMetrics();
+    assertEquals("Did not count the result bytes", numBytes,
+      scanMetrics.countOfBytesInResults.get());
+
     // now, test that the metrics are still collected even if you don't call close, but do
     // run past the end of all the records
     /** There seems to be a timing issue here.  Comment out for now. Fix when time.


Mime
View raw message