RainerMatthiasS opened a new pull request, #23239: URL: https://github.com/apache/flink/pull/23239
## Contribution Checklist - `Pending:` Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository). ## What is the purpose of the change Avoids a known flaw in Stream.flatMap, see https://bugs.openjdk.org/browse/JDK-8267359. Avoids potential OOM Error for keyed state with many keys when reading them with state processor api. ## Brief change log - replaced the original implementation of MultiStateKeyIterator with a Java-Stream-free implementation. - this fixes a known flaw in Stream.flatMap which leads to complete enumeration of inner iterator and buffering of all elements with potential for a OOM error for state with many keys - manual implementation of nested iterator avoids this problem ## Verifying this change This change adds a tests MultiStateKeyIteratorTest#testIteratorPullsSingleKeyFromAllDescriptors that fails with the previous implementation and succeeds with the new implementation. ## 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 - new code should be marginally faster (not verified) - 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? no - If yes, how is the feature documented? JavaDocs -- 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