Skip to content

Commit 9deac3b

Browse files
ajayydvxiaoyuyao
authored andcommitted
HDDS-1657. Fix parallelStream usage in volume and key native acl. Contributed by Ajay Kumar. (#926)
1 parent 46b23c1 commit 9deac3b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ public boolean setAcl(OzoneObj obj, List<OzoneAcl> acls) throws IOException {
13771377
SetAclRequest.Builder builder = SetAclRequest.newBuilder()
13781378
.setObj(OzoneObj.toProtobuf(obj));
13791379

1380-
acls.parallelStream().forEach(a -> builder.addAcl(OzoneAcl.toProtobuf(a)));
1380+
acls.forEach(a -> builder.addAcl(OzoneAcl.toProtobuf(a)));
13811381

13821382
OMRequest omRequest = createOMRequest(Type.SetAcl)
13831383
.setSetAclRequest(builder.build())

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,9 +2291,13 @@ private void validateOzoneAcl(OzoneObj ozObj) throws IOException {
22912291
expectedAcls.forEach(a -> assertTrue(finalNewAcls.contains(a)));
22922292

22932293
// Reset acl's.
2294-
store.setAcl(ozObj, new ArrayList<>());
2294+
OzoneAcl ua = new OzoneAcl(ACLIdentityType.USER, "userx", ACLType.READ_ACL);
2295+
OzoneAcl ug = new OzoneAcl(ACLIdentityType.GROUP, "userx", ACLType.ALL);
2296+
store.setAcl(ozObj, Arrays.asList(ua, ug));
22952297
newAcls = store.getAcl(ozObj);
2296-
assertTrue(newAcls.size() == 0);
2298+
assertTrue(newAcls.size() == 2);
2299+
assertTrue(newAcls.contains(ua));
2300+
assertTrue(newAcls.contains(ug));
22972301
}
22982302

22992303
private void writeKey(String key1, OzoneBucket bucket) throws IOException {

hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,7 @@ private RemoveAclResponse removeAcl(RemoveAclRequest req)
411411

412412
private SetAclResponse setAcl(SetAclRequest req) throws IOException {
413413
List<OzoneAcl> ozoneAcl = new ArrayList<>();
414-
req.getAclList().parallelStream().forEach(a ->
415-
ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
414+
req.getAclList().forEach(a -> ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
416415
boolean response = impl.setAcl(OzoneObjInfo.fromProtobuf(req.getObj()),
417416
ozoneAcl);
418417
return SetAclResponse.newBuilder().setResponse(response).build();

0 commit comments

Comments
 (0)