[ 
https://issues.apache.org/jira/browse/HIVE-29073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18007778#comment-18007778
 ] 

Butao Zhang commented on HIVE-29073:
------------------------------------

I haven't delved deeply into this part of the code yet. But based on the [patch 
|https://issues.apache.org/jira/secure/attachment/13077502/WIP-HIVE-29073.patch]
 you provided, if we set the metaconf every time before returning the 
metaStoreClient, would that work? What potential negative impacts could there 
be?

{code:java}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index e55be0f3e9..78a7ca7fd2 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -6119,6 +6119,16 @@ public synchronized IMetaStoreClient getMSC(
         metaStoreClient = 
HiveMetaStoreClient.newSynchronizedClient(metaStoreClient);
       }
     }
+    SessionState ss = SessionState.get();
+    if (ss != null) {
+      for (Map.Entry<String, String> entry : 
ss.getOverriddenMetaConfigurations().entrySet()) {
+        try {
+          setMetaConf(metaStoreClient, entry.getKey(), entry.getValue());
+        } catch (HiveException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
     return metaStoreClient;
   }

{code}


> Overlay modified session level metaconf to new hmsclient connection
> -------------------------------------------------------------------
>
>                 Key: HIVE-29073
>                 URL: https://issues.apache.org/jira/browse/HIVE-29073
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Raghav Aggarwal
>            Assignee: Raghav Aggarwal
>            Priority: Major
>         Attachments: HIVE-29073.pdf, WIP-HIVE-29073.patch
>
>
> Scenario steps:
> {code:java}
> 1. Create a beeline session and modify metaconf like following (for example):
> set metaconf:metastore.try.direct.sql=false;
> set metaconf:metastore.partition.name.whitelist.pattern=[^9]*;
> 2. Restart HMS keeping the beeline session same.
> 3. Run some queries which leverages the modified metaConf, the sessions level 
> modified metaconf are not honoured (observation){code}
>  
> In SetProcessor.java, for metaconf's, SessionState is not updated. 
> setMetaConf() is called which calls HMSHandler#setMetaConf and updates 
> HMSHandlerContext which is ThreadLocal.
> SessionState should store modified metaconf in a map, similar to 
> SessionState#overriddenConfigurations which currently stores only HS2 level 
> configs.
> {*}From user perspective{*}, if the configs are set on beeline, it shouldn't 
> matter to them, if HMS crashes and restarted or the HMS call (get_table etc) 
> goes to another HMS (if more than 1 HMS are present), it should honour the 
> session level modified conf. The new hmsclient connection should pass the 
> metaConf to HMSHandler.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to