@NotThreadSafe public class RetryingReadRowsOperation extends AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String> implements ScanHandler
AbstractRetryingOperation
that manages retries for the readRows
streaming RPC. This class will keep track of the last returned row key via
ReadRowsRequestManager
and automatically retry from the last row key .AbstractRetryingOperation.GrpcFuture<RespT>
call, callLock, completionFuture, currentBackoff, failedCount, LOG, operationSpan, operationTimerContext, retryExecutorService, retryOptions, rpc, rpcTimerContext, UNARY_DEADLINE_MINUTES
Constructor and Description |
---|
RetryingReadRowsOperation(io.grpc.stub.StreamObserver<FlatRow> observer,
RetryOptions retryOptions,
com.google.bigtable.v2.ReadRowsRequest request,
BigtableAsyncRpc<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse> retryableRpc,
io.grpc.CallOptions callOptions,
ScheduledExecutorService retryExecutorService,
io.grpc.Metadata originalMetadata) |
Modifier and Type | Method and Description |
---|---|
protected void |
finalizeStats(io.grpc.Status status) |
protected com.google.bigtable.v2.ReadRowsRequest |
getRetryRequest()
Updates the original request via
ReadRowsRequestManager.buildUpdatedRequest() . |
void |
handleTimeout(ScanTimeoutException rte)
This gets called by
ResumingStreamingResultScanner when a queue is empty via ResponseQueueReader.getNext() . |
protected boolean |
isRequestRetryable()
All read rows requests are retryable.
|
void |
onClose(io.grpc.Status status,
io.grpc.Metadata trailers) |
void |
onMessage(com.google.bigtable.v2.ReadRowsResponse message) |
protected boolean |
onOK(io.grpc.Metadata trailers)
A subclass has the opportunity to perform the final operations it needs now that the RPC is
successfully complete.
|
protected void |
performRetry(long nextBackOff) |
void |
run()
Calls
BigtableAsyncRpc.newCall(CallOptions) and
BigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall) }
with this as the listener so that retries happen correctly. |
void |
setException(Exception exception) |
void |
setResultObserver(io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse> resultObserver) |
cancel, cancel, getAsyncResult, getBlockingResult, getCallOptions, getExhaustedRetriesException, getNextBackoff, getOriginalRequest, getRunnable, onError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel
public RetryingReadRowsOperation(io.grpc.stub.StreamObserver<FlatRow> observer, RetryOptions retryOptions, com.google.bigtable.v2.ReadRowsRequest request, BigtableAsyncRpc<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse> retryableRpc, io.grpc.CallOptions callOptions, ScheduledExecutorService retryExecutorService, io.grpc.Metadata originalMetadata)
public void setResultObserver(io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse> resultObserver)
protected com.google.bigtable.v2.ReadRowsRequest getRetryRequest()
ReadRowsRequestManager.buildUpdatedRequest()
.getRetryRequest
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
public void run()
AbstractRetryingOperation
BigtableAsyncRpc.newCall(CallOptions)
and
BigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall)
}
with this as the listener so that retries happen correctly.run
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
public void onMessage(com.google.bigtable.v2.ReadRowsResponse message)
onMessage
in class io.grpc.ClientCall.Listener<com.google.bigtable.v2.ReadRowsResponse>
protected void finalizeStats(io.grpc.Status status)
finalizeStats
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
public void onClose(io.grpc.Status status, io.grpc.Metadata trailers)
onClose
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
public void setException(Exception exception)
setException
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
protected boolean isRequestRetryable()
isRequestRetryable
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
protected boolean onOK(io.grpc.Metadata trailers)
onOK
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
public void handleTimeout(ScanTimeoutException rte) throws BigtableRetriesExhaustedException
ResumingStreamingResultScanner
when a queue is empty via ResponseQueueReader.getNext()
.handleTimeout
in interface ScanHandler
rte
- a ScanTimeoutException
BigtableRetriesExhaustedException
protected void performRetry(long nextBackOff)
performRetry
in class AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>