This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-fs-spi
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 9d539779e26253d14a0a5147d270751209285185
Author: morningman <[email protected]>
AuthorDate: Wed Apr 1 16:00:17 2026 +0800

    [refactor](fs-spi) P4.8-E: delete SwitchingFileSystem and dead legacy 
provider infrastructure
    
    ### What problem does this PR solve?
    
    Issue Number: N/A
    
    Problem Summary:
    FileSystemProviderImpl, LegacyFileSystemProviderFactory, 
SwitchingFileSystem,
    and FileSystemLookup had zero callers outside their own files. The entire
    legacy provider chain was dead code: no production or test code referenced
    FileSystemProviderImpl or LegacyFileSystemProviderFactory after previous
    phases migrated all callers to the SPI FileSystemFactory.
    
    Changes:
    - Delete FileSystemProviderImpl (no callers; only created 
SwitchingFileSystem)
    - Delete LegacyFileSystemProviderFactory (interface with no callers)
    - Delete SwitchingFileSystem (only instantiated by deleted 
FileSystemProviderImpl)
    - Delete FileSystemLookup (FunctionalInterface only used by deleted 
SwitchingFileSystem)
    - FileSystem.java: replace @see LegacyFileSystemApi javadoc with reference 
to SPI
    
    Note: LegacyFileSystemApi is NOT deleted here — it is still implemented by
    PersistentFileSystem and LocalDfsFileSystem which are Phase G deletion 
scope.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test: No need to test (deleting unreachable dead code; build verifies no 
callers)
    - Behavior changed: No
    - Does this need documentation: No
    
    Co-authored-by: Copilot <[email protected]>
---
 .../main/java/org/apache/doris/fs/FileSystem.java  |   2 +-
 .../java/org/apache/doris/fs/FileSystemLookup.java |  30 -----
 .../apache/doris/fs/FileSystemProviderImpl.java    |  44 -------
 .../doris/fs/LegacyFileSystemProviderFactory.java  |  29 -----
 .../doris/fs/remote/SwitchingFileSystem.java       | 131 ---------------------
 5 files changed, 1 insertion(+), 235 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystem.java 
b/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystem.java
index 3d95c1f7e6f..6bc9c42a4e2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystem.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystem.java
@@ -34,7 +34,7 @@ import java.util.Set;
  * Implementations must be thread-safe. Instances may be shared and cached.
  *
  * @see MemoryFileSystem for in-memory testing
