nsivabalan commented on code in PR #18322:
URL: https://github.com/apache/hudi/pull/18322#discussion_r2957788255


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -590,13 +590,30 @@ public Pair<Boolean, List<CleanFileInfo>> 
getDeletePaths(String partitionPath, O
    */
   public Option<HoodieInstant> getEarliestCommitToRetain() {
     if (!earliestCommitToRetain.isPresent()) {
+      // Get the previous clean's earliest commit to retain, if available
+      Option<String> previousEarliestCommitToRetain = Option.empty();
+      Option<HoodieInstant> lastClean = 
hoodieTable.getCleanTimeline().filterCompletedInstants().lastInstant();
+      if (lastClean.isPresent()) {
+        try {
+          HoodieCleanMetadata cleanMetadata = 
hoodieTable.getActiveTimeline().readCleanMetadata(lastClean.get());
+          if (cleanMetadata.getEarliestCommitToRetain() != null
+              && !cleanMetadata.getEarliestCommitToRetain().trim().isEmpty()) {
+            previousEarliestCommitToRetain = 
Option.of(cleanMetadata.getEarliestCommitToRetain());
+          }
+        } catch (Exception e) {
+          log.warn("Failed to read previous clean metadata, proceeding without 
capping commits to clean", e);

Review Comment:
   I am just resorting to degraded performance. Just incase we can't deser the 
prev clean, I am favoring to make progress on clean rather than failing 
altogether. 
   



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -590,13 +590,30 @@ public Pair<Boolean, List<CleanFileInfo>> 
getDeletePaths(String partitionPath, O
    */
   public Option<HoodieInstant> getEarliestCommitToRetain() {
     if (!earliestCommitToRetain.isPresent()) {
+      // Get the previous clean's earliest commit to retain, if available
+      Option<String> previousEarliestCommitToRetain = Option.empty();
+      Option<HoodieInstant> lastClean = 
hoodieTable.getCleanTimeline().filterCompletedInstants().lastInstant();
+      if (lastClean.isPresent()) {
+        try {
+          HoodieCleanMetadata cleanMetadata = 
hoodieTable.getActiveTimeline().readCleanMetadata(lastClean.get());

Review Comment:
   yes, sure



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -590,13 +590,30 @@ public Pair<Boolean, List<CleanFileInfo>> 
getDeletePaths(String partitionPath, O
    */
   public Option<HoodieInstant> getEarliestCommitToRetain() {
     if (!earliestCommitToRetain.isPresent()) {
+      // Get the previous clean's earliest commit to retain, if available
+      Option<String> previousEarliestCommitToRetain = Option.empty();
+      Option<HoodieInstant> lastClean = 
hoodieTable.getCleanTimeline().filterCompletedInstants().lastInstant();
+      if (lastClean.isPresent()) {

Review Comment:
   will fix it



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