mirror of https://github.com/apache/kafka.git
KAFKA-19347 Don't update timeline data structures in createAcls (#19840)
CI / build (push) Waiting to run
Details
CI / build (push) Waiting to run
Details
This patch fixes a problem in AclControlManager where we are updating the timeline data structures prematurely. Reviewers: Alyssa Huang <ahuang@confluent.io>, Colin P. McCabe <cmccabe@apache.org>, Andrew Schofield <aschofield@confluent.io>,
This commit is contained in:
parent
be4762e401
commit
9dd4cff2d7
|
@ -106,10 +106,11 @@ public class AclControlManager {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
StandardAcl standardAcl = StandardAcl.fromAclBinding(acl);
|
StandardAcl standardAcl = StandardAcl.fromAclBinding(acl);
|
||||||
if (existingAcls.add(standardAcl)) {
|
if (!existingAcls.contains(standardAcl)) {
|
||||||
StandardAclWithId standardAclWithId = new StandardAclWithId(newAclId(), standardAcl);
|
StandardAclWithId standardAclWithId = new StandardAclWithId(newAclId(), standardAcl);
|
||||||
idToAcl.put(standardAclWithId.id(), standardAcl);
|
|
||||||
records.add(new ApiMessageAndVersion(standardAclWithId.toRecord(), (short) 0));
|
records.add(new ApiMessageAndVersion(standardAclWithId.toRecord(), (short) 0));
|
||||||
|
} else {
|
||||||
|
log.debug("Not creating ACL since it already exists: {}", standardAcl);
|
||||||
}
|
}
|
||||||
results.add(AclCreateResult.SUCCESS);
|
results.add(AclCreateResult.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,6 +346,7 @@ public class AclControlManagerTest {
|
||||||
new AccessControlEntry("User:user", "10.0.0.1", AclOperation.ALL, ALLOW));
|
new AccessControlEntry("User:user", "10.0.0.1", AclOperation.ALL, ALLOW));
|
||||||
|
|
||||||
ControllerResult<List<AclCreateResult>> createResult = manager.createAcls(List.of(aclBinding));
|
ControllerResult<List<AclCreateResult>> createResult = manager.createAcls(List.of(aclBinding));
|
||||||
|
RecordTestUtils.replayAll(manager, createResult.records());
|
||||||
Uuid id = ((AccessControlEntryRecord) createResult.records().get(0).message()).id();
|
Uuid id = ((AccessControlEntryRecord) createResult.records().get(0).message()).id();
|
||||||
assertEquals(1, createResult.records().size());
|
assertEquals(1, createResult.records().size());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue