zbingwen commented on issue #3452:
URL: https://github.com/apache/flink-cdc/issues/3452#issuecomment-2208424086

   restoredIntervalEnd logic is wrong
   ```
       public static GtidSet fixRestoredGtidSetOld(GtidSet serverGtidSet, 
GtidSet restoredGtidSet) {
           Map<String, GtidSet.UUIDSet> newSet = new HashMap<>();
           serverGtidSet.getUUIDSets().forEach(uuidSet -> 
newSet.put(uuidSet.getUUID(), uuidSet));
           for (GtidSet.UUIDSet uuidSet : restoredGtidSet.getUUIDSets()) {
               GtidSet.UUIDSet serverUuidSet = newSet.get(uuidSet.getUUID());
               if (serverUuidSet != null) {
                   long restoredIntervalEnd = getIntervalEnd(uuidSet);
                   List<com.github.shyiko.mysql.binlog.GtidSet.Interval> 
newIntervals =
                           new ArrayList<>();
                   for (GtidSet.Interval serverInterval : 
serverUuidSet.getIntervals()) {
                       if (serverInterval.getEnd() <= restoredIntervalEnd) {
                           newIntervals.add(
                                   new 
com.github.shyiko.mysql.binlog.GtidSet.Interval(
                                           serverInterval.getStart(), 
serverInterval.getEnd()));
                       } else if (serverInterval.getStart() <= 
restoredIntervalEnd
                               && serverInterval.getEnd() > 
restoredIntervalEnd) {
                           newIntervals.add(
                                   new 
com.github.shyiko.mysql.binlog.GtidSet.Interval(
                                           serverInterval.getStart(), 
restoredIntervalEnd));
                       }
                   }
                   newSet.put(
                           uuidSet.getUUID(),
                           new GtidSet.UUIDSet(
                                   new 
com.github.shyiko.mysql.binlog.GtidSet.UUIDSet(
                                           uuidSet.getUUID(), newIntervals)));
               } else {
                   newSet.put(uuidSet.getUUID(), uuidSet);
               }
           }
           return new GtidSet(newSet);
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to