You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2026/09/25 13:07:00 UTC

[jira] [Resolved] (KAFKA-21155) Document that the records map passed to ConsumerRecords must not contain empty lists

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

Chia-Ping Tsai resolved KAFKA-21155.
------------------------------------
    Fix Version/s: 4.5.0
       Resolution: Fixed

> Document that the records map passed to ConsumerRecords must not contain empty lists
> ------------------------------------------------------------------------------------
>
>                 Key: KAFKA-21155
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21155
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Assignee: Andy Huang
>            Priority: Minor
>             Fix For: 4.5.0
>
>
> {code:java}
>     public boolean isEmpty() {
>         return records.isEmpty();
>     }
>  {code}
> The empty list will make {{ConsumerRecords#isEmpty}} return false, and {{partitions()}} will include a partition with no records. I have checked that both classic and async consumers follow the rule. [https://github.com/apache/kafka/pull/23532] will fix the issue in share consumer.
> I was thinking of modifying {{{}isEmpty{}}}, but it may introduce an unexpected breaking change, and the constructor is public so interceptors can build {{ConsumerRecords}} too. That is to say ... let's update the docs instead 🙂



--
This message was sent by Atlassian Jira
(v8.20.10#820010)