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-4706: Unify StreamsKafkaClient instances #2631

Closed
wants to merge 3 commits into from

Conversation

sharad-develop
Copy link
Contributor

KAFKA:4706 - Unify StreamsKafkaClient instances

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

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.

Thanks for the PR @sharad-develop

Please wait for additional comments from @enothereska or @dguy before updating the PR (to avoid going forth and back :))

\cc @enothereska @dguy for second review

time,
streamsMetadataState,
cacheSizeBytes);
config,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: move builder one line down to get aligned indention.

} catch (final IOException e) {
log.warn("Could not close StreamKafkaClient.", e);
}
streamsKafkaClient.checkBrokerCompatibility();
Copy link
Member

Choose a reason for hiding this comment

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

KafkaStreams should close StreamsKafkaClient in it's own close() method. Also, InternalTopicManager should not close StreamKafkaClient anymore.

@@ -207,7 +207,7 @@ public void configure(Map<String, ?> configs) {
}

internalTopicManager = new InternalTopicManager(
new StreamsKafkaClient(this.streamThread.config),
this.streamThread.getStreamsKafkaClient(),
Copy link
Member

Choose a reason for hiding this comment

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

Nit: remove this (we try to avoid this when possible)

@@ -1103,6 +1104,22 @@ public String toString(final String indent) {
}

/**
*
Copy link
Member

Choose a reason for hiding this comment

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

Add JavaDocs (if we keep the setter)

}

/**
*
Copy link
Member

Choose a reason for hiding this comment

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

Add JavaDocs (if we keep the getter)

time,
streamsMetadataState,
cacheSizeBytes);
threads[i].setStreamsKafkaClient(streamsKafkaClient);
Copy link
Member

Choose a reason for hiding this comment

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

I would add this to the constructor instead of a setter.
\cc @enothereska @dguy WDYT?

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 initially started with a constructor approach. But the checkstyle was making the build fail as the constructor exceeded 10 arguments.

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 think constructor is a better approach , but not sure if there is a way around checkstyle.

Copy link
Member

Choose a reason for hiding this comment

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

I guess you can remove parameter applicationId because it is contained in the config anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Should I go ahead with the constructor approach or are we still deliberating on alternative approaches which are getting discussed ?

Copy link
Member

Choose a reason for hiding this comment

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

I guess we are still discussing...

@@ -203,6 +203,7 @@ private synchronized void setStateWhenNotInPendingShutdown(final State newState)
final StateDirectory stateDirectory;
private String originalReset;
private StreamPartitionAssignor partitionAssignor = null;
private StreamsKafkaClient streamsKafkaClient;
Copy link
Member

Choose a reason for hiding this comment

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

Can be final is we set it via constructor instead of setter.

@mjsax
Copy link
Member

mjsax commented Mar 3, 2017

@sharad-develop Can you please update the PR title to KAFKA-4706: Unify StreamsKafkaClient instances -- this allows the bot to link this PR to the JIRA automatically. Thx.

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@asfbot
Copy link

asfbot commented Mar 3, 2017

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

@dguy
Copy link
Contributor

dguy commented Mar 3, 2017

There is a bunch of streams test failures

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

I'm thinking we can extract an interface from StreamsKafkaClient - i'm not 100% sure what will be called yet (maybe AdminClient ?). Then we add a method to KafkaClientSupplier, i.e., AdminClient getAdminClient(final StreamsConfig config)

This would mean that creation of all Kafka related clients is behind the same interface. Which means that it will eventually help us with being able to decouple our integration tests from real brokers.
It also means that we don't need to add any setters or constructor params to the StreamThread as it already accepts a KafkaClientSupplier as an argument. If we do only really want one instance of the StreamsKafkaClient then this can be done easily enough in the DefaultKafkaClientSupplier.

@mjsax @enothereska @guozhangwang - thoughts?

@sharad-develop sharad-develop changed the title KAFKA:4706 - Unify StreamsKafkaClient instances KAFKA-4706: Unify StreamsKafkaClient instances Mar 3, 2017
@mjsax
Copy link
Member

mjsax commented Mar 3, 2017

AdminClient is already used by core (https://issues.apache.org/jira/browse/KAFKA-3265) - so not sure if the same name is a good choice. This raised the question, if we (at some point) could get rid of StreamKafkaClient and use AdminClient only?

I like the KafkaClientSupplier idea, however, this will require a KIP.

@guozhangwang
Copy link
Contributor

@dguy I like your idea, and I think the name of AdminClient is fine: for example we can add another method named getAdmin in KafkaClientSupplier which can then be used in both KafkaStreams then passed into each of the thread's StreamsPartitionAssignor.

@guozhangwang
Copy link
Contributor

BTW I think we can also piggy-back this with KIP-117 which will introduce an admin client in common package that is can be generally used. Today we have different impls of such client in streams and connect, and that KIP is aimed to condense all these clients.

@mjsax
Copy link
Member

mjsax commented Mar 6, 2017

@guozhangwang Do you suggest to delay this PR until KIP-117 is done? This might take some time, as the KIP is not even voted yet.

@guozhangwang
Copy link
Contributor

That's a good point: let's not wait for KIP-117 then, and we can do the merge in a separate JIRA after that is done.

@mjsax
Copy link
Member

mjsax commented Mar 6, 2017

Sounds good to me. I did create a JIRA for this: https://issues.apache.org/jira/browse/KAFKA-4857

@sharad-develop Can you follow up with this PR and address the comments. Thanks.

@guozhangwang
Copy link
Contributor

Closing this PR for now.

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.

5 participants