yihua commented on code in PR #10591:
URL: https://github.com/apache/hudi/pull/10591#discussion_r1569129096


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -736,14 +745,15 @@ private void initializeFileGroups(HoodieTableMetaClient 
dataMetaClient, Metadata
                                     int fileGroupCount) throws IOException {
     String partitionName = 
HoodieIndexUtils.getPartitionNameFromPartitionType(metadataPartition, 
dataMetaClient, dataWriteConfig.getFunctionalIndexConfig().getIndexName());
     // Remove all existing file groups or leftover files in the partition
-    final Path partitionPath = new Path(metadataWriteConfig.getBasePath(), 
partitionName);
-    FileSystem fs = metadataMetaClient.getFs();
+    final HoodieLocation partitionPath = new 
HoodieLocation(metadataWriteConfig.getBasePath(), partitionName);
+    HoodieStorage storage = metadataMetaClient.getHoodieStorage();
     try {
-      final FileStatus[] existingFiles = fs.listStatus(partitionPath);
-      if (existingFiles.length > 0) {
+      final List<HoodieFileStatus> existingFiles = 
storage.listDirectEntries(partitionPath);
+      if (existingFiles.size() > 0) {
         LOG.warn("Deleting all existing files found in MDT partition " + 
partitionName);
-        fs.delete(partitionPath, true);
-        ValidationUtils.checkState(!fs.exists(partitionPath), "Failed to 
delete MDT partition " + partitionName);
+        storage.deleteDirectory(partitionPath);

Review Comment:
   This API only works on directories.



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