Package org.apache.hadoop.hbase.client
Class ScannerCallable
java.lang.Object
org.apache.hadoop.hbase.client.RegionServerCallable<T,org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface>
org.apache.hadoop.hbase.client.ClientServiceCallable<Result[]>
org.apache.hadoop.hbase.client.ScannerCallable
- All Implemented Interfaces:
RetryingCallable<Result[]>
- Direct Known Subclasses:
ReversedScannerCallable
Scanner operations such as create, next, etc. Used by
ResultScanners made by
Table. Passed to a retrying caller such as RpcRetryingCaller so fails are
retried.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprotected booleanprotected Cursorprotected booleanSaves whether or not the most recent response from the server was a heartbeat message.protected final intprotected booleanprotected booleanstatic final org.slf4j.Loggerstatic final Stringstatic final Stringprivate intprivate booleanprivate ScannerCallable.MoreResultsprivate ScannerCallable.MoreResultsprivate longprotected booleanprotected final RpcControllerFactoryprotected final Scanprotected ScanMetricsprotected longFields inherited from class org.apache.hadoop.hbase.client.RegionServerCallable
location, requestAttributes, rpcController, stub -
Constructor Summary
ConstructorsConstructorDescriptionScannerCallable(ClusterConnection connection, TableName tableName, Scan scan, ScanMetrics scanMetrics, RpcControllerFactory rpcControllerFactory, int id, Map<String, byte[]> requestAttributes) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcompare the local machine hostname with region server's hostname to decide if hbase client connects to a remote region serverprivate voidclose()intGet the number of rows that will be fetched on nextReturns the HRegionInfo for the current regionprotected final HRegionLocationprotected final RegionLocationsgetRegionLocationsForPrepare(byte[] row) Fetch region locations for the row.protected ScangetScan()getScannerCallableForReplica(int id) (package private) boolean(package private) ScannerCallable.MoreResultsShould the client attempt to fetch more results for the whole scan.(package private) ScannerCallable.MoreResultsShould the client attempt to fetch more results from this regionprivate org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponsenext()private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponsevoidprepare(boolean reload) Prepare by setting up any connections to servers, etc., ahead of call invocation.protected Result[]rpcCall()Run the RPC call.private voidvoidsetCaching(int caching) Set the number of rows that will be fetched on nextvoidsetClose()Call this when the next invocation of call should close the scannerprivate voidsetHeartbeatMessage(boolean heartbeatMessage) (package private) voidsetMoreResultsForScan(ScannerCallable.MoreResults moreResults) (package private) voidsetMoreResultsInRegion(ScannerCallable.MoreResults moreResults) voidsetRenew(boolean val) Indicate whether we make a call only to renew the lease, but without affected the scanner in any other way.Methods inherited from class org.apache.hadoop.hbase.client.ClientServiceCallable
doGet, doMutate, setStubByServiceNameMethods inherited from class org.apache.hadoop.hbase.client.RegionServerCallable
call, getConnection, getExceptionMessageAdditionalDetail, getLocation, getPriority, getRow, getRpcController, getRpcControllerCellScanner, getStub, getTableName, setLocation, setRpcControllerCellScanner, setStub, sleep, throwable
-
Field Details
-
LOG_SCANNER_LATENCY_CUTOFF
- See Also:
-
LOG_SCANNER_ACTIVITY
- See Also:
-
LOG
-
scannerId
-
instantiated
-
closed
-
renew
-
scan
-
caching
-
scanMetrics
-
logScannerActivity
-
logCutOffLatency
-
id
-
moreResultsInRegion
-
moreResultsForScan
-
heartbeatMessage
Saves whether or not the most recent response from the server was a heartbeat message. Heartbeat messages are identified by the flagClientProtos.ScanResponse.getHeartbeatMessage() -
cursor
-
isRegionServerRemote
-
nextCallSeq
-
rpcControllerFactory
-
-
Constructor Details
-
ScannerCallable
public ScannerCallable(ClusterConnection connection, TableName tableName, Scan scan, ScanMetrics scanMetrics, RpcControllerFactory rpcControllerFactory, int id, Map<String, byte[]> requestAttributes) - Parameters:
connection- which connectiontableName- table callable is onscan- the scan to executescanMetrics- the ScanMetrics to used, if it is null, ScannerCallable won't collect metricsrpcControllerFactory- factory to use when creatingRpcController
-
-
Method Details
-
getLocationForReplica
- Throws:
HBaseIOException
-
getRegionLocationsForPrepare
Fetch region locations for the row. Since this is for prepare, we always useCache. This is because we can be sure that RpcRetryingCaller will have cleared the cache in error handling if this is a retry.- Parameters:
row- the row to look up region location for- Throws:
IOException
-
prepare
Description copied from interface:RetryingCallablePrepare by setting up any connections to servers, etc., ahead of call invocation. TODO: We call prepare before EVERY call. Seems wrong. FIX!!!!- Specified by:
preparein interfaceRetryingCallable<Result[]>- Overrides:
preparein classRegionServerCallable<Result[],org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface> - Parameters:
reload- force reload of server location- Throws:
IOException- e
-
checkIfRegionServerIsRemote
compare the local machine hostname with region server's hostname to decide if hbase client connects to a remote region server -
next
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse next() throws IOException- Throws:
IOException
-
setAlreadyClosed
-
rpcCall
Description copied from class:RegionServerCallableRun the RPC call. Implement this method. To get at the rpcController that has been created and configured to make this rpc call, use getRpcController(). We are trying to contain rpcController references so we don't pollute codebase with protobuf references; keep the protobuf references contained and only present in a few classes rather than all about the code base.- Specified by:
rpcCallin classRegionServerCallable<Result[],org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface> - Throws:
Exception
-
isHeartbeatMessage
boolean isHeartbeatMessage()- Returns:
- true when the most recent RPC response indicated that the response was a heartbeat message. Heartbeat messages are sent back from the server when the processing of the scan request exceeds a certain time threshold. Heartbeats allow the server to avoid timeouts during long running scan operations.
-
getCursor
-
setHeartbeatMessage
-
close
-
openScanner
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse openScanner() throws IOException- Throws:
IOException
-
getScan
-
setClose
Call this when the next invocation of call should close the scanner -
setRenew
Indicate whether we make a call only to renew the lease, but without affected the scanner in any other way.- Parameters:
val- true if only the lease should be renewed
-
getHRegionInfo
Returns the HRegionInfo for the current region- Overrides:
getHRegionInfoin classRegionServerCallable<Result[],org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface>
-
getCaching
Get the number of rows that will be fetched on next- Returns:
- the number of rows for caching
-
setCaching
Set the number of rows that will be fetched on next- Parameters:
caching- the number of rows for caching
-
getScannerCallableForReplica
-
moreResultsInRegion
Should the client attempt to fetch more results from this region -
setMoreResultsInRegion
-
moreResultsForScan
Should the client attempt to fetch more results for the whole scan. -
setMoreResultsForScan
-