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

Fixes the Kafka provider's max message limit error (#32926) #33321

Merged
merged 2 commits into from
Aug 12, 2023

Conversation

aritra24
Copy link
Collaborator

@aritra24 aritra24 commented Aug 11, 2023

The Kafka provider ConsumeFromTopicOperator throws
an error when max_messages is not set and there exist
more that a 1000 (Default value of max messages) messages

closes: #32926


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Fixes the issue(apache#32926) where kafka provider returns an
error when max messages is not set since it keeps
reading and messages left goes into negative.
Makes sure that the kafka provider works when
max messages isn't passed into the operator
@eladkal
Copy link
Contributor

eladkal commented Aug 11, 2023

cc @dylanbstorey

Copy link
Member

@hussein-awala hussein-awala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added test reproduces the reported issue, and the change fixes it. LGTM!

Comment on lines +164 to +165
if not self.read_to_end:
messages_left -= len(msgs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed and proposed in slack

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@potiuk potiuk merged commit c9d0fcd into apache:main Aug 12, 2023
42 checks passed
@aritra24 aritra24 deleted the kafka-max-message branch August 12, 2023 09:53
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 17, 2023
…ache#33321)

* Fixes kafka provider failing reading messages

Fixes the issue(apache#32926) where kafka provider returns an
error when max messages is not set since it keeps
reading and messages left goes into negative.

Makes sure that the kafka provider works when
max messages isn't passed into the operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Apache Kafka Provider Consumer Operator
5 participants