Class StoreChangelogReader

  • All Implemented Interfaces:
    ChangelogReader, ChangelogRegister

    public class StoreChangelogReader
    extends Object
    implements ChangelogReader
    ChangelogReader is created and maintained by the stream thread and used for both updating standby tasks and restoring active tasks. It manages the restore consumer, including its assigned partitions, when to pause / resume these partitions, etc.

    The reader also maintains the source of truth for restoration state: only active tasks restoring changelog could be completed, while standby tasks updating changelog would always be in restoring state after being initialized.

    • Constructor Detail

      • StoreChangelogReader

        public StoreChangelogReader​(org.apache.kafka.common.utils.Time time,
                                    StreamsConfig config,
                                    org.apache.kafka.common.utils.LogContext logContext,
                                    Admin adminClient,
                                    Consumer<byte[],​byte[]> restoreConsumer,
                                    StateRestoreListener stateRestoreListener)
    • Method Detail

      • register

        public void register​(TopicPartition partition,
                             ProcessorStateManager stateManager)
        Since it is shared for multiple tasks and hence multiple state managers, the registration would take its corresponding state manager as well for restoring.
        Specified by:
        register in interface ChangelogRegister
        Parameters:
        partition - the state store's changelog partition for restoring
        stateManager - the state manager used for restoring (one per task)
      • restore

        public void restore()
        Description copied from interface: ChangelogReader
        Restore all registered state stores by reading from their changelogs
        Specified by:
        restore in interface ChangelogReader
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface ChangelogReader
        Returns:
        whether the changelog reader has just been cleared or is uninitialized