You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "007vedant (via GitHub)" <gi...@apache.org> on 2024/03/04 12:39:19 UTC

[I] Using Delete Partition operation with KEEP_LATEST_FILE_VERSIONS = 1 cleaner policy option evicts parquet files from S3 storage [hudi]

007vedant opened a new issue, #10812:
URL: https://github.com/apache/hudi/issues/10812

   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?
   
   - Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.
   
   - If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   I'm having a Copy-On-Write (COW) table in AWS S3 bucket with some date based partitions. When I perform a `delete_partitions` operation on the Hudi table with cleaner policy configuration of `KEEP_LATEST_FILE_VERSIONS = 1`, hudi not only removes the partitions from the metadata (expected) but also actually deletes the partitions and the base parquet files from the S3 storage (unexpected). 
   
   I'm unable to understand why this is happening. As per Hudi's latest documentation, `KEEP_LATEST_FILE_VERSIONS` cleaner configurations deletes all but the latest file version from the storage. So when I perform the `delete_partitions` operation, are all the file groups in those partitions marked with a special `to_be_deleted` kind of version or the cleaning action first interacts with the table metadata, finds that the partitions and their files groups have been dropped and thus performs the actual cleaner action over those partitions. I'm more curious on why this is happening rather than how is this happening, as this is the favorable outcome in my use case.
   
   NOTE: The actual file eviction from storage was not happening when the cleaner configuration was `KEEP_LATEST_COMMITS = 1`. In this is case, I had to perform an additional commit to trigger the cleaner action.
   
   Write configurations used:
   ```
   
   val FILE_VERSIONS_TO_RETAIN = 1
   
   val options =  Map[String, String](
         DataSourceWriteOptions.OPERATION.key -> DataSourceWriteOptions.DELETE_PARTITION_OPERATION_OPT_VAL,
         DataSourceWriteOptions.PARTITIONS_TO_DELETE.key -> listOfPartitions,
         HoodieCleanConfig.CLEANER_POLICY.key -> HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS.name,
         HoodieCleanConfig.CLEANER_FILE_VERSIONS_RETAINED.key -> FILE_VERSIONS_TO_RETAIN
       )
   
   
   // empty df is an empty dataframe
   
   emptyDf.write
         .format("hudi")
         .options(cleanerOptions)
         .mode("append")
         .save(tablePath)
   ```
   
   A clear and concise description of the problem.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   1. Create a Copy-On-Write (COW) hudi table in AWS S3.
   2. Write some data into the table partitioned using `hoodie.datasource.write.partitionpath.field`
   3. Drop some partitions using the write configurations provided above.
   
   **Expected behavior**
   
   A clear and concise description of what you expected to happen.
   
   **Environment Description**
   
   * Hudi version : hudi-spark3.3-bundle_2.12
   
   * Spark version : 3.3.1
   
   * Hive version : 3.1.3
   
   * Hadoop version : 3.3.3
   
   * Storage (HDFS/S3/GCS..) : S3
   
   * Running on Docker? (yes/no) : no (AWS EMR 6.10.0)
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   


-- 
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-unsubscribe@hudi.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Using Delete Partition operation with KEEP_LATEST_FILE_VERSIONS = 1 cleaner policy option evicts parquet files from S3 storage [hudi]

Posted by "rangareddy (via GitHub)" <gi...@apache.org>.
rangareddy commented on issue #10812:
URL: https://github.com/apache/hudi/issues/10812#issuecomment-4850553867

   This is expected behavior, not a bug — `delete_partition` and the cleaner are two separate steps. `delete_partition` only writes a **replacecommit** marking the partition's file groups as *replaced* (a logical delete); no files are removed yet. The **cleaner** does the physical deletion, and the timing depends on the policy. `KEEP_LATEST_FILE_VERSIONS` retains the latest N versions of *live* file groups — a replaced group isn't a live version of anything, so it's removed immediately in the clean cycle triggered by the delete_partition commit, regardless of `CLEANER_FILE_VERSIONS_RETAINED` (that count only applies to live groups). `KEEP_LATEST_COMMITS` instead keeps files needed for the last N commits (for rollback/time-travel/incremental), so the replaced files are retained until the replacecommit ages out of that window — which is why you needed an extra commit to trigger the eviction. To your question: there's no per-file `to_be_deleted` flag; the replaced file groups are 
 recorded in the replacecommit metadata and the cleaner reads the timeline to find and remove them per policy. If you want immediate reclamation, `FILE_VERSIONS` is the right choice, just note it's effectively irreversible (no time-travel/rollback to before the delete); use `KEEP_LATEST_COMMITS` or a savepoint if you need recoverability.


-- 
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-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Using Delete Partition operation with KEEP_LATEST_FILE_VERSIONS = 1 cleaner policy option evicts parquet files from S3 storage [hudi]

Posted by "ad1happy2go (via GitHub)" <gi...@apache.org>.
ad1happy2go commented on issue #10812:
URL: https://github.com/apache/hudi/issues/10812#issuecomment-1978934641

   @007vedant I was trying and noticed that as soon as we switch the cleaner policy to KEEP_LATEST_FILE_VERSIONS, it deletes the partition irrespective of CLEANER_FILE_VERSIONS_RETAINED, its deleting the partition. 
   
   I will look into this more. 


-- 
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-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org