Skip to content
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

Fix wrong handeling of empty fetch response. #323

Merged

Conversation

zmstone
Copy link
Contributor

@zmstone zmstone commented May 10, 2019

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.

Empty fetch response happens only in incremental fetch sessions.
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.
@zmstone zmstone force-pushed the fix-wrong-implementation-on-empty-fetch-response-handeling branch from bc9cf82 to fc3b54d Compare May 10, 2019 21:24
@coveralls
Copy link

coveralls commented May 10, 2019

Pull Request Test Coverage Report for Build 1076

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 79.609%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/brod_consumer.erl 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
src/brod_consumer.erl 1 74.89%
Totals Coverage Status
Change from base Build 1068: 0.04%
Covered Lines: 2038
Relevant Lines: 2560

💛 - Coveralls

@zmstone zmstone requested a review from a team May 12, 2019 09:43
So to discover version discrepancy early
@zmstone zmstone merged commit 01633d0 into master May 13, 2019
@zmstone zmstone deleted the fix-wrong-implementation-on-empty-fetch-response-handeling branch May 13, 2019 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants