KAFKA-19347 Don't update timeline data structures in createAcls (#19840)
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:
David Arthur 2025-05-28 12:40:19 -04:00 committed by GitHub
parent be4762e401
commit 9dd4cff2d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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);
} }

View File

@ -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());