[Bug][Connector-V2][MySQL-CDC] BinlogOffset.compareTo ignores restartSkipRows when GTID sets are equal
#10775 opened on Apr 16, 2026
Description
Search before asking
I searched existing issues with keywords including BinlogOffset, GTID, restartSkipRows, and MySQL CDC compareTo, and did not find a duplicate issue for this offset comparison problem.
What happened
BinlogOffset stores both restartSkipEvents and restartSkipRows in the offset map, but BinlogOffset.compareTo only compares restartSkipEvents when both offsets have the same GTID set.
Code path:
seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/offset/BinlogOffset.java- When
gtidSet.equals(targetGtidSet), the method returns the comparison result ofrestartSkipEventsonly. restartSkipRowsis stored in the offset map but is not considered in this branch.
This means two offsets can be considered equal when they have:
- The same GTID set
- The same
restartSkipEvents - Different
restartSkipRows
For CDC recovery and offset ordering, this can be risky because row-level progress inside the same binlog event may be lost in comparison semantics.
Expected behavior
When GTID sets are equal, BinlogOffset.compareTo should preserve deterministic ordering for all relevant offset components.
At minimum, the comparison should consider restartSkipRows after restartSkipEvents. It may also be worth reviewing whether binlog file/position should be used as a fallback in this branch.
Why this matters
MySQL CDC correctness depends on precise offset comparison during recovery, checkpoint restore, and split/watermark coordination. If two distinct offsets compare as equal, SeaTunnel may make incorrect decisions when resuming from GTID-based offsets.
Suggested direction
Contributors are welcome to help with this issue.
A good PR could include:
- Add unit tests for
BinlogOffset.compareTocovering equal GTID sets with differentrestartSkipRows. - Decide the correct comparison order for equal GTID sets:
restartSkipEventsrestartSkipRows- optional fallback to binlog file/position if needed
- Update
compareToaccordingly. - Add regression coverage for GTID-based recovery semantics if possible.