Gimini-3 commented on code in PR #23128:
URL: https://github.com/apache/kafka/pull/23128#discussion_r4013737910
##########
metadata/src/main/java/org/apache/kafka/image/ScramImage.java:
##########
@@ -46,7 +46,10 @@ public record ScramImage(Map<ScramMechanism, Map<String,
ScramCredentialData>> m
public static final ScramImage EMPTY = new ScramImage(Map.of());
public ScramImage {
- mechanisms = Collections.unmodifiableMap(mechanisms);
+ Map<ScramMechanism, Map<String, ScramCredentialData>> copiedMechanisms
= new HashMap<>();
+ mechanisms.forEach((mechanism, credentials) ->
+ copiedMechanisms.put(mechanism, Collections.unmodifiableMap(new
HashMap<>(credentials))));
Review Comment:
Thanks for the review. I narrowed this PR to mechanism maps and reverted the
credential-array copies. I kept the snapshot copies of the outer and nested
maps, with a regression test covering changes to constructor inputs as well as
writes through `mechanisms()`. The PR title and description now reflect that
narrower scope.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]