rmdmattingly commented on code in PR #5424:
URL: https://github.com/apache/hbase/pull/5424#discussion_r1337790509
##########
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:
yeah that makes sense, seems like a reasonable optimization. should we bake
that into an `RpcCall#getRequestAttribute(String key)` method to help this
pattern be standard or is that overkill?
--
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]