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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Object[]The last primary key in chunk that is now in process.static final Stringprivate Stringprivate Stringstatic final Stringstatic final Stringprivate Object[]The PK of the last record that was passed to Kafka Connect.private static final org.slf4j.Loggerprivate Object[]The largest PK in the table at the start of snapshot.private final AtomicBooleanDetermines if the incremental snapshot was paused or not.private Tableprivate booleanprivate final AbstractIncrementalSnapshotContext.SnapshotDataCollection<T>static final Stringprivate final booleanprotected booleantrueif window is opened and deduplication should be executed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDataCollectionNamesToSnapshot(String correlationId, List<String> dataCollectionIds, List<AdditionalCondition> additionalCondition, String surrogateKey) private voidaddTablesIdsToSnapshot(List<DataCollection<T>> dataCollectionIds) private StringarrayToSerializedString(Object[] array) private Function<String,DataCollection<T>> buildDataCollection(List<AdditionalCondition> additionalCondition, String surrogateKey) Object[]booleancloseWindow(String id) intbooleanprotected static <U> IncrementalSnapshotContext<U>init(AbstractIncrementalSnapshotContext<U> context, Map<String, ?> offsets) booleanbooleanbooleanvoidmaximumKey(Object[] key) voidnextChunkPosition(Object[] end) private booleanThe snapshotting process can receive out-of-order windowing signals after connector restart as depending on committed offset position some signals can be replayed.booleanopenWindow(String id) voidbooleanremoveDataCollectionFromSnapshot(String dataCollectionId) private voidvoidvoidvoidprivate Object[]serializedStringToArray(String field, String serialized) voidvoidsetSchemaVerificationPassed(boolean schemaVerificationPassed) booleanvoidvoidtoString()void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
INCREMENTAL_SNAPSHOT_KEY
- See Also:
-
EVENT_PRIMARY_KEY
- See Also:
-
TABLE_MAXIMUM_KEY
- See Also:
-
CORRELATION_ID
- See Also:
-
snapshotDataCollection
-
windowOpened
protected boolean windowOpenedtrueif window is opened and deduplication should be executed -
chunkEndPosition
The last primary key in chunk that is now in process. -
useCatalogBeforeSchema
private final boolean useCatalogBeforeSchema -
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
-
maximumKey
The largest PK in the table at the start of snapshot. -
schema
-
schemaVerificationPassed
private boolean schemaVerificationPassed -
correlationId
-
paused
Determines if the incremental snapshot was paused or not.
-
-
Constructor Details
-
AbstractIncrementalSnapshotContext
public AbstractIncrementalSnapshotContext(boolean useCatalogBeforeSchema)
-
-
Method Details
-
openWindow
- Specified by:
openWindowin interfaceIncrementalSnapshotContext<T>
-
closeWindow
- Specified by:
closeWindowin interfaceIncrementalSnapshotContext<T>
-
pauseSnapshot
public void pauseSnapshot()- Specified by:
pauseSnapshotin interfaceIncrementalSnapshotContext<T>
-
resumeSnapshot
public void resumeSnapshot()- Specified by:
resumeSnapshotin interfaceIncrementalSnapshotContext<T>
-
isSnapshotPaused
public boolean isSnapshotPaused()- Specified by:
isSnapshotPausedin interfaceIncrementalSnapshotContext<T>
-
notExpectedChunk
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>
-
arrayToSerializedString
-
serializedStringToArray
-
snapshotRunning
public boolean snapshotRunning()- Specified by:
snapshotRunningin interfaceIncrementalSnapshotContext<T>
-
store
- Specified by:
storein interfaceIncrementalSnapshotContext<T>
-
addTablesIdsToSnapshot
-
addDataCollectionNamesToSnapshot
public List<DataCollection<T>> addDataCollectionNamesToSnapshot(String correlationId, List<String> dataCollectionIds, List<AdditionalCondition> additionalCondition, String surrogateKey) - Specified by:
addDataCollectionNamesToSnapshotin interfaceIncrementalSnapshotContext<T>
-
buildDataCollection
private Function<String,DataCollection<T>> buildDataCollection(List<AdditionalCondition> additionalCondition, String surrogateKey) -
stopSnapshot
public void stopSnapshot()- Specified by:
stopSnapshotin interfaceIncrementalSnapshotContext<T>
-
removeDataCollectionFromSnapshot
- Specified by:
removeDataCollectionFromSnapshotin interfaceIncrementalSnapshotContext<T>
-
getDataCollections
- Specified by:
getDataCollectionsin interfaceIncrementalSnapshotContext<T>
-
unsetCorrelationId
public void unsetCorrelationId()- Specified by:
unsetCorrelationIdin interfaceIncrementalSnapshotContext<T>
-
getCorrelationId
- Specified by:
getCorrelationIdin interfaceIncrementalSnapshotContext<T>
-
init
protected static <U> IncrementalSnapshotContext<U> init(AbstractIncrementalSnapshotContext<U> context, Map<String, ?> offsets) -
sendEvent
- Specified by:
sendEventin interfaceIncrementalSnapshotContext<T>
-
currentDataCollectionId
- Specified by:
currentDataCollectionIdin interfaceIncrementalSnapshotContext<T>
-
dataCollectionsToBeSnapshottedCount
public int dataCollectionsToBeSnapshottedCount()- Specified by:
dataCollectionsToBeSnapshottedCountin interfaceIncrementalSnapshotContext<T>
-
nextChunkPosition
- Specified by:
nextChunkPositionin interfaceIncrementalSnapshotContext<T>
-
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
- Specified by:
nextDataCollectionin interfaceIncrementalSnapshotContext<T>
-
startNewChunk
public void startNewChunk()- Specified by:
startNewChunkin interfaceIncrementalSnapshotContext<T>
-
currentChunkId
- Specified by:
currentChunkIdin interfaceIncrementalSnapshotContext<T>
-
maximumKey
- Specified by:
maximumKeyin interfaceIncrementalSnapshotContext<T>
-
maximumKey
- Specified by:
maximumKeyin interfaceIncrementalSnapshotContext<T>
-
getSchema
- Specified by:
getSchemain interfaceIncrementalSnapshotContext<T>
-
setSchema
- 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>
-
toString
-