Class AbstractIncrementalSnapshotContext<T>
- java.lang.Object
-
- io.debezium.pipeline.source.snapshot.incremental.AbstractIncrementalSnapshotContext<T>
-
- All Implemented Interfaces:
IncrementalSnapshotContext<T>
- Direct Known Subclasses:
SignalBasedIncrementalSnapshotContext
@NotThreadSafe public class AbstractIncrementalSnapshotContext<T> extends Object implements IncrementalSnapshotContext<T>
A class describing current state of incremental snapshot- Author:
- Jiri Pechanec
-
-
Field Summary
Fields Modifier and Type Field Description private Object[]
chunkEndPosition
The last primary key in chunk that is now in process.private String
currentChunkId
static String
DATA_COLLECTIONS_TO_SNAPSHOT_KEY
private Queue<T>
dataCollectionsToSnapshot
static String
EVENT_PRIMARY_KEY
static String
INCREMENTAL_SNAPSHOT_KEY
private Object[]
lastEventKeySent
The PK of the last record that was passed to Kafka Connect.private static org.slf4j.Logger
LOGGER
private Object[]
maximumKey
The largest PK in the table at the start of snapshot.private Table
schema
private boolean
schemaVerificationPassed
static String
TABLE_MAXIMUM_KEY
private boolean
useCatalogBeforeSchema
protected boolean
windowOpened
-
Constructor Summary
Constructors Constructor Description AbstractIncrementalSnapshotContext(boolean useCatalogBeforeSchema)
-
Method Summary
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
INCREMENTAL_SNAPSHOT_KEY
public static final String INCREMENTAL_SNAPSHOT_KEY
- See Also:
- Constant Field Values
-
DATA_COLLECTIONS_TO_SNAPSHOT_KEY
public static final String DATA_COLLECTIONS_TO_SNAPSHOT_KEY
- See Also:
- Constant Field Values
-
EVENT_PRIMARY_KEY
public static final String EVENT_PRIMARY_KEY
- See Also:
- Constant Field Values
-
TABLE_MAXIMUM_KEY
public static final String TABLE_MAXIMUM_KEY
- See Also:
- Constant Field Values
-
windowOpened
protected boolean windowOpened
-
chunkEndPosition
private Object[] chunkEndPosition
The last primary key in chunk that is now in process.
-
useCatalogBeforeSchema
private final boolean useCatalogBeforeSchema
-
lastEventKeySent
private Object[] lastEventKeySent
The PK of the last record that was passed to Kafka Connect. In case of connector restart the start of the first chunk will be populated from it.
-
currentChunkId
private String currentChunkId
-
maximumKey
private Object[] maximumKey
The largest PK in the table at the start of snapshot.
-
schema
private Table schema
-
schemaVerificationPassed
private boolean schemaVerificationPassed
-
-
Method Detail
-
openWindow
public boolean openWindow(String id)
- Specified by:
openWindow
in interfaceIncrementalSnapshotContext<T>
-
closeWindow
public boolean closeWindow(String id)
- Specified by:
closeWindow
in interfaceIncrementalSnapshotContext<T>
-
notExpectedChunk
private boolean notExpectedChunk(String id)
The snapshotting process can receive out-of-order windowing signals after connector restart as depending on committed offset position some signals can be replayed. In extreme case a signal can be received even when the incremental snapshot was completed just before the restart. Such windowing signals are ignored.
-
deduplicationNeeded
public boolean deduplicationNeeded()
- Specified by:
deduplicationNeeded
in interfaceIncrementalSnapshotContext<T>
-
dataCollectionsToSnapshotAsString
private String dataCollectionsToSnapshotAsString()
-
snapshotRunning
public boolean snapshotRunning()
- Specified by:
snapshotRunning
in interfaceIncrementalSnapshotContext<T>
-
store
public Map<String,Object> store(Map<String,Object> offset)
- Specified by:
store
in interfaceIncrementalSnapshotContext<T>
-
addDataCollectionNamesToSnapshot
public List<T> addDataCollectionNamesToSnapshot(List<String> dataCollectionIds)
- Specified by:
addDataCollectionNamesToSnapshot
in interfaceIncrementalSnapshotContext<T>
-
init
protected static <U> IncrementalSnapshotContext<U> init(AbstractIncrementalSnapshotContext<U> context, Map<String,?> offsets)
-
sendEvent
public void sendEvent(Object[] key)
- Specified by:
sendEvent
in interfaceIncrementalSnapshotContext<T>
-
currentDataCollectionId
public T currentDataCollectionId()
- Specified by:
currentDataCollectionId
in interfaceIncrementalSnapshotContext<T>
-
dataCollectionsToBeSnapshottedCount
public int dataCollectionsToBeSnapshottedCount()
- Specified by:
dataCollectionsToBeSnapshottedCount
in interfaceIncrementalSnapshotContext<T>
-
nextChunkPosition
public void nextChunkPosition(Object[] end)
- Specified by:
nextChunkPosition
in interfaceIncrementalSnapshotContext<T>
-
chunkEndPosititon
public Object[] chunkEndPosititon()
- Specified by:
chunkEndPosititon
in interfaceIncrementalSnapshotContext<T>
-
resetChunk
private void resetChunk()
-
revertChunk
public void revertChunk()
- Specified by:
revertChunk
in interfaceIncrementalSnapshotContext<T>
-
isNonInitialChunk
public boolean isNonInitialChunk()
- Specified by:
isNonInitialChunk
in interfaceIncrementalSnapshotContext<T>
-
nextDataCollection
public T nextDataCollection()
- Specified by:
nextDataCollection
in interfaceIncrementalSnapshotContext<T>
-
startNewChunk
public void startNewChunk()
- Specified by:
startNewChunk
in interfaceIncrementalSnapshotContext<T>
-
currentChunkId
public String currentChunkId()
- Specified by:
currentChunkId
in interfaceIncrementalSnapshotContext<T>
-
maximumKey
public void maximumKey(Object[] key)
- Specified by:
maximumKey
in interfaceIncrementalSnapshotContext<T>
-
maximumKey
public Optional<Object[]> maximumKey()
- Specified by:
maximumKey
in interfaceIncrementalSnapshotContext<T>
-
getSchema
public Table getSchema()
- Specified by:
getSchema
in interfaceIncrementalSnapshotContext<T>
-
setSchema
public void setSchema(Table schema)
- Specified by:
setSchema
in interfaceIncrementalSnapshotContext<T>
-
isSchemaVerificationPassed
public boolean isSchemaVerificationPassed()
- Specified by:
isSchemaVerificationPassed
in interfaceIncrementalSnapshotContext<T>
-
setSchemaVerificationPassed
public void setSchemaVerificationPassed(boolean schemaVerificationPassed)
- Specified by:
setSchemaVerificationPassed
in interfaceIncrementalSnapshotContext<T>
-
-