Class BinlogHistoryRecordComparator
java.lang.Object
io.debezium.relational.history.HistoryRecordComparator
io.debezium.connector.binlog.history.BinlogHistoryRecordComparator
Base implementation of the
HistoryRecordComparator for binlog-based connectors.- Author:
- Chris Cranford
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class -
Field Summary
FieldsFields inherited from class io.debezium.relational.history.HistoryRecordComparator
INSTANCE -
Constructor Summary
ConstructorsConstructorDescriptionBinlogHistoryRecordComparator(Predicate<String> gtidSourceFilter, GtidSetFactory gtidSetFactory) -
Method Summary
Modifier and TypeMethodDescriptiongetBinlogFileName(Document document) Get the binlog file name.protected intgetBinlogPosition(Document document) Get the binlog position.protected intgetBinlogRowInEvent(Document document) Get the binlog row in event value.protected intgetEventsToSkip(Document document) Get the number of events to skip.protected StringgetGtidSet(Document document) Get the global transaction identifier set.protected intgetServerId(Document document) Get the server unique identifier.protected longgetTimestamp(Document document) Get the timestamp.booleanisPositionAtOrBefore(Document recorded, Document desired) Determine whether the first offset is at or before the point in time of the second offset, where the offsets are given in JSON representations of maps returned by the connector's offset context.protected booleanisSnapshot(Document document) Get whether the event is part of the connector's snapshot phase.Methods inherited from class io.debezium.relational.history.HistoryRecordComparator
isAtOrBefore, isSameSource
-
Field Details
-
gtidSourceFilter
-
gtidSetFactory
-
-
Constructor Details
-
BinlogHistoryRecordComparator
public BinlogHistoryRecordComparator(Predicate<String> gtidSourceFilter, GtidSetFactory gtidSetFactory)
-
-
Method Details
-
isPositionAtOrBefore
Determine whether the first offset is at or before the point in time of the second offset, where the offsets are given in JSON representations of maps returned by the connector's offset context. This logic makes a significant assumption: once a server enables GTID, they are never disabled. This is the only way to compare a position with a GTID to a position without a GTID, and any change with a GTID is after positions without. When both positions have GTIDs, the positions are compared using the GTIDs. If the GTID values are identical, then we compare whether they have snapshots enabled.- Overrides:
isPositionAtOrBeforein classHistoryRecordComparator- Parameters:
recorded- the position obtained from the recorded history; never nulldesired- the desired position that we want to obtain, which should be after some recorded positions at some recorded positions, and before other recorded positions; never null- Returns:
- true if the recorded position is at or before the desired position; false otherwise.
-
getGtidSet
Get the global transaction identifier set.- Parameters:
document- the document to inspect, should not be null- Returns:
- the global transaction identifier set as a string
-
getServerId
Get the server unique identifier.- Parameters:
document- the document to inspect, should not be null- Returns:
- the unique server identifier
-
isSnapshot
Get whether the event is part of the connector's snapshot phase.- Parameters:
document- the document to inspect, should not be null- Returns:
- true if its part of the snapshot, false otherwise
-
getTimestamp
Get the timestamp.- Parameters:
document- the document to inspect, should not be null- Returns:
- the timestamp value
-
getBinlogFileName
Get the binlog file name.- Parameters:
document- the document to inspect, should not be null- Returns:
- the binlog file name value
-
getBinlogPosition
Get the binlog position.- Parameters:
document- the document to inspect, should not be null- Returns:
- the binlog position value
-
getEventsToSkip
Get the number of events to skip.- Parameters:
document- the document to inspect, should not be null- Returns:
- the binlog number of events to skip value
-
getBinlogRowInEvent
Get the binlog row in event value.- Parameters:
document- the document to inspect, should not be null- Returns:
- the binlog row in event value
-