Class CopyOnWriteStateTableSnapshot<K,N,S>
java.lang.Object
org.apache.flink.runtime.state.heap.CopyOnWriteStateTableSnapshot<K,N,S>
- Type Parameters:
K- type of keyN- type of namespaceS- type of state
- All Implemented Interfaces:
IterableStateSnapshot<K,,N, S> StateSnapshot,StateSnapshot.StateKeyGroupWriter
This class represents the snapshot of a
CopyOnWriteStateTable and has a role in operator
state checkpointing. This class is also responsible for writing the state in the process of
checkpointing.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.StateSnapshot
StateSnapshot.StateKeyGroupWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.flink.api.common.typeutils.TypeSerializer<K>A local duplicate of the table's key serializer.protected final org.apache.flink.api.common.typeutils.TypeSerializer<N>A local duplicate of the table's namespace serializer.protected final org.apache.flink.api.common.typeutils.TypeSerializer<S>A local duplicate of the table's state serializer.protected final StateTable<K,N, S> TheStateTablefrom which this snapshot was created.protected final StateSnapshotTransformer<S> -
Method Summary
Modifier and TypeMethodDescriptionIterator<StateEntry<K,N, S>> getIterator(int keyGroupId) This method returnsStateSnapshot.StateKeyGroupWriterand should be called in the asynchronous part of the snapshot.Returns a snapshot of the state's meta data.getStateMapSnapshotForKeyGroup(int keyGroup) Return the state map snapshot for the key group.voidrelease()Release the snapshot.voidwriteStateInKeyGroup(org.apache.flink.core.memory.DataOutputView dov, int keyGroupId) CopyOnWriteStateTablecould naturally support a kind of prefix-compressed format (grouping by namespace, writing the namespace only once per group instead for each mapping).
-
Field Details
-
owningStateTable
TheStateTablefrom which this snapshot was created. -
localKeySerializer
A local duplicate of the table's key serializer. -
localNamespaceSerializer
@Nonnull protected final org.apache.flink.api.common.typeutils.TypeSerializer<N> localNamespaceSerializerA local duplicate of the table's namespace serializer. -
localStateSerializer
@Nonnull protected final org.apache.flink.api.common.typeutils.TypeSerializer<S> localStateSerializerA local duplicate of the table's state serializer. -
stateSnapshotTransformer
-
-
Method Details
-
getStateMapSnapshotForKeyGroup
protected StateMapSnapshot<K,N, getStateMapSnapshotForKeyGroupS, ? extends StateMap<K, N, S>> (int keyGroup) Return the state map snapshot for the key group. If the snapshot does not exist, return null. -
release
public void release()Description copied from interface:StateSnapshotRelease the snapshot. All snapshots should be released when they are no longer used because some implementation can only release resources after a release. ProducedStateSnapshot.StateKeyGroupWritershould no longer be used after calling this method. -
getMetaInfoSnapshot
Description copied from interface:StateSnapshotReturns a snapshot of the state's meta data.- Specified by:
getMetaInfoSnapshotin interfaceStateSnapshot
-
getKeyGroupWriter
Description copied from interface:StateSnapshotThis method returnsStateSnapshot.StateKeyGroupWriterand should be called in the asynchronous part of the snapshot.- Specified by:
getKeyGroupWriterin interfaceStateSnapshot
-
getIterator
- Specified by:
getIteratorin interfaceIterableStateSnapshot<K,N, S>
-
writeStateInKeyGroup
public void writeStateInKeyGroup(@Nonnull org.apache.flink.core.memory.DataOutputView dov, int keyGroupId) throws IOException CopyOnWriteStateTablecould naturally support a kind of prefix-compressed format (grouping by namespace, writing the namespace only once per group instead for each mapping). We might implement support for different formats later (tailored towards different state table implementations).- Specified by:
writeStateInKeyGroupin interfaceStateSnapshot.StateKeyGroupWriter- Parameters:
dov- the output.keyGroupId- the key-group to write.- Throws:
IOException- on write-related problems.
-