You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/06/29 14:57:43 UTC

[GitHub] [kafka] sasukerui opened a new pull request #8950: Optimize the judgment condition of TopicMetadata parameters

sasukerui opened a new pull request #8950:
URL: https://github.com/apache/kafka/pull/8950


   Optimize the judgment condition of TopicMetadata parameters.
   Judgment has been made in the method handleTopicMetadataRequest. like authorizedTopics.isEmpty
   
   
   if (authorizedTopics.isEmpty)
           Seq.empty[MetadataResponse.TopicMetadata]
         else
           getTopicMetadata(metadataRequest.allowAutoTopicCreation, authorizedTopics, request.context.listenerName,
             errorUnavailableEndpoints, errorUnavailableListeners)
   
   I think there is no need to do another judgment in the getTopicMetadata method. I think  topics.isEmpty can be deleted
   
   if (topicResponses.size == topics.size) {
         topicResponses
       }
   


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

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



[GitHub] [kafka] chia7712 commented on a change in pull request #8950: Optimize the judgment condition of TopicMetadata parameters

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #8950:
URL: https://github.com/apache/kafka/pull/8950#discussion_r507472975



##########
File path: core/src/test/scala/unit/kafka/server/KafkaApisTest.scala
##########
@@ -987,6 +987,14 @@ class KafkaApisTest {
     testConsumerListOffsetLatest(IsolationLevel.READ_UNCOMMITTED)
   }
 
+  @Test
+  def testGetTopicMetadataMethodParameters(): Unit = {
+    val value = true
+    val (plaintextListener, _) = updateMetadataCacheWithInconsistentListeners()
+    val response = sendMetadataRequestWithInconsistentListeners(plaintextListener)
+    assertEquals(true, value)

Review comment:
       It seems the assert is always pass since the ```value``` is always ```true```




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

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