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

Merge _find_coordinator_id methods #2127

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

jeffwidman
Copy link
Collaborator

@jeffwidman jeffwidman commented Sep 17, 2020

Previously there were two methods:

  • _find_coordinator_id()
  • _find_many_coordinator_ids()

But they do basically the same thing internally. And we need the plural
two places, but the singular only one place.

So merge them, and change the function signature to take a list of
group_ids and return a dict of group_id: coordinator_id's.

As a result of this, the describe_groups() command should scale better
because the _find_coordinator_ids() command issues all the requests
async, instead of sequentially blocking as the described_groups() used
to do.

IIRC, this deviates slightly from the Java client, as they only take a singular group ID... mostly because it gets tricky to handle retriable vs non-retriable errors when you send a bunch at once. However, we don't handle errors quite the same way--we just raise if the futures don't complete, and also raise if we encounter any problems in the returned FindCoordinatorResponse. Given that, IMO this is more useful/scalable...

Fix #2124


This change is Reviewable

@jeffwidman
Copy link
Collaborator Author

jeffwidman commented Sep 17, 2020

fyi @swenzel

@jeffwidman jeffwidman force-pushed the merge-_find_coordinator_ids-methods branch from d579afe to 57ccb4d Compare September 17, 2020 17:45
Previously there were two methods:
* `_find_coordinator_id()`
* `_find_many_coordinator_ids()`

But they do basically the same thing internally. And we need the plural
two places, but the singular only one place.

So merge them, and change the function signature to take a list of
`group_ids` and return a dict of `group_id: coordinator_id`s.

As a result of this, the `describe_groups()` command should scale better
because the `_find_coordinator_ids()` command issues all the requests
async, instead of sequentially blocking as the `described_groups()` used
to do.
@jeffwidman jeffwidman force-pushed the merge-_find_coordinator_ids-methods branch from 57ccb4d to 80664a5 Compare September 17, 2020 18:16
@jeffwidman jeffwidman merged commit 098ecbf into master Sep 17, 2020
@jeffwidman jeffwidman deleted the merge-_find_coordinator_ids-methods branch September 17, 2020 19:15
gabriel-tincu pushed a commit to aiven/kafka-python that referenced this pull request Sep 22, 2020
Previously there were two methods:
* `_find_coordinator_id()`
* `_find_many_coordinator_ids()`

But they do basically the same thing internally. And we need the plural
two places, but the singular only one place.

So merge them, and change the function signature to take a list of
`group_ids` and return a dict of `group_id: coordinator_id`s.

As a result of this, the `describe_groups()` command should scale better
because the `_find_coordinator_ids()` command issues all the requests
async, instead of sequentially blocking as the `described_groups()` used
to do.
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.

Switch describe_consumer_groups() to use _find_many_coordinator_ids()
1 participant