Package org.apache.flink.state.changelog
Interface StateChangeLogger<Value,Namespace>
- Type Parameters:
Value- type of state (value)Namespace- type of namespace
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
KvStateChangeLogger<Value,Namespace>
Logs changes to a state created by
ChangelogKeyedStateBackend. The changes are intended
to be stored durably, included into a checkpoint and replayed on recovery in case of failure.
Note that the order of updating the delegated state and logging it using this class usually doesn't matter. However in some cases an already updated state needs to be logged. Besides that, delegated state update is usually local and would fail faster. Therefore, consider updating the delegated state first and logging the change second.
If state update succeeds and changelog append fails immediately then the updated change is discarded as no checkpoints can proceed.
If changelog append fails asynchronously then subsequent checkpoints can only succeed after state materialization.
-
Method Summary
Modifier and TypeMethodDescriptionvoidEnable logging meta data before next writes.voidvalueAdded(Value addedValue, Namespace ns) State added, such as append to list.addAll.voidState cleared.voidvalueElementAdded(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) State element added, such as append of a single element to a list.voidvalueElementAddedOrUpdated(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) State element added or updated, such as put into a map.voidvalueElementRemoved(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) State element removed, such mapping removal from a map.voidvalueUpdated(Value newValue, Namespace ns) State updated, such as byListState.update(java.util.List<T>).voidvalueUpdatedInternal(Value newValue, Namespace ns) State update internally (usually with a value that the user has no control over).
-
Method Details
-
valueUpdated
State updated, such as byListState.update(java.util.List<T>).- Throws:
IOException
-
valueUpdatedInternal
State update internally (usually with a value that the user has no control over).- Throws:
IOException
-
valueAdded
State added, such as append to list.addAll.- Throws:
IOException
-
valueCleared
State cleared.- Throws:
IOException
-
valueElementAdded
void valueElementAdded(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) throws IOExceptionState element added, such as append of a single element to a list.- Throws:
IOException
-
valueElementAddedOrUpdated
void valueElementAddedOrUpdated(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) throws IOExceptionState element added or updated, such as put into a map.- Throws:
IOException
-
valueElementRemoved
void valueElementRemoved(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView, IOException> dataSerializer, Namespace ns) throws IOExceptionState element removed, such mapping removal from a map.- Throws:
IOException
-
resetWritingMetaFlag
void resetWritingMetaFlag()Enable logging meta data before next writes.
-