Class MySqlSnapshotSplitAssigner

    • Constructor Detail

      • MySqlSnapshotSplitAssigner

        public MySqlSnapshotSplitAssigner​(MySqlSourceConfig sourceConfig,
                                          int currentParallelism,
                                          List<io.debezium.relational.TableId> remainingTables,
                                          boolean isTableIdCaseSensitive,
                                          org.apache.flink.api.connector.source.SplitEnumeratorContext<MySqlSplit> enumeratorContext)
    • Method Detail

      • open

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

        public Optional<MySqlSplit> getNext()
        Description copied from interface: MySqlSplitAssigner
        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 MySqlSplitAssigner
      • onFinishedSplits

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

        public SnapshotPendingSplitsState snapshotState​(long checkpointId)
        Description copied from interface: MySqlSplitAssigner
        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 MySqlSplitAssigner.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 MySqlSplitAssigner
        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: MySqlSplitAssigner
        Notifies the listener that the checkpoint with the given checkpointId completed and was committed.
        Specified by:
        notifyCheckpointComplete in interface MySqlSplitAssigner
        See Also:
        CheckpointListener.notifyCheckpointComplete(long)
      • onBinlogSplitUpdated

        public void onBinlogSplitUpdated()
        Description copied from interface: MySqlSplitAssigner
        Callback to handle the binlog 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:
        onBinlogSplitUpdated in interface MySqlSplitAssigner
      • noMoreSplits

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

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

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

        public void releaseSnapshotMetadata()
        Releases the heavyweight snapshot split metadata (assigned splits, finished offsets, table schemas) after the binlog phase begins, so it is no longer held in the coordinator nor checkpointed. Keeps alreadyProcessedTables and the assigner status so a restore does not re-discover tables. Only called once the binlog split is assigned and checkpoint-covered.
      • isSnapshotMetaReleased

        public boolean isSnapshotMetaReleased()
        Returns whether releaseSnapshotMetadata() has already been performed.