SteNicholas commented on code in PR #7891:
URL: https://github.com/apache/hudi/pull/7891#discussion_r1121281585
##########
hudi-common/src/main/java/org/apache/hudi/common/util/ClusteringUtils.java:
##########
@@ -250,15 +253,24 @@ public static Option<HoodieInstant>
getOldestInstantToRetainForClustering(
? cleanInstant
:
HoodieTimeline.getCleanRequestedInstant(cleanInstant.getTimestamp()))
.getEarliestInstantToRetain().getTimestamp();
- return StringUtils.isNullOrEmpty(earliestCommitToRetain)
- ? Option.empty()
- : replaceTimeline.filter(instant ->
- HoodieTimeline.compareTimestamps(instant.getTimestamp(),
- HoodieTimeline.GREATER_THAN_OR_EQUALS,
- earliestCommitToRetain))
- .firstInstant();
+ if (!StringUtils.isNullOrEmpty(earliestCommitToRetain)) {
+ oldestInstantToRetain = replaceTimeline.filterCompletedInstants()
+ .filter(instant ->
HoodieTimeline.compareTimestamps(instant.getTimestamp(),
HoodieTimeline.GREATER_THAN_OR_EQUALS, earliestCommitToRetain))
+ .firstInstant();
+ }
+ }
+ Option<HoodieInstant> pendingInstantOpt =
replaceTimeline.filterInflights().firstInstant();
+ if (pendingInstantOpt.isPresent()) {
+ // Get the previous commit before the first inflight clustering
instant.
+ Option<HoodieInstant> beforePendingInstant =
activeTimeline.filterCompletedInstants()
Review Comment:
@bvaradar, right. I will update to
`activeTImeline.getCommitsTimeline().filterCompletedInstants()`.
--
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]