the-other-tim-brown commented on code in PR #13653:
URL: https://github.com/apache/hudi/pull/13653#discussion_r2248056351


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/savepoint/SavepointHelpers.java:
##########
@@ -66,4 +72,28 @@ public static void validateSavepointPresence(HoodieTable 
table, String savepoint
       throw new HoodieRollbackException("No savepoint for instantTime " + 
savepointTime);
     }
   }
+
+  private static class SavepointInstantComparator implements 
Comparator<HoodieInstant> {
+    private final boolean tableVersion8OrLater;
+    private final InstantComparator instantComparator;
+
+    public SavepointInstantComparator(boolean tableVersion8OrLater, 
InstantComparator instantComparator) {
+      this.tableVersion8OrLater = tableVersion8OrLater;
+      this.instantComparator = instantComparator;
+    }
+
+    @Override
+    public int compare(HoodieInstant o1, HoodieInstant o2) {
+      if (tableVersion8OrLater) {
+        return instantComparator.completionTimeOrderedComparator().compare(o1, 
o2);
+      } else {
+        // Do to special handling of compaction instants, we need to use 
requested time based comparator for compaction instants but completion time 
based comparator for others
+        if (o1.getAction().equals(HoodieTimeline.COMMIT_ACTION) || 
o2.getAction().equals(HoodieTimeline.COMMIT_ACTION)) {

Review Comment:
   The issue here is around the special handling for compactions on v6 tables 
in the planner. The planner will retain a compaction that completed after the 
instant we are restoring to if the compaction started before the instant we are 
restoring to. The "last" instant on the timeline would be compaction in this 
case if we use completion time ordering and then the assertion will fail since 
the restore was targeting a delta commit that started after the compaction but 
finished before the compaction completed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to