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[]chunkEndPositionThe last primary key in chunk that is now in process.private StringcurrentChunkIdstatic StringDATA_COLLECTIONS_TO_SNAPSHOT_KEYprivate Queue<T>dataCollectionsToSnapshotstatic StringEVENT_PRIMARY_KEYstatic StringINCREMENTAL_SNAPSHOT_KEYprivate Object[]lastEventKeySentThe PK of the last record that was passed to Kafka Connect.private static org.slf4j.LoggerLOGGERprivate Object[]maximumKeyThe largest PK in the table at the start of snapshot.private Tableschemaprivate booleanschemaVerificationPassedstatic StringTABLE_MAXIMUM_KEYprivate booleanuseCatalogBeforeSchemaprotected booleanwindowOpened
-
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:
openWindowin interfaceIncrementalSnapshotContext<T>
-
closeWindow
public boolean closeWindow(String id)
- Specified by:
closeWindowin 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:
deduplicationNeededin interfaceIncrementalSnapshotContext<T>
-
dataCollectionsToSnapshotAsString
private String dataCollectionsToSnapshotAsString()
-
snapshotRunning
public boolean snapshotRunning()
- Specified by:
snapshotRunningin interfaceIncrementalSnapshotContext<T>
-
store
public Map<String,Object> store(Map<String,Object> offset)
- Specified by:
storein interfaceIncrementalSnapshotContext<T>
-
addDataCollectionNamesToSnapshot
public List<T> addDataCollectionNamesToSnapshot(List<String> dataCollectionIds)
- Specified by:
addDataCollectionNamesToSnapshotin interfaceIncrementalSnapshotContext<T>
-
init
protected static <U> IncrementalSnapshotContext<U> init(AbstractIncrementalSnapshotContext<U> context, Map<String,?> offsets)
-
sendEvent
public void sendEvent(Object[] key)
- Specified by:
sendEventin interfaceIncrementalSnapshotContext<T>
-
currentDataCollectionId
public T currentDataCollectionId()
- Specified by:
currentDataCollectionIdin interfaceIncrementalSnapshotContext<T>
-
dataCollectionsToBeSnapshottedCount
public int dataCollectionsToBeSnapshottedCount()
- Specified by:
dataCollectionsToBeSnapshottedCountin interfaceIncrementalSnapshotContext<T>
-
nextChunkPosition
public void nextChunkPosition(Object[] end)
- Specified by:
nextChunkPositionin interfaceIncrementalSnapshotContext<T>
-
chunkEndPosititon
public Object[] chunkEndPosititon()
- Specified by:
chunkEndPosititonin interfaceIncrementalSnapshotContext<T>
-
resetChunk
private void resetChunk()
-
revertChunk
public void revertChunk()
- Specified by:
revertChunkin interfaceIncrementalSnapshotContext<T>
-
isNonInitialChunk
public boolean isNonInitialChunk()
- Specified by:
isNonInitialChunkin interfaceIncrementalSnapshotContext<T>
-
nextDataCollection
public T nextDataCollection()
- Specified by:
nextDataCollectionin interfaceIncrementalSnapshotContext<T>
-
startNewChunk
public void startNewChunk()
- Specified by:
startNewChunkin interfaceIncrementalSnapshotContext<T>
-
currentChunkId
public String currentChunkId()
- Specified by:
currentChunkIdin interfaceIncrementalSnapshotContext<T>
-
maximumKey
public void maximumKey(Object[] key)
- Specified by:
maximumKeyin interfaceIncrementalSnapshotContext<T>
-
maximumKey
public Optional<Object[]> maximumKey()
- Specified by:
maximumKeyin interfaceIncrementalSnapshotContext<T>
-
getSchema
public Table getSchema()
- Specified by:
getSchemain interfaceIncrementalSnapshotContext<T>
-
setSchema
public void setSchema(Table schema)
- Specified by:
setSchemain interfaceIncrementalSnapshotContext<T>
-
isSchemaVerificationPassed
public boolean isSchemaVerificationPassed()
- Specified by:
isSchemaVerificationPassedin interfaceIncrementalSnapshotContext<T>
-
setSchemaVerificationPassed
public void setSchemaVerificationPassed(boolean schemaVerificationPassed)
- Specified by:
setSchemaVerificationPassedin interfaceIncrementalSnapshotContext<T>
-
-