use of org.apache.flink.migration.runtime.state.memory.MigrationRestoreSnapshot in project flink by apache.
the class HeapKeyedStateBackend method restoreOldSavepointKeyedState.
@SuppressWarnings({ "unchecked", "rawtypes", "DeprecatedIsStillUsed" })
@Deprecated
private void restoreOldSavepointKeyedState(Collection<KeyGroupsStateHandle> stateHandles) throws IOException, ClassNotFoundException {
if (stateHandles.isEmpty()) {
return;
}
Preconditions.checkState(1 == stateHandles.size(), "Only one element expected here.");
HashMap<String, KvStateSnapshot<K, ?, ?, ?>> namedStates;
try (FSDataInputStream inputStream = stateHandles.iterator().next().openInputStream()) {
namedStates = InstantiationUtil.deserializeObject(inputStream, userCodeClassLoader);
}
for (Map.Entry<String, KvStateSnapshot<K, ?, ?, ?>> nameToState : namedStates.entrySet()) {
final String stateName = nameToState.getKey();
final KvStateSnapshot<K, ?, ?, ?> genericSnapshot = nameToState.getValue();
if (genericSnapshot instanceof MigrationRestoreSnapshot) {
MigrationRestoreSnapshot<K, ?, ?> stateSnapshot = (MigrationRestoreSnapshot<K, ?, ?>) genericSnapshot;
final StateTable rawResultMap = stateSnapshot.deserialize(stateName, this);
// add named state to the backend
stateTables.put(stateName, rawResultMap);
} else {
throw new IllegalStateException("Unknown state: " + genericSnapshot);
}
}
}
Aggregations