OmniaGM commented on code in PR #15968:
URL: https://github.com/apache/kafka/pull/15968#discussion_r1644115910
##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -126,15 +134,15 @@ public ProduceRequest(ProduceRequestData
produceRequestData, short version) {
}
// visible for testing
- Map<TopicPartition, Integer> partitionSizes() {
+ Map<TopicIdPartition, Integer> partitionSizes() {
if (partitionSizes == null) {
// this method may be called by different thread (see the comment
on data)
synchronized (this) {
if (partitionSizes == null) {
- Map<TopicPartition, Integer> tmpPartitionSizes = new
HashMap<>();
+ Map<TopicIdPartition, Integer> tmpPartitionSizes = new
HashMap<>();
data.topicData().forEach(topicData ->
topicData.partitionData().forEach(partitionData ->
- tmpPartitionSizes.compute(new
TopicPartition(topicData.name(), partitionData.index()),
+ tmpPartitionSizes.compute(new
TopicIdPartition(topicData.topicId(), partitionData.index(), topicData.name()),
Review Comment:
In the context of `partitionSizes` method we don't need topic name however,
1. I didn't want to have if-else around this to decide if I will populate
topic name as this logic will handle both old and new version
2. `TopicIdPartition` contractor need either a topic name to construct
`TopicPartition` automatically or pass a constructed `TopicPartition` which
need topic name as well.
--
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]