-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to propagate OffsetOutOfRange error #1183
Add option to propagate OffsetOutOfRange error #1183
Conversation
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.
@varun06 I don't think this is easily testable. It's not something that can be easily re-created in a test scenario. @muirrn thanks for the detailed explanation and the patch. One question: how would you handle these cases. Assuming the |
The error gets propagated and we retry consuming until it works. Maybe a general solution is to only fetch offsets from the group coordinator, but I'm not really sure. |
@muirrn the reason why we added this in the first place was an endless loop of |
Thank you for your contribution! However, this pull request has not had any activity in the past 90 days and will be closed in 30 days if no updates occur. |
@dim are you still in favor of changing the default to |
@muirdm yes, I still think that |
Thank you for your contribution! However, this pull request has not had any activity in the past 90 days and will be closed in 30 days if no updates occur. |
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.
Resolves #1181