Class ForStIncrementalRestoreOperation<K>
java.lang.Object
org.apache.flink.state.forst.restore.ForStIncrementalRestoreOperation<K>
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.runtime.state.RestoreOperation<ForStRestoreResult>,ForStRestoreOperation
Encapsulates the process of restoring a ForSt instance from an incremental snapshot.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEntity to hold the temporary RocksDB instance created for restore. -
Constructor Summary
ConstructorsConstructorDescriptionForStIncrementalRestoreOperation(String operatorIdentifier, org.apache.flink.runtime.state.KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, org.apache.flink.core.fs.CloseableRegistry cancelStreamRegistry, ClassLoader userCodeClassLoader, Map<String, ForStOperationUtils.ForStKvStateInfo> kvStateInformation, org.apache.flink.runtime.state.StateSerializerProvider<K> keySerializerProvider, ForStResourceContainer optionsContainer, org.apache.flink.core.fs.Path forstBasePath, org.apache.flink.core.fs.Path instanceRocksDBPath, org.forstdb.DBOptions dbOptions, Function<String, org.forstdb.ColumnFamilyOptions> columnFamilyOptionsFactory, ForStNativeMetricOptions nativeMetricOptions, org.apache.flink.metrics.MetricGroup metricGroup, ForStDBTtlCompactFiltersManager ttlCompactFiltersManager, long writeBatchSize, Long writeBufferManagerCapacity, org.apache.flink.runtime.state.StateBackend.CustomInitializationMetrics customInitializationMetrics, Collection<org.apache.flink.runtime.state.IncrementalRemoteKeyedStateHandle> restoreStateHandles, double overlapFractionThreshold, boolean useIngestDbRestoreMode, boolean useDeleteFilesInRange, org.apache.flink.core.execution.RecoveryClaimMode recoveryClaimMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidexportColumnFamilies(org.forstdb.RocksDB db, List<org.forstdb.ColumnFamilyHandle> columnFamilyHandles, List<org.apache.flink.runtime.state.RegisteredStateMetaInfoBase> registeredStateMetaInfoBases, org.apache.flink.core.fs.Path exportBasePath, Map<org.apache.flink.runtime.state.RegisteredStateMetaInfoBase.Key, List<org.forstdb.ExportImportFilesMetaData>> resultOutput) Exports the data of the given column families in the given DB.voidmergeStateHandlesWithClipAndIngest(List<StateHandleTransferSpec> keyedStateHandles, byte[] startKeyGroupPrefixBytes, byte[] stopKeyGroupPrefixBytes) Restores the base DB by merging multiple state handles into one.restore()Root method that branches for different implementations ofIncrementalKeyedStateHandle.
-
Constructor Details
-
ForStIncrementalRestoreOperation
public ForStIncrementalRestoreOperation(String operatorIdentifier, org.apache.flink.runtime.state.KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, org.apache.flink.core.fs.CloseableRegistry cancelStreamRegistry, ClassLoader userCodeClassLoader, Map<String, ForStOperationUtils.ForStKvStateInfo> kvStateInformation, org.apache.flink.runtime.state.StateSerializerProvider<K> keySerializerProvider, ForStResourceContainer optionsContainer, org.apache.flink.core.fs.Path forstBasePath, org.apache.flink.core.fs.Path instanceRocksDBPath, org.forstdb.DBOptions dbOptions, Function<String, org.forstdb.ColumnFamilyOptions> columnFamilyOptionsFactory, ForStNativeMetricOptions nativeMetricOptions, org.apache.flink.metrics.MetricGroup metricGroup, @Nonnull ForStDBTtlCompactFiltersManager ttlCompactFiltersManager, @Nonnegative long writeBatchSize, Long writeBufferManagerCapacity, org.apache.flink.runtime.state.StateBackend.CustomInitializationMetrics customInitializationMetrics, @Nonnull Collection<org.apache.flink.runtime.state.IncrementalRemoteKeyedStateHandle> restoreStateHandles, double overlapFractionThreshold, boolean useIngestDbRestoreMode, boolean useDeleteFilesInRange, org.apache.flink.core.execution.RecoveryClaimMode recoveryClaimMode)
-
-
Method Details
-
restore
Root method that branches for different implementations ofIncrementalKeyedStateHandle.- Specified by:
restorein interfaceForStRestoreOperation- Specified by:
restorein interfaceorg.apache.flink.runtime.state.RestoreOperation<K>- Throws:
Exception
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
mergeStateHandlesWithClipAndIngest
public void mergeStateHandlesWithClipAndIngest(List<StateHandleTransferSpec> keyedStateHandles, byte[] startKeyGroupPrefixBytes, byte[] stopKeyGroupPrefixBytes) throws Exception Restores the base DB by merging multiple state handles into one. This method first checks if all data to import is in the expected key-groups range and then uses import/export. Otherwise, this method falls back to copying the data using a temporary DB.- Parameters:
keyedStateHandles- the list of state handles to restore the base DB from.startKeyGroupPrefixBytes- the min/start key of the key groups range as bytes.stopKeyGroupPrefixBytes- the max+1/end key of the key groups range as bytes.- Throws:
Exception- on any restore error.
-
exportColumnFamilies
public void exportColumnFamilies(org.forstdb.RocksDB db, List<org.forstdb.ColumnFamilyHandle> columnFamilyHandles, List<org.apache.flink.runtime.state.RegisteredStateMetaInfoBase> registeredStateMetaInfoBases, org.apache.flink.core.fs.Path exportBasePath, Map<org.apache.flink.runtime.state.RegisteredStateMetaInfoBase.Key, List<org.forstdb.ExportImportFilesMetaData>> resultOutput) throws org.forstdb.RocksDBException, IOExceptionExports the data of the given column families in the given DB.- Parameters:
db- the DB to export from.columnFamilyHandles- the column families to export.registeredStateMetaInfoBases- meta information about the registered states in the DB.exportBasePath- the path to which the export files go.resultOutput- output parameter for the metadata of the export.- Throws:
org.forstdb.RocksDBException- on problems inside RocksDB.IOException
-