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 04:29:54 UTC
svn commit: r1469668 -
/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
Author: sershe
Date: Fri Apr 19 02:29:54 2013
New Revision: 1469668
URL: http://svn.apache.org/r1469668
Log:
HBASE-8264 expose the number of seen KVs from StoreScanner
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java?rev=1469668&r1=1469667&r2=1469668&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java Fri Apr 19 02:29:54 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;
+ }
}