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
@Internal public class CopyOnWriteStateTableSnapshot<K,N,S> extends Object
This class represents the snapshot of aCopyOnWriteStateTableand 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
Fields Modifier and Type Field Description protected org.apache.flink.api.common.typeutils.TypeSerializer<K>localKeySerializerA local duplicate of the table's key serializer.protected org.apache.flink.api.common.typeutils.TypeSerializer<N>localNamespaceSerializerA local duplicate of the table's namespace serializer.protected org.apache.flink.api.common.typeutils.TypeSerializer<S>localStateSerializerA local duplicate of the table's state serializer.protected StateTable<K,N,S>owningStateTableTheStateTablefrom which this snapshot was created.protected StateSnapshotTransformer<S>stateSnapshotTransformer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<StateEntry<K,N,S>>getIterator(int keyGroupId)StateSnapshot.StateKeyGroupWritergetKeyGroupWriter()This method returnsStateSnapshot.StateKeyGroupWriterand should be called in the asynchronous part of the snapshot.StateMetaInfoSnapshotgetMetaInfoSnapshot()Returns a snapshot of the state's meta data.protected StateMapSnapshot<K,N,S,? extends StateMap<K,N,S>>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 Detail
-
owningStateTable
protected final StateTable<K,N,S> owningStateTable
TheStateTablefrom which this snapshot was created.
-
localKeySerializer
@Nonnull protected final org.apache.flink.api.common.typeutils.TypeSerializer<K> localKeySerializer
A local duplicate of the table's key serializer.
-
localNamespaceSerializer
@Nonnull protected final org.apache.flink.api.common.typeutils.TypeSerializer<N> localNamespaceSerializer
A local duplicate of the table's namespace serializer.
-
localStateSerializer
@Nonnull protected final org.apache.flink.api.common.typeutils.TypeSerializer<S> localStateSerializer
A local duplicate of the table's state serializer.
-
stateSnapshotTransformer
@Nullable protected final StateSnapshotTransformer<S> stateSnapshotTransformer
-
-
Method Detail
-
getStateMapSnapshotForKeyGroup
protected StateMapSnapshot<K,N,S,? extends StateMap<K,N,S>> getStateMapSnapshotForKeyGroup(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
@Nonnull public StateMetaInfoSnapshot getMetaInfoSnapshot()
Description copied from interface:StateSnapshotReturns a snapshot of the state's meta data.- Specified by:
getMetaInfoSnapshotin interfaceStateSnapshot
-
getKeyGroupWriter
public StateSnapshot.StateKeyGroupWriter getKeyGroupWriter()
Description copied from interface:StateSnapshotThis method returnsStateSnapshot.StateKeyGroupWriterand should be called in the asynchronous part of the snapshot.- Specified by:
getKeyGroupWriterin interfaceStateSnapshot
-
getIterator
public Iterator<StateEntry<K,N,S>> getIterator(int keyGroupId)
- Specified by:
getIteratorin interfaceIterableStateSnapshot<K,N,S>
-
writeStateInKeyGroup
public void writeStateInKeyGroup(@Nonnull org.apache.flink.core.memory.DataOutputView dov, int keyGroupId) throws IOExceptionCopyOnWriteStateTablecould 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.
-
-