From 37d15b66cad33bfe28459f8af7086c9daeb68a49 Mon Sep 17 00:00:00 2001 From: Calvin Kirs Date: Wed, 26 Feb 2025 18:01:27 +0800 Subject: [PATCH] [Fix](remote-fs)Change closed Field to Instance-Level to Avoid Global Shutdown Issues in RemoteFileSystem (#48351) ### PR Description: Change Background: The closed field in the current RemoteFileSystem class is static, meaning it is shared globally across all instances of the class. This design leads to issues when multiple parts of the application use RemoteFileSystem and attempt to close it. Once one instance is closed, the static closed field is set to true, causing other instances to incorrectly report that the file system is unavailable. This can cause confusion and inconsistent behavior, especially when multiple threads are involved. ### Change Details: closed Field: The closed field has been moved from a static field to an instance-level field. This ensures that each RemoteFileSystem instance maintains its own shutdown status, eliminating the problem of shared state between instances. --- .../main/java/org/apache/doris/fs/remote/RemoteFileSystem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/RemoteFileSystem.java b/fe/fe-core/src/main/java/org/apache/doris/fs/remote/RemoteFileSystem.java index 08b7e1cde78bef..290ee37e383cc6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/RemoteFileSystem.java +++ b/fe/fe-core/src/main/java/org/apache/doris/fs/remote/RemoteFileSystem.java @@ -43,7 +43,7 @@ public abstract class RemoteFileSystem extends PersistentFileSystem implements C // this field will be visited by multi-threads, better use volatile qualifier protected volatile org.apache.hadoop.fs.FileSystem dfsFileSystem = null; private final ReentrantLock fsLock = new ReentrantLock(); - protected static final AtomicBoolean closed = new AtomicBoolean(false); + protected AtomicBoolean closed = new AtomicBoolean(false); public RemoteFileSystem(String name, StorageBackend.StorageType type) { super(name, type);