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 aCopyOnWriteStateTable
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
Fields Modifier and Type Field Description protected org.apache.flink.api.common.typeutils.TypeSerializer<K>
localKeySerializer
A local duplicate of the table's key serializer.protected org.apache.flink.api.common.typeutils.TypeSerializer<N>
localNamespaceSerializer
A local duplicate of the table's namespace serializer.protected org.apache.flink.api.common.typeutils.TypeSerializer<S>
localStateSerializer
A local duplicate of the table's state serializer.protected StateTable<K,N,S>
owningStateTable
TheStateTable
from 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.StateKeyGroupWriter
getKeyGroupWriter()
This method returnsStateSnapshot.StateKeyGroupWriter
and should be called in the asynchronous part of the snapshot.StateMetaInfoSnapshot
getMetaInfoSnapshot()
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.void
release()
Release the snapshot.void
writeStateInKeyGroup(org.apache.flink.core.memory.DataOutputView dov, int keyGroupId)
CopyOnWriteStateTable
could 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
TheStateTable
from 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:StateSnapshot
Release the snapshot. All snapshots should be released when they are no longer used because some implementation can only release resources after a release. ProducedStateSnapshot.StateKeyGroupWriter
should no longer be used after calling this method.
-
getMetaInfoSnapshot
@Nonnull public StateMetaInfoSnapshot getMetaInfoSnapshot()
Description copied from interface:StateSnapshot
Returns a snapshot of the state's meta data.- Specified by:
getMetaInfoSnapshot
in interfaceStateSnapshot
-
getKeyGroupWriter
public StateSnapshot.StateKeyGroupWriter getKeyGroupWriter()
Description copied from interface:StateSnapshot
This method returnsStateSnapshot.StateKeyGroupWriter
and should be called in the asynchronous part of the snapshot.- Specified by:
getKeyGroupWriter
in interfaceStateSnapshot
-
getIterator
public Iterator<StateEntry<K,N,S>> getIterator(int keyGroupId)
- Specified by:
getIterator
in interfaceIterableStateSnapshot<K,N,S>
-
writeStateInKeyGroup
public void writeStateInKeyGroup(@Nonnull org.apache.flink.core.memory.DataOutputView dov, int keyGroupId) throws IOException
CopyOnWriteStateTable
could 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:
writeStateInKeyGroup
in interfaceStateSnapshot.StateKeyGroupWriter
- Parameters:
dov
- the output.keyGroupId
- the key-group to write.- Throws:
IOException
- on write-related problems.
-
-