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>

    @Internal
    public interface StateChangeLogger<Value,​Namespace>
    extends Closeable
    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 Detail

      • valueUpdatedInternal

        void valueUpdatedInternal​(Value newValue,
                                  Namespace ns)
                           throws IOException
        State update internally (usually with a value that the user has no control over).
        Throws:
        IOException
      • valueElementAdded

        void valueElementAdded​(org.apache.flink.util.function.ThrowingConsumer<org.apache.flink.core.memory.DataOutputView,​IOException> dataSerializer,
                               Namespace ns)
                        throws IOException
        State 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 IOException
        State 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 IOException
        State element removed, such mapping removal from a map.
        Throws:
        IOException
      • resetWritingMetaFlag

        void resetWritingMetaFlag()
        Enable logging meta data before next writes.