consumer: auto.offset.store commits incorrect offsets #4341
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.
Sponsored-by: China Medical University Hospital
--
Hi,
I guess this issue is introduced by #4208, but I do not understand the details in that issue.
I inspected the partition offset via
on_commit
by the Python library.W/o this patch, there are two case tried and I found the offsets committed are different:
case 1.
The consumer is configured with
where the
on_commit
function is:case 2
and then I invoked the
c.store_offset(message=msg)
manually, after processed a message.results
I run case 1 and case 2 twice. The first run is for reading the topic to the end and waiting for the offsets committed.
The expected result in the second run is that the consumers should not get any messages, since there aren't any producers running at this point.
The case 2 works correctly in the second run.
The case 1 starts consuming the log from some unexpected point of offset in the second run.
This patch fixed case 1. But I'm not sure of the side effect of it.