use of io.dingodb.store.row.cmd.store.GetRequest in project dingo by dingodb.
the class DefaultDingoRowStore method internalGet.
private void internalGet(final byte[] key, final boolean readOnlySafe, final CompletableFuture<byte[]> future, final int retriesLeft, final Errors lastCause, final boolean requireLeader) {
final Region region = this.pdClient.findRegionByKey(key, ErrorsHelper.isInvalidEpoch(lastCause));
final RegionEngine regionEngine = getRegionEngine(region.getId(), requireLeader);
// require leader on retry
final RetryRunner retryRunner = retryCause -> internalGet(key, readOnlySafe, future, retriesLeft - 1, retryCause, true);
final FailoverClosure<byte[]> closure = new FailoverClosureImpl<>(future, retriesLeft, retryRunner);
if (regionEngine != null) {
if (ensureOnValidEpoch(region, regionEngine, closure)) {
getRawKVStore(regionEngine).get(key, readOnlySafe, closure);
}
} else {
final GetRequest request = new GetRequest();
request.setKey(key);
request.setReadOnlySafe(readOnlySafe);
request.setRegionId(region.getId());
request.setRegionEpoch(region.getRegionEpoch());
this.dingoRowStoreRpcService.callAsyncWithRpc(request, closure, lastCause, requireLeader);
}
}
Aggregations