You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/08/30 01:58:00 UTC

[GitHub] [hudi] yihua commented on issue #6528: [SUPPORT]How to clean the compacted .log and .hfiles in metadata?

yihua commented on issue #6528:
URL: https://github.com/apache/hudi/issues/6528#issuecomment-1231051936

   @Zhangshunyu as @nsivabalan Hudi manages the compaction and cleaning for metadata table internally, as shown below in `HoodieBackedTableMetadataWriter` class:
   ```
   protected void cleanIfNecessary(BaseHoodieWriteClient writeClient, String instantTime) {
       Option<HoodieInstant> lastCompletedCompactionInstant = metadataMetaClient.reloadActiveTimeline()
           .getCommitTimeline().filterCompletedInstants().lastInstant();
       if (lastCompletedCompactionInstant.isPresent()
           && metadataMetaClient.getActiveTimeline().filterCompletedInstants()
               .findInstantsAfter(lastCompletedCompactionInstant.get().getTimestamp()).countInstants() < 3) {
         // do not clean the log files immediately after compaction to give some buffer time for metadata table reader,
         // because there is case that the reader has prepared for the log file readers already before the compaction completes
         // while before/during the reading of the log files, the cleaning triggers and delete the reading files,
         // then a FileNotFoundException(for LogFormatReader) or NPE(for HFileReader) would throw.
   
         // 3 is a value that I think is enough for metadata table reader.
         return;
       }
       // Trigger cleaning with suffixes based on the same instant time. This ensures that any future
       // delta commits synced over will not have an instant time lesser than the last completed instant on the
       // metadata table.
       writeClient.clean(instantTime + "002");
     }
   ```
   
   Also as laid out above, the current logic prevents the cleaning from happening within 3 instants after the compaction in metadata table.  That could be the reason why you don't see cleaning, as `hoodie.metadata.compact.max.delta.commits` is set to 1.
   
   Could you try setting  `hoodie.metadata.compact.max.delta.commits` to 5 and see if that solves your problem?


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