vinishjail97 commented on code in PR #732:
URL: https://github.com/apache/incubator-xtable/pull/732#discussion_r2234131715


##########
xtable-core/src/main/java/org/apache/xtable/hudi/HudiConversionSource.java:
##########
@@ -184,11 +185,32 @@ private boolean isAffectedByCleanupProcess(Instant 
instant) {
         TimelineMetadataUtils.deserializeHoodieCleanMetadata(
             
metaClient.getActiveTimeline().getInstantDetails(lastCleanInstant.get()).get());
     String earliestCommitToRetain = cleanMetadata.getEarliestCommitToRetain();
+    if (Strings.isNullOrEmpty(earliestCommitToRetain)) {
+      return cleanInstantsOccurredSinceLastSyncedInstant(instant);
+    }
     Instant earliestCommitToRetainInstant =
         HudiInstantUtils.parseFromInstantTime(earliestCommitToRetain);
     return earliestCommitToRetainInstant.isAfter(instant);
   }
 
+  // When clean instants have empty earliestCommitToRetain, trigger full 
snapshot sync if any
+  // clean instants occurred after the last synced instant to err on the side 
of caution
+  private boolean cleanInstantsOccurredSinceLastSyncedInstant(Instant instant) 
{
+    String lastSyncedCommitTime = 
HudiInstantUtils.convertInstantToCommit(instant);
+    List<HoodieInstant> cleanInstantsAfterLastSync =
+        metaClient
+            .getActiveTimeline()
+            .getCleanerTimeline()
+            .filterCompletedInstants()
+            .filter(
+                cleanInstant ->
+                    HoodieTimeline.compareTimestamps(
+                        cleanInstant.getTimestamp(), GREATER_THAN, 
lastSyncedCommitTime))

Review Comment:
   @alexr17 There are few build failures, GREATER_THAN import is missing. Can 
you add it? 



-- 
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...@xtable.apache.org

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

Reply via email to