lokeshj1703 commented on code in PR #11440:
URL: https://github.com/apache/hudi/pull/11440#discussion_r1683797553


##########
hudi-common/src/main/java/org/apache/hudi/common/util/ClusteringUtils.java:
##########
@@ -365,20 +370,56 @@ public static Option<HoodieInstant> 
getEarliestInstantToRetainForClustering(
           // TODO: This case has to be handled. HUDI-6352
           retainLowerBound = cleanInstant.getTimestamp();
         }
-
-        oldestInstantToRetain = replaceOrClusterTimeline.filter(instant ->
-                HoodieTimeline.compareTimestamps(
-                    instant.getTimestamp(),
-                    HoodieTimeline.GREATER_THAN_OR_EQUALS,
-                    retainLowerBound))
-            .firstInstant();
+        oldestInstantToRetain = 
replaceOrClusterTimeline.findInstantsAfterOrEquals(retainLowerBound).firstInstant();
       } else {
         oldestInstantToRetain = replaceOrClusterTimeline.firstInstant();
       }
     }
+    if (!shouldArchiveBeyondSavepoint) {

Review Comment:
   Addressed



##########
hudi-common/src/main/java/org/apache/hudi/common/util/ClusteringUtils.java:
##########
@@ -333,28 +335,31 @@ public static List<HoodieInstant> 
getPendingClusteringInstantTimes(HoodieTableMe
    * Returns the earliest instant to retain.
    * Make sure the clustering instant won't be archived before cleaned, and 
the earliest inflight clustering instant has a previous commit.
    *
-   * @param activeTimeline The active timeline
-   * @param metaClient     The meta client
+   * @param activeTimeline               The active timeline
+   * @param metaClient                   The meta client
+   * @param cleanerPolicy                The hoodie cleaning policy
+   * @param shouldArchiveBeyondSavepoint Is archival enabled to run beyond 
savepoint
    * @return the earliest instant to retain for clustering
    */
   public static Option<HoodieInstant> getEarliestInstantToRetainForClustering(
-      HoodieActiveTimeline activeTimeline, HoodieTableMetaClient metaClient) 
throws IOException {
+      HoodieActiveTimeline activeTimeline, HoodieTableMetaClient metaClient, 
HoodieCleaningPolicy cleanerPolicy, boolean shouldArchiveBeyondSavepoint) 
throws IOException {
     Option<HoodieInstant> oldestInstantToRetain = Option.empty();
     HoodieTimeline replaceOrClusterTimeline = 
activeTimeline.getTimelineOfActions(CollectionUtils.createSet(HoodieTimeline.REPLACE_COMMIT_ACTION,
 HoodieTimeline.CLUSTERING_ACTION));
+    Option<HoodieInstant> cleanInstantOpt =

Review Comment:
   Addressed



-- 
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]

Reply via email to