You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by se...@apache.org on 2013/04/19 22:43:38 UTC

svn commit: r1470032 - /hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java

Author: sershe
Date: Fri Apr 19 20:43:38 2013
New Revision: 1470032

URL: http://svn.apache.org/r1470032
Log:
HBASE-8264 expose the number of seen KVs from StoreScanner

Modified:
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java?rev=1470032&r1=1470031&r2=1470032&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java Fri Apr 19 20:43:38 2013
@@ -73,6 +73,12 @@ public class StoreScanner extends NonLaz
   protected final long oldestUnexpiredTS;
   protected final int minVersions;
 
+  /**
+   * The number of KVs seen by the scanner. Includes explicitly skipped KVs, but not
+   * KVs skipped via seeking to next row/column. TODO: estimate them?
+   */
+  private long kvsScanned = 0;
+
   /** We don't ever expect to change this, the constant is just for clarity. */
   static final boolean LAZY_SEEK_ENABLED_BY_DEFAULT = true;
   public static final String STORESCANNER_PARALLEL_SEEK_ENABLE =
@@ -390,6 +396,7 @@ public class StoreScanner extends NonLaz
 
     int count = 0;
     LOOP: while((kv = this.heap.peek()) != null) {
+      ++kvsScanned;
       // Check that the heap gives us KVs in an increasing order.
       assert prevKV == null || comparator == null || comparator.compare(prevKV, kv) <= 0 :
         "Key " + prevKV + " followed by a " + "smaller key " + kv + " in cf " + store;
@@ -649,5 +656,12 @@ public class StoreScanner extends NonLaz
   static void enableLazySeekGlobally(boolean enable) {
     lazySeekEnabledGlobally = enable;
   }
+
+  /**
+   * @return The estimated number of KVs seen by this scanner (includes some skipped KVs).
+   */
+  public long getEstimatedNumberOfKvsScanned() {
+    return this.kvsScanned;
+  }
 }