use of org.apache.flink.runtime.state.heap.HeapPriorityQueueStateSnapshot in project flink by apache.
the class RocksDBFullSnapshotResources method create.
public static <K> RocksDBFullSnapshotResources<K> create(final LinkedHashMap<String, RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation, // TODO: was it important that this is a LinkedHashMap
final Map<String, HeapPriorityQueueSnapshotRestoreWrapper<?>> registeredPQStates, final RocksDB db, final ResourceGuard rocksDBResourceGuard, final KeyGroupRange keyGroupRange, final TypeSerializer<K> keySerializer, final int keyGroupPrefixBytes, final StreamCompressionDecorator keyGroupCompressionDecorator) throws IOException {
final List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = new ArrayList<>(kvStateInformation.size());
final List<RocksDBKeyedStateBackend.RocksDbKvStateInfo> metaDataCopy = new ArrayList<>(kvStateInformation.size());
for (RocksDBKeyedStateBackend.RocksDbKvStateInfo stateInfo : kvStateInformation.values()) {
// snapshot meta info
stateMetaInfoSnapshots.add(stateInfo.metaInfo.snapshot());
metaDataCopy.add(stateInfo);
}
List<HeapPriorityQueueStateSnapshot<?>> heapPriorityQueuesSnapshots = new ArrayList<>(registeredPQStates.size());
for (HeapPriorityQueueSnapshotRestoreWrapper<?> stateInfo : registeredPQStates.values()) {
stateMetaInfoSnapshots.add(stateInfo.getMetaInfo().snapshot());
heapPriorityQueuesSnapshots.add(stateInfo.stateSnapshot());
}
final ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource();
final Snapshot snapshot = db.getSnapshot();
return new RocksDBFullSnapshotResources<>(lease, snapshot, metaDataCopy, heapPriorityQueuesSnapshots, stateMetaInfoSnapshots, db, keyGroupPrefixBytes, keyGroupRange, keySerializer, keyGroupCompressionDecorator);
}
Aggregations