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 2d178e1304 [cosn] FileSystem should be cached by authority (#8814)
2d178e1304 is described below

commit 2d178e13041754ef95097a7ac64a4af02e1f221f
Author: Eunbin Son <[email protected]>
AuthorDate: Thu Jul 23 19:33:01 2026 +0900

    [cosn] FileSystem should be cached by authority (#8814)
---
 .../apache/paimon/cosn/HadoopCompliantFileIO.java  | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/paimon-filesystems/paimon-cosn-impl/src/main/java/org/apache/paimon/cosn/HadoopCompliantFileIO.java
 
b/paimon-filesystems/paimon-cosn-impl/src/main/java/org/apache/paimon/cosn/HadoopCompliantFileIO.java
index 1887e89ac6..36e9a1e829 100644
--- 
a/paimon-filesystems/paimon-cosn-impl/src/main/java/org/apache/paimon/cosn/HadoopCompliantFileIO.java
+++ 
b/paimon-filesystems/paimon-cosn-impl/src/main/java/org/apache/paimon/cosn/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;
     }
 

Reply via email to