Package org.apache.hadoop.hbase.client
Class ClientAsyncPrefetchScanner
java.lang.Object
org.apache.hadoop.hbase.client.AbstractClientScanner
org.apache.hadoop.hbase.client.ClientScanner
org.apache.hadoop.hbase.client.ClientSimpleScanner
org.apache.hadoop.hbase.client.ClientAsyncPrefetchScanner
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<Result>,ResultScanner
ClientAsyncPrefetchScanner implements async scanner behaviour. Specifically, the cache used by
this scanner is a concurrent queue which allows both the producer (hbase client) and consumer
(application) to access the queue in parallel. The number of rows returned in a prefetch is
defined by the caching factor and the result size factor. This class allocates a buffer cache,
whose size is a function of both factors. The prefetch is invoked when the cache is half-filled,
instead of waiting for it to be empty. This is defined in the method
prefetchCondition().-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicLongprivate final Lockprivate longprivate final Conditionprivate final ConditionFields inherited from class org.apache.hadoop.hbase.client.ClientScanner
cache, caching, callable, caller, closed, conf, currentRegion, lastNext, lastResult, maxScannerResultSize, pool, primaryOperationTimeout, readRpcTimeout, requestAttributes, rpcControllerFactory, scan, scanMetricsPublished, scannerTimeout, span, tableNameFields inherited from class org.apache.hadoop.hbase.client.AbstractClientScanner
scanMetrics -
Constructor Summary
ConstructorsConstructorDescriptionClientAsyncPrefetchScanner(org.apache.hadoop.conf.Configuration configuration, Scan scan, Scan scanForMetrics, TableName name, ClusterConnection connection, RpcRetryingCallerFactory rpcCallerFactory, RpcControllerFactory rpcControllerFactory, ExecutorService pool, int scanReadRpcTimeout, int scannerTimeout, int replicaCallTimeoutMicroSecondScan, ConnectionConfiguration connectionConfiguration, Map<String, byte[]> requestAttributes) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEstimatedSize(long estimatedSize) voidclose()Closes the scanner and releases any resources it has allocatedprivate voidprotected voidnext()Grab the next row's worth of values.private Resultprivate booleanprivate longresultSize2CacheSize(long maxResultSize) (package private) voidsetPrefetchListener(Consumer<Boolean> prefetchListener) Methods inherited from class org.apache.hadoop.hbase.client.ClientSimpleScanner
createScannerCallable, setNewStartKeyMethods inherited from class org.apache.hadoop.hbase.client.ClientScanner
getCacheCount, getCacheSize, getCaching, getConf, getConnection, getMaxResultSize, getPool, getPrimaryOperationTimeout, getRetries, getScan, getScannerTimeout, getScanReplicaId, getTable, getTimestamp, initSyncCache, isAnyRPCcancelled, loadCache, moveToNextRegion, nextWithSyncCache, renewLease, writeScanMetricsMethods inherited from class org.apache.hadoop.hbase.client.AbstractClientScanner
getScanMetrics, initScanMetricsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.hadoop.hbase.client.ResultScanner
iterator, next
-
Field Details
-
maxCacheSize
-
cacheSizeInBytes
-
exceptionsQueue
-
prefetchListener
-
lock
-
notEmpty
-
notFull
-
-
Constructor Details
-
ClientAsyncPrefetchScanner
public ClientAsyncPrefetchScanner(org.apache.hadoop.conf.Configuration configuration, Scan scan, Scan scanForMetrics, TableName name, ClusterConnection connection, RpcRetryingCallerFactory rpcCallerFactory, RpcControllerFactory rpcControllerFactory, ExecutorService pool, int scanReadRpcTimeout, int scannerTimeout, int replicaCallTimeoutMicroSecondScan, ConnectionConfiguration connectionConfiguration, Map<String, byte[]> requestAttributes) throws IOException- Throws:
IOException
-
-
Method Details
-
setPrefetchListener
-
initCache
- Overrides:
initCachein classClientScanner
-
resultSize2CacheSize
-
next
Description copied from interface:ResultScannerGrab the next row's worth of values. The scanner will return a Result.- Specified by:
nextin interfaceResultScanner- Overrides:
nextin classClientScanner- Returns:
- Result object if there is another row, null if the scanner is exhausted.
- Throws:
IOException- e
-
close
Description copied from interface:ResultScannerCloses the scanner and releases any resources it has allocated- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceResultScanner- Overrides:
closein classClientScanner
-
addEstimatedSize
- Overrides:
addEstimatedSizein classClientScanner
-
handleException
- Throws:
IOException
-
prefetchCondition
-
pollCache
-