org.apache.flink.runtime.state.IncrementalKeyedStateHandle Java Examples
The following examples show how to use
org.apache.flink.runtime.state.IncrementalKeyedStateHandle.
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: RocksDBCheckpointIterator.java From bravo with Apache License 2.0 | 6 votes |
public RocksDBCheckpointIterator(IncrementalKeyedStateHandle handle, FilterFunction<String> stateFilter, String localPath) { this.localPath = localPath; this.cancelStreamRegistry = new CloseableRegistry(); List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = StateMetadataUtils .getKeyedBackendSerializationProxy(handle.getMetaStateHandle()).getStateMetaInfoSnapshots(); stateColumnFamilyHandles = new ArrayList<>(stateMetaInfoSnapshots.size() + 1); List<ColumnFamilyDescriptor> stateColumnFamilyDescriptors = createAndRegisterColumnFamilyDescriptors( stateMetaInfoSnapshots); try { transferAllStateDataToDirectory(handle, new Path(localPath)); this.db = openDB(localPath, stateColumnFamilyDescriptors, stateColumnFamilyHandles); createColumnIterators(stateFilter, stateMetaInfoSnapshots); } catch (Exception e) { throw new IllegalStateException(e); } }
Example #2
Source File: RocksDBIncrementalRestoreOperation.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void restorePreviousIncrementalFilesStatus(IncrementalKeyedStateHandle localKeyedStateHandle) { backendUID = localKeyedStateHandle.getBackendIdentifier(); restoredSstFiles.put( localKeyedStateHandle.getCheckpointId(), localKeyedStateHandle.getSharedStateHandleIDs()); lastCompletedCheckpointId = localKeyedStateHandle.getCheckpointId(); }
Example #3
Source File: RocksDBIncrementalRestoreOperation.java From flink with Apache License 2.0 | 5 votes |
private void restorePreviousIncrementalFilesStatus(IncrementalKeyedStateHandle localKeyedStateHandle) { backendUID = localKeyedStateHandle.getBackendIdentifier(); restoredSstFiles.put( localKeyedStateHandle.getCheckpointId(), localKeyedStateHandle.getSharedStateHandleIDs()); lastCompletedCheckpointId = localKeyedStateHandle.getCheckpointId(); }
Example #4
Source File: StateMetadataUtils.java From bravo with Apache License 2.0 | 5 votes |
public static Optional<KeyedBackendSerializationProxy<?>> getKeyedBackendSerializationProxy(OperatorState opState) { try { KeyedStateHandle firstHandle = opState.getStates().iterator().next().getManagedKeyedState().iterator() .next(); if (firstHandle instanceof IncrementalKeyedStateHandle) { return Optional.of(getKeyedBackendSerializationProxy( ((IncrementalKeyedStateHandle) firstHandle).getMetaStateHandle())); } else { return Optional.of(getKeyedBackendSerializationProxy((StreamStateHandle) firstHandle)); } } catch (Exception e) { return Optional.empty(); } }
Example #5
Source File: RocksDBCheckpointIterator.java From bravo with Apache License 2.0 | 5 votes |
private void transferAllStateDataToDirectory( IncrementalKeyedStateHandle restoreStateHandle, Path dest) throws IOException { final Map<StateHandleID, StreamStateHandle> sstFiles = restoreStateHandle.getSharedState(); final Map<StateHandleID, StreamStateHandle> miscFiles = restoreStateHandle.getPrivateState(); transferAllDataFromStateHandles(sstFiles, dest); transferAllDataFromStateHandles(miscFiles, dest); }
Example #6
Source File: RocksDBIncrementalRestoreOperation.java From flink with Apache License 2.0 | 5 votes |
private void restorePreviousIncrementalFilesStatus(IncrementalKeyedStateHandle localKeyedStateHandle) { backendUID = localKeyedStateHandle.getBackendIdentifier(); restoredSstFiles.put( localKeyedStateHandle.getCheckpointId(), localKeyedStateHandle.getSharedStateHandleIDs()); lastCompletedCheckpointId = localKeyedStateHandle.getCheckpointId(); }
Example #7
Source File: RocksDBKeyedStateBackendBuilder.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
private AbstractRocksDBRestoreOperation<K> getRocksDBRestoreOperation( int keyGroupPrefixBytes, CloseableRegistry cancelStreamRegistry, LinkedHashMap<String, RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation, RocksDbTtlCompactFiltersManager ttlCompactFiltersManager) { if (restoreStateHandles.isEmpty()) { return new RocksDBNoneRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } KeyedStateHandle firstStateHandle = restoreStateHandles.iterator().next(); if (firstStateHandle instanceof IncrementalKeyedStateHandle) { return new RocksDBIncrementalRestoreOperation<>( operatorIdentifier, keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } else { return new RocksDBFullRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } }
Example #8
Source File: RocksDBKeyedStateBackendBuilder.java From flink with Apache License 2.0 | 4 votes |
private AbstractRocksDBRestoreOperation<K> getRocksDBRestoreOperation( int keyGroupPrefixBytes, CloseableRegistry cancelStreamRegistry, LinkedHashMap<String, RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation, RocksDbTtlCompactFiltersManager ttlCompactFiltersManager) { if (restoreStateHandles.isEmpty()) { return new RocksDBNoneRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } KeyedStateHandle firstStateHandle = restoreStateHandles.iterator().next(); if (firstStateHandle instanceof IncrementalKeyedStateHandle) { return new RocksDBIncrementalRestoreOperation<>( operatorIdentifier, keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } else { return new RocksDBFullRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } }
Example #9
Source File: RocksDBKeyedStateBackendBuilder.java From flink with Apache License 2.0 | 4 votes |
private AbstractRocksDBRestoreOperation<K> getRocksDBRestoreOperation( int keyGroupPrefixBytes, CloseableRegistry cancelStreamRegistry, LinkedHashMap<String, RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation, RocksDbTtlCompactFiltersManager ttlCompactFiltersManager) { DBOptions dbOptions = optionsContainer.getDbOptions(); if (restoreStateHandles.isEmpty()) { return new RocksDBNoneRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager); } KeyedStateHandle firstStateHandle = restoreStateHandles.iterator().next(); if (firstStateHandle instanceof IncrementalKeyedStateHandle) { return new RocksDBIncrementalRestoreOperation<>( operatorIdentifier, keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager, writeBatchSize); } else { return new RocksDBFullRestoreOperation<>( keyGroupRange, keyGroupPrefixBytes, numberOfTransferingThreads, cancelStreamRegistry, userCodeClassLoader, kvStateInformation, keySerializerProvider, instanceBasePath, instanceRocksDBPath, dbOptions, columnFamilyOptionsFactory, nativeMetricOptions, metricGroup, restoreStateHandles, ttlCompactFiltersManager, writeBatchSize); } }