Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to propagate OffsetOutOfRange error
When consuming a partition using a consumer group, the code handles ErrOffsetOutOfRange errors by resetting to the "initial" position, as specified by user (i.e. either oldest or newest available offset). This, however, can be very dangerous. Say a consumer has consumed up to offset 100 on replica A but replica B has only replicated up to offset 99 due to temporary under-replication. During a rebalance, sarama can end up with an offset out-of-range error if it fetches partition metadata from replica B since the desired offset of 100 is greater than the newest offset of 99. The sarama consumer would reset the offset in this case, which can cause reprocessing of old data, especially if the initial offset is configured as "oldest". This commit adds a config flag to disable this automatic reset. In the above case, the consumer will be able to proceed normally after the data replicates.
- Loading branch information