diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/HdfsStorage.java b/fe/fe-core/src/main/java/org/apache/doris/backup/HdfsStorage.java index ca4d9e0fc455e2..17ffb9723b92ac 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/HdfsStorage.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/HdfsStorage.java @@ -63,7 +63,7 @@ public class HdfsStorage extends BlobStorage { private final int readBufferSize = 128 << 10; // 128k private final int writeBufferSize = 128 << 10; // 128k - private FileSystem dfsFileSystem = null; + private volatile FileSystem dfsFileSystem = null; /** * init HdfsStorage with properties. @@ -86,6 +86,9 @@ public static String getFsName(String path) { @Override public FileSystem getFileSystem(String remotePath) throws UserException { + if (dfsFileSystem != null) { + return dfsFileSystem; + } synchronized (this) { if (dfsFileSystem == null) { String username = hdfsProperties.get(HdfsResource.HADOOP_USER_NAME); @@ -98,7 +101,7 @@ public FileSystem getFileSystem(String remotePath) throws UserException { isSecurityEnabled = true; } } - + conf.set("fs.hdfs.impl.disable.cache", "true"); try { if (isSecurityEnabled) { UserGroupInformation.setConfiguration(conf); @@ -117,7 +120,6 @@ public FileSystem getFileSystem(String remotePath) throws UserException { } } } - return dfsFileSystem; }