Fix wrong handeling of empty fetch response. #323
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.
Empty fetch response happens only in incremental fetch sessions.
(which we do not support yet)
The current parsing code is a copy-paste from kafka_protocol test_lib code
which is fine.
But the comment is wrong: It's fetch session not transactional session
which is a entirely different thing.
And the handling is even more wrong: In case empty fetch response is
received, it should not advance begin_offset, but keep retrying the one
used in the last fetch request, because essentially an empty
response implies no new offsets and no partition metadata change either.
Noticed this when investigating #321, but it should not be the cause of it,
because the bug is reported on brod 3.4,
the highest fetch request supported in 3.4 is version 3 (session is introduced in version 7).
we do not support incremental fetches in latest brod either.
Unless there is a bug in kafka which may take a random fetch request as
a part of some session.