prashantwason commented on a change in pull request #4212:
URL: https://github.com/apache/hudi/pull/4212#discussion_r762380654



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java
##########
@@ -708,15 +708,25 @@ public HoodieCleanMetadata clean(String cleanInstantTime, 
boolean skipLocking) t
    * @param skipLocking if this is triggered by another parent transaction, 
locking can be skipped.
    */
   public HoodieCleanMetadata clean(String cleanInstantTime, boolean 
scheduleInline, boolean skipLocking) throws HoodieIOException {
-    if (scheduleInline) {
-      scheduleTableServiceInternal(cleanInstantTime, Option.empty(), 
TableServiceType.CLEAN);
-    }
     LOG.info("Cleaner started");
     final Timer.Context timerContext = metrics.getCleanCtx();
     LOG.info("Cleaned failed attempts if any");
     CleanerUtils.rollbackFailedWrites(config.getFailedWritesCleanPolicy(),
         HoodieTimeline.CLEAN_ACTION, () -> rollbackFailedWrites(skipLocking));
-    HoodieCleanMetadata metadata = createTable(config, 
hadoopConf).clean(context, cleanInstantTime, skipLocking);
+
+    // If there are pending clean operations, attempt them before scheduling 
the next clean. This prevents the
+    // next clean from deciding to clean the same files which might be under 
clean from pending operations.
+    HoodieCleanMetadata metadata = null;
+    HoodieTable table = createTable(config, hadoopConf);

Review comment:
       The caller does not know if the previous clean failed or succeed. For 
the caller to know this, it will have to check the timeline which is internal 
to HUDI and IMO should not be exposed to the caller.
   
   Another way to reason about this is - "What is the HUDI Write Client API 
contract/guarantee?". When the caller calls clean() what does it guarantee?
   1. That the clean will be scheduled, or
   2. That the clean will eventually be completed, or
   3. The clean may or may not complete
   
   I might have misunderstood your point though.
   
   >> why only clean the first instant ?
   The logic (as I want to implement) cleans all leftover cleans and then 
performs an additional clean.




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