chia7712 commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1616243577


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1247,7 +1247,7 @@ class ReplicaManager(val config: KafkaConfig,
         val usableBytes = adjustForLargeFileSystems(fileStore.getUsableSpace)
         logsByDir.get(absolutePath) match {

Review Comment:
   How abort getting `topicInfos` by this match pattern?
   
   ```scala
           val topicInfos = logsByDir.get(absolutePath) match {
             case Some(logs) =>
               logs.groupBy(_.topicPartition.topic).map { case (topic, logs) =>
                 new 
DescribeLogDirsResponseData.DescribeLogDirsTopic().setName(topic).setPartitions(
                   logs.filter { log =>
                     partitions.contains(log.topicPartition)
                   }.map { log =>
                     new DescribeLogDirsResponseData.DescribeLogDirsPartition()
                       .setPartitionSize(log.size)
                       .setPartitionIndex(log.topicPartition.partition)
                       .setOffsetLag(getLogEndOffsetLag(log.topicPartition, 
log.logEndOffset, log.isFuture))
                       .setIsFutureKey(log.isFuture)
                   }.toList.asJava)
               }.filterNot(_.partitions().isEmpty).toList.asJava
             case None =>
               Collections.emptyList[DescribeLogDirsTopic]()
           }
   ```
   
   and then we can move impl of `createDescribeLogDirsResult` to here. with 
that we don't need to have a extra method. 



-- 
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]

Reply via email to