ShivsundarR commented on code in PR #19192: URL: https://github.com/apache/kafka/pull/19192#discussion_r1992120109
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java: ########## @@ -1004,8 +1014,10 @@ private void updateLeaderInfoMap(ShareAcknowledgeResponseData.PartitionData part } private TopicIdPartition lookupTopicId(Uuid topicId, int partitionIndex) { - String topicName = metadata.topicNames().getOrDefault(topicId, - topicNamesMap.remove(new IdAndPartition(topicId, partitionIndex))); + String topicName = metadata.topicNames().get(topicId); + if (topicName == null) { + topicName = topicNamesMap.remove(new IdAndPartition(topicId, partitionIndex)); + } Review Comment: Thanks @AndrewJSchofield for clarifying, realised that this way of using getOrDefault still executes the `topicNamesMap.remove()` call anyway and decides to use it as default based on whether the value was present in the map or not. We ideally want to remove it only if we cannot find the value in the map, so I'll keep this change in the PR. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org