Skip to content

Conversation

jeffwidman
Copy link
Contributor

@jeffwidman jeffwidman commented May 22, 2018

If a valid broker in the cluster has no partitions, it will return None rather than an empty set.

This was surprising behavior to me, I expected a broker that exists but has no partitions would return an empty set. So I'm not sure if it's better to document the current behavior, or change this to get(broker_id, set()).

Similarly documented a few other methods that sometimes can return None.

If a valid broker in the cluster has no partitions, it will return None rather than an empty set.

Similarly updated a few other methods.
@jeffwidman jeffwidman requested a review from dpkp May 22, 2018 18:33
set: {TopicPartition, ...}
None if the broker either has no partitions or does not exist.
"""
return self._broker_partitions.get(broker_id)
Copy link
Contributor Author

@jeffwidman jeffwidman May 22, 2018

Choose a reason for hiding this comment

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

This is where the None comes from if a broker exists but has no partitions. Alternatively, could instead change this to get(broker_id, set()), although this would make non-existent brokers return an empty set rather than None.

@jeffwidman jeffwidman merged commit c9d783a into master May 23, 2018
@jeffwidman jeffwidman deleted the document-methods-returning-none branch May 23, 2018 22:19
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