org.apache.flink.queryablestate.exceptions.UnknownKvStateKeyGroupLocationException Java Examples
The following examples show how to use
org.apache.flink.queryablestate.exceptions.UnknownKvStateKeyGroupLocationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KvStateClientProxyHandler.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
private CompletableFuture<KvStateResponse> getState( final KvStateRequest request, final boolean forceUpdate) { return getKvStateLookupInfo(request.getJobId(), request.getStateName(), forceUpdate) .thenComposeAsync((Function<KvStateLocation, CompletableFuture<KvStateResponse>>) location -> { final int keyGroupIndex = KeyGroupRangeAssignment.computeKeyGroupForKeyHash( request.getKeyHashCode(), location.getNumKeyGroups()); final InetSocketAddress serverAddress = location.getKvStateServerAddress(keyGroupIndex); if (serverAddress == null) { return FutureUtils.completedExceptionally(new UnknownKvStateKeyGroupLocationException(getServerName())); } else { // Query server final KvStateID kvStateId = location.getKvStateID(keyGroupIndex); final KvStateInternalRequest internalRequest = new KvStateInternalRequest( kvStateId, request.getSerializedKeyAndNamespace()); return kvStateClient.sendRequest(serverAddress, internalRequest); } }, queryExecutor); }
Example #2
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 6 votes |
private CompletableFuture<KvStateResponse> getState( final KvStateRequest request, final boolean forceUpdate) { return getKvStateLookupInfo(request.getJobId(), request.getStateName(), forceUpdate) .thenComposeAsync((Function<KvStateLocation, CompletableFuture<KvStateResponse>>) location -> { final int keyGroupIndex = KeyGroupRangeAssignment.computeKeyGroupForKeyHash( request.getKeyHashCode(), location.getNumKeyGroups()); final InetSocketAddress serverAddress = location.getKvStateServerAddress(keyGroupIndex); if (serverAddress == null) { return FutureUtils.completedExceptionally(new UnknownKvStateKeyGroupLocationException(getServerName())); } else { // Query server final KvStateID kvStateId = location.getKvStateID(keyGroupIndex); final KvStateInternalRequest internalRequest = new KvStateInternalRequest( kvStateId, request.getSerializedKeyAndNamespace()); return kvStateClient.sendRequest(serverAddress, internalRequest); } }, queryExecutor); }
Example #3
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 6 votes |
private CompletableFuture<KvStateResponse> getState( final KvStateRequest request, final boolean forceUpdate) { return getKvStateLookupInfo(request.getJobId(), request.getStateName(), forceUpdate) .thenComposeAsync((Function<KvStateLocation, CompletableFuture<KvStateResponse>>) location -> { final int keyGroupIndex = KeyGroupRangeAssignment.computeKeyGroupForKeyHash( request.getKeyHashCode(), location.getNumKeyGroups()); final InetSocketAddress serverAddress = location.getKvStateServerAddress(keyGroupIndex); if (serverAddress == null) { return FutureUtils.completedExceptionally(new UnknownKvStateKeyGroupLocationException(getServerName())); } else { // Query server final KvStateID kvStateId = location.getKvStateID(keyGroupIndex); final KvStateInternalRequest internalRequest = new KvStateInternalRequest( kvStateId, request.getSerializedKeyAndNamespace()); return kvStateClient.sendRequest(serverAddress, internalRequest); } }, queryExecutor); }
Example #4
Source File: KvStateClientProxyHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void executeActionAsync( final CompletableFuture<KvStateResponse> result, final KvStateRequest request, final boolean update) { if (!result.isDone()) { final CompletableFuture<KvStateResponse> operationFuture = getState(request, update); operationFuture.whenCompleteAsync( (t, throwable) -> { if (throwable != null) { if ( throwable.getCause() instanceof UnknownKvStateIdException || throwable.getCause() instanceof UnknownKvStateKeyGroupLocationException || throwable.getCause() instanceof ConnectException ) { // These failures are likely to be caused by out-of-sync // KvStateLocation. Therefore we retry this query and // force look up the location. LOG.debug("Retrying after failing to retrieve state due to: {}.", throwable.getCause().getMessage()); executeActionAsync(result, request, true); } else { result.completeExceptionally(throwable); } } else { result.complete(t); } }, queryExecutor); result.whenComplete( (t, throwable) -> operationFuture.cancel(false)); } }
Example #5
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 5 votes |
private void executeActionAsync( final CompletableFuture<KvStateResponse> result, final KvStateRequest request, final boolean update) { if (!result.isDone()) { final CompletableFuture<KvStateResponse> operationFuture = getState(request, update); operationFuture.whenCompleteAsync( (t, throwable) -> { if (throwable != null) { if ( throwable.getCause() instanceof UnknownKvStateIdException || throwable.getCause() instanceof UnknownKvStateKeyGroupLocationException || throwable.getCause() instanceof ConnectException ) { // These failures are likely to be caused by out-of-sync // KvStateLocation. Therefore we retry this query and // force look up the location. LOG.debug("Retrying after failing to retrieve state due to: {}.", throwable.getCause().getMessage()); executeActionAsync(result, request, true); } else { result.completeExceptionally(throwable); } } else { result.complete(t); } }, queryExecutor); result.whenComplete( (t, throwable) -> operationFuture.cancel(false)); } }
Example #6
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 5 votes |
private void executeActionAsync( final CompletableFuture<KvStateResponse> result, final KvStateRequest request, final boolean update) { if (!result.isDone()) { final CompletableFuture<KvStateResponse> operationFuture = getState(request, update); operationFuture.whenCompleteAsync( (t, throwable) -> { if (throwable != null) { if ( throwable.getCause() instanceof UnknownKvStateIdException || throwable.getCause() instanceof UnknownKvStateKeyGroupLocationException || throwable.getCause() instanceof ConnectException ) { // These failures are likely to be caused by out-of-sync // KvStateLocation. Therefore we retry this query and // force look up the location. LOG.debug("Retrying after failing to retrieve state due to: {}.", throwable.getCause().getMessage()); executeActionAsync(result, request, true); } else { result.completeExceptionally(throwable); } } else { result.complete(t); } }, queryExecutor); result.whenComplete( (t, throwable) -> operationFuture.cancel(false)); } }