You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "m1a2st (via GitHub)" <gi...@apache.org> on 2024/05/23 12:33:56 UTC

[PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

m1a2st opened a new pull request, #16042:
URL: https://github.com/apache/kafka/pull/16042

   ReplicaManager will generate a response having unexpected topics with empty patitions, so I add a filter to check partition is empty.


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2137471257

   > There are two tests to test describeLogDirs methods which is testing topic exists and non topic exists. What other situations have I not considered? Thanks you
   
   Could you share the test name with me? thanks


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1613525989


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1247,7 +1247,8 @@ class ReplicaManager(val config: KafkaConfig,
         val usableBytes = adjustForLargeFileSystems(fileStore.getUsableSpace)
         logsByDir.get(absolutePath) match {
           case Some(logs) =>
-            val topicInfos = logs.groupBy(_.topicPartition.topic).map{case (topic, logs) =>
+            val topicInfos = logs.filter(_.topicPartition.topic.nonEmpty)

Review Comment:
   @chia7712 , @gaurav-narula , Thanks for your comments, I changed the code



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2143225345

   @m1a2st Could you rebase code to include newest fixes?


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1616243847


##########
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:
   BTW, please add UT for this extra fix



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1613531701


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -6594,6 +6594,64 @@ class ReplicaManagerTest {
       ))
     }
   }
+
+  @Test
+  def testReplicaManagerDontGenerateEmptyTopicPartition(): Unit = {

Review Comment:
   Because there is a test that direct to test `describeLogDirs` method in ReplicaManagerTest, So I consider that to wirte a new test in `ReplicaManagerTest` is better than `DescribeLogDirsRequestTest`



##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -6594,6 +6594,64 @@ class ReplicaManagerTest {
       ))
     }
   }
+
+  @Test
+  def testReplicaManagerDontGenerateEmptyTopicPartition(): Unit = {

Review Comment:
   Because there is a test that direct to test `describeLogDirs` method in ReplicaManagerTest, So I consider that to wirte a new test in `ReplicaManagerTest` is better than `DescribeLogDirsRequestTest`.



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "gaurav-narula (via GitHub)" <gi...@apache.org>.
gaurav-narula commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1611804316


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -6594,6 +6594,64 @@ class ReplicaManagerTest {
       ))
     }
   }
+
+  @Test
+  def testReplicaManagerDontGenerateEmptyTopicPartition(): Unit = {

Review Comment:
   It might be easier to test this in `DescribeLogDirsRequestTest` by setting up 2 topics with 2 topic partitions each and querying for both partitions of either one of the topics.



##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1247,7 +1247,8 @@ class ReplicaManager(val config: KafkaConfig,
         val usableBytes = adjustForLargeFileSystems(fileStore.getUsableSpace)
         logsByDir.get(absolutePath) match {
           case Some(logs) =>
-            val topicInfos = logs.groupBy(_.topicPartition.topic).map{case (topic, logs) =>
+            val topicInfos = logs.filter(_.topicPartition.topic.nonEmpty)

Review Comment:
   I don't think the bug is due to `UnifiedLog.topicPartition.topic` being empty but rather because we don't filter for logs which pertain to the topics in the argument to the function.
   
   Consider the case where the `logs` refers to logs for `["topicA-0", "topicA-1", "topicB-0", "topicB-1"]` and `partitions` is `["topicA-0", "topicA-1"]`



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1618905589


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1259,12 +1260,18 @@ class ReplicaManager(val config: KafkaConfig,
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
             }.filterNot(_.partitions().isEmpty).toList.asJava
-
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, topicInfos)
           case None =>
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, Collections.emptyList())
+            Collections.emptyList[DescribeLogDirsTopic]()
         }
 
+        val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+          .setLogDir(absolutePath)
+          .setErrorCode(Errors.NONE.code)
+          .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+        if (!topicInfos.isEmpty)

Review Comment:
   In `DescribeLogDirsResult` contructor has already been init a empty List, so If the `topicInfos.isEmpty` I don't need to `setTopics`. I think that is redundant 



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "soarez (via GitHub)" <gi...@apache.org>.
soarez commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1618883471


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1259,12 +1260,18 @@ class ReplicaManager(val config: KafkaConfig,
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
             }.filterNot(_.partitions().isEmpty).toList.asJava
-
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, topicInfos)
           case None =>
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, Collections.emptyList())
+            Collections.emptyList[DescribeLogDirsTopic]()
         }
 
+        val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+          .setLogDir(absolutePath)
+          .setErrorCode(Errors.NONE.code)
+          .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+        if (!topicInfos.isEmpty)

Review Comment:
   Is this check necessary?



##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1284,6 +1280,20 @@ class ReplicaManager(val config: KafkaConfig,
     }.toList
   }
 
