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

Federated Clients: implement various federated consumer methods #119

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jonlee2
Copy link
Contributor

@jonlee2 jonlee2 commented May 17, 2019

No description provided.

}

@Override
public void commitAsync(OffsetCommitCallback callback) {
throw new UnsupportedOperationException("Not implemented yet");
for (ClusterConsumerPair<K, V> entry : getImmutableConsumerList()) {
entry.getConsumer().commitAsync(callback);
Copy link
Contributor

Choose a reason for hiding this comment

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

this would call a user-provided callback N times for N consumers. we need to aggregate them 1st and call the user callback only once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this. Added a wrapper callback, which will call the user callback once.

List<ClusterConsumerPair<K, V>> consumers = getImmutableConsumerList();
for (Map.Entry<ClusterDescriptor, Map<TopicPartition, OffsetAndMetadata>> entry :
getPartitionValueMapByCluster(offsets).entrySet()) {
getOrCreatePerClusterConsumer(consumers, entry.getKey()).commitAsync(entry.getValue(), callback);
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to above - user-provided callbacks should be called once

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

throw new UnsupportedOperationException("Not implemented yet");
List<ClusterConsumerPair<K, V>> consumers = getImmutableConsumerList();
for (Map.Entry<ClusterDescriptor, Collection<TopicPartition>> entry : getPartitionsByCluster(partitions).entrySet()) {
getOrCreatePerClusterConsumer(consumers, entry.getKey()).seekToBeginning(entry.getValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if seek() should result in the creation of a consumer - i think only subscribe/assign should

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current implementation of config reload closes clients but does not recreate them. They will be recreated at the subsequent operation. If we keep this "lazy" reload behavior, seek() may need to create a consumer.

Copy link
Contributor

Choose a reason for hiding this comment

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

i dont know what the lazy approach gets us - we expect these clients to be active.

@@ -534,27 +694,17 @@ public void uncaughtException(Thread t, Throwable e) {
try {
if (!countDownLatch.await(deadlineTimeMs - System.currentTimeMillis(), TimeUnit.MILLISECONDS)) {
LiKafkaClientsUtils.dumpStacksForAllLiveThreads(threads);
throw new KafkaException("Fail to close all consumers for cluster group " + _clusterGroup + " in " +
timeout + " " + timeUnit);
throw new KafkaException("fail to perform " + methodName + " for cluster group " + _clusterGroup + " in " +
Copy link
Contributor

Choose a reason for hiding this comment

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

for bonus points could iterate over threads still alive and print their stacks

Copy link
Contributor Author

@jonlee2 jonlee2 Jun 14, 2019

Choose a reason for hiding this comment

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

I think that's what the line above (LiKafkaClientsUtils.dumpStacksForAllLiveThreads(threads)) is already doing? Did you mean something else?

@jonlee2 jonlee2 force-pushed the federated-consumer-misc branch 2 times, most recently from d749b92 to c823088 Compare June 14, 2019 18:44
@jonlee2 jonlee2 requested a review from kehuum June 14, 2019 18:47
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.

3 participants