Class WalPositionLocator
- java.lang.Object
-
- io.debezium.connector.postgresql.connection.WalPositionLocator
-
public class WalPositionLocator extends Object
This class is responsible for finding out a LSN from which Debezium should resume streaming after connector restarts. The LSNs are not guaranteed to be ordered in the WAL. LSN of commits are ordered and LSNs inside a transaction are ordered. It is thus necessary to find out the beginning of the unprocessed transaction and the LSN from which the streaming should start.- Author:
- Jiri Pechanec
-
-
Field Summary
Fields Modifier and Type Field Description private LsnfirstLsnReceivedprivate LsnlastCommitStoredLsnprivate LsnlastEventStoredLsnprivate static org.slf4j.LoggerLOGGERprivate LsnlsnAfterLastEventStoredLsnprivate booleanpassMessagesprivate LsnstartStreamingLsnprivate booleanstoreLsnAfterLastEventStoredLsnprivate LsntxStartLsn
-
Constructor Summary
Constructors Constructor Description WalPositionLocator()WalPositionLocator(Lsn lastCommitStoredLsn, Lsn lastEventStoredLsn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenableFiltering()Enables filtering of message LSNs based on calculated position.LsngetLastEventStoredLsn()Optional<Lsn>resumeFromLsn(Lsn currentLsn, ReplicationMessage message)booleansearchingEnabled()booleanskipMessage(Lsn lsn)Decides whether the message with given LSN should be removed or not based on previously located LSN point.StringtoString()
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
lastCommitStoredLsn
private final Lsn lastCommitStoredLsn
-
lastEventStoredLsn
private final Lsn lastEventStoredLsn
-
txStartLsn
private Lsn txStartLsn
-
lsnAfterLastEventStoredLsn
private Lsn lsnAfterLastEventStoredLsn
-
firstLsnReceived
private Lsn firstLsnReceived
-
passMessages
private boolean passMessages
-
startStreamingLsn
private Lsn startStreamingLsn
-
storeLsnAfterLastEventStoredLsn
private boolean storeLsnAfterLastEventStoredLsn
-
-
Method Detail
-
resumeFromLsn
public Optional<Lsn> resumeFromLsn(Lsn currentLsn, ReplicationMessage message)
- Returns:
- the first LSN from which processing should be started or empty if the position has not been found yet
-
skipMessage
public boolean skipMessage(Lsn lsn)
Decides whether the message with given LSN should be removed or not based on previously located LSN point.- Parameters:
lsn-- Returns:
- true if the message should be skipped, false otherwise
-
enableFiltering
public void enableFiltering()
Enables filtering of message LSNs based on calculated position.
-
searchingEnabled
public boolean searchingEnabled()
- Returns:
- true if searching of WAL position should be executed
-
getLastEventStoredLsn
public Lsn getLastEventStoredLsn()
-
-