Package io.debezium.connector.mongodb
Class MongoDbIncrementalSnapshotContext<T>
java.lang.Object
io.debezium.connector.mongodb.MongoDbIncrementalSnapshotContext<T>
- All Implemented Interfaces:
IncrementalSnapshotContext<T>
@NotThreadSafe
public class MongoDbIncrementalSnapshotContext<T>
extends Object
implements IncrementalSnapshotContext<T>
Describes current state of incremental snapshot of MongoDB connector
- Author:
- Jiri Pechanec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Object[]The last primary key in chunk that is now in process.private Stringstatic final 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 Tableprivate booleanstatic final Stringprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDataCollectionNamesToSnapshot(List<String> dataCollectionIds) private voidaddTablesIdsToSnapshot(List<T> dataCollectionIds) private StringarrayToSerializedString(Object[] array) Object[]booleancloseWindow(String id) intprivate Stringbooleanprotected static <U> IncrementalSnapshotContext<U>init(MongoDbIncrementalSnapshotContext<U> context, Map<String, ?> offsets) booleanbooleanstatic <U> MongoDbIncrementalSnapshotContext<U>voidmaximumKey(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) private voidvoidvoidprivate Object[]serializedStringToArray(String field, String serialized) voidvoidsetSchemaVerificationPassed(boolean schemaVerificationPassed) booleanvoidstringToDataCollections(String dataCollectionsStr) toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
INCREMENTAL_SNAPSHOT_KEY
- See Also:
-
DATA_COLLECTIONS_TO_SNAPSHOT_KEY
- See Also:
-
EVENT_PRIMARY_KEY
- See Also:
-
TABLE_MAXIMUM_KEY
- See Also:
-
windowOpened
protected boolean windowOpened -
chunkEndPosition
The last primary key in chunk that is now in process. -
dataCollectionsToSnapshot
-
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
-
-
Constructor Details
-
MongoDbIncrementalSnapshotContext
public MongoDbIncrementalSnapshotContext(boolean useCatalogBeforeSchema)
-
-
Method Details
-
openWindow
- Specified by:
openWindowin interfaceIncrementalSnapshotContext<T>
-
closeWindow
- Specified by:
closeWindowin 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
-
dataCollectionsToSnapshotAsString
-
stringToDataCollections
-
snapshotRunning
public boolean snapshotRunning()- Specified by:
snapshotRunningin interfaceIncrementalSnapshotContext<T>
-
store
- Specified by:
storein interfaceIncrementalSnapshotContext<T>
-
addTablesIdsToSnapshot
-
addDataCollectionNamesToSnapshot
- Specified by:
addDataCollectionNamesToSnapshotin interfaceIncrementalSnapshotContext<T>
-
init
protected static <U> IncrementalSnapshotContext<U> init(MongoDbIncrementalSnapshotContext<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>
-
load
public static <U> MongoDbIncrementalSnapshotContext<U> load(Map<String, ?> offsets, boolean useCatalogBeforeSchema) -
toString
-