YuanHanzhong opened a new pull request, #28191:
URL: https://github.com/apache/flink/pull/28191

   ## What is the purpose of the change
   
   `HybridSourceReader` can be checkpointed during recovery after restored 
`HybridSourceSplit` instances were added back, but before the 
`SwitchSourceEvent` creates the underlying reader. In that window 
`currentReader` is still `null`, and `snapshotState()` previously snapshotted 
an empty list. A second failure from that checkpoint would then lose the 
recovered splits.
   
   This keeps the already-restored hybrid splits in the checkpoint state until 
the source switch hands them to the underlying reader.
   
   ## Brief change log
   
   - Add a regression test for snapshotting recovered `HybridSourceSplit` state 
before the recovery `SwitchSourceEvent`.
   - Return a defensive copy of `restoredSplits` when `snapshotState()` runs 
before a current reader exists.
   
   ## Verifying this change
   
   - `./mvnw -pl flink-connectors/flink-connector-base -DskipITs 
-Dtest=HybridSourceReaderTest#testReaderRecoverySnapshotBeforeSwitchSourceEvent 
-Dsurefire.failIfNoSpecifiedTests=false test`
   - `./mvnw -pl flink-connectors/flink-connector-base -DskipITs 
-Dtest=HybridSourceReaderTest -Dsurefire.failIfNoSpecifiedTests=false test`
   - `./mvnw -pl flink-connectors/flink-connector-base -DskipITs test`
   - `git diff --check`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to