smengcl commented on code in PR #4188:
URL: https://github.com/apache/ozone/pull/4188#discussion_r1550036354
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -736,17 +736,24 @@ private static void verifySpaceQuota(long quota) throws
OMException {
* @return listOfAcls
* */
private List<OzoneAcl> getAclList() {
+ UserGroupInformation realUserInfo = getRealUserInfo();
+ return OzoneAclUtil.getAclList(realUserInfo.getUserName(),
+ realUserInfo.getGroupNames(), userRights, groupRights);
+ }
+
+ /**
+ * Helper function to get the actual operating user.
+ *
+ * @return listOfAcls
+ * */
+ private UserGroupInformation getRealUserInfo() {
+ // After HDDS-5881 the user will not be different,
+ // as S3G uses single RpcClient. So we should be checking thread-local
+ // S3Auth and use it during proxy.
if (ozoneManagerClient.getThreadLocalS3Auth() != null) {
- UserGroupInformation aclUgi =
- UserGroupInformation.createRemoteUser(
- ozoneManagerClient.getThreadLocalS3Auth().getAccessID());
- return OzoneAclUtil.getAclList(
- aclUgi.getUserName(),
- aclUgi.getGroupNames(),
- userRights, groupRights);
+ return
UserGroupInformation.createRemoteUser(getThreadLocalS3Auth().getUserPrincipal());
}
Review Comment:
Can we cache the result of `UserGroupInformation.createRemoteUser()` in the
case of S3?
Every single call `getRealUserInfo()` creates a new UGI object, and that is
being called every single time in `createKey()` now.
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -736,17 +736,24 @@ private static void verifySpaceQuota(long quota) throws
OMException {
* @return listOfAcls
* */
private List<OzoneAcl> getAclList() {
+ UserGroupInformation realUserInfo = getRealUserInfo();
+ return OzoneAclUtil.getAclList(realUserInfo.getUserName(),
+ realUserInfo.getGroupNames(), userRights, groupRights);
+ }
+
+ /**
+ * Helper function to get the actual operating user.
+ *
+ * @return listOfAcls
+ * */
+ private UserGroupInformation getRealUserInfo() {
+ // After HDDS-5881 the user will not be different,
+ // as S3G uses single RpcClient. So we should be checking thread-local
+ // S3Auth and use it during proxy.
if (ozoneManagerClient.getThreadLocalS3Auth() != null) {
- UserGroupInformation aclUgi =
- UserGroupInformation.createRemoteUser(
- ozoneManagerClient.getThreadLocalS3Auth().getAccessID());
- return OzoneAclUtil.getAclList(
- aclUgi.getUserName(),
- aclUgi.getGroupNames(),
- userRights, groupRights);
+ return
UserGroupInformation.createRemoteUser(getThreadLocalS3Auth().getUserPrincipal());
}
Review Comment:
Can we cache the result of `UserGroupInformation.createRemoteUser()` in the
case of S3?
Every single `getRealUserInfo()` call creates a new UGI object, and that is
being called every single time in `createKey()` now.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]