Search in sources :

Example 1 with RegisteredStateMetaInfoBase

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;
}
Also used : RegisteredStateMetaInfoBase(org.apache.flink.runtime.state.RegisteredStateMetaInfoBase) ArrayList(java.util.ArrayList) StateMetaInfoSnapshot(org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot) ColumnFamilyDescriptor(org.rocksdb.ColumnFamilyDescriptor)

Example 2 with RegisteredStateMetaInfoBase

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;
}
Also used : RegisteredStateMetaInfoBase(org.apache.flink.runtime.state.RegisteredStateMetaInfoBase) RocksDbKvStateInfo(org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend.RocksDbKvStateInfo)

Example 3 with RegisteredStateMetaInfoBase

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())));
}
Also used : RegisteredStateMetaInfoBase(org.apache.flink.runtime.state.RegisteredStateMetaInfoBase) StateMetaInfoSnapshot(org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot)

Aggregations

RegisteredStateMetaInfoBase (org.apache.flink.runtime.state.RegisteredStateMetaInfoBase)3 StateMetaInfoSnapshot (org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot)2 ArrayList (java.util.ArrayList)1 RocksDbKvStateInfo (org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend.RocksDbKvStateInfo)1 ColumnFamilyDescriptor (org.rocksdb.ColumnFamilyDescriptor)1