the-other-tim-brown commented on code in PR #13340:
URL: https://github.com/apache/hudi/pull/13340#discussion_r2110748077


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -848,22 +790,59 @@ public HoodieCleanMetadata clean(String cleanInstantTime, 
boolean scheduleInline
       }
     }
 
-    if (hasInflightClean || scheduledClean) {
+    if (inflightClean.isPresent() || cleanInstantTime.isPresent()) {
       table.getMetaClient().reloadActiveTimeline();
       // Proceeds to execute any requested or inflight clean instances in the 
timeline
-      HoodieCleanMetadata metadata = table.clean(context, cleanInstantTime);
+      String cleanInstant = cleanInstantTime.isPresent() ? 
cleanInstantTime.get() : inflightClean.get();
+      HoodieCleanMetadata metadata = table.clean(context, cleanInstant);
       if (timerContext != null && metadata != null) {
         long durationMs = metrics.getDurationInMs(timerContext.stop());
         metrics.updateCleanMetrics(durationMs, 
metadata.getTotalFilesDeleted());
         LOG.info("Cleaned {} files Earliest Retained Instant :{} 
cleanerElapsedMs: {}",
             metadata.getTotalFilesDeleted(), 
metadata.getEarliestCommitToRetain(), durationMs);
       }
-      releaseResources(cleanInstantTime);
+      releaseResources(cleanInstant);
       return metadata;
     }
     return null;
   }
 
+  /**
+   * Computes a cleaner plan and persists it to the timeline if cleaning is 
required.
+   *
+   * @param table table to schedule cleaning on.
+   * @param suppliedCleanInstant Optional supplied clean instant time that 
overrides the generated time. This can only be used for testing.
+   * @return the requested instant time if the service was scheduled
+   */
+  private Option<String> scheduleCleaning(HoodieTable<?, ?, ?, ?> table, 
Option<String> suppliedCleanInstant) {
+    Option<HoodieCleanerPlan> cleanerPlan = table.createCleanerPlan(context, 
Option.empty());
+    if (cleanerPlan.isPresent()) {
+      // handle special case where planner returns empty plan due to 
corruption of existing instant

Review Comment:
   This is the case from this 
[comment](https://github.com/apache/hudi/pull/13340#discussion_r2110745146)



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