You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/05 18:16:12 UTC

[jira] [Commented] (KAFKA-3661) org.apache.kafka.clients.consumer.RoundRobinAssignor throws NPE when topic metadata not found

    [ https://issues.apache.org/jira/browse/KAFKA-3661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15272768#comment-15272768 ] 

ASF GitHub Bot commented on KAFKA-3661:
---------------------------------------

GitHub user onurkaraman opened a pull request:

    https://github.com/apache/kafka/pull/1326

    KAFKA-3661: fix NPE in o.a.k.c.c.RoundRobinAssignor when topic metadata not found

    AbstractPartitionAssignor.assign has an ambiguous line in its documentation:
    > @param partitionsPerTopic The number of partitions for each subscribed topic (may be empty for some topics)
    
    Does empty mean the topic has an entry with value zero, or that the entry is excluded from the map altogether? The current implementation in AbstractPartitionAssignor excludes the entry from partitionsPerTopic if the topic isn't in the metadata.
    
    RoundRobinAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
    RangeAssignor interprets emptiness as excluding the entry from the map.
    RangeAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
    
    This implementation chooses to solve the NPE by deciding to exclude topics from partitionsPerTopic when the topic is not in the metadata.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/onurkaraman/kafka KAFKA-3661

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/1326.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1326
    
----
commit a1374bdd07d76044b196cf833e4efbb88c940d70
Author: Onur Karaman <ok...@linkedin.com>
Date:   2016-05-05T18:07:00Z

    fix NPE in org.apache.kafka.clients.consumer.RoundRobinAssignor when topic metadata not found
    
    AbstractPartitionAssignor.assign has an ambiguous line in its documentation:
    @param partitionsPerTopic The number of partitions for each subscribed topic (may be empty for some topics)
    
    Does empty mean the topic has an entry with value zero, or that the entry is excluded from the map altogether? The current implementation in AbstractPartitionAssignor excludes the entry from partitionsPerTopic if the topic isn't in the metadata.
    
    RoundRobinAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
    RangeAssignor interprets emptiness as excluding the entry from the map.
    RangeAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
    
    This implementation chooses to solve the NPE by deciding to exclude topics from partitionsPerTopic when the topic is not in the metadata.

----


> org.apache.kafka.clients.consumer.RoundRobinAssignor throws NPE when topic metadata not found
> ---------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-3661
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3661
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Onur Karaman
>            Assignee: Onur Karaman
>
> AbstractPartitionAssignor.assign has an ambiguous line in its documentation:
> {code}
> @param partitionsPerTopic The number of partitions for each subscribed topic (may be empty for some topics)
> {code}
> Does empty mean the topic has an entry with value zero, or that the entry is excluded from the map altogether? The current implementation in AbstractPartitionAssignor excludes the entry from partitionsPerTopic if the topic isn't in the metadata.
> RoundRobinAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
> RangeAssignor interprets emptiness as excluding the entry from the map.
> RangeAssignorTest.testOneConsumerNonexistentTopic interprets emptiness as providing the topic with a zero value.
> I don't really have a preference in which direction we take. We just need to more clearly document what happens when the topic isn't in the metadata.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)