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


##########
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:
   I think the idea of this PR is similar to 
https://github.com/apache/hudi/pull/7690, maybe we can refer to its conditions 
`shouldUseBatchLookup`?
   
![image](https://user-images.githubusercontent.com/37108074/218666353-749c4d94-3112-493b-b0cc-69ecccc96d05.png)
   



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