Allow rewind detection when previous zero lag #716
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rewinds can occur even when the consumer has no lag and its often an indication
that something that gone quite wrong. This change checks for a rewind when there
is any current lag. If a rewind is found in the history of the consumer offsets,
it then checks to see if the consumer has 'recovered' from the rewind. If not,
it is marked as a rewind. If it has recovered, we fall back to the usual
usual status evaluation rules.
Currently the wiki doesn't say anything about REWIND status, but does say:
However that misses the case where lag can be zero for a while and then jump
back in time. This can occur during a rebalance as consumers drain existing
work (for those that keep a pipeline of work) or due to a broker bug that throws an
Exception when attempting to retrieve the current offsets, causing many consumers
to revert to the beginning of the topic (
auto.offset.reset = earliest
). Thelatter can occur with periodically and unfortunately is a reoccuring theme of
bug (see: KAFKA-9824, KAFKA-9543, KAFKA-9807, KAFKA-9835, etc.)
Addresses #714