Skip to content

Commit 411bc08

Browse files
committed
Explicitly check for None rather than False
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 dpkp#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.
1 parent ffc7cae commit 411bc08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kafka/coordinator/consumer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _on_join_complete(self, generation, member_id, protocol,
190190
# if we were the assignor, then we need to make sure that there have
191191
# been no metadata updates since the rebalance begin. Otherwise, we
192192
# won't rebalance again until the next metadata change
193-
if self._assignment_snapshot and self._assignment_snapshot != self._metadata_snapshot:
193+
if self._assignment_snapshot is not None and self._assignment_snapshot != self._metadata_snapshot:
194194
self._subscription.mark_for_reassignment()
195195
return
196196

0 commit comments

Comments
 (0)