You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Manikumar (JIRA)" <ji...@apache.org> on 2018/11/20 17:48:00 UTC
[jira] [Resolved] (KAFKA-7616) MockConsumer can return
ConsumerRecords objects with a non-empty map but no records
[ https://issues.apache.org/jira/browse/KAFKA-7616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Manikumar resolved KAFKA-7616.
------------------------------
Resolution: Fixed
Fix Version/s: 2.2.0
Issue resolved by pull request 5901
[https://github.com/apache/kafka/pull/5901]
> MockConsumer can return ConsumerRecords objects with a non-empty map but no records
> -----------------------------------------------------------------------------------
>
> Key: KAFKA-7616
> URL: https://issues.apache.org/jira/browse/KAFKA-7616
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 2.0.1
> Reporter: Stig Rohde Døssing
> Assignee: Stig Rohde Døssing
> Priority: Trivial
> Fix For: 2.2.0
>
>
> The ConsumerRecords returned from MockConsumer.poll can return false for isEmpty while not containing any records. This behavior is because MockConsumer.poll eagerly adds entries to the returned Map<TopicPartition, List<ConsumerRecord>>, based on which partitions have been added. If no records are returned for a partition, e.g. because the position was too far ahead, the entry for that partition will still be there.
>
> The MockConsumer should lazily add entries to the map as they are needed, since it is more in line with how the real consumer behaves.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)