You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "saihemanth-cloudera (via GitHub)" <gi...@apache.org> on 2026/09/15 22:59:03 UTC

[PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

saihemanth-cloudera opened a new pull request, #6790:
URL: https://github.com/apache/hive/pull/6790

   Remote Thrift REST catalog deployments shared one CachedClientPool key for all authenticated users, so set_ugi pinned the first caller on pooled HMS connections. Resolve UGI/user_name cache keys when pools are used, configure user_name for external HMS in HMSCatalogFactory, and use metastore delegation tokens for Kerberos proxy users via TokenAuthHiveClientPool.
   
   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducible example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6347315875

   @henrib / @difin Can you review this patch?


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6349260856

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [27 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "saihemanth-cloudera (via GitHub) via gitbox" <gi...@hive.apache.org>.
saihemanth-cloudera commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6640321212

   @henrib / @difin Can you please review this patch? The flaky tests are finally green.


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6431507984

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub) via gitbox" <gi...@hive.apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6614640454

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6280849377

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-5689842880

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "okumin (via GitHub)" <gi...@apache.org>.
okumin commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-5997136363

   CC: @difin , who implemented the standalone mode


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6426421877

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-5920921256

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [70 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6790&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6790&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1.7% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6790&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6790)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6790:
URL: https://github.com/apache/hive/pull/6790#discussion_r4341248610


##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/CachedClientPool.java:
##########
@@ -124,6 +150,26 @@ public <R> R run(Action<R, IMetaStoreClient, TException> action, boolean retry)
     return clientPool().run(action, retry);
   }
 
