Class SnapshotSplitAssigner<C extends SourceConfig>

    • Method Detail

      • open

        public void open()
        Description copied from interface: SplitAssigner
        Called to open the assigner to acquire any resources, like threads or network connections.
        Specified by:
        open in interface SplitAssigner
      • initEnumeratorMetrics

        public void initEnumeratorMetrics​(SourceEnumeratorMetrics enumeratorMetrics)
        This must be invoked before this class's open() method, because open() starts an asynchronous splitting thread that concurrently mutates remainingSplits.
      • getNext

        public Optional<SourceSplitBase> getNext()
        Description copied from interface: SplitAssigner
        Gets the next split.

        When this method returns an empty Optional, then the set of splits is assumed to be done and the source will finish once the readers finished their current splits.

        Specified by:
        getNext in interface SplitAssigner
      • onFinishedSplits

        public void onFinishedSplits​(Map<String,​Offset> splitFinishedOffsets)
        Description copied from interface: SplitAssigner
        Callback to handle the finished splits with finished change log offset. This is useful for determine when to generate stream split and what stream split to generate.
        Specified by:
        onFinishedSplits in interface SplitAssigner
      • addSplits

        public void addSplits​(Collection<SourceSplitBase> splits)
        Description copied from interface: SplitAssigner
        Adds a set of splits to this assigner. This happens for example when some split processing failed and the splits need to be re-added.
        Specified by:
        addSplits in interface SplitAssigner
      • snapshotState

        public SnapshotPendingSplitsState snapshotState​(long checkpointId)
        Description copied from interface: SplitAssigner
        Creates a snapshot of the state of this split assigner, to be stored in a checkpoint.

        The snapshot should contain the latest state of the assigner: It should assume that all operations that happened before the snapshot have successfully completed. For example all splits assigned to readers via SplitAssigner.getNext() don't need to be included in the snapshot anymore.

        This method takes the ID of the checkpoint for which the state is snapshotted. Most implementations should be able to ignore this parameter, because for the contents of the snapshot, it doesn't matter for which checkpoint it gets created. This parameter can be interesting for source connectors with external systems where those systems are themselves aware of checkpoints; for example in cases where the enumerator notifies that system about a specific checkpoint being triggered.

        Specified by:
        snapshotState in interface SplitAssigner
        Parameters:
        checkpointId - The ID of the checkpoint for which the snapshot is created.
        Returns:
        an object containing the state of the split enumerator.
      • notifyCheckpointComplete

        public void notifyCheckpointComplete​(long checkpointId)
        Description copied from interface: SplitAssigner
        Notifies the listener that the checkpoint with the given checkpointId completed and was committed.
        Specified by:
        notifyCheckpointComplete in interface SplitAssigner
        See Also:
        CheckpointListener.notifyCheckpointComplete(long)
      • releaseSnapshotMetadata

        public void releaseSnapshotMetadata()
        Releases the bulk snapshot-split metadata once the reader has assembled it and a checkpoint has covered that assignment. Clears the metadata maps but keeps alreadyProcessedTables, the assigner status and the chunk-splitter state so a restore does not re-discover tables or rebuild the stream split. Generalizes the MySQL mechanism (FLINK-39775).
        Specified by:
        releaseSnapshotMetadata in interface SplitAssigner
      • noMoreSplits

        public boolean noMoreSplits()
        Description copied from interface: SplitAssigner
        Indicates there is no more splits available in this assigner.
        Specified by:
        noMoreSplits in interface SplitAssigner
      • needToDiscoveryTables

        public boolean needToDiscoveryTables()
        Indicates current assigner need to discovery tables or not.
      • onStreamSplitUpdated

        public void onStreamSplitUpdated()
        Description copied from interface: SplitAssigner
        Callback to handle the stream split has been updated in the newly added tables process. This is useful to check the newly added tables has been finished or not.
        Specified by:
        onStreamSplitUpdated in interface SplitAssigner
      • getTableSchemas

        public Map<io.debezium.relational.TableId,​io.debezium.relational.history.TableChanges.TableChange> getTableSchemas()
      • getSplitFinishedOffsets

        public Map<String,​Offset> getSplitFinishedOffsets()