Class ChunkBoundaryCalculator
java.lang.Object
io.debezium.pipeline.source.snapshot.chunked.ChunkBoundaryCalculator
Calculates chunk boundaries for chunked table snapshots.
- Author:
- Chris Cranford
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JdbcConnectionprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateBoundaries(Table table, List<Column> keyColumns, OptionalLong rowCount, int numChunks) Calculate chunk boundaries for a table.Object[]calculateMaxKey(Table table, List<Column> keyColumns) createChunks(Table table, List<Object[]> boundaries, int tableOrder, int tableCount, String baseSelectStatement, OptionalLong totalRowCount, Object[] maximumKey) Create SnapshotChunk objects from calculated boundaries.private Object[]queryBoundaryAtPosition(TableId tableId, String keyColumnNames, List<Column> keyColumns, long position) private Object[]queryColumnValues(List<Column> columns, String sql)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
jdbcConnection
-
-
Constructor Details
-
ChunkBoundaryCalculator
-
-
Method Details
-
calculateBoundaries
public List<Object[]> calculateBoundaries(Table table, List<Column> keyColumns, OptionalLong rowCount, int numChunks) throws SQLException Calculate chunk boundaries for a table.- Parameters:
table- The table to chunkkeyColumns- The columns to use for chunking (PK or message.key.columns)rowCount- Estimated row countnumChunks- Desired number of chunks- Returns:
- List of boundary value arrays (each array has values for all key columns)
- Throws:
SQLException
-
queryBoundaryAtPosition
private Object[] queryBoundaryAtPosition(TableId tableId, String keyColumnNames, List<Column> keyColumns, long position) throws SQLException - Throws:
SQLException
-
createChunks
public List<SnapshotChunk> createChunks(Table table, List<Object[]> boundaries, int tableOrder, int tableCount, String baseSelectStatement, OptionalLong totalRowCount, Object[] maximumKey) Create SnapshotChunk objects from calculated boundaries. -
calculateMaxKey
- Throws:
SQLException
-
queryColumnValues
- Throws:
SQLException
-