-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDDS-1600. Add userName and IPAddress as part of OMRequest. #857
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
Conversation
b4a0740
to
1d18242
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Show resolved
Hide resolved
throw new OzoneAclException("User " + user.getUserName() + " doesn't " + | ||
"have " + acl + " permission to access " + resType, | ||
ErrorCode.PERMISSION_DENIED); | ||
user.getUserName(), aclType, resType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit test failure seems related:
TestOmAcls.testOMAclsPermissionDenied
org.apache.hadoop.ozone.om.exceptions.OMException: User jenkins1000 doesn't have CREATE permission to access volume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @xiaoyuyao. Will address in the next patch along with review comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
volumeName, bucketName, null); | ||
} | ||
|
||
metadataManager.getLock().acquireVolumeLock(volumeName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the right lock pattern is to acquire lock out of try {} block and release them in the final block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
} | ||
|
||
// acquire lock | ||
omMetadataManager.getLock().acquireBucketLock(volumeName, bucketName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
...e-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bharatviswa504 for working on this. Patch LGTM overall. A few minor comments inline.
@bharatviswa504 thanks for the patch. On a second thought i wonder why don't we complete authorization on the OM which receives the first request from client, this will save us the trouble of propagating credentials in rest of the call and simplify HA design. |
We cannot do checkAcls on any OM(which some times might not be leader), because think of a case like setAcl's is not applied on that OM(as it is a follower) but we are performing check Acl's. Discussed offline with @xiaoyuyao and @ajayydv, we cannot take this approach as OM followers can lag leader OM, so it might not have latest changes, if we do check on Non-leader OM, we might see some inconsistent behavior. |
Hi @xiaoyuyao |
LGTM, thanks for the update. +1, pending CI. |
💔 -1 overall
This message was automatically generated. |
/retest |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Checkstyle issues and test failures are not related to this patch. |
Author: Hai Lu <halu@linkedin.com> Reviewers: Xinyu Liu <xiliu@linkedin.com> Closes apache#857 from lhaiesp/master
In OM HA, the actual execution of request happens under GRPC context, so UGI object which we retrieve from ProtobufRpcEngine.Server.getRemoteUser(); will not be available.
In similar manner ProtobufRpcEngine.Server.getRemoteIp().
So, during preExecute(which happens under RPC context) extract userName and IPAddress and add it to the OMRequest, and then send the request to ratis server.