use of org.apache.flink.runtime.state.SavepointKeyedStateHandle in project flink by apache.
the class HeapKeyedStateBackendBuilder method restoreState.
private void restoreState(Map<String, StateTable<K, ?, ?>> registeredKVStates, Map<String, HeapPriorityQueueSnapshotRestoreWrapper<?>> registeredPQStates, InternalKeyContext<K> keyContext, StateTableFactory<K> stateTableFactory) throws BackendBuildingException {
final RestoreOperation<Void> restoreOperation;
final KeyedStateHandle firstHandle;
if (restoreStateHandles.isEmpty()) {
firstHandle = null;
} else {
firstHandle = restoreStateHandles.iterator().next();
}
if (firstHandle instanceof SavepointKeyedStateHandle) {
restoreOperation = new HeapSavepointRestoreOperation<>(restoreStateHandles, keySerializerProvider, userCodeClassLoader, registeredKVStates, registeredPQStates, priorityQueueSetFactory, keyGroupRange, numberOfKeyGroups, stateTableFactory, keyContext);
} else {
restoreOperation = new HeapRestoreOperation<>(restoreStateHandles, keySerializerProvider, userCodeClassLoader, registeredKVStates, registeredPQStates, cancelStreamRegistry, priorityQueueSetFactory, keyGroupRange, numberOfKeyGroups, stateTableFactory, keyContext);
}
try {
restoreOperation.restore();
logger.info("Finished to build heap keyed state-backend.");
} catch (Exception e) {
throw new BackendBuildingException("Failed when trying to restore heap backend", e);
}
}
Aggregations