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

Fix describe config for multi-broker clusters #1869

Merged

Conversation

jlandersen
Copy link
Contributor

@jlandersen jlandersen commented Jul 28, 2019

Currently all describe config requests are sent to "least loaded node". Requests for broker configs must, however, be sent to the specific broker, otherwise an error is returned. Only topic requests can be handled by any node.

This changes the logic to send all describe config requests to the specific broker.

Same should be done for alter configs (there is already a comment stating this should be done - I'll be happy to send a PR for this soon'ish).


This change is Reviewable

Copy link
Owner

@dpkp dpkp left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR -- can you take a look at my comments about the return value?

kafka/admin/client.py Outdated Show resolved Hide resolved
kafka/admin/client.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Tests should be based on pytest, not unittest so that #1196 is not blocked.

kafka/admin/client.py Show resolved Hide resolved
test/test_admin_integration.py Outdated Show resolved Hide resolved
test/test_admin_integration.py Outdated Show resolved Hide resolved
@jeffwidman
Copy link
Collaborator

nudge @jlandersen

@jlandersen
Copy link
Contributor Author

nudge @jlandersen

apologies for the late reply, been a bit busy + traveling as well.
I'll try and get the changes in by the end of next week (still away at the moment). I pretty much agree with all of it (and not being concerned with backwards compat in the admin client makes it alot easier :) )

Currently all describe config requests are sent to "least loaded node". Requests for broker configs must, however, be sent to the specific broker, otherwise an error is returned. Only topic requests can be handled by any node.

This changes the logic to send all describe config requests to the specific broker.
@jlandersen jlandersen force-pushed the fix_describe_configs_broker_requests branch from cfa2424 to cb9e664 Compare October 8, 2019 16:11
@jlandersen
Copy link
Contributor Author

jlandersen commented Oct 8, 2019

Got some time to walk over it before I expected :)

  1. Tests are changed to follow the new structure
  2. The response is now a list of each response received back rather than trying to merge it - should follow the general admin client interface more closely now. As described previously, a potential improvement for the future could be to convert it to a custom Config type that is more easily accessible.

One remaining comment is the handling of ValueError (see at the original comment)

Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Almost there... need to drop the simple_client fixture as that's going away in #1196... hopefully we can get that landed very soon once we are sure that 1.4.7 doesn't need any urgent patch releases.

test/test_admin_integration.py Outdated Show resolved Hide resolved

@pytest.mark.skipif(env_kafka_version() < (0, 11), reason="Describe config features require broker >=0.11")
def test_describe_configs_topic_resource_returns_configs(simple_client, kafka_admin_client):
topic = simple_client.topics[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is available via kafka_admin_client._client.topics()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Close :) but by default it doesen't seem like the kafka admin fixture creates topics for tests, so added "topic" as parameter instead.

test/test_admin_integration.py Outdated Show resolved Hide resolved
Also removes dependency on simple_client in tests
@jlandersen
Copy link
Contributor Author

jlandersen commented Oct 9, 2019

@jeffwidman changes should be in - let me know of any other things to change!

Update: cancel that - some tests seem to have some trouble now with the topic fixture. Is this the right way to setup topics for tests?

Another update: seems like the order of fixture arguments matter :-) switched around (kafka_admin_client, topic) to (topic, kafka_admin_client) and the topic is now there correctly for the admin client. At least this seems to have an effect when running via tox. Had no trouble debugging in PyCharm.

Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Thank you for your hard work on this!

kafka/admin/client.py Show resolved Hide resolved
test/test_admin_integration.py Show resolved Hide resolved
@jeffwidman jeffwidman merged commit 6d3800c into dpkp:master Oct 11, 2019
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.

3 participants