[ https://issues.apache.org/jira/browse/HIVE-25892?focusedWorklogId=714414&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-714414 ]
ASF GitHub Bot logged work on HIVE-25892: ----------------------------------------- Author: ASF GitHub Bot Created on: 25/Jan/22 11:45 Start Date: 25/Jan/22 11:45 Worklog Time Spent: 10m Work Description: dengzhhu653 commented on a change in pull request #2967: URL: https://github.com/apache/hive/pull/2967#discussion_r791630926 ########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java ########## @@ -705,32 +635,22 @@ public static RawStore getMSForConf(Configuration conf) throws MetaException { ms.shutdown(); throw e; } - threadLocalMS.set(ms); - ms = threadLocalMS.get(); - LOG.info("Created RawStore: " + ms + " from thread id: " + Thread.currentThread().getId()); + HMSHandlerContext.setRawStore(ms); + LOG.info("Created RawStore: " + ms + " from thread id: " + HMSHandlerContext.getThreadId()); } return ms; } @Override public TxnStore getTxnHandler() { - return getMsThreadTxnHandler(conf); - } - - public static TxnStore getMsThreadTxnHandler(Configuration conf) { - TxnStore txn = threadLocalTxn.get(); - if (txn == null) { - txn = TxnUtils.getTxnStore(conf); - threadLocalTxn.set(txn); - } - return txn; + return HMSHandlerContext.getTxnStore(conf); } static RawStore newRawStoreForConf(Configuration conf) throws MetaException { Configuration newConf = new Configuration(conf); String rawStoreClassName = MetastoreConf.getVar(newConf, ConfVars.RAW_STORE_IMPL); - LOG.info(addPrefix("Opening raw store with implementation class:" + rawStoreClassName)); - return RawStoreProxy.getProxy(newConf, conf, rawStoreClassName, threadLocalId.get()); + LOG.info("{}: Opening raw store with implementation class: {}", HMSHandlerContext.getThreadId(), rawStoreClassName); Review comment: The `addPrefix` method will insert the threadId before the log, unsure why do like this. It makes sense for me to remove the threadId from the log. -- 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-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 714414) Time Spent: 1h 40m (was: 1.5h) > Group HMSHandler's thread locals into a single context > ------------------------------------------------------ > > Key: HIVE-25892 > URL: https://issues.apache.org/jira/browse/HIVE-25892 > Project: Hive > Issue Type: Improvement > Components: Standalone Metastore > Reporter: Zhihua Deng > Priority: Minor > Labels: pull-request-available > Time Spent: 1h 40m > Remaining Estimate: 0h > > There are more than six ThreadLocal variables in HMSHandler, we can group > them together into a single context to improve the management of variables > and the code readability. > -- This message was sent by Atlassian Jira (v8.20.1#820001)