Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The problem of specified partitions is that the latest offset of a new partition is generally 0 or a small value when discovery, which is very unpredictable and unreasonable. If the specified offset is greater than that value, Kafka Client will consume according to the OffsetResetStrategy, that is EARLIEST (See org.apache.kafka.clients.consumer.internals.Fetcher#handleOffsetOutOfRange).

image.png

For example, if the Specified offset of topic1-1 is set to 10, when  new partition-1 is discovered with an offset range of [0, 5], all messages in the range of [0, 5] will be consumed. If new partition-1 already has more than 10 messages written when it is discovered, then consumption will begin from offset 10. If partition-2 has no specified offset, when new partition-2 is discovered with an offset range of [0, 5], all messages in the range of [0, 5] will be consumed.


Using "Earliest" ensures that the same behavior of consuming offsets for new partitions is maintained.

...