adoroszlai commented on code in PR #4738:
URL: https://github.com/apache/ozone/pull/4738#discussion_r1198920659
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java:
##########
@@ -200,10 +199,11 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
omDirectoryResult == NONE) {
List<String> missingParents = omPathInfo.getMissingParents();
long baseObjId = ozoneManager.getObjectIdFromTxId(trxnLogIndex);
- List<OzoneAcl> inheritAcls = omPathInfo.getAcls();
+ List<OzoneAcl> inheritAcls =
Review Comment:
```suggestion
List<OzoneAcl> acls =
```
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestWithFSO.java:
##########
@@ -172,7 +171,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager,
omPathInfo.getLeafNodeName(),
keyArgs, omPathInfo.getLeafNodeObjectId(),
omPathInfo.getLastKnownParentId(), trxnLogIndex,
- OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()));
+ inheritDefaultAcls(keyArgs, omBucketInfo.getAcls()));
Review Comment:
If ancestor directory exists, the new directories should inherit from that
ancestor instead of the bucket. I think `omPathInfo` has the information about
the ancestor or bucket in both cases.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -307,6 +307,14 @@ protected List< OzoneAcl > getAclsForKey(KeyArgs keyArgs,
return acls;
}
+ protected static List<OzoneAcl> inheritDefaultAcls(KeyArgs keyArgs,
+ List<OzoneAcl> parentAcls) {
+ List<OzoneAcl> inheritAcls = new ArrayList<>();
+ inheritAcls.addAll(OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()));
+ OzoneAclUtil.inheritDefaultAcls(inheritAcls, parentAcls);
+ return inheritAcls;
Review Comment:
Can be simplified, since `OzoneAclUtil.fromProtobuf` creates a new
`ArrayList` for the ACLs from `keyArgs`:
```suggestion
List<OzoneAcl> acls = OzoneAclUtil.fromProtobuf(keyArgs.getAclsList());
OzoneAclUtil.inheritDefaultAcls(acls, parentAcls);
return acls;
```
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java:
##########
@@ -200,10 +199,11 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
omDirectoryResult == NONE) {
List<String> missingParents = omPathInfo.getMissingParents();
long baseObjId = ozoneManager.getObjectIdFromTxId(trxnLogIndex);
- List<OzoneAcl> inheritAcls = omPathInfo.getAcls();
+ List<OzoneAcl> inheritAcls =
+ inheritDefaultAcls(keyArgs, omPathInfo.getAcls());
dirKeyInfo = createDirectoryKeyInfoWithACL(keyName, keyArgs, baseObjId,
- OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()), trxnLogIndex,
+ inheritAcls, trxnLogIndex,
Review Comment:
```suggestion
acls, trxnLogIndex,
```
--
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]