hello-stephen commented on code in PR #71089:
URL: https://github.com/apache/doris/pull/71089#discussion_r4734565396


##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/IcebergSiblingProperties.java:
##########
@@ -54,13 +56,14 @@ private IcebergSiblingProperties() {
 
     /**
      * Returns a NEW property map = the gateway catalog's properties verbatim 
with the iceberg catalog flavor
-     * forced to {@code hms}. The input is never mutated (the gateway holds it 
unmodifiable and shared). An
-     * existing {@code iceberg.catalog.type} is overridden unconditionally — 
an iceberg-on-HMS sibling is always
-     * the hms flavor.
+     * chosen from the gateway's metadata backend. The input is never mutated; 
an existing
+     * {@code iceberg.catalog.type} cannot redirect a sibling to another 
metadata service.
      */
     static Map<String, String> synthesize(Map<String, String> 
gatewayCatalogProperties) {
         Map<String, String> siblingProperties = new 
HashMap<>(gatewayCatalogProperties);
-        siblingProperties.put(ICEBERG_CATALOG_TYPE_KEY, 
ICEBERG_CATALOG_TYPE_HMS);
+        // The sibling must use the same metadata service rather than dialing 
an absent Thrift URI.
+        siblingProperties.put(ICEBERG_CATALOG_TYPE_KEY,
+                HmsClientConfig.isDlfMetastore(gatewayCatalogProperties) ? 
"dlf" : ICEBERG_CATALOG_TYPE_HMS);

Review Comment:
   [P2] Preserve HMS connection settings for Iceberg siblings using proxy modes
   
   For a DLF-backed HMS catalog using `dlf.proxy.mode=METASTORE_ONLY`, an 
inline `hive.metastore.uris`, valid DLF credentials and explicit OSS settings, 
the gateway can discover Iceberg tables through the configured HMS. This 
condition forces the sibling into `IcebergConnector.createDlfCatalog`, whose 
`toDlfCatalogConf`/`buildDlfConfiguration` path keeps the proxy mode but drops 
the HMS URI and `hive.*` authentication/resource settings. `DLFClientPool` 
therefore constructs its `METASTORE_ONLY` proxy without the configured Thrift 
endpoint, so discovery succeeds but querying an Iceberg table fails. Preserve 
those settings for proxy modes, or keep `METASTORE_ONLY` on the HMS flavor, and 
cover the downstream sibling configuration.



##########
fe/fe-connector/fe-connector-metastore-hms/src/main/java/org/apache/doris/connector/metastore/hms/DefaultHmsMetaStoreProperties.java:
##########
@@ -42,6 +48,19 @@ public static DefaultHmsMetaStoreProperties of(Map<String, 
String> raw, Map<Stri
 
     @Override
     public void validate() {
-        validateConnection();
+        if (dlf != null) {
+            dlf.validate();
+        } else {
+            validateConnection();
+        }
+    }
+
+    @Override
+    public Map<String, String> toHiveConfOverrides(String 
defaultClientSocketTimeoutSeconds) {
+        Map<String, String> conf = 
super.toHiveConfOverrides(defaultClientSocketTimeoutSeconds);
+        if (dlf != null) {
+            conf.putAll(dlf.toDlfCatalogConf());

Review Comment:
   [P2] Preserve the canonical HMS username when merging DLF settings
   
   For an otherwise valid DLF-backed HMS catalog using 
`dlf.proxy.mode=METASTORE_ONLY`, `hive.metastore.authentication.type=simple`, 
`hive.metastore.username=metastore-user` and `hadoop.username=storage-user`, 
`super.toHiveConfOverrides(...)` correctly resolves the HMS username to 
`metastore-user`. The map merged here calls `applyStorageConfig` again and 
overwrites it with `storage-user`. Hive and Hudi's simple authenticators read 
that final `hadoop.username`, so metadata RPCs run as the storage user and fail 
when only the configured HMS user has access. Merge the DLF settings before the 
canonical HMS overrides, or exclude the repeated storage overlay, and cover 
this proxy case with distinct metadata and storage usernames.



-- 
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