bbeaudreault commented on code in PR #5424:
URL: https://github.com/apache/hbase/pull/5424#discussion_r1337793712
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java:
##########
@@ -160,6 +172,27 @@ protected boolean isExceedThrottleQuotaEnabled() {
return exceedThrottleQuotaEnabled;
}
+ /**
+ * Applies a request attribute user override if available, otherwise returns
the UGI's short
+ * username
+ * @param ugi The request's UserGroupInformation
+ */
+ private String getQuotaUserName(final UserGroupInformation ugi) {
+ if (userOverrideRequestAttributeKey == null) {
+ return ugi.getShortUserName();
+ }
+
+ Optional<RpcCall> rpcCall = RpcServer.getCurrentCall();
+ if (
+ rpcCall.isPresent()
+ &&
rpcCall.get().getRequestAttributes().containsKey(userOverrideRequestAttributeKey)
Review Comment:
Yea, let's do that. We can have it pull from the map if it's non-null, and
otherwise loop. Just add javadoc describing the difference between that and
getRequestAttributes() and when to use each.
--
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]