+  private def createDescribeLogDirsResult(absolutePath: String,
+                                          totalBytes: Long,
+                                          usableBytes: Long,
+                                          topics: util.List[DescribeLogDirsResponseData.DescribeLogDirsTopic]): DescribeLogDirsResponseData.DescribeLogDirsResult = {
+    val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+      .setLogDir(absolutePath)
+      .setErrorCode(Errors.NONE.code)
+      .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+    if (!topics.isEmpty)

Review Comment:
   Is this check necessary?



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2143228875

   I already rebased the code


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2143563321

   @m1a2st Could you please rebase code again?


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1616025501


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1258,7 +1258,7 @@ class ReplicaManager(val config: KafkaConfig,
                     .setOffsetLag(getLogEndOffsetLag(log.topicPartition, log.logEndOffset, log.isFuture))
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
-            }.toList.asJava
+            }.filterNot(_.partitions().isEmpty).toList.asJava
 
             new DescribeLogDirsResponseData.DescribeLogDirsResult().setLogDir(absolutePath)
               .setErrorCode(Errors.NONE.code).setTopics(topicInfos)

Review Comment:
   Another question: Should we call `setTopics(topicInfos)` if `topicInfos` is empty?



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #16042:
URL: https://github.com/apache/kafka/pull/16042


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1611813848


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1247,7 +1247,8 @@ class ReplicaManager(val config: KafkaConfig,
         val usableBytes = adjustForLargeFileSystems(fileStore.getUsableSpace)
         logsByDir.get(absolutePath) match {
           case Some(logs) =>
-            val topicInfos = logs.groupBy(_.topicPartition.topic).map{case (topic, logs) =>
+            val topicInfos = logs.filter(_.topicPartition.topic.nonEmpty)

Review Comment:
   agree to @gaurav-narula 
   
   Maybe we can just add a filter to remove the topics having "zero" partitions.



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1618905589


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1259,12 +1260,18 @@ class ReplicaManager(val config: KafkaConfig,
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
             }.filterNot(_.partitions().isEmpty).toList.asJava
-
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, topicInfos)
           case None =>
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, Collections.emptyList())
+            Collections.emptyList[DescribeLogDirsTopic]()
         }
 
+        val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+          .setLogDir(absolutePath)
+          .setErrorCode(Errors.NONE.code)
+          .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+        if (!topicInfos.isEmpty)

Review Comment:
   I think you are right, In `DescribeLogDirsResult` contructor has already init a empty List, so I didn't need to check `!topicInfos.isEmpty`



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2127085517

   @chia7712, please take a look, Thanks you.


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r1618905589


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1259,12 +1260,18 @@ class ReplicaManager(val config: KafkaConfig,
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
             }.filterNot(_.partitions().isEmpty).toList.asJava
-
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, topicInfos)
           case None =>
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, Collections.emptyList())
+            Collections.emptyList[DescribeLogDirsTopic]()
         }
 
+        val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+          .setLogDir(absolutePath)
+          .setErrorCode(Errors.NONE.code)
+          .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+        if (!topicInfos.isEmpty)

Review Comment:
   In `DescribeLogDirsResult` contructor has already init a empty List, so If the `topicInfos.isEmpty` I don't need to `setTopics`. I think that is redundant 



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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2137479544

   The test names are `testDescribeLogDirsWithoutAnyPartitionTopic` and `testDescribeLogDirs`


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2137423731

   @chia7712, There are two tests to test `describeLogDirs` methods which test have topic and non topic. What other situations have I not considered? Thanks you


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16042:
URL: https://github.com/apache/kafka/pull/16042#issuecomment-2140664027

   > The test names are testDescribeLogDirsWithoutAnyPartitionTopic and testDescribeLogDirs.
   
   It seems to me the method needs to come with the guarantee: `DescribeLogDirsTopic` should not have empty `partitions`
   
   Hence, could you please add following asserts to `testDescribeLogDirs`
   
   ```scala
         responses.foreach { response =>
           assertEquals(Errors.NONE.code, response.errorCode)
           assertTrue(response.totalBytes > 0)
           assertTrue(response.usableBytes >= 0)
           assertFalse(response.topics().isEmpty)
           response.topics().forEach(t => assertFalse(t.partitions().isEmpty))
         }
   ```


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


Re: [PR] KAFKA-16807: DescribeLogDirsResponseData#results#topics have unexpected topics having empty partitions [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #16042:
URL: https://github.com/apache/kafka/pull/16042#discussion_r2377510526


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1259,12 +1260,18 @@ class ReplicaManager(val config: KafkaConfig,
                     .setIsFutureKey(log.isFuture)
                 }.toList.asJava)
             }.filterNot(_.partitions().isEmpty).toList.asJava
-
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, topicInfos)
           case None =>
-            createDescribeLogDirsResult(absolutePath, totalBytes, usableBytes, Collections.emptyList())
+            Collections.emptyList[DescribeLogDirsTopic]()
         }
 
+        val describeLogDirsResult = new DescribeLogDirsResponseData.DescribeLogDirsResult()
+          .setLogDir(absolutePath)
+          .setErrorCode(Errors.NONE.code)
+          .setTotalBytes(totalBytes).setUsableBytes(usableBytes)
+        if (!topicInfos.isEmpty)

Review Comment:
   `setTopics` is executed at line#1264, so I think the check is unnecessary



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