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

[FLINK-33231] [source] Properly evict offsetsToCommit cache on checkpoint complete if no offsets exist #58

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

tzulitai
Copy link
Contributor

Prior to this fix, if the offsets to commit for a given checkpoint is empty, which can be the case if no starting offsets were retrieved from Kafka yet, then on checkpoint completion the cache is not properly evicted up to the given checkpoint.

This change fixes this such that in notifyOnCheckpointComplete, we shortcut the method execution to not need to try to commit the offsets since its empty anyways, and always remember to evict the cache up to the completed checkpoint.

Testing

I've modified the existing KafkaSourceReaderTest#testCommitEmptyOffsets() test to fail if the cache eviction fix was not applied. With this PR, that test now passes.

…oint complete if no offsets exist

Prior to this fix, if the offsets to commit for a given checkpoint is empty,
which can be the case if no starting offsets were retrieved from Kafka yet,
then on checkpoint completion the cache is not properly evicted up to the
given checkpoint.

This change fixes this such that in notifyOnCheckpointComplete, we shortcut
the method execution to not need to try to commit the offsets since its
empty anyways, and always remember to evict the cache up to the completed
checkpoint.
Copy link
Contributor

@MartijnVisser MartijnVisser left a comment

Choose a reason for hiding this comment

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

LGTM

@lauri-suurvali-cko
Copy link

LGTM!

@MartijnVisser MartijnVisser merged commit b0f15f2 into main Oct 11, 2023
4 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 11, 2023

Awesome work, congrats on your first merged pull request!

@MartijnVisser MartijnVisser deleted the FLINK-33231 branch October 11, 2023 07:06
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.

3 participants