SteNicholas commented on code in PR #7405:
URL: https://github.com/apache/hudi/pull/7405#discussion_r1057625411


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -188,8 +188,12 @@ private List<String> 
getPartitionPathsForIncrementalCleaning(HoodieCleanMetadata
         + "since last cleaned at " + cleanMetadata.getEarliestCommitToRetain()
         + ". New Instant to retain : " + newInstantToRetain);
     return 
hoodieTable.getCompletedCommitsTimeline().getInstantsAsStream().filter(
-        instant -> HoodieTimeline.compareTimestamps(instant.getTimestamp(), 
HoodieTimeline.GREATER_THAN_OR_EQUALS,
-            cleanMetadata.getEarliestCommitToRetain()) && 
HoodieTimeline.compareTimestamps(instant.getTimestamp(),
+        instant -> (HoodieTimeline.compareTimestamps(instant.getTimestamp(), 
HoodieTimeline.GREATER_THAN_OR_EQUALS,
+            cleanMetadata.getEarliestCommitToRetain())
+              || (instant.getMarkerFileModificationTimestamp().isPresent()

Review Comment:
   @stream2000 do you mean the change should be in the 
`getEarliestCommitToRetain` with the following:
   ```
   if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_COMMITS
           && commitTimeline.countInstants() > commitsRetained) {
         Option<HoodieInstant> earliestPendingCommits = 
hoodieTable.getMetaClient()
             .getActiveTimeline()
             .getCommitsTimeline()
             .filter(s -> !s.isCompleted()).firstInstant();
         if (earliestPendingCommits.isPresent()) {
           // Earliest commit to retain must not be later than the earliest 
pending commit
           earliestCommitToRetain =
               commitTimeline.nthInstant(commitTimeline.countInstants() - 
commitsRetained).map(nthInstant -> {
                 if (nthInstant.compareTo(earliestPendingCommits.get()) <= 0) {
                   return Option.of(nthInstant);
                 } else {
                   return 
commitTimeline.findInstantsBefore(earliestPendingCommits.get().getTimestamp()).lastInstant();
                 }
               }).orElse(Option.empty());
         } else {
           earliestCommitToRetain = 
commitTimeline.nthInstant(commitTimeline.countInstants() -
               commitsRetained); //15 instants total, 10 commits to retain, 
this gives 6th instant in the list
         }
    }
   ```
   ?



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

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

Reply via email to