CalvinKirs commented on code in PR #66004:
URL: https://github.com/apache/doris/pull/66004#discussion_r3654549614


##########
fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemPluginManager.java:
##########
@@ -141,6 +158,162 @@ public void registerProvider(FileSystemProvider provider) 
{
         
DatasourcePrintableMap.registerSensitiveKeys(provider.sensitivePropertyKeys());
     }
 
+    /** Returns an unmodifiable view of the loaded providers, in registration 
order. */
+    public List<FileSystemProvider> getProviders() {
+        return Collections.unmodifiableList(providers);
+    }
+
+    /**
+     * Selection priority for raw-user-props binding = {@code 
StorageRegistry.Provider} declaration
+     * order (single source of truth; mirrors the legacy 
StorageProperties.PROVIDERS registry
+     * order, with JFS hoisted ahead of HDFS so a jfs:// uri beats HDFS's 
key-hint guess).
+     */
+
+    private static final String DEPRECATED_OSS_HDFS_SUPPORT = 
"oss.hdfs.enabled";
+
+    /**
+     * Binds the first matching provider for raw user properties, mirroring
+     * {@code StorageProperties.createPrimary}: fixed priority, explicit 
{@code fs.<x>.support}
+     * flags first-class, heuristic guesses globally disabled once any 
explicit flag is present,
+     * and no default fallback — throws when nothing matches.
+     */
+    public FileSystemProperties bindPrimary(Map<String, String> properties) {
+        boolean useGuess = !hasAnyExplicitFsSupport(properties);
+        Map<String, String> probeView = withProbeContext(properties);
+        for (StorageRegistry.Provider meta : 
StorageRegistry.Provider.values()) {
+            FileSystemProvider provider = providerByName(meta.name());
+            if (provider == null) {
+                continue;
+            }
+            if (provider.supportsExplicit(properties) || (useGuess && 
provider.supportsGuess(probeView))) {
+                return provider.bind(properties);
+            }
+        }
+        // Providers not in the StorageRegistry.Provider table (out-of-tree 
plugins) are consulted
+        // after every known provider, in registration order — adding a plugin 
needs no fe-core
+        // priority-list change and can never preempt the legacy fourteen.
+        for (FileSystemProvider provider : providers) {
+            if (StorageRegistry.Provider.byName(provider.name()).isPresent()) {
+                continue;
+            }
+            if (provider.supportsExplicit(properties) || (useGuess && 
provider.supportsGuess(probeView))) {

Review Comment:
   Addressed with the explicit-rejection option. Typed binding cannot 
faithfully represent a raw-SPI provider (no typed properties to wrap), so 
instead of a lossy bridge the unlisted-provider loop now consults `supports()` 
for providers without typed hooks and rejects them with an actionable WARN 
naming the missing methods (`supportsExplicit`/`supportsGuess`/`bind`), rather 
than skipping them silently; they remain fully usable through the raw 
`createFileSystem(Map)` entry point, matching the `FileSystemProvider.bind` 
javadoc's migration contract. `UnlistedProviderExtensibilityTest` now includes 
a raw-SPI stub asserting it is consulted, not typed-bound, and still selectable 
via the raw path.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to