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

Explicitly check for None rather than False #1240

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

jeffwidman
Copy link
Collaborator

@jeffwidman jeffwidman commented Oct 6, 2017

If the group leader somehow gets in a state that it has an empty partition assignment, then self._assignment_snapshot will be {} which evaluates to False. So self._subscription.mark_for_reassignment() will never be triggered, even if self._assignment_snapshot != self._metadata_snapshot.

Here is the relevant upstream Java code:
https://github.com/apache/kafka/blob/c5d26c4829583c95af7ca9e961a4d3954f8e09eb/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java#L197

Fixes the symptoms of #1237 although I suspect there's an additional bug in that case that triggers the condition of the the group leader getting an empty partition assignment.

I'm hesitant with this fix because I still don't fully understand the race condition that results in the group leader simultaneously having:

  1. a valid topic subscription
  2. an empty partition assignment
    3.subscription.needs_partition_assignment = False.

Related: #1237 / #1241 / #1242

If the group leader somehow gets in a state that it has an empty partition assignment, then `self._assignment_snapshot` will be `{}` which evaluates to `False`. So `self._subscription.mark_for_reassignment()` will never be triggered, even if `self._assignment_snapshot != self._metadata_snapshot`. 

Fixes the symptoms of #1237 although I suspect there's an additional bug in that case that triggers the condition of the the group leader getting an empty partition assignment.
@jeffwidman
Copy link
Collaborator Author

Discussed in person with @dpkp and he agreed it should be merged.

@jeffwidman jeffwidman merged commit 411bc08 into master Oct 6, 2017
@jeffwidman jeffwidman deleted the check-for-none-in-on-join-complete branch October 6, 2017 21:44
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.

1 participant