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

[fix][io] Kafka Source connector maybe stuck #22511

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

shibd
Copy link
Member

@shibd shibd commented Apr 15, 2024

Motivation

The current implementation of Kafka source connector, that KafkaRecord does not implement the fail() method.

protected static class KafkaRecord<V> implements Record<V> {

If PulsarSink send a message to pulsar failed, will call record.fail().

But because KafkaRecord does not implement it, this futures will never end.

This causes the Kafka consumer to leave the consumer group due to more than max.poll.interval.ms.

2024-04-11T14:06:25,730-0400 [kafka-coordinator-heartbeat-thread | kafka2pulsarConsumer] INFO  org.apache.kafka.clients.consumer.internals.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=consumer-g-1] Member consumer-1 sending LeaveGroup request to coordinator localhost:9092 (id: 2147483644 rack: null) due to consumer poll timeout has expired. This means the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time processing messages. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size of batches returned in poll() with max.poll.records.

Modifications

  • Implement fail() method for KakfaRecord.
  • Let CompletableFuture.allOf(futures).get() support a timeout, set to 2/3 of max.poll.interval.ms. This adjustment is to ensure the interval between two poll requests does not exceed Kafka max.poll.interval.ms.
    • When it times out, it will trigger a connector failure, thereby restarting the connector.

Verifying this change

  • Add throwExceptionBySendFail and throwExceptionBySendTimeOut to cover it.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

Copy link

@shibd Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Apr 15, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Good work @shibd

@lhotari lhotari added release/3.1.4 release/3.2.3 release/3.0.5 type/bug The PR fixed a bug or issue reported a bug labels Apr 15, 2024
Copy link
Member

@Demogorgon314 Demogorgon314 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

LGTM

@shibd shibd merged commit bbff29d into apache:master Apr 16, 2024
51 of 54 checks passed
shibd added a commit that referenced this pull request Apr 16, 2024
shibd added a commit that referenced this pull request Apr 16, 2024
shibd added a commit that referenced this pull request Apr 16, 2024
shibd added a commit that referenced this pull request Apr 16, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 16, 2024
(cherry picked from commit bbff29d)
(cherry picked from commit a0120d0)
@Technoboy- Technoboy- added this to the 3.3.0 milestone Apr 17, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 17, 2024
(cherry picked from commit bbff29d)
(cherry picked from commit a0120d0)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 17, 2024
(cherry picked from commit bbff29d)
(cherry picked from commit a0120d0)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 19, 2024
(cherry picked from commit bbff29d)
(cherry picked from commit a0120d0)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
(cherry picked from commit bbff29d)
(cherry picked from commit a0120d0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants