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
ResultScanner
s made by
Table
. Passed to a retrying caller such as RpcRetryingCaller
so fails are
retried.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
protected boolean
protected Cursor
protected boolean
Saves whether or not the most recent response from the server was a heartbeat message.protected final int
protected boolean
protected boolean
static final org.slf4j.Logger
static final String
static final String
private int
private boolean
private ScannerCallable.MoreResults
private ScannerCallable.MoreResults
private long
protected boolean
protected final RpcControllerFactory
protected final Scan
protected ScanMetrics
protected long
Fields inherited from class org.apache.hadoop.hbase.client.RegionServerCallable
location, requestAttributes, rpcController, stub
-
Constructor Summary
ConstructorDescriptionScannerCallable
(ClusterConnection connection, TableName tableName, Scan scan, ScanMetrics scanMetrics, RpcControllerFactory rpcControllerFactory, int id, Map<String, byte[]> requestAttributes) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
compare the local machine hostname with region server's hostname to decide if hbase client connects to a remote region serverprivate void
close()
int
Get the number of rows that will be fetched on nextReturns the HRegionInfo for the current regionprotected final HRegionLocation
protected final RegionLocations
getRegionLocationsForPrepare
(byte[] row) Fetch region locations for the row.protected Scan
getScan()
getScannerCallableForReplica
(int id) (package private) boolean
(package private) ScannerCallable.MoreResults
Should the client attempt to fetch more results for the whole scan.(package private) ScannerCallable.MoreResults
Should the client attempt to fetch more results from this regionprivate org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse
next()
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse
void
prepare
(boolean reload) Prepare by setting up any connections to servers, etc., ahead of call invocation.protected Result[]
rpcCall()
Run the RPC call.private void
void
setCaching
(int caching) Set the number of rows that will be fetched on nextvoid
setClose()
Call this when the next invocation of call should close the scannerprivate void
setHeartbeatMessage
(boolean heartbeatMessage) (package private) void
setMoreResultsForScan
(ScannerCallable.MoreResults moreResults) (package private) void
setMoreResultsInRegion
(ScannerCallable.MoreResults moreResults) void
setRenew
(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, setStubByServiceName
Methods 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:RetryingCallable
Prepare by setting up any connections to servers, etc., ahead of call invocation. TODO: We call prepare before EVERY call. Seems wrong. FIX!!!!- Specified by:
prepare
in interfaceRetryingCallable<Result[]>
- Overrides:
prepare
in 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:RegionServerCallable
Run 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:
rpcCall
in 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:
getHRegionInfo
in 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
-