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


##########
hudi-common/src/main/java/org/apache/hudi/common/util/CleanerUtils.java:
##########
@@ -161,4 +163,42 @@ public static void 
rollbackFailedWrites(HoodieFailedWritesCleaningPolicy cleanin
         throw new IllegalArgumentException("Unsupported action type " + 
actionType);
     }
   }
+
+  /**
+   * Get latest clean planner clean time.
+   * @param metaClient
+   * @return Latest clean planner clean time.
+   * @throws IOException
+   */
+  public static Option<String> getLatestInstantCleanTime(HoodieTableMetaClient 
metaClient)
+      throws IOException {
+    HoodieActiveTimeline activeTimeline =  metaClient.getActiveTimeline();
+    Option<HoodieInstant> lastCleanInstantOption = 
activeTimeline.getCleanerTimeline().lastInstant();
+    Option<HoodieCleanMetadata> cleanMetadata = 
lastCleanInstantOption.isPresent() && ! 
activeTimeline.isEmpty(lastCleanInstantOption.get())
+        ? 
Option.ofNullable(TimelineMetadataUtils.deserializeHoodieCleanMetadata(activeTimeline.getInstantDetails(lastCleanInstantOption.get()).get()))
+        : Option.empty();
+    return cleanMetadata.isPresent() ? 
Option.ofNullable(cleanMetadata.get().getStartCleanTime()) : Option.empty();
+  }
+
+  /**
+   * Get earliest unClean completed instant
+   * @param metaClient
+   * @return
+   * @throws IOException
+   */
+  public static Option<HoodieInstant> 
getEarliestUnCleanCompletedInstant(HoodieTableMetaClient metaClient) throws 
IOException {

Review Comment:
   ```suggestion
     public static Option<HoodieInstant> 
getEarliestUncleanCompletedInstant(HoodieTableMetaClient metaClient) throws 
IOException {
   ```



##########
hudi-common/src/main/java/org/apache/hudi/common/util/CleanerUtils.java:
##########
@@ -161,4 +163,42 @@ public static void 
rollbackFailedWrites(HoodieFailedWritesCleaningPolicy cleanin
         throw new IllegalArgumentException("Unsupported action type " + 
actionType);
     }
   }
+
+  /**
+   * Get latest clean planner clean time.
+   * @param metaClient
+   * @return Latest clean planner clean time.
+   * @throws IOException
+   */
+  public static Option<String> getLatestInstantCleanTime(HoodieTableMetaClient 
metaClient)
+      throws IOException {
+    HoodieActiveTimeline activeTimeline =  metaClient.getActiveTimeline();
+    Option<HoodieInstant> lastCleanInstantOption = 
activeTimeline.getCleanerTimeline().lastInstant();
+    Option<HoodieCleanMetadata> cleanMetadata = 
lastCleanInstantOption.isPresent() && ! 
activeTimeline.isEmpty(lastCleanInstantOption.get())
+        ? 
Option.ofNullable(TimelineMetadataUtils.deserializeHoodieCleanMetadata(activeTimeline.getInstantDetails(lastCleanInstantOption.get()).get()))
+        : Option.empty();
+    return cleanMetadata.isPresent() ? 
Option.ofNullable(cleanMetadata.get().getStartCleanTime()) : Option.empty();
+  }
+
+  /**
+   * Get earliest unClean completed instant
+   * @param metaClient
+   * @return
+   * @throws IOException
+   */
+  public static Option<HoodieInstant> 
getEarliestUnCleanCompletedInstant(HoodieTableMetaClient metaClient) throws 
IOException {

Review Comment:
   ```suggestion
     public static Option<HoodieInstant> 
getEarliestUncleanCompletedInstant(HoodieTableMetaClient metaClient) throws 
IOException {
   ```



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