close
Skip to content

[Bugifx][kafka] Fix kafka enumerator assign split NPE#9220

Merged
wuchunfu merged 1 commit into
apache:devfrom
hailin0:dev-fix-kafka
Apr 26, 2025
Merged

[Bugifx][kafka] Fix kafka enumerator assign split NPE#9220
wuchunfu merged 1 commit into
apache:devfrom
hailin0:dev-fix-kafka

Conversation

@hailin0

@hailin0 hailin0 commented Apr 23, 2025

Copy link
Copy Markdown
Member

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@hailin0

hailin0 commented Apr 23, 2025

Copy link
Copy Markdown
Member Author

image

@hailin0 hailin0 marked this pull request as ready for review April 23, 2025 08:36
@hailin0 hailin0 requested a review from Copilot April 23, 2025 08:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a potential NullPointerException in the Kafka enumerator's split assignment logic by adding initialization state checks.

  • Introduces a volatile boolean flag (initialized) to control when discovery and assignment of splits should occur.
  • Updates the discovery logic in open() and the registration logic in registerReader() to respect the new initialization state.
Comments suppressed due to low confidence (1)

seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceSplitEnumerator.java:262

  • [nitpick] Adding 'initialized' to the condition in registerReader() ensures no premature split assignment. Please confirm that this check does not inadvertently delay processing of pending splits when readers are registered.
if (!pendingSplit.isEmpty() && initialized) {

@zhilinli123 zhilinli123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@wuchunfu wuchunfu merged commit 7ca0c0c into apache:dev Apr 26, 2025
jia17 pushed a commit to jia17/seatunnel that referenced this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants