use of org.apache.flink.runtime.state.RegisteredStateMetaInfoBase in project flink by apache.
the class RocksDBIncrementalRestoreOperation method createColumnFamilyDescriptors.
/**
* This method recreates and registers all {@link ColumnFamilyDescriptor} from Flink's state
* meta data snapshot.
*/
private List<ColumnFamilyDescriptor> createColumnFamilyDescriptors(List<StateMetaInfoSnapshot> stateMetaInfoSnapshots, boolean registerTtlCompactFilter) {
List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(stateMetaInfoSnapshots.size());
for (StateMetaInfoSnapshot stateMetaInfoSnapshot : stateMetaInfoSnapshots) {
RegisteredStateMetaInfoBase metaInfoBase = RegisteredStateMetaInfoBase.fromMetaInfoSnapshot(stateMetaInfoSnapshot);
ColumnFamilyDescriptor columnFamilyDescriptor = RocksDBOperationUtils.createColumnFamilyDescriptor(metaInfoBase, this.rocksHandle.getColumnFamilyOptionsFactory(), registerTtlCompactFilter ? this.rocksHandle.getTtlCompactFiltersManager() : null, this.rocksHandle.getWriteBufferManagerCapacity());
columnFamilyDescriptors.add(columnFamilyDescriptor);
}
return columnFamilyDescriptors;
}
use of org.apache.flink.runtime.state.RegisteredStateMetaInfoBase in project flink by apache.
the class RocksDBHandle method getOrRegisterStateColumnFamilyHandle.
RocksDbKvStateInfo getOrRegisterStateColumnFamilyHandle(ColumnFamilyHandle columnFamilyHandle, StateMetaInfoSnapshot stateMetaInfoSnapshot) {
RocksDbKvStateInfo registeredStateMetaInfoEntry = kvStateInformation.get(stateMetaInfoSnapshot.getName());
if (null == registeredStateMetaInfoEntry) {
// create a meta info for the state on restore;
// this allows us to retain the state in future snapshots even if it wasn't accessed
RegisteredStateMetaInfoBase stateMetaInfo = RegisteredStateMetaInfoBase.fromMetaInfoSnapshot(stateMetaInfoSnapshot);
if (columnFamilyHandle == null) {
registeredStateMetaInfoEntry = RocksDBOperationUtils.createStateInfo(stateMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager, writeBufferManagerCapacity);
} else {
registeredStateMetaInfoEntry = new RocksDbKvStateInfo(columnFamilyHandle, stateMetaInfo);
}
RocksDBOperationUtils.registerKvStateInformation(kvStateInformation, nativeMetricMonitor, stateMetaInfoSnapshot.getName(), registeredStateMetaInfoEntry);
} else {
// TODO with eager state registration in place, check here for serializer migration
// strategies
}
return registeredStateMetaInfoEntry;
}
use of org.apache.flink.runtime.state.RegisteredStateMetaInfoBase in project flink by apache.
the class ChangelogBackendLogApplier method applyMetaDataChange.
private static void applyMetaDataChange(DataInputView in, ChangelogKeyedStateBackend<?> backend, ClassLoader classLoader, Map<Short, StateID> stateIds) throws Exception {
StateMetaInfoSnapshot snapshot = readStateMetaInfoSnapshot(in, classLoader);
RegisteredStateMetaInfoBase meta;
switch(snapshot.getBackendStateType()) {
case KEY_VALUE:
meta = restoreKvMetaData(backend, snapshot, in);
break;
case PRIORITY_QUEUE:
meta = restorePqMetaData(backend, snapshot);
break;
default:
throw new RuntimeException("Unsupported state type: " + snapshot.getBackendStateType() + ", sate: " + snapshot.getName());
}
stateIds.put(in.readShort(), new StateID(meta.getName(), BackendStateType.byCode(in.readByte())));
}
Aggregations