[FLINK-28817] NullPointerException in HybridSource when restoring from checkpoint
What is the purpose of the change
This pull request fix NullPointerException in HybridSource when restoring from checkpoint.
After the recovery action is triggered, only the source with sourceIndex = 1 is loaded in the switchedSources in the HybridSourceSplitEnumerator
For the new SourceReaderFinishedEvent that triggers the load of a new source, the default is to get the source with sourceIndex = 0, which triggers the NPE.
Please correct me if there is a mistake.
Brief change log
For the new SourceReaderFinishedEvent, get an available source.
Verifying this change
This change added tests and can be verified as follows:
- Added testRestoreEnumeratorWith2ndSource in HybridSourceSplitEnumeratorTest
Does this pull request potentially affect one of the following parts:
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes)
Documentation
- Does this pull request introduce a new feature? (no)
CI report:
- 243e28f8ed3fffcce9eeb4ab5dda38addac59320 Azure: SUCCESS
Bot commands
The @flinkbot bot supports the following commands:-
@flinkbot run azurere-run the last Azure build
@zhongqishang thanks for the PR, I'm going to take a look soon.
@tweise Thanks for your review. I have addressed all your comments.
@flinkbot run azure
@flinkbot run azure
@zhongqishang, could you please add test which refers to HybridSourceTest to verify whether to fix the bug of FLINK-26938?
@SteNicholas, In fact I encountered the situation described in FLINK-26938, I will try to add a test case as soon as possible.
@zhongqishang, it's better to add the test case for the situation described in FLINK-26938. cc @tweise
@zhongqishang, it's better to add the test case for the situation described in FLINK-26938. cc @tweise
Let's address that in a separate PR, since it's a separate JIRA also.
@zhongqishang thanks for the contribution! Can you please open a backport PR for release-1.15 also?