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

KAFKA-4716: Fix case when controller cannot be reached #2526

Closed
wants to merge 1 commit into from
Closed

KAFKA-4716: Fix case when controller cannot be reached #2526

wants to merge 1 commit into from

Conversation

enothereska
Copy link
Contributor

No description provided.

@enothereska
Copy link
Contributor Author

This is the 0.10.2 version of #2522.
@norwood could you have a look. All tests pass for me and on AWS.

@asfbot
Copy link

asfbot commented Feb 9, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1596/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Feb 9, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1599/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Feb 9, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1596/
Test PASSed (JDK 8 and Scala 2.12).


final ClientRequest clientRequest = kafkaClient.newClientRequest(
getBrokerId(),
getAnyReadyBrokerId(),
Copy link
Contributor

Choose a reason for hiding this comment

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

im not 100% sure, but i think you want this to also hit the controller. i hit the controller in my personal client, and @cmccabe is doing it here https://github.com/apache/kafka/pull/2472/files#diff-7378a806dbf302c1e7a9098c4780d2a8R283

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. The metadata can be received from any broker. That's how one bootstraps, e.g., with a bootstrap list, which might not include the controller. cc @ijuma

Copy link
Contributor

Choose a reason for hiding this comment

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

The case where you should fetch the metadata from the controller is if you expect the metadata response to include the topic that was just created. For example, if you create a topic, it returns a success and then you ask any broker for the metadata, it may be missing the topic that was just created (since metadata updates are asynchronous). I haven't checked the code to understand if this matters or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the code before creating topics. This code just gets the metadata first, which then allows us to figure out which one is the controller.

Copy link
Contributor

@ijuma ijuma Feb 9, 2017

Choose a reason for hiding this comment

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

Sounds fine then (what else could you do if you don't even know who the controller is :)).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact the current logic in prepareTopic loops until each one of the topic metadata has been propagated to at least one broker. So the above is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

it also depends on what you want to check. asking the controller will tell you what state brokers should eventually be in, checking any random broker will tell you what state that particular one is in now. i.e. if you want to make sure its fully propagated you'd have to check all the brokers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm doing a limited exploration that addresses the blocker. I completely agree that we need to write down the exact invariants in some of the code, as well as add a ton of unit tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hoping KIP-117 will do that eventually.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally don't think it makes sense to wait for the metadata to propagate to all brokers. A broker may be partitioned away from the controller, but not the clients, for example. I would prefer to make the consumer and producer smarter when they get stale metadata from a random broker.

Copy link
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

LGTM

@norwood
Copy link
Contributor

norwood commented Feb 9, 2017

🥇

asfgit pushed a commit that referenced this pull request Feb 9, 2017
Author: Eno Thereska <eno@confluent.io>

Reviewers: Dan Norwood, Ismael Juma, Guozhang Wang

Closes #2526 from enothereska/0.10.2-KAFKA-4716
Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

Merged to 0.10.2.

@enothereska enothereska deleted the 0.10.2-KAFKA-4716 branch February 10, 2017 07:45
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.

6 participants