Skip to content

Conversation

@liunaijie
Copy link
Member

@liunaijie liunaijie commented Nov 26, 2025

What is the purpose of the change

bug fix for https://issues.apache.org/jira/browse/FLINK-38735

Brief change log

  • Avoid got NoSuchElementException when restore with empty state

Verifying this change

WIP

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature : yes

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 26, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@davidradl davidradl left a comment

Choose a reason for hiding this comment

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

  1. Please correct the title to include the jira number
  2. I see you indicate htis is covered by existing tests, but the existing tests did not fail, can we add a test to restore with empty state to drive the failing case.

@liunaijie liunaijie changed the title [connector-file] add restore state check [FLINK-38735][connector-file] add restore state check Nov 26, 2025
@liunaijie
Copy link
Member Author

Thanks for your review and quick response. @davidradl

  1. Please correct the title to include the jira number

Done

  1. I see you indicate htis is covered by existing tests, but the existing tests did not fail, can we add a test to restore with empty state to drive the failing case.

Sure I will try to add a test case to cover this edge case.

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Nov 26, 2025
@liunaijie
Copy link
Member Author

I write a test with mockito, the result was as we expected.

Before fix, when restore with empty state, it will throw NoSuchElementException.

image

After fix, the class init will success, and can get empty result.
image

As flink does not recommend using mockito to write unit tests, so I need some time to learn how to write this test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants