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

[FLINK-5368] Log msg if kafka topic doesn't have any partitions #3036

Closed
wants to merge 1 commit into from
Closed

[FLINK-5368] Log msg if kafka topic doesn't have any partitions #3036

wants to merge 1 commit into from

Conversation

HungUnicorn
Copy link
Contributor

As a developer when reading data from many topics, I want Kafka consumer to show something if any topic is not available.

The motivation is we read many topics as list at one time, and sometimes we fail to recognize that one or two topics' names have been changed or deprecated, and Flink Kafka connector didn't show the error.

@DieBauer
Copy link

DieBauer commented Dec 21, 2016

Looks like the buildjob ran out of memory on 13075.1:

Running org.apache.flink.api.scala.ScalaShellITCase
Running org.apache.flink.api.scala.ScalaShellLocalStartupITCase
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.355 sec - in org.apache.flink.api.scala.ScalaShellLocalStartupITCase
java.lang.OutOfMemoryError: Java heap space

All others went fine.

@@ -208,13 +208,12 @@ public FlinkKafkaConsumer09(List<String> topics, KeyedDeserializationSchema<T> d
if (partitionsForTopic != null) {
partitions.addAll(convertToFlinkKafkaTopicPartition(partitionsForTopic));
}
else{
throw new RuntimeException("Unable to retrieve any partitions for the requested topics " + topic);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think throwing an exception here is not a good idea.
If you have 10 topics, and only one of them doesn't have any partitions, the consumer won't start anymore.
Also the exception message is not accurate. It says Flink can not retrieve ANY partitions for the requested topicS. However, its just the partitions of one topic.

I suggest to only log a INFO-level message in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. I will change the exception message to INFO log message.

@HungUnicorn HungUnicorn reopened this Dec 27, 2016
@HungUnicorn HungUnicorn changed the title [FLINK-5368] Throw exception if kafka topic doesn't exist [FLINK-5368] Log msg if kafka topic doesn't have any partitions Dec 27, 2016
}
}

if (partitions.isEmpty()) {
throw new RuntimeException("Unable to retrieve any partitions for the requested topics " + topics);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we still want to fail if there are no partitions at all for ALL topics, correct?
This change here will remove that behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To throw exception fits our case better than to log INFO message, but @rmetzger suggested that some cases might be fine and to log INFO is more general if I understood correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Robert was suggesting to log messages only for cases where some topics don't have partitions, so that the consumer doesn't just fail if for example only 1 out of 10 topics don't have partitions.

If ALL topics failed to return partitions in the end, we probably should still fail the consumer, like before.

@Rohithyeravothula
Copy link

is the issue still open

@tzulitai
Copy link
Contributor

+1 to merge. Thank you for the reminder @Rohithyeravothula.

@tzulitai
Copy link
Contributor

Merging this ...

@asfgit asfgit closed this in f266e82 Jan 20, 2017
asfgit pushed a commit that referenced this pull request Jan 20, 2017
alpinegizmo pushed a commit to alpinegizmo/flink that referenced this pull request Jan 20, 2017
joseprupi pushed a commit to joseprupi/flink that referenced this pull request Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants