GitHub user original-brownbear opened a pull request:
https://github.com/apache/kafka/pull/2699
KAFKA-4569: Make KafkaConsumer Trigger Wakeup before Updating Offsets
An attempt at resolving https://issues.apache.org/jira/browse/KAFKA-4569
using the @hachikuji suggestions from
https://issues.apache.org/jira/browse/KAFKA-4569?focusedCommentId=15901556&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15901556.
I tried to use this:
> We could also add a hasPendingWakeup() or something to
ConsumerNetworkClient. If a wakeup is expected, then we can just call poll(0)
to trigger it.
but instead of adding a new method to `ConsumerNetworkClient` I simply
exposed
`org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient#maybeTriggerWakeup`
publicly. Since we still have to synchronize to not run into issues with
concurrent calls to
`org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient#pollNoWakeup`
by the heartbeat thread, this seemed to be the shortest route to triggering
the wake up if one is pending before committing offsets.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/original-brownbear/kafka KAFKA-4569
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/2699.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2699
----
commit 6d8e3f616ab5cfe3e961a79b77dba4576d61e55d
Author: Armin Braun <[email protected]>
Date: 2017-03-17T09:48:23Z
KAFKA-4569 make KafkaConsumer trigger wakeup before updating offsets
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---