HDDS-1657. Fix parallelStream usage in volume and key native acl. Contributed by Ajay Kumar. (#926)

This commit is contained in:
Ajay Yadav 2019-06-07 21:47:14 -07:00 committed by Xiaoyu Yao
parent 46b23c11b0
commit 9deac3b6bf
3 changed files with 8 additions and 5 deletions

View File

@ -1377,7 +1377,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
SetAclRequest.Builder builder = SetAclRequest.newBuilder()
.setObj(OzoneObj.toProtobuf(obj));
acls.parallelStream().forEach(a -> builder.addAcl(OzoneAcl.toProtobuf(a)));
acls.forEach(a -> builder.addAcl(OzoneAcl.toProtobuf(a)));
OMRequest omRequest = createOMRequest(Type.SetAcl)
.setSetAclRequest(builder.build())

View File

@ -2291,9 +2291,13 @@ public abstract class TestOzoneRpcClientAbstract {
expectedAcls.forEach(a -> assertTrue(finalNewAcls.contains(a)));
// Reset acl's.
store.setAcl(ozObj, new ArrayList<>());
OzoneAcl ua = new OzoneAcl(ACLIdentityType.USER, "userx", ACLType.READ_ACL);
OzoneAcl ug = new OzoneAcl(ACLIdentityType.GROUP, "userx", ACLType.ALL);
store.setAcl(ozObj, Arrays.asList(ua, ug));
newAcls = store.getAcl(ozObj);
assertTrue(newAcls.size() == 0);
assertTrue(newAcls.size() == 2);
assertTrue(newAcls.contains(ua));
assertTrue(newAcls.contains(ug));
}
private void writeKey(String key1, OzoneBucket bucket) throws IOException {

View File

@ -411,8 +411,7 @@ public class OzoneManagerRequestHandler implements RequestHandler {
private SetAclResponse setAcl(SetAclRequest req) throws IOException {
List<OzoneAcl> ozoneAcl = new ArrayList<>();
req.getAclList().parallelStream().forEach(a ->
ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
req.getAclList().forEach(a -> ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
boolean response = impl.setAcl(OzoneObjInfo.fromProtobuf(req.getObj()),
ozoneAcl);
return SetAclResponse.newBuilder().setResponse(response).build();