This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 0e80c0e70d [azure] FileSystem should be cached by authority (#8816)
0e80c0e70d is described below
commit 0e80c0e70da21c2a781c919fa0e2f6e04b613c58
Author: Eunbin Son <[email protected]>
AuthorDate: Thu Jul 23 19:32:49 2026 +0900
[azure] FileSystem should be cached by authority (#8816)
---
.../apache/paimon/azure/HadoopCompliantFileIO.java | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git
a/paimon-filesystems/paimon-azure-impl/src/main/java/org/apache/paimon/azure/HadoopCompliantFileIO.java
b/paimon-filesystems/paimon-azure-impl/src/main/java/org/apache/paimon/azure/HadoopCompliantFileIO.java
index 0758bb4437..f928bde84b 100644
---
a/paimon-filesystems/paimon-azure-impl/src/main/java/org/apache/paimon/azure/HadoopCompliantFileIO.java
+++
b/paimon-filesystems/paimon-azure-impl/src/main/java/org/apache/paimon/azure/HadoopCompliantFileIO.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.fs.FileSystem;
import javax.annotation.Nullable;
import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Hadoop {@link FileIO}.
@@ -41,7 +43,7 @@ public abstract class HadoopCompliantFileIO implements FileIO
{
private static final long serialVersionUID = 1L;
- protected transient volatile FileSystem fs;
+ protected transient volatile Map<String, FileSystem> fsMap;
@Override
public SeekableInputStream newInputStream(Path path) throws IOException {
@@ -107,13 +109,25 @@ public abstract class HadoopCompliantFileIO implements
FileIO {
}
private FileSystem getFileSystem(org.apache.hadoop.fs.Path path) throws
IOException {
- if (fs == null) {
+ if (fsMap == null) {
synchronized (this) {
- if (fs == null) {
- fs = createFileSystem(path);
+ if (fsMap == null) {
+ fsMap = new ConcurrentHashMap<>();
}
}
}
+
+ Map<String, FileSystem> map = fsMap;
+
+ String authority = path.toUri().getAuthority();
+ if (authority == null) {
+ authority = "DEFAULT";
+ }
+ FileSystem fs = map.get(authority);
+ if (fs == null) {
+ fs = createFileSystem(path);
+ map.put(authority, fs);
+ }
return fs;
}