+  private static boolean hasUserScopedKeyElement(String cacheKeysConfig) {
+    if (cacheKeysConfig == null || cacheKeysConfig.isEmpty()) {
+      return false;
+    }
+    for (String element : cacheKeysConfig.split(",", -1)) {
+      String trimmed = element.trim();
+      if (trimmed.isEmpty()) {
+        continue;
+      }
+      if (trimmed.toLowerCase(Locale.ROOT).startsWith(CONF_ELEMENT_PREFIX)) {
+        continue;
+      }
+      KeyElementType type = KeyElementType.valueOf(trimmed.toUpperCase(Locale.ROOT));
+      if (type == KeyElementType.UGI || type == KeyElementType.USER_NAME) {
+        return true;
+      }
+    }

Review Comment:
   `hasUserScopedKeyElement` calls `KeyElementType.valueOf(...)` directly, which will throw `IllegalArgumentException` for invalid elements. This changes validation behavior (and likely error type/message) compared to `extractKey(...)` which appears to own cache-key parsing/validation. Consider reusing the same parsing/validation path as `extractKey` (e.g., a shared parser that returns both 'has user-scoped elements' + validated elements) or catching `IllegalArgumentException` and rethrowing a `ValidationException` consistent with existing behavior.



##########
standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCatalogFactory.java:
##########
@@ -80,6 +85,16 @@ private Catalog createCatalog() {
     // This tells HiveCatalog to use Thrift connection to external HMS
     if (!StringUtils.isEmpty(configUri)) {
       properties.put(CatalogProperties.URI, configUri);
+      // Remote HMS: isolate metastore client pools per authenticated REST user so set_ugi matches the caller.
+      if (configuration.get(SERVLET_ID_KEY) == null) {
+        properties.put(CatalogProperties.CLIENT_POOL_CACHE_KEYS, CLIENT_POOL_USER_CACHE_KEY);
+      }

Review Comment:
   Keying the HMS client pool cache by `user_name` can create one pooled client set per distinct REST user. In environments with many users this can materially increase the number of open Thrift connections and memory usage. Consider adding/adjusting safeguards (e.g., documenting recommended eviction interval sizing for REST deployments, or ensuring the cache is bounded) to reduce the risk of unbounded per-user pool growth.



##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/TokenAuthHiveClientPool.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.iceberg.hive;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.metastore.utils.SecurityUtils;
+import org.apache.hadoop.security.UserGroupInformation;
+
+/**
+ * HiveClientPool that authenticates to a remote secure HMS as the current proxy user using
+ * a metastore delegation token obtained by the catalog service principal.
+ */
+class TokenAuthHiveClientPool extends HiveClientPool {
+
+  static final String DELEGATION_TOKEN_SERVICE = "DelegationTokenForHiveMetaStoreServer";
+
+  private final HiveConf hiveConf;
+
+  TokenAuthHiveClientPool(int poolSize, Configuration conf) {
+    super(poolSize, conf);
+    this.hiveConf = super.hiveConf();
+  }
+
+  private void setDelegationToken() {
+    IMetaStoreClient tokenClient = null;
+    try {
+      UserGroupInformation currentUgi = SecurityUtils.getUGI();
+      if (currentUgi.getAuthenticationMethod() != UserGroupInformation.AuthenticationMethod.PROXY) {
+        return;
+      }
+      hiveConf.unset(MetastoreConf.ConfVars.TOKEN_SIGNATURE.getVarname());
+      UserGroupInformation realUser = currentUgi.getRealUser();
+      if (realUser == null) {
+        realUser = UserGroupInformation.getLoginUser();
+      }
+      final UserGroupInformation tokenFetcher = realUser;
+      tokenClient =
+          tokenFetcher.doAs(
+              (PrivilegedExceptionAction<IMetaStoreClient>)
+                  () -> new HiveMetaStoreClient(hiveConf));
+      String proxyUser = currentUgi.getUserName();
+      String delegationTokenStr = tokenClient.getDelegationToken(proxyUser, proxyUser);

Review Comment:
   The renewer passed to `getDelegationToken(owner, renewer)` is set to the proxy user (`proxyUser`). For long-lived services, this can produce tokens that the catalog service (or login/real user) cannot renew, leading to token expiry and failures. Consider using the catalog service/real user as the renewer (e.g., the `tokenFetcher`'s user name), while keeping the owner as the proxy user.



##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/TokenAuthHiveClientPool.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.iceberg.hive;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.metastore.utils.SecurityUtils;
+import org.apache.hadoop.security.UserGroupInformation;
+
+/**
+ * HiveClientPool that authenticates to a remote secure HMS as the current proxy user using
+ * a metastore delegation token obtained by the catalog service principal.
+ */
+class TokenAuthHiveClientPool extends HiveClientPool {
+
+  static final String DELEGATION_TOKEN_SERVICE = "DelegationTokenForHiveMetaStoreServer";
+
+  private final HiveConf hiveConf;
+
+  TokenAuthHiveClientPool(int poolSize, Configuration conf) {
+    super(poolSize, conf);
+    this.hiveConf = super.hiveConf();
+  }
+
+  private void setDelegationToken() {
+    IMetaStoreClient tokenClient = null;
+    try {
+      UserGroupInformation currentUgi = SecurityUtils.getUGI();
+      if (currentUgi.getAuthenticationMethod() != UserGroupInformation.AuthenticationMethod.PROXY) {
+        return;
+      }
+      hiveConf.unset(MetastoreConf.ConfVars.TOKEN_SIGNATURE.getVarname());
+      UserGroupInformation realUser = currentUgi.getRealUser();
+      if (realUser == null) {
+        realUser = UserGroupInformation.getLoginUser();
+      }
+      final UserGroupInformation tokenFetcher = realUser;
+      tokenClient =
+          tokenFetcher.doAs(
+              (PrivilegedExceptionAction<IMetaStoreClient>)
+                  () -> new HiveMetaStoreClient(hiveConf));
+      String proxyUser = currentUgi.getUserName();
+      String delegationTokenStr = tokenClient.getDelegationToken(proxyUser, proxyUser);
+      SecurityUtils.setTokenStr(currentUgi, delegationTokenStr, DELEGATION_TOKEN_SERVICE);
+      MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.TOKEN_SIGNATURE, DELEGATION_TOKEN_SERVICE);

Review Comment:
   `setDelegationToken()` mutates the shared `hiveConf` (`unset` then `setVar`). If this pool is used concurrently, or if an exception occurs after `unset` but before `setVar`, the `TokenAuthHiveClientPool` instance can be left with `TOKEN_SIGNATURE` cleared (affecting subsequent client creation/reconnect) and can race with other threads. Consider avoiding mutable shared configuration (e.g., preserve/restore the previous `TOKEN_SIGNATURE` in a `finally`, and/or use a per-client/per-thread `HiveConf` copy for token-fetch + client creation) so failures and concurrency do not corrupt pool-wide configuration.



##########
iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java:
##########
@@ -147,6 +153,31 @@ public void testCacheKey() throws Exception {
         .hasMessageContaining("Conf key element k1 already specified");
   }
 
+  @Test
+  public void testPerUserClientPoolsWhenUserNameInCacheKeys() throws Exception {
+    UserGroupInformation current = UserGroupInformation.getCurrentUser();
+    UserGroupInformation foo = UserGroupInformation.createProxyUser("foo", current);
+    UserGroupInformation bar = UserGroupInformation.createProxyUser("bar", current);
+    HiveConf hiveConf = HIVE_METASTORE_EXTENSION.hiveConf();
+    Map<String, String> properties =
+        ImmutableMap.of(CatalogProperties.CLIENT_POOL_CACHE_KEYS, "user_name");
+
+    CachedClientPool pool = new CachedClientPool(hiveConf, properties);
+    HiveClientPool fooPool = foo.doAs((PrivilegedAction<HiveClientPool>) pool::clientPool);
+    HiveClientPool barPool = bar.doAs((PrivilegedAction<HiveClientPool>) pool::clientPool);

Review Comment:
   The explicit cast on the method reference is likely to introduce (or hide) an unchecked-cast warning. Using an explicit lambda with an inferred return type (e.g., `() -> pool.clientPool()`) avoids the cast and keeps the test compilation cleaner.



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-30003: Isolate REST catalog HMS client pools per user [hive]

Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on PR #6790:
URL: https://github.com/apache/hive/pull/6790#issuecomment-6347288375

   Latest patch-set addresses: token conf isolation + renewer fix, aligned cache-key validation, cache size cap + factory note, test lambda cleanup.


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org