Skip to content

Conversation

eason-yuchen-liu
Copy link
Contributor

What changes were proposed in this pull request?

This PR solves the issue by not fetching the latest topic partitions in function prepareForTriggerAvailableNow. Instead, it fetches in latestOffset, because Spark will not call latestOffset when retrying the uncommitted batch.

Why are the changes needed?

There is a crash loop when using Kafka source with AvailableNow. It will be triggered deterministically when the query fails / terminates in the middle of the run, and the user changes the Kafka topic partition, then restarts the query. This is because the topic partitions in uncommitted batch and the latest topic partitions aren't the same, but trigger.AvailableNow requires it anyway.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Created a new unit test.

Was this patch authored or co-authored using generative AI tooling?

No.

…in Kafka source and AvailableNow trigger

### What changes were proposed in this pull request?

This PR solves the issue by not fetching the latest topic partitions in function `prepareForTriggerAvailableNow`. Instead, it fetches in `latestOffset`, because Spark will not call `latestOffset` when retrying the uncommitted batch.

### Why are the changes needed?

There is a crash loop when using Kafka source with AvailableNow. It will be triggered deterministically when the query fails / terminates in the middle of the run, and the user changes the Kafka topic partition, then restarts the query. This is because the topic partitions in uncommitted batch and the latest topic partitions aren't the same, but trigger.AvailableNow requires it anyway.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Created a new unit test.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#52304 from eason-yuchen-liu/kafkaAvailableNow.

Authored-by: Yuchen Liu <[email protected]>
Signed-off-by: Anish Shrigondekar <[email protected]>
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.

1 participant