Skip to content

Commit

Permalink
Allow keep latest file to pin commit
Browse files Browse the repository at this point in the history
  • Loading branch information
parisni committed Sep 5, 2022
1 parent 4b6ed43 commit 054e2a5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public List<String> getPartitionPathsToClean(Option<HoodieInstant> earliestRetai
switch (config.getCleanerPolicy()) {
case KEEP_LATEST_COMMITS:
case KEEP_LATEST_BY_HOURS:
return getPartitionPathsForFullCleaning();
case KEEP_LATEST_FILE_VERSIONS:
return getPartitionPathsForCleanByCommits(earliestRetainedInstant);
default:
Expand Down Expand Up @@ -471,6 +470,8 @@ public Option<HoodieInstant> getEarliestCommitToRetain() {
String earliestTimeToRetain = HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(hoursRetained).toInstant()));
earliestCommitToRetain = Option.fromJavaOptional(commitTimeline.getInstants().filter(i -> HoodieTimeline.compareTimestamps(i.getTimestamp(),
HoodieTimeline.GREATER_THAN_OR_EQUALS, earliestTimeToRetain)).findFirst());
} else if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS) {
earliestCommitToRetain = hoodieTable.getCleanTimeline().filterCompletedInstants().lastInstant();
}
return earliestCommitToRetain;
}
Expand Down

0 comments on commit 054e2a5

Please sign in to comment.