HBASE-8264 expose the number of seen KVs from StoreScanner
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1469668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35038df81d
commit
efc32c83ba
|
@ -73,6 +73,12 @@ public class StoreScanner extends NonLazyKeyValueScanner
|
||||||
protected final long oldestUnexpiredTS;
|
protected final long oldestUnexpiredTS;
|
||||||
protected final int minVersions;
|
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. */
|
/** We don't ever expect to change this, the constant is just for clarity. */
|
||||||
static final boolean LAZY_SEEK_ENABLED_BY_DEFAULT = true;
|
static final boolean LAZY_SEEK_ENABLED_BY_DEFAULT = true;
|
||||||
public static final String STORESCANNER_PARALLEL_SEEK_ENABLE =
|
public static final String STORESCANNER_PARALLEL_SEEK_ENABLE =
|
||||||
|
@ -390,6 +396,7 @@ public class StoreScanner extends NonLazyKeyValueScanner
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
LOOP: while((kv = this.heap.peek()) != null) {
|
LOOP: while((kv = this.heap.peek()) != null) {
|
||||||
|
++kvsScanned;
|
||||||
// Check that the heap gives us KVs in an increasing order.
|
// Check that the heap gives us KVs in an increasing order.
|
||||||
assert prevKV == null || comparator == null || comparator.compare(prevKV, kv) <= 0 :
|
assert prevKV == null || comparator == null || comparator.compare(prevKV, kv) <= 0 :
|
||||||
"Key " + prevKV + " followed by a " + "smaller key " + kv + " in cf " + store;
|
"Key " + prevKV + " followed by a " + "smaller key " + kv + " in cf " + store;
|
||||||
|
@ -649,5 +656,12 @@ public class StoreScanner extends NonLazyKeyValueScanner
|
||||||
static void enableLazySeekGlobally(boolean enable) {
|
static void enableLazySeekGlobally(boolean enable) {
|
||||||
lazySeekEnabledGlobally = enable;
|
lazySeekEnabledGlobally = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The estimated number of KVs seen by this scanner (includes some skipped KVs).
|
||||||
|
*/
|
||||||
|
public long getEstimatedNumberOfKvsScanned() {
|
||||||
|
return this.kvsScanned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue