Java Code Examples for org.apache.flink.runtime.state.StateSnapshotTransformer.StateSnapshotTransformFactory#noTransform()
The following examples show how to use
org.apache.flink.runtime.state.StateSnapshotTransformer.StateSnapshotTransformFactory#noTransform() .
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: TtlStateFactory.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private StateSnapshotTransformFactory<?> getSnapshotTransformFactory() { if (!ttlConfig.getCleanupStrategies().inFullSnapshot()) { return StateSnapshotTransformFactory.noTransform(); } else { return new TtlStateSnapshotTransformer.Factory<>(timeProvider, ttl); } }
Example 2
Source File: RegisteredKeyValueStateBackendMetaInfo.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public RegisteredKeyValueStateBackendMetaInfo( @Nonnull StateDescriptor.Type stateType, @Nonnull String name, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull TypeSerializer<S> stateSerializer) { this( stateType, name, StateSerializerProvider.fromNewRegisteredSerializer(namespaceSerializer), StateSerializerProvider.fromNewRegisteredSerializer(stateSerializer), StateSnapshotTransformFactory.noTransform()); }
Example 3
Source File: RegisteredKeyValueStateBackendMetaInfo.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public RegisteredKeyValueStateBackendMetaInfo(@Nonnull StateMetaInfoSnapshot snapshot) { this( StateDescriptor.Type.valueOf(snapshot.getOption(StateMetaInfoSnapshot.CommonOptionsKeys.KEYED_STATE_TYPE)), snapshot.getName(), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<N>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.NAMESPACE_SERIALIZER))), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<S>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER))), StateSnapshotTransformFactory.noTransform()); Preconditions.checkState(StateMetaInfoSnapshot.BackendStateType.KEY_VALUE == snapshot.getBackendStateType()); }
Example 4
Source File: TtlStateFactory.java From flink with Apache License 2.0 | 5 votes |
private StateSnapshotTransformFactory<?> getSnapshotTransformFactory() { if (!ttlConfig.getCleanupStrategies().inFullSnapshot()) { return StateSnapshotTransformFactory.noTransform(); } else { return new TtlStateSnapshotTransformer.Factory<>(timeProvider, ttl); } }
Example 5
Source File: RegisteredKeyValueStateBackendMetaInfo.java From flink with Apache License 2.0 | 5 votes |
public RegisteredKeyValueStateBackendMetaInfo( @Nonnull StateDescriptor.Type stateType, @Nonnull String name, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull TypeSerializer<S> stateSerializer) { this( stateType, name, StateSerializerProvider.fromNewRegisteredSerializer(namespaceSerializer), StateSerializerProvider.fromNewRegisteredSerializer(stateSerializer), StateSnapshotTransformFactory.noTransform()); }
Example 6
Source File: RegisteredKeyValueStateBackendMetaInfo.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public RegisteredKeyValueStateBackendMetaInfo(@Nonnull StateMetaInfoSnapshot snapshot) { this( StateDescriptor.Type.valueOf(snapshot.getOption(StateMetaInfoSnapshot.CommonOptionsKeys.KEYED_STATE_TYPE)), snapshot.getName(), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<N>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.NAMESPACE_SERIALIZER))), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<S>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER))), StateSnapshotTransformFactory.noTransform()); Preconditions.checkState(StateMetaInfoSnapshot.BackendStateType.KEY_VALUE == snapshot.getBackendStateType()); }
Example 7
Source File: TtlStateFactory.java From flink with Apache License 2.0 | 5 votes |
private StateSnapshotTransformFactory<?> getSnapshotTransformFactory() { if (!ttlConfig.getCleanupStrategies().inFullSnapshot()) { return StateSnapshotTransformFactory.noTransform(); } else { return new TtlStateSnapshotTransformer.Factory<>(timeProvider, ttl); } }
Example 8
Source File: RegisteredKeyValueStateBackendMetaInfo.java From flink with Apache License 2.0 | 5 votes |
public RegisteredKeyValueStateBackendMetaInfo( @Nonnull StateDescriptor.Type stateType, @Nonnull String name, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull TypeSerializer<S> stateSerializer) { this( stateType, name, StateSerializerProvider.fromNewRegisteredSerializer(namespaceSerializer), StateSerializerProvider.fromNewRegisteredSerializer(stateSerializer), StateSnapshotTransformFactory.noTransform()); }
Example 9
Source File: RegisteredKeyValueStateBackendMetaInfo.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public RegisteredKeyValueStateBackendMetaInfo(@Nonnull StateMetaInfoSnapshot snapshot) { this( StateDescriptor.Type.valueOf(snapshot.getOption(StateMetaInfoSnapshot.CommonOptionsKeys.KEYED_STATE_TYPE)), snapshot.getName(), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<N>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.NAMESPACE_SERIALIZER))), StateSerializerProvider.fromPreviousSerializerSnapshot( (TypeSerializerSnapshot<S>) Preconditions.checkNotNull( snapshot.getTypeSerializerSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER))), StateSnapshotTransformFactory.noTransform()); Preconditions.checkState(StateMetaInfoSnapshot.BackendStateType.KEY_VALUE == snapshot.getBackendStateType()); }
Example 10
Source File: RocksDBKeyedStateBackend.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Registers a k/v state information, which includes its state id, type, RocksDB column family handle, and serializers. * * <p>When restoring from a snapshot, we don’t restore the individual k/v states, just the global RocksDB database and * the list of k/v state information. When a k/v state is first requested we check here whether we * already have a registered entry for that and return it (after some necessary state compatibility checks) * or create a new one if it does not exist. */ private <N, S extends State, SV, SEV> Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> tryRegisterKvStateInformation( StateDescriptor<S, SV> stateDesc, TypeSerializer<N> namespaceSerializer, @Nonnull StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception { RocksDbKvStateInfo oldStateInfo = kvStateInformation.get(stateDesc.getName()); TypeSerializer<SV> stateSerializer = stateDesc.getSerializer(); RocksDbKvStateInfo newRocksStateInfo; RegisteredKeyValueStateBackendMetaInfo<N, SV> newMetaInfo; if (oldStateInfo != null) { @SuppressWarnings("unchecked") RegisteredKeyValueStateBackendMetaInfo<N, SV> castedMetaInfo = (RegisteredKeyValueStateBackendMetaInfo<N, SV>) oldStateInfo.metaInfo; newMetaInfo = updateRestoredStateMetaInfo( Tuple2.of(oldStateInfo.columnFamilyHandle, castedMetaInfo), stateDesc, namespaceSerializer, stateSerializer); newRocksStateInfo = new RocksDbKvStateInfo(oldStateInfo.columnFamilyHandle, newMetaInfo); kvStateInformation.put(stateDesc.getName(), newRocksStateInfo); } else { newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>( stateDesc.getType(), stateDesc.getName(), namespaceSerializer, stateSerializer, StateSnapshotTransformFactory.noTransform()); newRocksStateInfo = RocksDBOperationUtils.createStateInfo( newMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager); RocksDBOperationUtils.registerKvStateInformation(this.kvStateInformation, this.nativeMetricMonitor, stateDesc.getName(), newRocksStateInfo); } StateSnapshotTransformFactory<SV> wrappedSnapshotTransformFactory = wrapStateSnapshotTransformFactory( stateDesc, snapshotTransformFactory, newMetaInfo.getStateSerializer()); newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory); ttlCompactFiltersManager.configCompactFilter(stateDesc, newMetaInfo.getStateSerializer()); return Tuple2.of(newRocksStateInfo.columnFamilyHandle, newMetaInfo); }
Example 11
Source File: RocksDBKeyedStateBackend.java From flink with Apache License 2.0 | 4 votes |
/** * Registers a k/v state information, which includes its state id, type, RocksDB column family handle, and serializers. * * <p>When restoring from a snapshot, we don’t restore the individual k/v states, just the global RocksDB database and * the list of k/v state information. When a k/v state is first requested we check here whether we * already have a registered entry for that and return it (after some necessary state compatibility checks) * or create a new one if it does not exist. */ private <N, S extends State, SV, SEV> Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> tryRegisterKvStateInformation( StateDescriptor<S, SV> stateDesc, TypeSerializer<N> namespaceSerializer, @Nonnull StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception { RocksDbKvStateInfo oldStateInfo = kvStateInformation.get(stateDesc.getName()); TypeSerializer<SV> stateSerializer = stateDesc.getSerializer(); RocksDbKvStateInfo newRocksStateInfo; RegisteredKeyValueStateBackendMetaInfo<N, SV> newMetaInfo; if (oldStateInfo != null) { @SuppressWarnings("unchecked") RegisteredKeyValueStateBackendMetaInfo<N, SV> castedMetaInfo = (RegisteredKeyValueStateBackendMetaInfo<N, SV>) oldStateInfo.metaInfo; newMetaInfo = updateRestoredStateMetaInfo( Tuple2.of(oldStateInfo.columnFamilyHandle, castedMetaInfo), stateDesc, namespaceSerializer, stateSerializer); newRocksStateInfo = new RocksDbKvStateInfo(oldStateInfo.columnFamilyHandle, newMetaInfo); kvStateInformation.put(stateDesc.getName(), newRocksStateInfo); } else { newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>( stateDesc.getType(), stateDesc.getName(), namespaceSerializer, stateSerializer, StateSnapshotTransformFactory.noTransform()); newRocksStateInfo = RocksDBOperationUtils.createStateInfo( newMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager); RocksDBOperationUtils.registerKvStateInformation(this.kvStateInformation, this.nativeMetricMonitor, stateDesc.getName(), newRocksStateInfo); } StateSnapshotTransformFactory<SV> wrappedSnapshotTransformFactory = wrapStateSnapshotTransformFactory( stateDesc, snapshotTransformFactory, newMetaInfo.getStateSerializer()); newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory); ttlCompactFiltersManager.configCompactFilter(stateDesc, newMetaInfo.getStateSerializer()); return Tuple2.of(newRocksStateInfo.columnFamilyHandle, newMetaInfo); }
Example 12
Source File: RocksDBKeyedStateBackend.java From flink with Apache License 2.0 | 4 votes |
/** * Registers a k/v state information, which includes its state id, type, RocksDB column family handle, and serializers. * * <p>When restoring from a snapshot, we don’t restore the individual k/v states, just the global RocksDB database and * the list of k/v state information. When a k/v state is first requested we check here whether we * already have a registered entry for that and return it (after some necessary state compatibility checks) * or create a new one if it does not exist. */ private <N, S extends State, SV, SEV> Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> tryRegisterKvStateInformation( StateDescriptor<S, SV> stateDesc, TypeSerializer<N> namespaceSerializer, @Nonnull StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception { RocksDbKvStateInfo oldStateInfo = kvStateInformation.get(stateDesc.getName()); TypeSerializer<SV> stateSerializer = stateDesc.getSerializer(); RocksDbKvStateInfo newRocksStateInfo; RegisteredKeyValueStateBackendMetaInfo<N, SV> newMetaInfo; if (oldStateInfo != null) { @SuppressWarnings("unchecked") RegisteredKeyValueStateBackendMetaInfo<N, SV> castedMetaInfo = (RegisteredKeyValueStateBackendMetaInfo<N, SV>) oldStateInfo.metaInfo; newMetaInfo = updateRestoredStateMetaInfo( Tuple2.of(oldStateInfo.columnFamilyHandle, castedMetaInfo), stateDesc, namespaceSerializer, stateSerializer); newRocksStateInfo = new RocksDbKvStateInfo(oldStateInfo.columnFamilyHandle, newMetaInfo); kvStateInformation.put(stateDesc.getName(), newRocksStateInfo); } else { newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>( stateDesc.getType(), stateDesc.getName(), namespaceSerializer, stateSerializer, StateSnapshotTransformFactory.noTransform()); newRocksStateInfo = RocksDBOperationUtils.createStateInfo( newMetaInfo, db, columnFamilyOptionsFactory, ttlCompactFiltersManager); RocksDBOperationUtils.registerKvStateInformation(this.kvStateInformation, this.nativeMetricMonitor, stateDesc.getName(), newRocksStateInfo); } StateSnapshotTransformFactory<SV> wrappedSnapshotTransformFactory = wrapStateSnapshotTransformFactory( stateDesc, snapshotTransformFactory, newMetaInfo.getStateSerializer()); newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory); ttlCompactFiltersManager.configCompactFilter(stateDesc, newMetaInfo.getStateSerializer()); return Tuple2.of(newRocksStateInfo.columnFamilyHandle, newMetaInfo); }