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-5434: Console consumer hangs if not existing partition is specified #3335

Closed
wants to merge 2 commits into from

Conversation

ppatierno
Copy link
Contributor

Added checking partition exists before assign request

@asfbot
Copy link

asfbot commented Jun 14, 2017

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

@asfbot
Copy link

asfbot commented Jun 14, 2017

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

Copy link
Contributor

@ewencp ewencp left a comment

Choose a reason for hiding this comment

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

The old consumer is deprecated now, so we'd generally not be making changes to it unless it was a critical bug. You probably want to be focusing on the new consumer at this point.

Also, does it actually hang indefinitely even if you later create the topic partition?

@ppatierno
Copy link
Contributor Author

@ewencp actually it happens with the new consumer as well (using the NewShinyConsumer class in the tool).
Btw I have just noticed that we have two different cases.
If the topic exists (or it not exists but it's automatically created when the consumer connects) but the requested partition doesn't exist, then if the partition is created, the consumer works fine.
If the topic doesn't exist and it's not automatically created on consumer connection, after creating it with right partitions, the consumer doesn't work.
So it seems to be a different problem on not existing topic.
What should we do ? Closing this PR, opening a new JIRA for the above problem ?

@ewencp
Copy link
Contributor

ewencp commented Jul 21, 2017

@ppatierno Actually, it looks like people have been a bit more active in this part of the code than I thought, so maybe this would be fine. I'm probably the wrong person to review this as I haven't done much with the old consumer code.

I'd try to isolate truly separate issues into separate JIRAs. In terms of this patch, I think one question is whether we want this behavior generally or if you need to make it somehow conditional based on the fact that it's the console consumer running.

Also, for your scenarios, there could also be cases where auto topic creation is off, but one process is responsible for creating the topic and it races with the consumer process. In that case you actually want to just wait until you can see the topic partition, so always throwing an exception might not be the right solution. In any case, from the client side, you can't really tell whether auto topic creation is enabled so I don't think there's a way to handle that case differently.


// check if the requested partition exists for the topic
val availablePartitions = consumer.partitionsFor(topic).asScala
val partitionInfo = availablePartitions.find(_.partition() == partitionId)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use exists instead of find here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, done.

@asfgit
Copy link

asfgit commented Aug 7, 2017

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

@asfgit
Copy link

asfgit commented Aug 7, 2017

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

@ppatierno
Copy link
Contributor Author

@ewencp @ijuma do you think that this PR is still useful ?

@ppatierno
Copy link
Contributor Author

I think that this PR is not so useful anymore. The old consumer is deprecated so no reasons for adding more.

@ppatierno ppatierno closed this Jun 6, 2018
@ppatierno ppatierno deleted the kafka-5434 branch June 6, 2018 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants