rionmonster opened a new pull request, #26983: URL: https://github.com/apache/flink/pull/26983
## Contribution Checklist ## What is the purpose of the change This pull request addresses the issue detailed in [FLINK-38345](https://issues.apache.org/jira/browse/FLINK-38345) where checkpoint recovery scenarios for `HybridSource` instances could result in null pointer exceptions (as the `currentEnumerator` is null subsequently results in the `previousEnumerator` also being null). ## Brief change log - Added an `isRecovering` flag for the `HybridSourceSplitEnumerator` to detect recovery-based scenarios. - Added two new static helper classes within the `HybridSourceSplitEnumerator` responsible for recovery: - `RecoveryAwareSourceSwitchContext` which replaces a similar, previously inline, implementation for establishing a new context for the `previousEnumerator`. - `EmptyRecoverySourceSwitchContext` which is a temporary context used to facilitate source creation (as the creation of a new `Source` instances requires an existing context). - Added a new `testRestoreEnumeratorWithSwitchContextSource` (originally written by @mattcuento) to reproduce the original issue and as a means to verify the fix. ## Verifying this change This change added tests and can be verified as follows: - Added new `testRestoreEnumeratorWithSwitchContextSource` which originally reproduced the issue by creating a `HybridSource` instance, triggering a source switch, snapshotting, and attempting enumerator restoration. ## 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): **don't know** - Anything that affects deployment or recovery: **no/don't know** - The S3 file system connector: **no** ## Documentation - Does this pull request introduce a new feature? **no** - If yes, how is the feature documented? **not applicable** -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org