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

Splitting partition causes message loss for consumers with auto.offset.reset=latest

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.7.0
    • 3.6.0
    • None
    • None

    Description

      As of now, auto.offset.reset of ConsumerConfig is "latest" by default.

       

      This could be a pitfall that causes message delivery loss when we split topic's partitions like below:

      Say we have a topic-X which have only 1 partition.

      1. split topic-X to 2 partitions by kafka-topics.sh --alter --topic topic-X --partitions 2 (topic-X-1 is added)
      2. producer knows that new partitions are added by refreshing metadata. starts to produce to topic-X-1
      3. bit later, consumer knows that new partitions are added and triggering consumer rebalance, then starts consuming topic-X-1
        • upon starting consumption, it resets its offset to log-end-offset

      If the producer sent several records before 3, they could be not-delivered to the consumer.

       

       

      This behavior isn't preferable in most cases, so it should be documented in AUTO_OFFSET_RESET_DOC at least.

      Attachments

        Issue Links

          Activity

            People

              ocadaruma Haruki Okada
              ocadaruma Haruki Okada
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: