Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-25892: Group HMSHandler's thread locals into a single context #2967

Merged
merged 6 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove thread id from some logs
  • Loading branch information
dengzhhu653 committed Jan 25, 2022
commit b8b804ec6c118d56857fee192f382ea98f5726f5
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ public static RawStore getMSForConf(Configuration conf) throws MetaException {
throw e;
}
HMSHandlerContext.setRawStore(ms);
LOG.info("Created RawStore: " + ms + " from thread id: " + HMSHandlerContext.getThreadId());
LOG.info("Created RawStore: {}", ms);
}
return ms;
}
Expand All @@ -649,7 +649,7 @@ public TxnStore getTxnHandler() {
static RawStore newRawStoreForConf(Configuration conf) throws MetaException {
Configuration newConf = new Configuration(conf);
String rawStoreClassName = MetastoreConf.getVar(newConf, ConfVars.RAW_STORE_IMPL);
LOG.info("{}: Opening raw store with implementation class: {}", HMSHandlerContext.getThreadId(), rawStoreClassName);
LOG.info("Opening raw store with implementation class: {}", rawStoreClassName);
return RawStoreProxy.getProxy(newConf, conf, rawStoreClassName, HMSHandlerContext.getThreadId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the threadId is not used in the RawStoreProxy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i was thinking if we can remove the getThreadId from IHMSHandler, which is declared as InterfaceAudience.Private, the getThreadId is only used for logging now, how about raising another pr for this? I also want to improve the metrics and audit of the HMSHandler #2441.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Then we will be able to remove the ThreadId threadlocal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I opened https://issues.apache.org/jira/browse/HIVE-25896 for the removal of getThreadId

}

Expand Down Expand Up @@ -836,7 +836,7 @@ private void addAdminUsers_core() throws MetaException {
}

private static void logAndAudit(final String m) {
LOG.debug("{}: {}", HMSHandlerContext.getThreadId(), m);
LOG.debug(m);
logAuditEvent(m);
}

Expand Down Expand Up @@ -6424,8 +6424,7 @@ public String get_config_value(String name, String defaultValue)
toReturn = defaultValue;
}
} catch (RuntimeException e) {
LOG.error(HMSHandlerContext.getThreadId() + ": "
+ "RuntimeException thrown in get_config_value - msg: "
LOG.error("RuntimeException thrown in get_config_value - msg: "
+ e.getMessage() + " cause: " + e.getCause());
}
success = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ public static void setIpAddress(String ipAddress) {
public static void clear() {
context.remove();
}

}