- * @see LegacyFileSystemApi for the legacy Status-based interface (deprecated)
+ * @see org.apache.doris.filesystem.spi.FileSystem for the new SPI interface
  */
 public interface FileSystem extends Closeable {
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemLookup.java 
b/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemLookup.java
deleted file mode 100644
index 0bd67143504..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemLookup.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.fs;
-
-/**
- * Abstraction for looking up FileSystem instances from a cache,
- * used by SwitchingFileSystem to avoid direct dependency on 
ExternalMetaCacheMgr.
- */
-public interface FileSystemLookup {
-    /**
-     * Looks up and returns a cached FileSystem for the given key.
-     * Creates a new instance if not cached.
-     */
-    LegacyFileSystemApi lookup(FileSystemCache.FileSystemCacheKey key);
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemProviderImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemProviderImpl.java
deleted file mode 100644
index f8a8b6ac599..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemProviderImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.fs;
-
-import org.apache.doris.datasource.ExternalMetaCacheMgr;
-import org.apache.doris.datasource.SessionContext;
-import org.apache.doris.datasource.property.storage.StorageProperties;
-import org.apache.doris.fs.remote.SwitchingFileSystem;
-
-import java.util.Map;
-
-public class FileSystemProviderImpl implements LegacyFileSystemProviderFactory 
{
-    private ExternalMetaCacheMgr extMetaCacheMgr;
-
-    private Map<StorageProperties.Type, StorageProperties> 
storagePropertiesMap;
-
-    public FileSystemProviderImpl(ExternalMetaCacheMgr extMetaCacheMgr,
-                                  Map<StorageProperties.Type, 
StorageProperties> storagePropertiesMap) {
-        this.extMetaCacheMgr = extMetaCacheMgr;
-        this.storagePropertiesMap = storagePropertiesMap;
-    }
-
-    @Override
-    public LegacyFileSystemApi get(SessionContext ctx) {
-        return new SwitchingFileSystem(
-                key -> FileSystemFactory.get(key.getProperties()),
-                storagePropertiesMap);
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/fs/LegacyFileSystemProviderFactory.java
 
b/fe/fe-core/src/main/java/org/apache/doris/fs/LegacyFileSystemProviderFactory.java
deleted file mode 100644
index 84f04643210..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/fs/LegacyFileSystemProviderFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.fs;
-
-import org.apache.doris.datasource.SessionContext;
-
-/**
- * Factory interface for the legacy (pre-SPI) filesystem provider system.
- * Renamed from FileSystemProvider to avoid naming conflict with the new
- * org.apache.doris.filesystem.spi.FileSystemProvider SPI interface (Phase 3).
- */
-public interface LegacyFileSystemProviderFactory {
-    LegacyFileSystemApi get(SessionContext ctx);
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/SwitchingFileSystem.java 
b/fe/fe-core/src/main/java/org/apache/doris/fs/remote/SwitchingFileSystem.java
deleted file mode 100644
index 3d1a45975d9..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/SwitchingFileSystem.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.fs.remote;
-
-import org.apache.doris.backup.Status;
-import org.apache.doris.common.util.LocationPath;
-import org.apache.doris.datasource.property.storage.StorageProperties;
-import org.apache.doris.fs.FileSystemCache;
-import org.apache.doris.fs.FileSystemLookup;
-import org.apache.doris.fs.LegacyFileSystemApi;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class SwitchingFileSystem implements LegacyFileSystemApi {
-
-    private final FileSystemLookup lookup;
-
-    private final Map<StorageProperties.Type, StorageProperties> 
storagePropertiesMap;
-
-    public SwitchingFileSystem(FileSystemLookup lookup,
-                               Map<StorageProperties.Type, StorageProperties> 
storagePropertiesMap) {
-        this.lookup = lookup;
-        this.storagePropertiesMap = storagePropertiesMap;
-    }
-
-    @Override
-    public Map<String, String> getProperties() {
-        //fixme need this ?
-        return null;
-    }
-
-    @Override
-    public Status exists(String remotePath) {
-        return fileSystem(remotePath).exists(remotePath);
-    }
-
-    @Override
-    public Status directoryExists(String dir) {
-        return fileSystem(dir).directoryExists(dir);
-    }
-
-    @Override
-    public Status downloadWithFileSize(String remoteFilePath, String 
localFilePath, long fileSize) {
-        return fileSystem(remoteFilePath).downloadWithFileSize(remoteFilePath, 
localFilePath, fileSize);
-    }
-
-    @Override
-    public Status upload(String localPath, String remotePath) {
-        return fileSystem(localPath).upload(localPath, remotePath);
-    }
-
-    @Override
-    public Status directUpload(String content, String remoteFile) {
-        return fileSystem(remoteFile).directUpload(content, remoteFile);
-    }
-
-    @Override
-    public Status rename(String origFilePath, String destFilePath) {
-        return fileSystem(origFilePath).rename(origFilePath, destFilePath);
-    }
-
-    @Override
-    public Status renameDir(String origFilePath, String destFilePath) {
-        return fileSystem(origFilePath).renameDir(origFilePath, destFilePath);
-    }
-
-    @Override
-    public Status renameDir(String origFilePath, String destFilePath, Runnable 
runWhenPathNotExist) {
-        return fileSystem(origFilePath).renameDir(origFilePath, destFilePath, 
runWhenPathNotExist);
-    }
-
-    @Override
-    public Status delete(String remotePath) {
-        return fileSystem(remotePath).delete(remotePath);
-    }
-
-    @Override
-    public Status deleteDirectory(String absolutePath) {
-        return fileSystem(absolutePath).deleteDirectory(absolutePath);
-    }
-
-    @Override
-    public Status makeDir(String remotePath) {
-        return fileSystem(remotePath).makeDir(remotePath);
-    }
-
-    @Override
-    public Status listFiles(String remotePath, boolean recursive, 
List<RemoteFile> result) {
-        return fileSystem(remotePath).listFiles(remotePath, recursive, result);
-    }
-
-    @Override
-    public Status globList(String remotePath, List<RemoteFile> result) {
-        return fileSystem(remotePath).globList(remotePath, result);
-    }
-
-    @Override
-    public Status globList(String remotePath, List<RemoteFile> result, boolean 
fileNameOnly) {
-        return fileSystem(remotePath).globList(remotePath, result, 
fileNameOnly);
-    }
-
-    @Override
-    public Status listDirectories(String remotePath, Set<String> result) {
-        return fileSystem(remotePath).listDirectories(remotePath, result);
-    }
-
-    public LegacyFileSystemApi fileSystem(String location) {
-        LocationPath path = LocationPath.of(location, storagePropertiesMap);
-        FileSystemCache.FileSystemCacheKey fileSystemCacheKey = new 
FileSystemCache.FileSystemCacheKey(
-                path.getFsIdentifier(), path.getStorageProperties()
-        );
-        return lookup.lookup(fileSystemCacheKey);
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to