You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mimaison (via GitHub)" <gi...@apache.org> on 2026/06/19 13:22:56 UTC
Re: [PR] MINOR: avoid redundant HashMap lookups and simplify Uuid conversions [kafka]
mimaison commented on code in PR #22122:
URL: https://github.com/apache/kafka/pull/22122#discussion_r3442742137
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -3035,11 +3035,11 @@ static Map<Uuid, InitMapValue> combineInitMaps(
combinedTopicIdSet.addAll(initializingSet);
for (Uuid topicId : combinedTopicIdSet) {
- Set<Integer> initializedPartitions = initialized.containsKey(topicId) ? initialized.get(topicId).partitions() : new HashSet<>();
- long timestamp = initialized.containsKey(topicId) ? initialized.get(topicId).timestamp() : -1;
- String name = initialized.containsKey(topicId) ? initialized.get(topicId).name() : "UNKNOWN";
+ InitMapValue initializedValue = initialized.get(topicId);
+ Set<Integer> finalPartitions = initializedValue != null ? new HashSet<>(initializedValue.partitions()) : new HashSet<>();
+ long timestamp = initializedValue != null ? initializedValue.timestamp() : -1;
+ String name = initializedValue != null ? initializedValue.name() : "UNKNOWN";
Review Comment:
Could we do something similar in the `if` block just below?
```
if (initializingSet.contains(topicId)) {
InitMapValue initializingValue = initializing.get(topicId);
...
```
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org