[ 
https://issues.apache.org/jira/browse/KAFKA-12789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

HaiyuanZhao resolved KAFKA-12789.
---------------------------------
    Resolution: Fixed

> Remove Stale comments for meta response handling logic
> ------------------------------------------------------
>
>                 Key: KAFKA-12789
>                 URL: https://issues.apache.org/jira/browse/KAFKA-12789
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: HaiyuanZhao
>            Assignee: HaiyuanZhao
>            Priority: Minor
>
> According to my understanding, the following paragraph looks like a stale 
> comments.
> {code:java}
> public void handleSuccessfulResponse(RequestHeader requestHeader, long now, 
> MetadataResponse response) {
>             ...
>             // Don't update the cluster if there are no valid nodes...the 
> topic we want may still be in the process of being
>             // created which means we will get errors and no nodes until it 
> exists
>             if (response.brokers().isEmpty()) {
>                 log.trace("Ignoring empty metadata response with correlation 
> id {}.", requestHeader.correlationId());
>                 this.metadata.failedUpdate(now);
>             } else {
>                 this.metadata.update(inProgress.requestVersion, response, 
> inProgress.isPartialUpdate, now);
>             }
>             ...
> {code}
> The comments above mean we will may get errors and no nodes if the topic we 
> want may still be in the process of being created.
>  However, every meta request will return all brokers from the logic of the 
> server side, just as followed
> {code:java}
>   def handleTopicMetadataRequest(request: RequestChannel.Request): Unit = {
>     ...
>     val brokers = metadataCache.getAliveBrokers
>     ...
>   }
> {code}
> I studied the related git commit history and figured out why.
>  # This comments was first introduced in KAFKA-642 (e11447650a). which means 
> meta request only need brokers related to the topics we want.
>  # KAFKA-1535 (commitId: 4ebcdfd51f) changed the server side logic. which has 
> the metadata response contain all alive brokers rather than just the ones 
> needed for the given topics.
>  # However, this comments are retained till now.
> So According to my understanding, this comments looks like a stale one and 
> can be removed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to