OmniaGM commented on code in PR #19964: URL: https://github.com/apache/kafka/pull/19964#discussion_r2160230646
########## clients/src/main/java/org/apache/kafka/common/TopicIdPartition.java: ########## @@ -78,6 +80,21 @@ public TopicPartition topicPartition() { return topicPartition; } + /** + * Checking if TopicIdPartition meant to be the same reference to same this object but doesn't have all the data. + * If topic name is empty and topic id is persisted then the method will rely on topic id only + * otherwise the method will rely on topic name. + * @return true if topic has same topicId and partition index as topic names some time might be empty. + */ + public boolean same(TopicIdPartition tpId) { + if (Utils.isBlank(tpId.topic()) && !tpId.topicId.equals(Uuid.ZERO_UUID)) { + return topicId.equals(tpId.topicId) && + topicPartition.partition() == tpId.partition(); + } else { + return topicPartition.equals(tpId.topicPartition()); Review Comment: What about change `ProducerBatch` to use `TopicIdPartition` instead of `TopicPartition` this will simplify things instead of all of these checks and metadata lookups also I wouldn' tneed to filter batches to find the 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org