Package io.debezium.connector.postgresql
Class PostgresOffsetContext
- java.lang.Object
-
- io.debezium.connector.postgresql.PostgresOffsetContext
-
- All Implemented Interfaces:
OffsetContext
public class PostgresOffsetContext extends Object implements OffsetContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPostgresOffsetContext.Loader
-
Field Summary
Fields Modifier and Type Field Description private IncrementalSnapshotContext<TableId>incrementalSnapshotContextstatic StringLAST_COMMIT_LSN_KEYstatic StringLAST_COMPLETELY_PROCESSED_LSN_KEYprivate LsnlastCommitLsnprivate LsnlastCompletelyProcessedLsnprivate booleanlastSnapshotRecordprivate static org.slf4j.LoggerLOGGERprivate SourceInfosourceInfoprivate org.apache.kafka.connect.data.SchemasourceInfoSchemaprivate LsnstreamingStoppingLsnprivate TransactionContexttransactionContext
-
Constructor Summary
Constructors Modifier Constructor Description privatePostgresOffsetContext(PostgresConnectorConfig connectorConfig, Lsn lsn, Lsn lastCompletelyProcessedLsn, Lsn lastCommitLsn, Long txId, Instant time, boolean snapshot, boolean lastSnapshotRecord, TransactionContext transactionContext, IncrementalSnapshotContext<TableId> incrementalSnapshotContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OffsetStateasOffsetState()voidevent(DataCollectionId tableId, Instant instant)IncrementalSnapshotContext<?>getIncrementalSnapshotContext()Map<String,?>getOffset()org.apache.kafka.connect.data.StructgetSourceInfo()org.apache.kafka.connect.data.SchemagetSourceInfoSchema()(package private) LsngetStreamingStoppingLsn()Returns the LSN that the streaming phase should stream events up to or null if a stopping point is not set.TransactionContextgetTransactionContext()(package private) booleanhasCompletelyProcessedPosition()(package private) booleanhasLastKnownPosition()voidincrementalSnapshotEvents()static PostgresOffsetContextinitialContext(PostgresConnectorConfig connectorConfig, PostgresConnection jdbcConnection, Clock clock)static PostgresOffsetContextinitialContext(PostgresConnectorConfig connectorConfig, PostgresConnection jdbcConnection, Clock clock, Lsn lastCommitLsn, Lsn lastCompletelyProcessedLsn)booleanisSnapshotRunning()(package private) LsnlastCommitLsn()(package private) LsnlastCompletelyProcessedLsn()(package private) Lsnlsn()voidmarkLastSnapshotRecord()voidpostSnapshotCompletion()voidpreSnapshotCompletion()voidpreSnapshotStart()voidsetStreamingStoppingLsn(Lsn streamingStoppingLsn)StringtoString()voidupdateCommitPosition(Lsn lsn, Lsn lastCompletelyProcessedLsn)voidupdateSnapshotPosition(Instant timestamp, TableId tableId)voidupdateWalPosition(Lsn lsn, Lsn lastCompletelyProcessedLsn, Instant commitTime, Long txId, TableId tableId, Long xmin)(package private) Longxmin()
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
LAST_COMPLETELY_PROCESSED_LSN_KEY
public static final String LAST_COMPLETELY_PROCESSED_LSN_KEY
- See Also:
- Constant Field Values
-
LAST_COMMIT_LSN_KEY
public static final String LAST_COMMIT_LSN_KEY
- See Also:
- Constant Field Values
-
sourceInfoSchema
private final org.apache.kafka.connect.data.Schema sourceInfoSchema
-
sourceInfo
private final SourceInfo sourceInfo
-
lastSnapshotRecord
private boolean lastSnapshotRecord
-
lastCompletelyProcessedLsn
private Lsn lastCompletelyProcessedLsn
-
lastCommitLsn
private Lsn lastCommitLsn
-
streamingStoppingLsn
private Lsn streamingStoppingLsn
-
transactionContext
private final TransactionContext transactionContext
-
incrementalSnapshotContext
private final IncrementalSnapshotContext<TableId> incrementalSnapshotContext
-
-
Constructor Detail
-
PostgresOffsetContext
private PostgresOffsetContext(PostgresConnectorConfig connectorConfig, Lsn lsn, Lsn lastCompletelyProcessedLsn, Lsn lastCommitLsn, Long txId, Instant time, boolean snapshot, boolean lastSnapshotRecord, TransactionContext transactionContext, IncrementalSnapshotContext<TableId> incrementalSnapshotContext)
-
-
Method Detail
-
getOffset
public Map<String,?> getOffset()
- Specified by:
getOffsetin interfaceOffsetContext
-
getSourceInfoSchema
public org.apache.kafka.connect.data.Schema getSourceInfoSchema()
- Specified by:
getSourceInfoSchemain interfaceOffsetContext
-
getSourceInfo
public org.apache.kafka.connect.data.Struct getSourceInfo()
- Specified by:
getSourceInfoin interfaceOffsetContext
-
isSnapshotRunning
public boolean isSnapshotRunning()
- Specified by:
isSnapshotRunningin interfaceOffsetContext
-
preSnapshotStart
public void preSnapshotStart()
- Specified by:
preSnapshotStartin interfaceOffsetContext
-
preSnapshotCompletion
public void preSnapshotCompletion()
- Specified by:
preSnapshotCompletionin interfaceOffsetContext
-
postSnapshotCompletion
public void postSnapshotCompletion()
- Specified by:
postSnapshotCompletionin interfaceOffsetContext
-
updateWalPosition
public void updateWalPosition(Lsn lsn, Lsn lastCompletelyProcessedLsn, Instant commitTime, Long txId, TableId tableId, Long xmin)
-
hasLastKnownPosition
boolean hasLastKnownPosition()
-
hasCompletelyProcessedPosition
boolean hasCompletelyProcessedPosition()
-
lsn
Lsn lsn()
-
lastCompletelyProcessedLsn
Lsn lastCompletelyProcessedLsn()
-
lastCommitLsn
Lsn lastCommitLsn()
-
getStreamingStoppingLsn
Lsn getStreamingStoppingLsn()
Returns the LSN that the streaming phase should stream events up to or null if a stopping point is not set. If set during the streaming phase, any event with an LSN less than the stopping LSN will be processed and once the stopping LSN is reached, the streaming phase will end. Useful for a pre-snapshot catch up streaming phase.
-
setStreamingStoppingLsn
public void setStreamingStoppingLsn(Lsn streamingStoppingLsn)
-
xmin
Long xmin()
-
initialContext
public static PostgresOffsetContext initialContext(PostgresConnectorConfig connectorConfig, PostgresConnection jdbcConnection, Clock clock)
-
initialContext
public static PostgresOffsetContext initialContext(PostgresConnectorConfig connectorConfig, PostgresConnection jdbcConnection, Clock clock, Lsn lastCommitLsn, Lsn lastCompletelyProcessedLsn)
-
asOffsetState
public OffsetState asOffsetState()
-
markLastSnapshotRecord
public void markLastSnapshotRecord()
- Specified by:
markLastSnapshotRecordin interfaceOffsetContext
-
event
public void event(DataCollectionId tableId, Instant instant)
- Specified by:
eventin interfaceOffsetContext
-
getTransactionContext
public TransactionContext getTransactionContext()
- Specified by:
getTransactionContextin interfaceOffsetContext
-
incrementalSnapshotEvents
public void incrementalSnapshotEvents()
- Specified by:
incrementalSnapshotEventsin interfaceOffsetContext
-
getIncrementalSnapshotContext
public IncrementalSnapshotContext<?> getIncrementalSnapshotContext()
- Specified by:
getIncrementalSnapshotContextin interfaceOffsetContext
-
-