HDDS-1657. Fix parallelStream usage in volume and key native acl. Contributed by Ajay Kumar. (#926)
This commit is contained in:
parent
46b23c11b0
commit
9deac3b6bf
|
@ -1377,7 +1377,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
|
||||||
SetAclRequest.Builder builder = SetAclRequest.newBuilder()
|
SetAclRequest.Builder builder = SetAclRequest.newBuilder()
|
||||||
.setObj(OzoneObj.toProtobuf(obj));
|
.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)
|
OMRequest omRequest = createOMRequest(Type.SetAcl)
|
||||||
.setSetAclRequest(builder.build())
|
.setSetAclRequest(builder.build())
|
||||||
|
|
|
@ -2291,9 +2291,13 @@ public abstract class TestOzoneRpcClientAbstract {
|
||||||
expectedAcls.forEach(a -> assertTrue(finalNewAcls.contains(a)));
|
expectedAcls.forEach(a -> assertTrue(finalNewAcls.contains(a)));
|
||||||
|
|
||||||
// Reset acl's.
|
// 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);
|
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 {
|
private void writeKey(String key1, OzoneBucket bucket) throws IOException {
|
||||||
|
|
|
@ -411,8 +411,7 @@ public class OzoneManagerRequestHandler implements RequestHandler {
|
||||||
|
|
||||||
private SetAclResponse setAcl(SetAclRequest req) throws IOException {
|
private SetAclResponse setAcl(SetAclRequest req) throws IOException {
|
||||||
List<OzoneAcl> ozoneAcl = new ArrayList<>();
|
List<OzoneAcl> ozoneAcl = new ArrayList<>();
|
||||||
req.getAclList().parallelStream().forEach(a ->
|
req.getAclList().forEach(a -> ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
|
||||||
ozoneAcl.add(OzoneAcl.fromProtobuf(a)));
|
|
||||||
boolean response = impl.setAcl(OzoneObjInfo.fromProtobuf(req.getObj()),
|
boolean response = impl.setAcl(OzoneObjInfo.fromProtobuf(req.getObj()),
|
||||||
ozoneAcl);
|
ozoneAcl);
|
||||||
return SetAclResponse.newBuilder().setResponse(response).build();
|
return SetAclResponse.newBuilder().setResponse(response).build();
|
||||||
|
|
Loading…
Reference in New Issue