Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-12980

Allow consumers to return from poll when position advances due to aborted transactions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0
    • consumer
    • None

    Description

      When Consumer::poll is invoked on a topic with an open transaction, and then that transaction is aborted, poll does not return unless there are other records available in that topic after the aborted transaction.

      Instead, poll could return in this case, even when no records are available.

      This facilitates reads to the end of a topic where the end offsets of a topic are listed and then a consumer for that topic is polled until its position is at or beyond each of those offsets (for example, Connect does this when reading to the end of any of its internal topics).

      We could update the existing language in the docs for Consumer::poll from

      This method returns immediately if there are records available.

      to

      This method returns immediately if there are records available or if the position advances past control records.

       

      A workaround for existing users who would like to see this is to use short poll intervals and manually check the consumer's position in between each poll, but this is fairly tedious and may lead to excess CPU and network utilization depending on the latency requirements for knowing when the end of the topic has been reached.

      Attachments

        Issue Links

          Activity

            People

              ChrisEgerton Chris Egerton
              ChrisEgerton Chris Egerton
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: