pratyakshsharma commented on a change in pull request #3646:
URL: https://github.com/apache/hudi/pull/3646#discussion_r736201659
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java
##########
@@ -402,9 +478,16 @@ private String
getLatestVersionBeforeCommit(List<FileSlice> fileSliceList, Hoodi
public Option<HoodieInstant> getEarliestCommitToRetain() {
Option<HoodieInstant> earliestCommitToRetain = Option.empty();
int commitsRetained = config.getCleanerCommitsRetained();
+ int hoursRetained = config.getCleanerHoursRetained();
if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_COMMITS
&& commitTimeline.countInstants() > commitsRetained) {
- earliestCommitToRetain =
commitTimeline.nthInstant(commitTimeline.countInstants() - commitsRetained);
+ earliestCommitToRetain =
commitTimeline.nthInstant(commitTimeline.countInstants() - commitsRetained);
//15 instants total, 10 commits to retain, this gives 6th instant in the list
+ } else if (config.getCleanerPolicy() ==
HoodieCleaningPolicy.KEEP_LAST_X_HOURS) {
+ Instant instant = Instant.now();
+ ZonedDateTime commitDateTime = ZonedDateTime.ofInstant(instant,
ZoneId.systemDefault());
Review comment:
@nsivabalan I checked. There is no uniformity as of now. We use joda
dateTime library in TimestampBasedKeyGenerator, java.time.ZonedDateTime in
SlashEncodedHourPartitionValueExtractor, and java.util.Date in
HoodieActiveTimeline.
@prashantwason nthInstant is what we are using throughout the codebase. I
guess there is no need to introduce a new method `findInstantInPast` here.
--
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]