This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch branch-0.x
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/branch-0.x by this push:
new ed1fa579d015 [HUDI-9681] Remove mkdir in partition listing and add try
catch to listStatus of partition (#13739)
ed1fa579d015 is described below
commit ed1fa579d015a6b259818d6891832102fa7a7729
Author: Y Ethan Guo <[email protected]>
AuthorDate: Wed Aug 20 13:52:38 2025 -0700
[HUDI-9681] Remove mkdir in partition listing and add try catch to
listStatus of partition (#13739)
---
.../hudi/common/table/view/AbstractTableFileSystemView.java | 4 ----
.../org/apache/hudi/metadata/FileSystemBackedTableMetadata.java | 9 ++++++++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java
index 7cfdb4d0d701..f63c6bf3ddeb 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java
@@ -398,9 +398,7 @@ public abstract class AbstractTableFileSystemView
implements SyncableFileSystemV
pathInfoMap.put(partitionPair,
metaClient.getStorage().listDirectEntries(absolutePartitionPath));
} catch (IOException e) {
- // Create the path if it does not exist already
if (!metaClient.getStorage().exists(absolutePartitionPath)) {
- metaClient.getStorage().createDirectory(absolutePartitionPath);
pathInfoMap.put(partitionPair, Collections.emptyList());
} else {
// in case the partition path was created by another caller
@@ -471,9 +469,7 @@ public abstract class AbstractTableFileSystemView
implements SyncableFileSystemV
try {
return metaClient.getStorage().listDirectEntries(partitionPath);
} catch (IOException e) {
- // Create the path if it does not exist already
if (!metaClient.getStorage().exists(partitionPath)) {
- metaClient.getStorage().createDirectory(partitionPath);
return Collections.emptyList();
} else {
// in case the partition path was created by another caller
diff --git
a/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
b/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
index 82c56f67c968..73ee52e35b87 100644
---
a/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
+++
b/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
@@ -44,6 +44,7 @@ import org.apache.hudi.storage.HoodieStorageUtils;
import org.apache.hudi.storage.StoragePath;
import org.apache.hudi.storage.StoragePathInfo;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -52,6 +53,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* Implementation of {@link HoodieTableMetadata} based file-system-backed
table metadata.
@@ -177,7 +179,12 @@ public class FileSystemBackedTableMetadata extends
AbstractHoodieTableMetadata {
"Listing all partitions with prefix " + relativePathPrefix);
// Need to use serializable file status here, see HUDI-5936
List<StoragePathInfo> dirToFileListing =
engineContext.flatMap(pathsToList, path -> {
- return getStorage().listDirectEntries(path).stream();
+ try {
+ return getStorage().listDirectEntries(path).stream();
+ } catch (FileNotFoundException e) {
+ // The partition may have been cleaned.
+ return Stream.empty();
+ }
}, listingParallelism);
pathsToList.clear();