Interface MySqlSplitAssigner
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
MySqlBinlogSplitAssigner,MySqlHybridSplitAssigner,MySqlSnapshotSplitAssigner
@Internal public interface MySqlSplitAssigner extends Closeable
TheMySqlSplitAssigneris responsible for deciding what split should be processed. It determines split processing order.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddSplits(Collection<MySqlSplit> splits)Adds a set of splits to this assigner.voidclose()Called to close the assigner, in case it holds on to any resources, like threads or network connections.AssignerStatusgetAssignerStatus()Gets the split assigner status, seeAssignerStatus.List<FinishedSnapshotSplitInfo>getFinishedSplitInfos()Gets the finished splits' information.Optional<MySqlSplit>getNext()Gets the next split.booleannoMoreSplits()Indicates there is no more splits available in this assigner.voidnotifyCheckpointComplete(long checkpointId)Notifies the listener that the checkpoint with the givencheckpointIdcompleted and was committed.voidonBinlogSplitUpdated()Callback to handle the binlog split has been updated in the newly added tables process.voidonFinishedSplits(Map<String,BinlogOffset> splitFinishedOffsets)Callback to handle the finished splits with finished binlog offset.voidopen()Called to open the assigner to acquire any resources, like threads or network connections.PendingSplitsStatesnapshotState(long checkpointId)Creates a snapshot of the state of this split assigner, to be stored in a checkpoint.voidstartAssignNewlyAddedTables()Starts assign newly added tables.booleanwaitingForFinishedSplits()Whether the split assigner is still waiting for callback of finished splits, i.e.
-
-
-
Method Detail
-
open
void open()
Called to open the assigner to acquire any resources, like threads or network connections.
-
getNext
Optional<MySqlSplit> getNext()
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.
-
waitingForFinishedSplits
boolean waitingForFinishedSplits()
Whether the split assigner is still waiting for callback of finished splits, i.e.onFinishedSplits(Map).
-
getFinishedSplitInfos
List<FinishedSnapshotSplitInfo> getFinishedSplitInfos()
Gets the finished splits' information. This is useful metadata to generate a binlog split that considering finished snapshot splits.
-
onFinishedSplits
void onFinishedSplits(Map<String,BinlogOffset> splitFinishedOffsets)
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.
-
addSplits
void addSplits(Collection<MySqlSplit> splits)
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.
-
snapshotState
PendingSplitsState snapshotState(long checkpointId)
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
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.
- Parameters:
checkpointId- The ID of the checkpoint for which the snapshot is created.- Returns:
- an object containing the state of the split enumerator.
-
notifyCheckpointComplete
void notifyCheckpointComplete(long checkpointId)
Notifies the listener that the checkpoint with the givencheckpointIdcompleted and was committed.- See Also:
CheckpointListener.notifyCheckpointComplete(long)
-
getAssignerStatus
AssignerStatus getAssignerStatus()
Gets the split assigner status, seeAssignerStatus.
-
startAssignNewlyAddedTables
void startAssignNewlyAddedTables()
Starts assign newly added tables.
-
noMoreSplits
boolean noMoreSplits()
Indicates there is no more splits available in this assigner.
-
onBinlogSplitUpdated
void onBinlogSplitUpdated()
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.
-
close
void close() throws IOExceptionCalled to close the assigner, in case it holds on to any resources, like threads or network connections.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-