Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

APEXMALHAR-2506 Added the monitoring to Kafka Consumer threads, if on… #633

Merged
merged 1 commit into from Jul 22, 2017
Merged

APEXMALHAR-2506 Added the monitoring to Kafka Consumer threads, if on… #633

merged 1 commit into from Jul 22, 2017

Conversation

sandeshh
Copy link
Contributor

@sandeshh sandeshh commented Jun 9, 2017

…e of them dies then the Kafka operator is killed so that it can recover from the proper state.

@PramodSSImmaneni please review.

@@ -90,6 +92,19 @@

private boolean waitForReplay = false;

final List<Future<?>> kafkaConsumreThreads = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

fix typo in kafkaConsumerThreads

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


public boolean areKafkaThreadsAreRunning()
{
for (Future<?> future : kafkaConsumreThreads) {
Copy link
Member

Choose a reason for hiding this comment

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

Not directly related to this PR, but it does not seem right to use execution service for never ending tasks. It may lead to resource starvation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can have a separate discussion about. How do you want to it?

@@ -90,6 +92,19 @@

private boolean waitForReplay = false;

private final List<Future<?>> kafkaConsumerThreads = new ArrayList<>();

public boolean doesAnyKafkaReaderThreadDied()
Copy link
Contributor

Choose a reason for hiding this comment

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

does -> has

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -255,6 +255,10 @@ public void emitTuples()
}
}
emitCount += count;

if (!consumerWrapper.doesAnyKafkaReaderThreadDied()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be the correct handling for all situations. What happens, for example, on partition or lead broker change? Or a transient connection issue? Downstream resets may be very costly and should only be triggered when really necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If any of these thread dies because of the exception, how to handle that cleanly?

{
for (Future<?> future : kafkaConsumerThreads) {
if (future.isDone() || future.isCancelled()) {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

You have flipped true/false and also need to fix the check when calling this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it.

@tweise
Copy link
Contributor

tweise commented Jul 2, 2017

Check if there are conditions under which the consumer thread exits that is not an error but expected (such as partition change).

…e data from Kafka, if those threads die, operator thread will detect and throw an exception
@sandeshh
Copy link
Contributor Author

There is no exit strategy for consumer thread, the assumption is that they are running forever.

@sandeshh
Copy link
Contributor Author

@tweise I have addressed all the review comments. Can you please review and merge the PR?

@tweise
Copy link
Contributor

tweise commented Jul 21, 2017

What testing was done? (Please document in the JIRA.)

@sandeshh
Copy link
Contributor Author

@tweise I have documented my observation. This fix was done to address an intermittent issue.

@tweise tweise closed this Jul 21, 2017
@tweise tweise reopened this Jul 21, 2017
@tweise tweise closed this Jul 21, 2017
@tweise tweise reopened this Jul 21, 2017
@tweise tweise merged commit 99dc9b2 into apache:master Jul 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants