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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 08b741371c0 branch-3.0: [fix](iceberg)Ensure proper authentication 
context before accessing Iceberg Catalog  #52149 (#52233)
08b741371c0 is described below

commit 08b741371c0be299683896c9fe236f88e19cd790
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 9 10:22:34 2025 +0800

    branch-3.0: [fix](iceberg)Ensure proper authentication context before 
accessing Iceberg Catalog  #52149 (#52233)
    
    Cherry-picked from #52149
    
    Co-authored-by: Calvin Kirs <[email protected]>
    Co-authored-by: Tiewei Fang <[email protected]>
---
 .../doris/datasource/iceberg/IcebergExternalCatalog.java     | 12 ++++++++++++
 .../doris/datasource/iceberg/IcebergExternalDatabase.java    | 12 +++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java
index 7282de52aa0..30590f5af26 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java
@@ -68,6 +68,18 @@ public abstract class IcebergExternalCatalog extends 
ExternalCatalog {
         metadataOps = ops;
     }
 
+    /**
+     * Returns the underlying {@link Catalog} instance used by this external 
catalog.
+     *
+     * <p><strong>Warning:</strong> This method does not handle any 
authentication logic. If the
+     * returned catalog implementation relies on external systems
+     * that require authentication — especially in environments where Kerberos 
is enabled — the caller is
+     * fully responsible for ensuring the appropriate authentication has been 
performed <em>before</em>
+     * invoking this method.
+     * <p>Failing to authenticate beforehand may result in authorization 
errors or IO failures.
+     *
+     * @return the underlying catalog instance
+     */
     public Catalog getCatalog() {
         makeSureInitialized();
         return ((IcebergMetadataOps) metadataOps).getCatalog();
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java
index 7a1a53825a1..2e4e45f062e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java
@@ -41,8 +41,14 @@ public class IcebergExternalDatabase extends 
ExternalDatabase<IcebergExternalTab
     }
 
     public String getLocation() {
-        Map<String, String> props = ((SupportsNamespaces) 
((IcebergExternalCatalog) getCatalog()).getCatalog())
-                .loadNamespaceMetadata(Namespace.of(name));
-        return props.getOrDefault("location", "");
+        try {
+            return extCatalog.getPreExecutionAuthenticator().execute(() -> {
+                Map<String, String> props = ((SupportsNamespaces) 
((IcebergExternalCatalog) getCatalog()).getCatalog())
+                        .loadNamespaceMetadata(Namespace.of(name));
+                return props.getOrDefault("location", "");
+            });
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to get location for Iceberg 
database: " + name, e);
+        }
     }
 }


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

Reply via email to