Class MySqlChunkSplitter
- java.lang.Object
-
- org.apache.flink.cdc.connectors.mysql.source.assigners.MySqlChunkSplitter
-
- All Implemented Interfaces:
ChunkSplitter
public class MySqlChunkSplitter extends Object implements ChunkSplitter
TheChunkSplitterimplementation for MySQL.
-
-
Constructor Summary
Constructors Constructor Description MySqlChunkSplitter(MySqlSchema mySqlSchema, MySqlSourceConfig sourceConfig)MySqlChunkSplitter(MySqlSchema mySqlSchema, MySqlSourceConfig sourceConfig, ChunkSplitterState chunkSplitterState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Called to close the splitter, in case it holds on to any resources, like threads or jdbc connections.io.debezium.relational.TableIdgetCurrentSplittingTableId()IntegergetNextChunkId()booleanhasNextChunk()Get whether the splitter has more chunks for current table.voidnotifyCheckpointComplete(long checkpointId)Notifies the listener that the checkpoint with the givencheckpointIdcompleted and was committed.voidopen()Called to open the chunk splitter to acquire any resources, like threads or jdbc connections.ChunkSplitterStatesnapshotState(long checkpointId)Creates a snapshot of the state of this chunk splitter, to be stored in a checkpoint.List<MySqlSnapshotSplit>splitChunks(io.debezium.connector.mysql.MySqlPartition partition, io.debezium.relational.TableId tableId)Called to split chunks for a table, the assigner could invoke this method multiple times to receive all the splits.List<org.apache.flink.cdc.connectors.mysql.source.assigners.ChunkRange>splitEvenlySizedChunks(io.debezium.relational.TableId tableId, Object min, Object max, long approximateRowCnt, int chunkSize, int dynamicChunkSize)Split table into evenly sized chunks based on the numeric min and max value of split column, and tumble chunks in step size.
-
-
-
Constructor Detail
-
MySqlChunkSplitter
public MySqlChunkSplitter(MySqlSchema mySqlSchema, MySqlSourceConfig sourceConfig)
-
MySqlChunkSplitter
public MySqlChunkSplitter(MySqlSchema mySqlSchema, MySqlSourceConfig sourceConfig, ChunkSplitterState chunkSplitterState)
-
-
Method Detail
-
open
public void open()
Description copied from interface:ChunkSplitterCalled to open the chunk splitter to acquire any resources, like threads or jdbc connections.- Specified by:
openin interfaceChunkSplitter
-
splitChunks
public List<MySqlSnapshotSplit> splitChunks(io.debezium.connector.mysql.MySqlPartition partition, io.debezium.relational.TableId tableId) throws Exception
Description copied from interface:ChunkSplitterCalled to split chunks for a table, the assigner could invoke this method multiple times to receive all the splits.- Specified by:
splitChunksin interfaceChunkSplitter- Throws:
Exception
-
hasNextChunk
public boolean hasNextChunk()
Description copied from interface:ChunkSplitterGet whether the splitter has more chunks for current table.- Specified by:
hasNextChunkin interfaceChunkSplitter
-
snapshotState
public ChunkSplitterState snapshotState(long checkpointId)
Description copied from interface:ChunkSplitterCreates a snapshot of the state of this chunk splitter, to be stored in a checkpoint.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:
snapshotStatein interfaceChunkSplitter- 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:ChunkSplitterNotifies the listener that the checkpoint with the givencheckpointIdcompleted and was committed.- Specified by:
notifyCheckpointCompletein interfaceChunkSplitter- See Also:
CheckpointListener.notifyCheckpointComplete(long)
-
splitEvenlySizedChunks
@VisibleForTesting public List<org.apache.flink.cdc.connectors.mysql.source.assigners.ChunkRange> splitEvenlySizedChunks(io.debezium.relational.TableId tableId, Object min, Object max, long approximateRowCnt, int chunkSize, int dynamicChunkSize)
Split table into evenly sized chunks based on the numeric min and max value of split column, and tumble chunks in step size.
-
getCurrentSplittingTableId
public io.debezium.relational.TableId getCurrentSplittingTableId()
-
getNextChunkId
public Integer getNextChunkId()
-
close
public void close() throws ExceptionDescription copied from interface:ChunkSplitterCalled to close the splitter, in case it holds on to any resources, like threads or jdbc connections.- Specified by:
closein interfaceChunkSplitter- Throws:
Exception
-
-