You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "zhangyue19921010 (via GitHub)" <gi...@apache.org> on 2023/02/13 09:21:28 UTC

[GitHub] [hudi] zhangyue19921010 commented on a diff in pull request #7865: [HUDI-5710] Load all partitions in advance when using KEEP_LATEST_FILE_VERSIONS clean policy and MDT enable

zhangyue19921010 commented on code in PR #7865:
URL: https://github.com/apache/hudi/pull/7865#discussion_r1104187459


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -101,6 +102,16 @@ public CleanPlanner(HoodieEngineContext context, HoodieTable<T, I, K, O> hoodieT
     this.fgIdToPendingLogCompactionOperations = fileSystemView.getPendingLogCompactionOperations()
         .map(entry -> Pair.of(new HoodieFileGroupId(entry.getValue().getPartitionPath(), entry.getValue().getFileId()), entry.getValue()))
         .collect(Collectors.toMap(Pair::getKey, Pair::getValue));
+
+    // load all partitions in advance if necessary.
+    if (config.isMetadataTableEnabled()
+        && config.getCleanerPolicy().equals(HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS)
+        && (config.getViewStorageConfig().getStorageType().equals(FileSystemViewStorageType.MEMORY)
+            || (config.getViewStorageConfig().getStorageType().equals(FileSystemViewStorageType.REMOTE_FIRST)
+                && config.getViewStorageConfig().getSecondaryStorageType().equals(FileSystemViewStorageType.MEMORY)))) {
+      LOG.info("Load all partitions and files into file system view in advance when using KEEP_LATEST_FILE_VERSIONS.");
+      fileSystemView.loadAllPartitions();

Review Comment:
   Thanks @stream2000 for your attention.  I will update our test result later, in summary
   Data size: 300T
   Partition numbers: 63,000
   KEEP_LATEST_FILE_VERSIONS
   
   |  feature   | clean time |
   |  ----  | ----  |
   | Disable MDT | 2.3 min |
   | Enable MDT  | 1.1h |
   |Enable MDT + current PR| 7s |
   
   Disable MDT
   ![image](https://user-images.githubusercontent.com/69956021/218418777-a14b94ba-302c-483b-b7a8-401c45b62fc0.png)
   
   Enable MDT
   ![image](https://user-images.githubusercontent.com/69956021/218418908-8f17c673-5102-426c-b0d9-a8f7f935ffe2.png)
   
   
   Enable MDT + current PR
   ![image](https://user-images.githubusercontent.com/69956021/218418593-8b1a3b90-198e-4c77-9e1d-8fd67e61e6ce.png)
   
   
   CC @yihua and @nsivabalan 
   
   



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